Bug 545431, fix versioning of mac sdks, r=ted.mielczarek
[gecko.git] / configure.in
blobe3380e3f4fefde5b8d3d2d2ca948c189c5b491f6
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 dnl
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
10 dnl
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
14 dnl License.
15 dnl
16 dnl The Original Code is this file as it was released upon August 6, 1998.
17 dnl
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
22 dnl
23 dnl Contributor(s):
24 dnl   Jamie Zawinski <jwz@jwz.org>
25 dnl   gettimeofday args check
26 dnl   Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl   gnomefe update & enable-pthreads
28 dnl   Ramiro Estrugo <ramiro@netscape.com>
29 dnl   X11 makedepend support
30 dnl   Insure support.
31 dnl   Henry Sobotka <sobotka@axess.com>
32 dnl   OS/2 support
33 dnl   Dan Mosedale <dmose@mozilla.org>
34 dnl   LDAP support
35 dnl   Seth Spitzer <sspitzer@netscape.com>
36 dnl   xpctools support
37 dnl   Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl   Howard Chu <hyc@symas.com>
39 dnl   MSYS support
40 dnl   Mark Mentovai <mark@moxienet.com>:
41 dnl   Mac OS X 10.4 support
42 dnl   Giorgio Maone <g.maone@informaction.com>
43 dnl   MSVC l10n compatible version check
44 dnl   Ben Turner <mozilla@songbirdnest.com>
45 dnl   Windows x64 support
46 dnl   Makoto Kato <m_kato@ga2.so-net.ne.jp>
47 dnl
48 dnl Alternatively, the contents of this file may be used under the terms of
49 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
50 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
51 dnl in which case the provisions of the GPL or the LGPL are applicable instead
52 dnl of those above. If you wish to allow use of your version of this file only
53 dnl under the terms of either the GPL or the LGPL, and not to allow others to
54 dnl use your version of this file under the terms of the MPL, indicate your
55 dnl decision by deleting the provisions above and replace them with the notice
56 dnl and other provisions required by the GPL or the LGPL. If you do not delete
57 dnl the provisions above, a recipient may use your version of this file under
58 dnl the terms of any one of the MPL, the GPL or the LGPL.
59 dnl
60 dnl ***** END LICENSE BLOCK *****
62 dnl Process this file with autoconf to produce a configure script.
63 dnl ========================================================
65 AC_PREREQ(2.13)
66 AC_INIT(config/config.mk)
67 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
68 AC_CANONICAL_SYSTEM
69 TARGET_CPU="${target_cpu}"
70 TARGET_VENDOR="${target_vendor}"
71 TARGET_OS="${target_os}"
74 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1` 
75 AC_SUBST(MOZ_DEB_TIMESTAMP)
78 dnl ========================================================
79 dnl =
80 dnl = Don't change the following two lines.  Doing so breaks:
81 dnl =
82 dnl = CFLAGS="-foo" ./configure
83 dnl =
84 dnl ========================================================
85 CFLAGS="${CFLAGS=}"
86 CPPFLAGS="${CPPFLAGS=}"
87 CXXFLAGS="${CXXFLAGS=}"
88 LDFLAGS="${LDFLAGS=}"
89 HOST_CFLAGS="${HOST_CFLAGS=}"
90 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
91 HOST_LDFLAGS="${HOST_LDFLAGS=}"
93 dnl ========================================================
94 dnl = Preserve certain environment flags passed to configure
95 dnl = We want sub projects to receive the same flags
96 dnl = untainted by this configure script
97 dnl ========================================================
98 _SUBDIR_CC="$CC"
99 _SUBDIR_CXX="$CXX"
100 _SUBDIR_CFLAGS="$CFLAGS"
101 _SUBDIR_CPPFLAGS="$CPPFLAGS"
102 _SUBDIR_CXXFLAGS="$CXXFLAGS"
103 _SUBDIR_LDFLAGS="$LDFLAGS"
104 _SUBDIR_HOST_CC="$HOST_CC"
105 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
106 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
107 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
108 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
110 dnl Set the version number of the libs included with mozilla
111 dnl ========================================================
112 MOZJPEG=62
113 MOZPNG=10400
114 MOZZLIB=0x1230
115 NSPR_VERSION=4
116 NSS_VERSION=3
118 dnl Set the minimum version of toolkit libs used by mozilla
119 dnl ========================================================
120 GLIB_VERSION=1.2.0
121 LIBIDL_VERSION=0.6.3
122 PERL_VERSION=5.006
123 PYTHON_VERSION=2.4
124 CAIRO_VERSION=1.8.8
125 PANGO_VERSION=1.14.0
126 GTK2_VERSION=2.10.0
127 WINDRES_VERSION=2.14.90
128 W32API_VERSION=3.8
129 GNOMEVFS_VERSION=2.0
130 GNOMEUI_VERSION=2.2.0
131 GCONF_VERSION=1.2.1
132 GIO_VERSION=2.0
133 STARTUP_NOTIFICATION_VERSION=0.8
134 DBUS_VERSION=0.60
135 SQLITE_VERSION=3.6.22
136 LIBNOTIFY_VERSION=0.4
138 MSMANIFEST_TOOL=
140 dnl Set various checks
141 dnl ========================================================
142 MISSING_X=
143 AC_PROG_AWK
145 dnl Initialize the Pthread test variables early so they can be
146 dnl  overridden by each platform.
147 dnl ========================================================
148 USE_PTHREADS=
149 _PTHREAD_LDFLAGS=""
151 dnl Do not allow a separate objdir build if a srcdir build exists.
152 dnl ==============================================================
153 _topsrcdir=`cd \`dirname $0\`; pwd`
154 _objdir=`pwd`
156 if test "$_topsrcdir" != "$_objdir"
157 then
158   # Check for a couple representative files in the source tree
159   _conflict_files=
160   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
161     if test -f $file; then
162       _conflict_files="$_conflict_files $file"
163     fi
164   done
165   if test "$_conflict_files"; then
166     echo "***"
167     echo "*   Your source tree contains these files:"
168     for file in $_conflict_files; do
169       echo "*         $file"
170     done
171     cat 1>&2 <<-EOF
172         *   This indicates that you previously built in the source tree.
173         *   A source tree build can confuse the separate objdir build.
174         *
175         *   To clean up the source tree:
176         *     1. cd $_topsrcdir
177         *     2. gmake distclean
178         ***
179         EOF
180     exit 1
181     break
182   fi
184 MOZ_BUILD_ROOT=`pwd`
186 dnl Default to MSVC for win32 and gcc-4.2 for darwin
187 dnl ==============================================================
188 if test -z "$CROSS_COMPILE"; then
189 case "$target" in
190 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
191     if test -z "$CC"; then CC=cl; fi
192     if test -z "$CXX"; then CXX=cl; fi
193     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
194     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
195     if test -z "$LD"; then LD=link; fi
196     if test -z "$AS"; then
197         case "${target_cpu}" in
198         i*86)
199             AS=ml;
200             ;;
201         x86_64)
202             AS=ml64;
203             ;;
204         esac
205     fi
206     if test -z "$MIDL"; then MIDL=midl; fi
207     ;;
208 *-darwin*)
209     if test -z "$CC"; then CC=gcc-4.2; fi
210     if test -z "$CXX"; then CXX=g++-4.2; fi
211     ;;
212 esac
215 COMPILE_ENVIRONMENT=1
216 MOZ_ARG_DISABLE_BOOL(compile-environment,
217 [  --disable-compile-environment
218                            Disable compiler/library checks.],
219     COMPILE_ENVIRONMENT= )
220 AC_SUBST(COMPILE_ENVIRONMENT)
222 MOZ_ARG_WITH_STRING(l10n-base,
223 [  --with-l10n-base=DIR     path to l10n repositories],
224     L10NBASEDIR=$withval)
225 if test ! -z "$L10NBASEDIR"; then
226     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
227         AC_MSG_ERROR([--with-l10n-base must specify a path])
228     elif test -d "$L10NBASEDIR"; then
229         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
230     else
231         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
232     fi
234 AC_SUBST(L10NBASEDIR)
236 dnl Check for Perl first -- needed for win32 SDK checks
237 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
238 if test -z "$PERL" || test "$PERL" = ":"; then
239     AC_MSG_ERROR([perl not found in \$PATH])
242 dnl ========================================================
243 dnl Checks for compilers.
244 dnl ========================================================
245 dnl Set CROSS_COMPILE in the environment when running configure
246 dnl to use the cross-compile setup for now
247 dnl ========================================================
249 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
250 AR_FLAGS='cr $@'
252 if test "$COMPILE_ENVIRONMENT"; then
254 dnl Do some special WinCE toolchain stuff
255 case "$target" in
256 *wince|*winmo)
258     MOZ_ARG_WITH_STRING(wince-sdk,
259     [  --with-wince-sdk=WINCE_SDK_DIR
260                         The path to the Windows CE SDK],
261     WINCE_SDK_DIR=$withval)
263     MOZ_ARG_WITH_STRING(ogles-sdk,
264     [  --with-ogles-sdk=OGLES_SDK_DIR
265                         The path to the OGLES SDK],
266     OGLES_SDK_DIR=$withval)
268     AC_DEFINE(WINCE)
269     
270     export WINCE=1
272     echo -----------------------------------------------------------------------------
273     echo Building Windows CE Shunt Library and Tool Chain
274     echo Using SDK in:
275     echo $WINCE_SDK_DIR
277     ac_exeext=.exe
279     _pwd=`pwd -W`
280     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
281     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
282     TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
283     -C $srcdir/build/wince/tools
285     CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
286     CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
287     CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
288     CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
289     LD="$_pwd/dist/sdk/bin/$target-link.exe"
290     AR="$_pwd/dist/sdk/bin/$target-lib.exe"
291     AS="$_pwd/dist/sdk/bin/$target-as.exe"
292     RC="$_pwd/dist/sdk/bin/$target-res.exe"
295     echo -----------------------------------------------------------------------------
297     ;;
298 esac
300 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
301     echo "cross compiling from $host to $target"
302     cross_compiling=yes
304     _SAVE_CC="$CC"
305     _SAVE_CFLAGS="$CFLAGS"
306     _SAVE_LDFLAGS="$LDFLAGS"
308     AC_MSG_CHECKING([for host c compiler])
309     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
310     if test -z "$HOST_CC"; then
311         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
312     fi
313     AC_MSG_RESULT([$HOST_CC])
314     AC_MSG_CHECKING([for host c++ compiler])
315     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
316     if test -z "$HOST_CXX"; then
317         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
318     fi
319     AC_MSG_RESULT([$HOST_CXX])
321     if test -z "$HOST_CFLAGS"; then
322         HOST_CFLAGS="$CFLAGS"
323     fi
324     if test -z "$HOST_CXXFLAGS"; then
325         HOST_CXXFLAGS="$CXXFLAGS"
326     fi
327     if test -z "$HOST_LDFLAGS"; then
328         HOST_LDFLAGS="$LDFLAGS"
329     fi
330     if test -z "$HOST_AR_FLAGS"; then
331         HOST_AR_FLAGS="$AR_FLAGS"
332     fi
333     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
334     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
335     CC="$HOST_CC"
336     CFLAGS="$HOST_CFLAGS"
337     LDFLAGS="$HOST_LDFLAGS"
339     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
340     AC_TRY_COMPILE([], [return(0);], 
341         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
342         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
344     CC="$HOST_CXX"
345     CFLAGS="$HOST_CXXFLAGS"
347     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
348     AC_TRY_COMPILE([], [return(0);], 
349         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
350         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
351     
352     CC=$_SAVE_CC
353     CFLAGS=$_SAVE_CFLAGS
354     LDFLAGS=$_SAVE_LDFLAGS
356     case "$build:$target" in
357       powerpc-apple-darwin8*:i?86-apple-darwin*)
358         dnl The Darwin cross compiler doesn't necessarily point itself at a
359         dnl root that has libraries for the proper architecture, it defaults
360         dnl to the system root.  The libraries in the system root on current
361         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
362         dnl checks will fail.  Fake a working SDK in that case.
363         _SAVE_CFLAGS=$CFLAGS
364         _SAVE_CXXFLAGS=$CXXLAGS
365         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
366         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
367         ;;
368     esac
370     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
371     unset ac_cv_prog_CC
372     AC_PROG_CC
373     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
374     unset ac_cv_prog_CXX
375     AC_PROG_CXX
377     case "$build:$target" in
378       powerpc-apple-darwin8*:i?86-apple-darwin*)
379         dnl Revert the changes made above.  From this point on, the target
380         dnl compiler will never be used without applying the SDK to CFLAGS
381         dnl (see --with-macos-sdk below).
382         CFLAGS=$_SAVE_CFLAGS
383         CXXFLAGS=$_SAVE_CXXFLAGS
384         ;;
385     esac
387     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
388     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
389     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
390     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
391     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
392     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
393     AC_DEFINE(CROSS_COMPILE)
394 else
395     AC_PROG_CC
396     AC_PROG_CXX
397     AC_PROG_RANLIB
398     MOZ_PATH_PROGS(AS, $AS as, $CC)
399     AC_CHECK_PROGS(AR, ar, :)
400     AC_CHECK_PROGS(LD, ld, :)
401     AC_CHECK_PROGS(STRIP, strip, :)
402     AC_CHECK_PROGS(WINDRES, windres, :)
403     if test -z "$HOST_CC"; then
404         HOST_CC='$(CC)'
405     fi
406     if test -z "$HOST_CFLAGS"; then
407         HOST_CFLAGS='$(CFLAGS)'
408     fi
409     if test -z "$HOST_CXX"; then
410         HOST_CXX='$(CXX)'
411     fi
412     if test -z "$HOST_CXXFLAGS"; then
413         HOST_CXXFLAGS='$(CXXFLAGS)'
414     fi
415     if test -z "$HOST_LDFLAGS"; then
416         HOST_LDFLAGS='$(LDFLAGS)'
417     fi
418     if test -z "$HOST_RANLIB"; then
419         HOST_RANLIB='$(RANLIB)'
420     fi
421     if test -z "$HOST_AR"; then
422         HOST_AR='$(AR)'
423     fi
424     if test -z "$HOST_AR_FLAGS"; then
425         HOST_AR_FLAGS='$(AR_FLAGS)'
426     fi
429 GNU_AS=
430 GNU_LD=
431 GNU_CC=
432 GNU_CXX=
433 CC_VERSION='N/A'
434 CXX_VERSION='N/A'
435 if test "$GCC" = "yes"; then
436     GNU_CC=1
437     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
439 if test "$GXX" = "yes"; then
440     GNU_CXX=1
441     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
443 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
444     GNU_AS=1
446 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
447     GNU_LD=1
449 if test "$GNU_CC"; then
450     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
451         GCC_USE_GNU_LD=1
452     fi
455 INTEL_CC=
456 INTEL_CXX=
457 if test "$GCC" = yes; then
458    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
459      INTEL_CC=1
460    fi
463 if test "$GXX" = yes; then
464    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
465      INTEL_CXX=1
466    fi
469 dnl Special win32 checks
470 dnl ========================================================
471 case "$target" in
472 *-wince|*-winmo)
473     WINVER=500
474     WINSDK_TARGETVER=502
475     ;;
477     WINVER=502
478     dnl Target the Windows 7 SDK by default
479     WINSDK_TARGETVER=601
480     ;;
481 esac
484 MOZ_ARG_WITH_STRING(windows-version,
485 [  --with-windows-version=WINSDK_TARGETVER
486                           Highest Windows version to target using this SDK
487                               502: Windows Server 2003
488                               600: Windows Vista
489                               601: Windows 7],
490   WINSDK_TARGETVER=$withval)
492 case "$WINSDK_TARGETVER" in
493 502|600|601)
494     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
495     ;;
498     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
499     ;;
501 esac
503 dnl Vista SDK specific api (deprecated)
504 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
505 [  --disable-vista-sdk-requirements
506                            Do not build Vista SDK specific code],
507    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
508    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=$_PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
509 if test -n "$COMPILE_ENVIRONMENT"; then
510 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
511     AC_MSG_WARN([--disable-vista-sdk-requirements is deprecated, use --with-windows-version=502 instead])
512     MOZ_WINSDK_TARGETVER=05020000
515 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
516     MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
517     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
518     # We can't build parental controls either
519     MOZ_DISABLE_PARENTAL_CONTROLS=1
523 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
525 case "$target" in
526 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
527     if test "$GCC" != "yes"; then
528         # Check to see if we are really running in a msvc environemnt
529         _WIN32_MSVC=1
530         AC_CHECK_PROGS(MIDL, midl)
532         # Make sure compilers are valid
533         CFLAGS="$CFLAGS -TC -nologo"
534         CXXFLAGS="$CXXFLAGS -TP -nologo"
535         AC_LANG_SAVE
536         AC_LANG_C
537         AC_TRY_COMPILE([#include <stdio.h>],
538             [ printf("Hello World\n"); ],,
539             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
541         AC_LANG_CPLUSPLUS
542         AC_TRY_COMPILE([#include <new.h>],
543             [ unsigned *test = new unsigned(42); ],,
544             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
545         AC_LANG_RESTORE
546         
547         changequote(,)
548         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
549         changequote([,])
550         
551         # Determine compiler version
552         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
553         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
554         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
555         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
556         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
557         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
559         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
560         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
562         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
563             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
564         fi
565         if test "$_CC_MAJOR_VERSION" = "13"; then
566             _CC_SUITE=7
567         elif test "$_CC_MAJOR_VERSION" = "14"; then
568             _CC_SUITE=8
569             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
570             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
571             dnl so be very specific here!
572             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
573             if test $_CC_RELEASE -gt 50727; then
574                _USE_DYNAMICBASE=1
575             elif test $_CC_BUILD -ge 762; then
576                _USE_DYNAMICBASE=1
577             fi
578             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
579             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
580         elif test "$_CC_MAJOR_VERSION" = "15"; then
581             _CC_SUITE=9
582             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
583             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
584             _USE_DYNAMICBASE=1
585             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
586             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
587         elif test "$_CC_MAJOR_VERSION" = "16"; then
588             _CC_SUITE=10
589             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
590             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
591             _USE_DYNAMICBASE=1
592             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
593             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
594         else
595             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
596         fi
598         _MOZ_RTTI_FLAGS_ON='-GR'
599         _MOZ_RTTI_FLAGS_OFF='-GR-'
600         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
601         _MOZ_EXCEPTIONS_FLAGS_OFF=''
603         if test -n "$WIN32_REDIST_DIR"; then
604             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
605         fi
606         
607         # bug #249782
608         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
609         if test "$_CC_SUITE" -ge "8"; then
610                 changequote(,)
611                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
612                 changequote([,])
614                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
615                 if test -n "$MSMT_TOOL"; then
616                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
617                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
618                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
619                         fi
620                         MSMANIFEST_TOOL=1
621                         unset MSMT_TOOL
622                 else
623                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
624                 fi
625         fi
627         # Check linker version
628         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
629         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
630         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
631             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
632         fi
633         INCREMENTAL_LINKER=1
635         # Check midl version
636         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
637         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
638         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
639         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
640         # Add flags if necessary
641         AC_MSG_CHECKING([for midl flags])
642         case "$target" in
643         i*86-*)
644             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
645                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
646                 # MIDL version 7.00.0500 or later has no problem.
647                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
648                 AC_MSG_RESULT([need -env win32])
649             else
650                 AC_MSG_RESULT([none needed])
651             fi
652             ;;
653         x86_64-*)
654             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
655             ;;
656         *)
657             AC_MSG_RESULT([none needed])
658             ;;
659         esac
661         # Identify which version of the SDK we're building with
662         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
663         # from there
664         AC_CHECK_HEADERS([winsdkver.h])
665         if test "$ac_cv_header_winsdkver_h" = "yes"; then
666             # Get the highest _WIN32_WINNT and NTDDI versions supported
667             # Take the higher of the two
668             # This is done because the Windows 7 beta SDK reports its
669             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
670             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
671                            ac_cv_winsdk_maxver,
672                            [cat > conftest.h <<EOF
673 #include <winsdkver.h>
674 #include <sdkddkver.h>
676 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
677 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
678 #else
679 #define WINSDK_MAXVER NTDDI_MAXVER
680 #endif
682 WINSDK_MAXVER
684                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
685                             rm -f conftest.h
686                            ])
687             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
688         else
689             # The Vista SDK is the only one to have sdkddkver.h but not
690             # WinSDKVer.h
691             AC_CHECK_HEADERS([sdkddkver.h])
692             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
693                 MOZ_WINSDK_MAXVER=0x06000000
694             else
695                 # Assume the Server 2003 Platform SDK
696                 MOZ_WINSDK_MAXVER=0x05020000
697             fi
698         fi
700         unset _MSVC_VER_FILTER
702     else
703         # Check w32api version
704         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
705         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
706         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
707         AC_TRY_COMPILE([#include <w32api.h>],
708             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
709                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
710                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
711                 #error "test failed."
712             #endif
713             , [ res=yes ], [ res=no ])
714         AC_MSG_RESULT([$res])
715         if test "$res" != "yes"; then
716             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
717         fi
718         # Check windres version
719         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
720         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
721         AC_MSG_RESULT([$_WINDRES_VERSION])
722         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
723         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
724         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
725         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
726         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
727         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
728         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
729                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
730                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
731                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
732                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
733                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
734         then
735             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
736         fi
738         # Server 2003 is the highest version supported
739         MOZ_WINSDK_MAXVER=0x05020000
740     fi # !GNU_CC
742     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
743     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
744     # Require OS features provided by IE 5.0
745     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
747     # If the maximum version supported by this SDK is lower than the target
748     # version, error out
749     AC_MSG_CHECKING([for Windows SDK being recent enough])
750     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
751         AC_MSG_RESULT("yes")
752     else
753         AC_MSG_RESULT("no")
754         AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
755     fi
757     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
758     # Definitions matching sdkddkver.h
759     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
760     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
761     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
762     ;;
763 esac
765 dnl Test breaks icc on OS/2 && MSVC
766 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
767     AC_PROG_CC_C_O
768     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
769         USING_HCC=1
770         _OLDCC=$CC
771         _OLDCXX=$CXX
772         CC="${srcdir}/build/hcc '$CC'"
773         CXX="${srcdir}/build/hcpp '$CXX'"
774     fi
777 AC_PROG_CPP
778 AC_PROG_CXXCPP
780 if test -n "$_WIN32_MSVC"; then
781     SKIP_PATH_CHECKS=1
782     SKIP_COMPILER_CHECKS=1
783     SKIP_LIBRARY_CHECKS=1
785     # Since we're skipping compiler and library checks, hard-code
786     # some facts here.
787     case "$target" in
788     *-wince|*-winmo)
789         ;;
790     *)
791         AC_DEFINE(HAVE_IO_H)
792         AC_DEFINE(HAVE_SETBUF)
793         AC_DEFINE(HAVE_ISATTY)
794         ;;
795     esac
798 fi # COMPILE_ENVIRONMENT
800 AC_SUBST(MIDL_FLAGS)
801 AC_SUBST(_MSC_VER)
803 AC_SUBST(GNU_AS)
804 AC_SUBST(GNU_LD)
805 AC_SUBST(GNU_CC)
806 AC_SUBST(GNU_CXX)
807 AC_SUBST(INTEL_CC)
808 AC_SUBST(INTEL_CXX)
810 dnl ========================================================
811 dnl Checks for programs.
812 dnl ========================================================
813 AC_PROG_INSTALL
814 AC_PROG_LN_S
816 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
817 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
818 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
819 _perl_res=$?
820 AC_MSG_RESULT([$_perl_version])
822 if test "$_perl_res" != 0; then
823     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
827 AC_MSG_CHECKING([for full perl installation])
828 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
829 _perl_res=$?
830 if test "$_perl_res" != 0; then
831     AC_MSG_RESULT([no])
832     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
833 else
834     AC_MSG_RESULT([yes])    
837 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.5 python2.4 python)
838 if test -z "$PYTHON"; then
839     AC_MSG_ERROR([python was not found in \$PATH])
842 if test -z "$COMPILE_ENVIRONMENT"; then
843     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
845 AC_SUBST(NSINSTALL_BIN)
847 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
848 MOZ_PATH_PROG(WHOAMI, whoami, :)
849 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
850 MOZ_PATH_PROG(UNZIP, unzip, :)
851 MOZ_PATH_PROGS(ZIP, zip)
852 if test -z "$ZIP" || test "$ZIP" = ":"; then
853     AC_MSG_ERROR([zip not found in \$PATH])
855 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
856 MOZ_PATH_PROG(XARGS, xargs)
857 if test -z "$XARGS" || test "$XARGS" = ":"; then
858     AC_MSG_ERROR([xargs not found in \$PATH .])
861 if test "$COMPILE_ENVIRONMENT"; then
863 dnl ========================================================
864 dnl = Mac OS X toolchain support
865 dnl ========================================================
867 case "$target_os" in
868 darwin*)
869     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
870     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
871     dnl the environment and includedir purposes (when using an SDK, below),
872     dnl but remember the full version number for the libdir (SDK).
873     changequote(,)
874     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
875     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
876     changequote([,])
877     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
878         dnl Bug 280479, but this keeps popping up in bug 292530 too because
879         dnl 4.0.0/4061 is the default compiler in Tiger.
880         changequote(,)
881         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
882         changequote([,])
883         if test "$GCC_BUILD" = "4061" ; then
884             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
885 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
886 from building Mozilla. Upgrade to Xcode 2.1 or later.])
887         fi
888     fi
890     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
891     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
892     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
893     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
895     case "$PBBUILD" in
896       *xcodebuild*)
897         changequote(,)
898         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
899         changequote([,])
900         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
901           HAS_XCODE_2_1=1;
902         fi
903       ;;
904     esac
906     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
907     dnl it has moved into /usr/bin.
908     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
909     ;;
910 esac
912 AC_SUBST(GCC_VERSION)
913 AC_SUBST(XCODEBUILD_VERSION)
914 AC_SUBST(HAS_XCODE_2_1)
916 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
917 dnl that a universal binary is being produced.
918 AC_SUBST(UNIVERSAL_BINARY)
920 dnl ========================================================
921 dnl Check for MacOS deployment target version
922 dnl ========================================================
924 MOZ_ARG_ENABLE_STRING(macos-target,
925                       [  --enable-macos-target=VER (default=10.5)
926                           Set the minimum MacOS version needed at runtime],
927                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
929 case "$target" in
930 *-darwin*)
931     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
932         dnl Use the specified value
933         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
934         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
935     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
936         dnl No value specified on the command line or in the environment,
937         dnl use architecture minimum.
938         export MACOSX_DEPLOYMENT_TARGET=10.5
939     fi
940     ;;
941 esac
943 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
945 dnl ========================================================
946 dnl = Mac OS X SDK support
947 dnl ========================================================
948 MACOS_SDK_DIR=
949 NEXT_ROOT=
950 MOZ_ARG_WITH_STRING(macos-sdk,
951 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
952     MACOS_SDK_DIR=$withval)
954 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
955 dnl NEXT_ROOT will be set and exported only if it's needed.
956 AC_SUBST(MACOS_SDK_DIR)
957 AC_SUBST(NEXT_ROOT)
959 if test "$MACOS_SDK_DIR"; then
960   dnl Sync this section with the ones in NSPR and NSS.
961   dnl Changes to the cross environment here need to be accounted for in
962   dnl the libIDL checks (below) and xpidl build.
964   if test ! -d "$MACOS_SDK_DIR"; then
965     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
966 specify a valid SDK.  SDKs are installed when the optional cross-development
967 tools are selected during the Xcode/Developer Tools installation.])
968   fi
970   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
971   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
972     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
973   else
974     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
975     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
977     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
978     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
979     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
981     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
982       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
983       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
984       dnl be ignored and cause warnings when -syslibroot is specified.
985       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
986       dnl the -isysroot it receives, so this is only needed with 4.0.0.
987       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
988     fi
989   fi
991   AC_LANG_SAVE
992   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
993   AC_LANG_CPLUSPLUS
994   AC_TRY_COMPILE([#include <new>
995                  int main() { return 0; }],
996    result=yes,
997    result=no)
998   AC_LANG_RESTORE
999   AC_MSG_RESULT($result)
1001   if test "$result" = "no" ; then
1002     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1003   fi
1006 fi # COMPILE_ENVIRONMENT
1008 if test -n "$MAKE"; then
1009   if test `echo $MAKE | grep -c make.py` != 1; then
1010      NOT_PYMAKE=$MAKE
1011   fi
1014 case "$host_os" in
1015 cygwin*|mingw*|mks*|msvc*)
1016     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1017     ;;
1019     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1020     ;;
1021 esac
1022 if test "$GMAKE" = ":"; then
1023    AC_MSG_ERROR([GNU make not found])
1025 AC_SUBST(GMAKE)
1027 if test "$COMPILE_ENVIRONMENT"; then
1029 AC_PATH_XTRA
1031 XCFLAGS="$X_CFLAGS"
1033 fi # COMPILE_ENVIRONMENT
1035 dnl ========================================================
1036 dnl set the defaults first
1037 dnl ========================================================
1038 AS_BIN=$AS
1039 AR_LIST='$(AR) t'
1040 AR_EXTRACT='$(AR) x'
1041 AR_DELETE='$(AR) d'
1042 AS='$(CC)'
1043 AS_DASH_C_FLAG='-c'
1044 DLL_PREFIX=lib
1045 LIB_PREFIX=lib
1046 DLL_SUFFIX=.so
1047 OBJ_SUFFIX=o
1048 LIB_SUFFIX=a
1049 ASM_SUFFIX=s
1050 IMPORT_LIB_SUFFIX=
1051 TARGET_MD_ARCH=unix
1052 DIRENT_INO=d_ino
1053 CYGWIN_WRAPPER=
1054 WIN_TOP_SRC=
1055 MOZ_USER_DIR=".mozilla"
1057 MOZ_JPEG_CFLAGS=
1058 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1059 MOZ_ZLIB_CFLAGS=
1060 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1061 MOZ_BZ2_CFLAGS=
1062 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1063 MOZ_PNG_CFLAGS=
1064 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1066 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1067 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1068 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1069 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1070 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1071 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1072 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1074 MOZ_FS_LAYOUT=unix
1076 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1078 USE_DEPENDENT_LIBS=1
1080 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1082 MOZ_ENABLE_POSTSCRIPT=1 
1084 if test -n "$CROSS_COMPILE"; then
1085     OS_TARGET="${target_os}"
1086     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1087     OS_RELEASE=
1088     case "${target_os}" in
1089         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1090         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1091         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1092         mingw*)       OS_ARCH=WINNT ;;
1093         wince*)       OS_ARCH=WINCE ;;
1094         winmo*)       OS_ARCH=WINCE ;;
1095         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1096     esac
1097 else
1098     OS_TARGET=`uname -s`
1099     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1100     OS_RELEASE=`uname -r`
1103 # Before this used `uname -m` when not cross compiling
1104 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1105 OS_TEST="${target_cpu}"
1107 _COMPILER_PREFIX=
1109 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1111 #######################################################################
1112 # Master "Core Components" macros for getting the OS target           #
1113 #######################################################################
1116 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1117 # cross-compilation.
1121 # Define and override various archtecture-specific variables, including
1122 # HOST_OS_ARCH
1123 # OS_ARCH
1124 # OS_TEST
1125 # OS_TARGET
1126 # OS_RELEASE
1127 # OS_MINOR_RELEASE
1130 case "$HOST_OS_ARCH" in
1131 cygwin*|mingw*|mks*|msvc*)
1132     HOST_OS_ARCH=WINNT
1133     ;;
1134 linux*)
1135     HOST_OS_ARCH=Linux
1136     ;;
1137 solaris*)
1138     HOST_OS_ARCH=SunOS
1139     SOLARIS_SUNPRO_CC=
1140     SOLARIS_SUNPRO_CXX=
1141     if test -z "$GNU_CC"; then
1142         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1143             SOLARIS_SUNPRO_CC=1
1144        fi
1145     fi
1147     if test -z "$GNU_CXX"; then
1148        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1149            SOLARIS_SUNPRO_CXX=1
1150        fi
1151     fi
1152     AC_SUBST(SOLARIS_SUNPRO_CC)
1153     AC_SUBST(SOLARIS_SUNPRO_CXX)
1154     ;;
1155 BSD_386)
1156     HOST_OS_ARCH=BSD
1157     ;;
1158 dgux)
1159     HOST_OS_ARCH=DGUX
1160     ;;
1161 IRIX64)
1162     HOST_OS_ARCH=IRIX
1163     ;;
1164 UNIX_SV)
1165     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1166         HOST_OS_ARCH=NCR
1167     else
1168         HOST_OS_ARCH=UNIXWARE
1169     fi
1170     ;;
1171 ncr)
1172     HOST_OS_ARCH=NCR
1173     ;;
1174 UNIX_SYSTEM_V)
1175     HOST_OS_ARCH=NEC
1176     ;;
1177 OSF1)
1178     ;;
1179 *OpenVMS*)
1180     HOST_OS_ARCH=OpenVMS
1181     ;;
1182 OS_2)
1183     HOST_OS_ARCH=OS2
1184     ;;
1185 QNX)
1186     ;;
1187 SCO_SV)
1188     HOST_OS_ARCH=SCOOS
1189     ;;
1190 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1191     HOST_OS_ARCH=SINIX
1192     ;;
1193 UnixWare)
1194     HOST_OS_ARCH=UNIXWARE
1195     ;;
1196 esac
1198 case "$OS_ARCH" in
1199 WINNT)
1200     if test -z "$CROSS_COMPILE" ; then
1201         OS_TEST=`uname -p`
1202     fi
1203     ;;
1204 Windows_NT)
1206 # If uname -s returns "Windows_NT", we assume that we are using
1207 # the uname.exe in MKS toolkit.
1209 # The -r option of MKS uname only returns the major version number.
1210 # So we need to use its -v option to get the minor version number.
1211 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1213     OS_ARCH=WINNT
1214     OS_TARGET=WINNT
1215     OS_MINOR_RELEASE=`uname -v`
1216     if test "$OS_MINOR_RELEASE" = "00"; then
1217         OS_MINOR_RELEASE=0
1218     fi
1219     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1220     ;;
1221 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1223 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1224 # the uname.exe in the Cygwin tools.
1225 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1226 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1227 # the uname.exe in the GNU-Win32 tools.
1228 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1229 # the uname.exe in the MSYS tools.
1231     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1232     OS_ARCH=WINNT
1233     OS_TARGET=WINNT
1234     ;;
1235 AIX)
1236     OS_RELEASE=`uname -v`.`uname -r`
1237     OS_TEST=${target_cpu}
1238     ;;
1239 BSD_386)
1240     OS_ARCH=BSD
1241     ;;
1242 dgux)
1243     OS_ARCH=DGUX
1244     ;;
1245 IRIX64)
1246     OS_ARCH=IRIX
1247     ;;
1248 UNIX_SV)
1249     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1250         OS_ARCH=NCR
1251     else
1252         OS_ARCH=UNIXWARE
1253         OS_RELEASE=`uname -v`
1254     fi
1255     ;;
1256 ncr)
1257     OS_ARCH=NCR
1258     ;;
1259 UNIX_SYSTEM_V)
1260     OS_ARCH=NEC
1261     ;;
1262 OSF1)
1263     case `uname -v` in
1264     148)
1265         OS_RELEASE=V3.2C
1266         ;;
1267     564)
1268         OS_RELEASE=V4.0B
1269         ;;
1270     878)
1271         OS_RELEASE=V4.0D
1272         ;;
1273     esac
1274     ;;
1275 *OpenVMS*)
1276     OS_ARCH=OpenVMS
1277     OS_RELEASE=`uname -v`
1278     OS_TEST=`uname -p`
1279     ;;
1280 OS_2)
1281     OS_ARCH=OS2
1282     OS_TARGET=OS2
1283     OS_RELEASE=`uname -v`
1284     ;;
1285 QNX)
1286     if test "$OS_TARGET" != "NTO"; then
1287         changequote(,)
1288         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1289         changequote([,])
1290     fi
1291     OS_TEST=x86
1292     ;;
1293 SCO_SV)
1294     OS_ARCH=SCOOS
1295     OS_RELEASE=5.0
1296     ;;
1297 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1298     OS_ARCH=SINIX
1299     OS_TEST=`uname -p`
1300     ;;
1301 UnixWare)
1302     OS_ARCH=UNIXWARE
1303     OS_RELEASE=`uname -v`
1304     ;;
1305 WINCE)
1306     OS_ARCH=WINCE
1307     case "${target_os}" in
1308     *winmo)
1309         OS_TARGET=WINMO
1310         WINCE_WINDOWS_MOBILE=1
1311         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1312         ;;
1313     *)
1314         OS_TARGET=WINCE
1315         ;;
1316     esac
1317     ;;
1318 Darwin)
1319     case "${target_cpu}" in
1320     powerpc*)
1321         OS_TEST=ppc
1322         ;;
1323     i*86*)
1324         OS_TEST=i386 
1325         ;;
1326     x86_64)
1327         OS_TEST=x86_64
1328         ;;
1329     *)
1330         if test -z "$CROSS_COMPILE" ; then
1331             OS_TEST=`uname -p`
1332         fi
1333         ;;
1334     esac
1335     ;;
1336 esac
1338 if test "$OS_ARCH" = "NCR"; then
1339     changequote(,)
1340     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1341     changequote([,])
1344 # Only set CPU_ARCH if we recognize the value of OS_TEST
1346 case "$OS_TEST" in
1347 *86 | i86pc)
1348     CPU_ARCH=x86
1349     ;;
1351 powerpc64 | ppc64)
1352     CPU_ARCH=ppc64
1353     ;;
1355 powerpc | ppc | rs6000)
1356     CPU_ARCH=ppc
1357     ;;
1359 Alpha | alpha | ALPHA)
1360     CPU_ARCH=Alpha
1361     ;;
1363 s390)
1364     CPU_ARCH=s390
1365     ;;
1367 s390x)
1368     CPU_ARCH=s390x
1369     ;;
1371 hppa* | parisc)
1372     CPU_ARCH=hppa
1373     ;;
1375 sun4u | sparc*)
1376     CPU_ARCH=sparc
1377     ;;
1379 x86_64 | ia64)
1380     CPU_ARCH="$OS_TEST"
1381     ;;
1383 arm)
1384     if test "$OS_TARGET" = "WINCE"; then
1385         CPU_ARCH="$OS_TEST"
1386     fi
1387     ;;
1388 esac
1390 if test -z "$OS_TARGET"; then
1391     OS_TARGET=$OS_ARCH
1393 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1395 dnl ========================================================
1396 dnl GNU specific defaults
1397 dnl ========================================================
1398 if test "$GNU_CC"; then
1399     # FIXME: Let us build with strict aliasing. bug 414641.
1400     CFLAGS="$CFLAGS -fno-strict-aliasing"
1401     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1402     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1403     DSO_LDOPTS='-shared'
1404     if test "$GCC_USE_GNU_LD"; then
1405         # Don't allow undefined symbols in libraries
1406         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1407     fi
1408     WARNINGS_AS_ERRORS='-Werror'
1409     DSO_CFLAGS=''
1410     DSO_PIC_CFLAGS='-fPIC'
1411     ASFLAGS="$ASFLAGS -fPIC"
1412     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1413     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1414     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1415     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1417     # Turn on GNU specific features
1418     # -Wall - turn on all warnings
1419     # -pedantic - make compiler warn about non-ANSI stuff, and
1420     #             be a little bit stricter
1421     # Warnings slamm took out for now (these were giving more noise than help):
1422     # -Wbad-function-cast - warns when casting a function to a new return type
1423     # -Wshadow - removed because it generates more noise than help --pete
1424     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1425     if test -z "$INTEL_CC"; then
1426        # Don't use -Wcast-align with ICC
1427        case "$CPU_ARCH" in
1428            # And don't use it on hppa, ia64, sparc, since it's noisy there
1429            hppa | ia64 | sparc)
1430            ;;
1431            *)
1432         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1433            ;;
1434        esac
1435     fi
1437     dnl Turn pedantic on but disable the warnings for long long
1438     _PEDANTIC=1
1440     if test -z "$INTEL_CC"; then
1441       _IGNORE_LONG_LONG_WARNINGS=1
1442       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1443     else
1444       _IGNORE_LONG_LONG_WARNINGS=
1445     fi
1448     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1449     _USE_CPP_INCLUDE_FLAG=1
1450 elif test "$SOLARIS_SUNPRO_CC"; then
1451     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1452     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1454     DSO_LDOPTS='-shared'
1455     if test "$GNU_LD"; then
1456         # Don't allow undefined symbols in libraries
1457         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1458     fi
1460     DSO_CFLAGS=''
1461     if test "$CPU_ARCH" = "sparc"; then
1462         # for Sun Studio on Solaris/SPARC
1463         DSO_PIC_CFLAGS='-xcode=pic32'
1464     else
1465         DSO_PIC_CFLAGS='-KPIC'
1466     fi
1467     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1468 else
1469     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1470     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1472     DSO_LDOPTS='-shared'
1473     if test "$GNU_LD"; then
1474         # Don't allow undefined symbols in libraries
1475         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1476     fi
1478     DSO_CFLAGS=''
1479     DSO_PIC_CFLAGS='-KPIC'
1480     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1483 if test "$GNU_CXX"; then
1484     # FIXME: Let us build with strict aliasing. bug 414641.
1485     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1486     # Turn on GNU specific features
1487     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1488     if test -z "$INTEL_CC"; then
1489        # Don't use -Wcast-align with ICC
1490        case "$CPU_ARCH" in
1491            # And don't use it on hppa, ia64, sparc, since it's noisy there
1492            hppa | ia64 | sparc)
1493            ;;
1494            *)
1495         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1496            ;;
1497        esac
1498     fi
1500     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1501     _USE_CPP_INCLUDE_FLAG=1
1503     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1504                    ac_has_wno_invalid_offsetof,
1505         [
1506             AC_LANG_SAVE
1507             AC_LANG_CPLUSPLUS
1508             _SAVE_CXXFLAGS="$CXXFLAGS"
1509             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1510             AC_TRY_COMPILE([],
1511                            [return(0);],
1512                            ac_has_wno_invalid_offsetof="yes",
1513                            ac_has_wno_invalid_offsetof="no")
1514             CXXFLAGS="$_SAVE_CXXFLAGS"
1515             AC_LANG_RESTORE
1516         ])
1517     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1518         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1519     fi
1521     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1522                    ac_has_wno_variadic_macros,
1523         [
1524             AC_LANG_SAVE
1525             AC_LANG_CPLUSPLUS
1526             _SAVE_CXXFLAGS="$CXXFLAGS"
1527             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1528             AC_TRY_COMPILE([],
1529                            [return(0);],
1530                            ac_has_wno_variadic_macros="yes",
1531                            ac_has_wno_variadic_macros="no")
1532             CXXFLAGS="$_SAVE_CXXFLAGS"
1533             AC_LANG_RESTORE
1534         ])
1535     if test "$ac_has_wno_variadic_macros" = "yes"; then
1536         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1537     fi
1539     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1540                    ac_has_werror_return_type,
1541         [
1542             AC_LANG_SAVE
1543             AC_LANG_CPLUSPLUS
1544             _SAVE_CXXFLAGS="$CXXFLAGS"
1545             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1546             AC_TRY_COMPILE([],
1547                            [return(0);],
1548                            ac_has_werror_return_type="yes",
1549                            ac_has_werror_return_type="no")
1550             CXXFLAGS="$_SAVE_CXXFLAGS"
1551             AC_LANG_RESTORE
1552         ])
1553     if test "$ac_has_werror_return_type" = "yes"; then
1554         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1555     fi
1557 else
1558     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1561 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1562 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1563 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1564 dnl normal behavior.
1565 dnl ========================================================
1566 MKSHLIB_FORCE_ALL=
1567 MKSHLIB_UNFORCE_ALL=
1569 if test "$COMPILE_ENVIRONMENT"; then
1570 if test "$GNU_CC"; then
1571   AC_MSG_CHECKING(whether ld has archive extraction flags)
1572   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1573    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1574     ac_cv_mkshlib_force_and_unforce="no"
1575     exec 3<&0 <<LOOP_INPUT
1576         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1577         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1578         force="-Wl,-all";              unforce="-Wl,-none"
1579 LOOP_INPUT
1580     while read line
1581     do
1582       eval $line
1583       LDFLAGS=$force
1584       LIBS=$unforce
1585       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1586     done
1587     exec 0<&3 3<&-
1588     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1589    ])
1590   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1591     AC_MSG_RESULT(no)
1592   else
1593     AC_MSG_RESULT(yes)
1594     eval $ac_cv_mkshlib_force_and_unforce
1595     MKSHLIB_FORCE_ALL=$force
1596     MKSHLIB_UNFORCE_ALL=$unforce
1597   fi
1598 fi # GNU_CC
1599 fi # COMPILE_ENVIRONMENT
1601 dnl =================================================================
1602 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1603 dnl which is bad when cross compiling.
1604 dnl =================================================================
1605 if test "$COMPILE_ENVIRONMENT"; then
1606 configure_static_assert_macros='
1607 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1608 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1609 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1612 dnl test that the macros actually work:
1613 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1614 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1615  [AC_LANG_SAVE
1616   AC_LANG_C
1617   ac_cv_static_assertion_macros_work="yes"
1618   AC_TRY_COMPILE([$configure_static_assert_macros],
1619                  [CONFIGURE_STATIC_ASSERT(1)],
1620                  ,
1621                  ac_cv_static_assertion_macros_work="no")
1622   AC_TRY_COMPILE([$configure_static_assert_macros],
1623                  [CONFIGURE_STATIC_ASSERT(0)],
1624                  ac_cv_static_assertion_macros_work="no",
1625                  )
1626   AC_LANG_CPLUSPLUS
1627   AC_TRY_COMPILE([$configure_static_assert_macros],
1628                  [CONFIGURE_STATIC_ASSERT(1)],
1629                  ,
1630                  ac_cv_static_assertion_macros_work="no")
1631   AC_TRY_COMPILE([$configure_static_assert_macros],
1632                  [CONFIGURE_STATIC_ASSERT(0)],
1633                  ac_cv_static_assertion_macros_work="no",
1634                  )
1635   AC_LANG_RESTORE
1636  ])
1637 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1638 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1639     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1641 fi # COMPILE_ENVIRONMENT
1643 dnl ========================================================
1644 dnl Checking for 64-bit OS
1645 dnl ========================================================
1646 if test "$COMPILE_ENVIRONMENT"; then
1647 AC_LANG_SAVE
1648 AC_LANG_C
1649 AC_MSG_CHECKING(for 64-bit OS)
1650 AC_TRY_COMPILE([$configure_static_assert_macros],
1651                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1652                result="yes", result="no")
1653 AC_MSG_RESULT("$result")
1654 if test "$result" = "yes"; then
1655     AC_DEFINE(HAVE_64BIT_OS)
1656     HAVE_64BIT_OS=1
1658 AC_SUBST(HAVE_64BIT_OS)
1659 AC_LANG_RESTORE
1660 fi # COMPILE_ENVIRONMENT
1662 dnl ========================================================
1663 dnl Enable high-memory support on OS/2 by default.
1664 dnl ========================================================
1665 MOZ_OS2_HIGH_MEMORY=1
1666 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1667 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1668     MOZ_OS2_HIGH_MEMORY=,
1669     MOZ_OS2_HIGH_MEMORY=1 )
1670 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1672 dnl ========================================================
1673 dnl System overrides of the defaults for host
1674 dnl ========================================================
1675 case "$host" in
1676 *-beos*)
1677     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1678     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1679     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1680     ;;
1682 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1683     # we need Python 2.5 on Windows
1684     PYTHON_VERSION=2.5
1685     if test -n "$_WIN32_MSVC"; then
1686         HOST_AR=lib
1687         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1688         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1689         HOST_RANLIB='echo ranlib'
1690     else
1691         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1692     fi
1693     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1694     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1695     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1696     HOST_BIN_SUFFIX=.exe
1697     case "$host" in
1698     *mingw*)
1699     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1700         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1701         ;;
1702     *)
1703         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1704         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1705             _pwd=`pwd`
1706             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1707         fi
1708         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1709             AS_PERL=1
1710             PERL="${CYGWIN_WRAPPER} $PERL"
1711         fi
1713         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1714             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1715         fi
1716         ;;
1717     esac
1719     case "${host_cpu}" in
1720     x86_64)
1721         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1722         ;;
1723     esac
1724     ;;
1726 *-darwin*)
1727     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1728     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1729     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1730     ;;
1732 *-linux*|*-kfreebsd*-gnu)
1733     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1734     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1735     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1736     ;;
1738 *os2*)
1739     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1740     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1741     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1742     HOST_BIN_SUFFIX=.exe
1743     MOZ_FIX_LINK_PATHS=
1744     ;;
1746 *-osf*)
1747     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1748     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1749     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1750     ;;
1753     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1754     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1755     ;;
1756 esac
1758 dnl We require version 2.4 or newer of Python to build,
1759 dnl and 2.5 or newer on Windows.
1760 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1761 changequote(,)
1762 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1763 _python_res=$?
1764 changequote([,])
1765 if test "$_python_res" != 0; then
1766     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1768 AC_MSG_RESULT([yes])
1770 dnl Get mozilla version from central milestone file
1771 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1773 dnl Get version of various core apps from the version files.
1774 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1776 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1777 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1779 dnl ========================================================
1780 dnl System overrides of the defaults for target
1781 dnl ========================================================
1783 case "$target" in
1784 *-aix*)
1785     AC_DEFINE(AIX)
1786     if test ! "$GNU_CC"; then
1787         if test ! "$HAVE_64BIT_OS"; then
1788             # Compiling with Visual Age C++ object model compat is the
1789             # default. To compile with object model ibm, add 
1790             # AIX_OBJMODEL=ibm to .mozconfig.
1791             if test "$AIX_OBJMODEL" = "ibm"; then
1792                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1793             else
1794                 AIX_OBJMODEL=compat
1795             fi
1796         else
1797             AIX_OBJMODEL=compat
1798         fi
1799         AC_SUBST(AIX_OBJMODEL)
1800         DSO_LDOPTS='-qmkshrobj=1'
1801         DSO_CFLAGS='-qflag=w:w'
1802         DSO_PIC_CFLAGS=
1803         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1804         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1805         MOZ_FIX_LINK_PATHS=
1806         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1807         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1808         if test "$COMPILE_ENVIRONMENT"; then
1809             AC_LANG_SAVE
1810             AC_LANG_CPLUSPLUS
1811             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1812             AC_TRY_COMPILE([],
1813                 [#if (__IBMCPP__ < 600)
1814                  #error "Bad compiler"
1815                  #endif],
1816                 _BAD_COMPILER=,_BAD_COMPILER=1)
1817             if test -n "$_BAD_COMPILER"; then
1818                 AC_MSG_RESULT([no])    
1819                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1820             else
1821                 AC_MSG_RESULT([yes])    
1822             fi
1823             AC_LANG_RESTORE
1824             TARGET_COMPILER_ABI="ibmc"
1825             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1826             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1827         fi
1828     fi
1829     case "${target_os}" in
1830     aix4.1*)
1831         DLL_SUFFIX='_shr.a'
1832         ;;
1833     esac
1834     if test "$COMPILE_ENVIRONMENT"; then
1835         AC_CHECK_HEADERS(sys/inttypes.h)
1836     fi
1837     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1838     ;;
1840 *-beos*)
1841     no_x=yes
1842     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1843     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1844     DSO_LDOPTS='-nostart'
1845     TK_LIBS='-lbe -lroot'
1846     LIBS="$LIBS -lbe"
1847     if test "$COMPILE_ENVIRONMENT"; then
1848         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1849         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1850     fi
1851     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1852     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1853     _MOZ_USE_RTTI=1
1854     USE_DEPENDENT_LIBS=
1855     MOZ_USER_DIR="Mozilla"
1856     ;;
1858 *-bsdi*)
1859     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1860     _PEDANTIC=
1861     _IGNORE_LONG_LONG_WARNINGS=
1862     case $OS_RELEASE in
1863         4.*|5.*)
1864             STRIP="$STRIP -d"
1865             ;;
1866         *)
1867             DSO_CFLAGS=''
1868             DSO_LDOPTS='-r'
1869             _WARNINGS_CFLAGS="-Wall"
1870             _WARNINGS_CXXFLAGS="-Wall"
1871             # The test above doesn't work properly, at least on 3.1.
1872             MKSHLIB_FORCE_ALL=''
1873             MKSHLIB_UNFORCE_ALL=''
1874         ;;
1875     esac
1876     ;;
1878 *-darwin*) 
1879     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1880     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1881     MOZ_OPTIMIZE_FLAGS="-O3"
1882     _PEDANTIC=
1883     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1884     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1885     DLL_SUFFIX=".dylib"
1886     DSO_LDOPTS=''
1887     STRIP="$STRIP -x -S"
1888     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1889     MOZ_ENABLE_POSTSCRIPT=
1890     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1891     # The ExceptionHandling framework is needed for Objective-C exception
1892     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1893     # builds.
1894     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1896     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1897     dnl ===================================================================
1898     if test "x$enable_dtrace" = "xyes"; then
1899         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1900     else
1901         dnl check for the presence of the -dead_strip linker flag
1902         AC_MSG_CHECKING([for -dead_strip option to ld])
1903         _SAVE_LDFLAGS=$LDFLAGS
1904         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1905         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1906         if test -n "$_HAVE_DEAD_STRIP" ; then
1907             AC_MSG_RESULT([yes])
1908             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1909         else
1910             AC_MSG_RESULT([no])
1911         fi
1912         
1913         LDFLAGS=$_SAVE_LDFLAGS
1914     fi
1915     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1916     ;;
1918 *-freebsd*)
1919     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1920         DLL_SUFFIX=".so.1.0"
1921         DSO_LDOPTS="-shared"
1922     fi
1923     if test ! "$GNU_CC"; then
1924         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1925     fi
1926 # Can't have force w/o an unforce.
1927 #    # Hack for FreeBSD 2.2
1928 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1929 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1930 #       MKSHLIB_UNFORCE_ALL=''
1931 #    fi
1932     ;; 
1934 *-hpux*)
1935     DLL_SUFFIX=".sl"
1936     if test ! "$GNU_CC"; then
1937         DSO_LDOPTS='-b -Wl,+s'
1938         DSO_CFLAGS=""
1939         DSO_PIC_CFLAGS="+Z"
1940         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1941         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1942         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1943     else
1944         DSO_LDOPTS='-b -E +s'
1945         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1946         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1947     fi
1948     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1949     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1950     ;;
1952 *-irix5*)
1953     AC_DEFINE(IRIX)
1954     DSO_LDOPTS='-elf -shared'
1956     if test "$GNU_CC"; then
1957        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1958        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1959        MKSHLIB_FORCE_ALL='-Wl,-all'
1960        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1961        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1962     else
1963        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1964        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1965        MKSHLIB_FORCE_ALL='-all'
1966        MKSHLIB_UNFORCE_ALL='-none'
1967     fi
1968     ;;
1970 *-irix6*)
1971     AC_DEFINE(IRIX)
1972     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1973     dnl compile and link using -n32
1974     USE_N32=1
1975     TARGET_COMPILER_ABI=n32
1976     DSO_LDOPTS='-elf -shared'
1977     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1978     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1979     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1980     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1981     if test "$GNU_CC"; then
1982        MKSHLIB_FORCE_ALL='-Wl,-all'
1983        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1984        _WARNINGS_CFLAGS="-Wall"
1985        _WARNINGS_CXXFLAGS="-Wall"
1986        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1987     else
1988        MKSHLIB_FORCE_ALL='-all'
1989        MKSHLIB_UNFORCE_ALL='-none'
1990            AR_LIST="$AR t"
1991            AR_EXTRACT="$AR x"
1992            AR_DELETE="$AR d"
1993            AR='$(CXX) -ar'
1994            AR_FLAGS='-o $@'
1995        CFLAGS="$CFLAGS -woff 3262 -G 4"
1996        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1997        if test -n "$USE_N32"; then
1998            ASFLAGS="$ASFLAGS -n32"
1999            CFLAGS="$CFLAGS -n32"
2000            CXXFLAGS="$CXXFLAGS -n32"
2001            LDFLAGS="$LDFLAGS -n32"
2002        fi
2003        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2004        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2005        MOZ_FIX_LINK_PATHS=
2006     fi
2007     if test -z "$GNU_CXX"; then
2008       MIPSPRO_CXX=1
2009     fi
2010     ;;
2012 *-*linux*)
2013     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2014     # Similarly for GNU_CXX and INTEL_CXX.
2015     if test "$INTEL_CC" || test "$INTEL_CXX"; then
2016         # -Os has been broken on Intel's C/C++ compilers for quite a
2017         # while; Intel recommends against using it.
2018         MOZ_OPTIMIZE_FLAGS="-O2"
2019         MOZ_DEBUG_FLAGS="-g"
2020     elif test "$GNU_CC" || test "$GNU_CXX"; then
2021         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2022         case $GCC_VERSION in
2023         4.1.*|4.2.*)
2024             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
2025             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2026         esac
2027         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
2028         MOZ_DEBUG_FLAGS="-g"
2029     fi
2031     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2033     MOZ_MEMORY=1
2035     case "${target_cpu}" in
2036     alpha*)
2037         CFLAGS="$CFLAGS -mieee"
2038         CXXFLAGS="$CXXFLAGS -mieee"
2039     ;;
2040     i*86)
2041         USE_ELF_DYNSTR_GC=1
2042     ;;
2043     mips*)
2044         MOZ_DEBUG_FLAGS="-g" # We want inlining
2045     ;;
2046     esac
2047     ;;
2049 *-wince*|*-winmo*)
2050     TARGET_COMPILER_ABI=msvc
2051     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2052     _PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
2053     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2054     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2055     AR_LIST="$AR -list"
2056     AR_EXTRACT="$AR -extract"
2057     AR_DELETE="$AR d"
2058     AR_FLAGS='-OUT:"$@"'
2059     MOZ_MEMORY=1
2060     NSS_DISABLE_DBM=1
2061     MOZ_OGG=
2062     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2064     if test "$AS_BIN"; then
2065         AS="$AS_BIN"
2066     fi
2067     DSO_CFLAGS=
2068     DSO_PIC_CFLAGS=
2069     DLL_SUFFIX=.dll
2070     BIN_SUFFIX='.exe'
2071     if test -z "$RC"; then 
2072         RC=rc.exe  
2073     fi
2074     # certain versions of cygwin's makedepend barf on the 
2075     # #include <string> vs -I./dist/include/string issue so don't use it
2076     SYSTEM_MAKEDEPEND=
2078     HOST_CC=cl
2079     HOST_CXX=cl
2080     HOST_LD=link
2081     HOST_AR='lib -OUT:$@'
2082     HOST_RANLIB='echo ranlib'
2083     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2084         
2085         
2086     WARNINGS_AS_ERRORS='-WX'
2087     MOZ_OPTIMIZE_FLAGS='-Ox'
2088     AR_FLAGS='-NOLOGO -OUT:"$@"'
2089     ASM_SUFFIX=asm
2090     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2091     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2092     DLL_PREFIX=
2093     DOXYGEN=:
2094     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2095     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2096     GARBAGE=
2097     IMPORT_LIB_SUFFIX=lib
2098     dnl Need to force-link against mozalloc because it's used in the shunt
2099     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2100     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2101     LIB_PREFIX=
2102     LIB_SUFFIX=lib 
2103     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2104     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2105     MKSHLIB_FORCE_ALL=
2106     MKSHLIB_UNFORCE_ALL=
2107     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2108     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2109     MOZ_DEBUG_FLAGS='-Zi'
2110     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2111     MOZ_FIX_LINK_PATHS=
2112     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2113     OBJ_SUFFIX=obj
2114     RANLIB='echo not_ranlib'
2115     STRIP='echo not_strip'
2116     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2117     UNZIP=unzip
2118     XARGS=xargs
2119     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2120     ZIP=zip
2121     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2122     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2123     STATIC_LIBIDL=1
2124     MOZ_TREE_FREETYPE=1
2126     AC_DEFINE(HAVE_SNPRINTF)
2127     AC_DEFINE(_WINDOWS)
2128     AC_DEFINE(WIN32)
2129     AC_DEFINE(XP_WIN)
2130     AC_DEFINE(XP_WIN32)
2131     AC_DEFINE(HW_THREADS)
2132     AC_DEFINE(STDC_HEADERS)
2133     AC_DEFINE(NEW_H, <new>)
2134     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2135     AC_DEFINE(HAVE_LOCALTIME_R)
2137     TARGET_MD_ARCH=win32
2138     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2139     BIN_SUFFIX='.exe'
2140     MOZ_ENABLE_POSTSCRIPT=
2141     MOZ_USER_DIR="Mozilla"
2143     MOZ_GFX_OPTIMIZE_MOBILE=1
2145     # Sanity check for WINCE_WINDOWS_MOBILE
2146     # XXX disabled until we can fix the mobile tinderbox
2147     ##if test "$WINCE_WINDOWS_MOBILE"; then
2148     ##   AC_CHECK_HEADER(tpcshell.h, [],
2149     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2150     ##fi
2154 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2155     DSO_CFLAGS=
2156     DSO_PIC_CFLAGS=
2157     DLL_SUFFIX=.dll
2158     RC=rc.exe
2159     # certain versions of cygwin's makedepend barf on the 
2160     # #include <string> vs -I./dist/include/string issue so don't use it
2161     SYSTEM_MAKEDEPEND=
2162     if test -n "$GNU_CC"; then
2163         CC="$CC -mno-cygwin"
2164         CXX="$CXX -mno-cygwin"
2165         CPP="$CPP -mno-cygwin"
2166         CFLAGS="$CFLAGS -mms-bitfields"
2167         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2168         DSO_LDOPTS='-shared'
2169         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2170         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2171         RC='$(WINDRES)'
2172         # Use temp file for windres (bug 213281)
2173         RCFLAGS='-O coff --use-temp-file'
2174         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2175         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2176         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2177         MOZ_FIX_LINK_PATHS=
2178         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2179         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2180         DLL_PREFIX=
2181         IMPORT_LIB_SUFFIX=dll.a
2182     else
2183         TARGET_COMPILER_ABI=msvc
2184         HOST_CC='$(CC)'
2185         HOST_CXX='$(CXX)'
2186         HOST_LD='$(LD)'
2187         if test "$AS_BIN"; then
2188             AS="$(basename "$AS_BIN")"
2189         fi
2190         AR='lib -NOLOGO -OUT:"$@"'
2191         AR_FLAGS=
2192         RANLIB='echo not_ranlib'
2193         STRIP='echo not_strip'
2194         XARGS=xargs
2195         ZIP=zip
2196         UNZIP=unzip
2197         DOXYGEN=:
2198         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2199         ASM_SUFFIX=asm
2200         OBJ_SUFFIX=obj
2201         LIB_SUFFIX=lib
2202         DLL_PREFIX=
2203         LIB_PREFIX=
2204         IMPORT_LIB_SUFFIX=lib
2205         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2206         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2207         MKSHLIB_FORCE_ALL=
2208         MKSHLIB_UNFORCE_ALL=
2209         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2210         _USE_CPP_INCLUDE_FLAG=1
2211         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2212         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2213         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2214         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2215         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2216         MOZ_DEBUG_FLAGS='-Zi'
2217         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2218         WARNINGS_AS_ERRORS='-WX'
2219         MOZ_OPTIMIZE_FLAGS='-O1'
2220         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2221         MOZ_FIX_LINK_PATHS=
2222         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2223         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2224         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2225         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2226         if test $_MSC_VER -ge 1400; then
2227             LDFLAGS="$LDFLAGS -NXCOMPAT"
2228             dnl For profile-guided optimization
2229             PROFILE_GEN_CFLAGS="-GL"
2230             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2231             dnl XXX: PGO builds can fail with warnings treated as errors,
2232             dnl specifically "no profile data available" appears to be
2233             dnl treated as an error sometimes. This might be a consequence
2234             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2235             dnl with the linker doing most of the work in the whole-program
2236             dnl optimization/PGO case. I think it's probably a compiler bug,
2237             dnl but we work around it here.
2238             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2239             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2240             dnl Probably also a compiler bug, but what can you do?
2241             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2242             if test -n "$_USE_DYNAMICBASE"; then
2243                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2244             fi
2245         fi
2246     fi
2247     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2248     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2249     AC_DEFINE(HAVE_SNPRINTF)
2250     AC_DEFINE(_WINDOWS)
2251     AC_DEFINE(WIN32)
2252     AC_DEFINE(XP_WIN)
2253     AC_DEFINE(XP_WIN32)
2254     AC_DEFINE(HW_THREADS)
2255     AC_DEFINE(STDC_HEADERS)
2256     AC_DEFINE(NEW_H, <new>)
2257     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2258     TARGET_MD_ARCH=win32
2259     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2260     BIN_SUFFIX='.exe'
2261     MOZ_ENABLE_POSTSCRIPT=
2262     MOZ_USER_DIR="Mozilla"
2264     dnl Hardcode to win95 for now - cls
2265     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2267     dnl set NO_X11 defines here as the general check is skipped on win32
2268     no_x=yes
2269     AC_DEFINE(NO_X11)
2271     dnl MinGW/MSYS doesn't provide or need cygpath
2272     case "$host" in
2273     *-mingw*)
2274         CYGPATH_W=echo
2275         CYGPATH_S=cat
2276         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2277         ;;
2278     *-cygwin*|*-msvc*|*-mks*)
2279         CYGPATH_W="cygpath -a -w"
2280         CYGPATH_S="sed -e s|\\\\|/|g"
2281         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2282         ;;
2283     esac
2284     case "$host" in
2285     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2287     if test -z "$MOZ_TOOLS"; then
2288         AC_MSG_ERROR([MOZ_TOOLS is not set])
2289     fi
2291     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2292     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2293         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2294     fi
2295     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2296     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2297         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2298     fi
2299     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2301     if test -n "$GLIB_PREFIX"; then
2302         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2303         if test "$?" = "0"; then
2304             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2305                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2306             fi
2307             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2308         else
2309             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2310         fi
2311     else
2312         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2313     fi
2314     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2315         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2316     fi
2317     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2318     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2319         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2320     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2321         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2322     else
2323         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2324     fi
2326     if test -n "$LIBIDL_PREFIX"; then
2327         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2328         if test "$?" = "0"; then
2329             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2330                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2331             fi
2332             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2333         else
2334             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2335         fi
2336     else
2337         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2338     fi        
2339     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2340         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2341     fi
2342     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2343     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2344         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2345         STATIC_LIBIDL=1
2346     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2347         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2348     else
2349         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2350     fi
2351     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2352     ;;
2354     *) # else cross-compiling
2355         if test -n "$GLIB_PREFIX"; then
2356             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2357             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2358                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2359             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2360                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2361             else
2362                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2363             fi
2364         fi
2365         if test -n "$LIBIDL_PREFIX"; then
2366             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2367             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2368                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2369                 STATIC_LIBIDL=1
2370             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2371                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2372             else
2373                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2374             fi
2375         fi
2376         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2377         ;;
2378     esac 
2381     case "$host_os" in
2382     cygwin*|msvc*|mks*)
2383         AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites])
2384         ;;
2386     *)
2387         AC_CHECK_HEADERS(oleacc.idl)
2389         AC_LANG_SAVE
2390         AC_LANG_CPLUSPLUS
2391         AC_CHECK_HEADERS(atlbase.h)
2392         AC_LANG_RESTORE
2393         ;;
2394     esac
2396     case "$target" in
2397     i*86-*)
2398         if test "$HAVE_64BIT_OS"; then
2399             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2400         fi
2402         if test $_MSC_VER -ge 1400; then
2403             LDFLAGS="$LDFLAGS -SAFESEH"
2404         fi
2405         AC_CHECK_HEADERS(mmintrin.h)
2406         AC_DEFINE(_X86_)
2407         ;;
2408     alpha-*)
2409         AC_DEFINE(_ALPHA_)
2410         ;;
2411     mips-*)
2412         AC_DEFINE(_MIPS_)
2413         ;;
2414     x86_64-*)
2415         AC_DEFINE(_AMD64_)
2416         ;;
2417     *)
2418         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2419         ;;
2420     esac
2422     if test "$HAVE_64BIT_OS"; then
2423         AC_DEFINE(_WIN64)
2424     fi
2425     ;;
2427 *-netbsd*)
2428     DSO_CFLAGS=''
2429     CFLAGS="$CFLAGS -Dunix"
2430     CXXFLAGS="$CXXFLAGS -Dunix"
2431     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2432         DLL_SUFFIX=".so"
2433         DSO_PIC_CFLAGS='-fPIC -DPIC'
2434         DSO_LDOPTS='-shared'
2435         BIN_FLAGS='-Wl,--export-dynamic'
2436     else
2437         DSO_PIC_CFLAGS='-fPIC -DPIC'
2438         DLL_SUFFIX=".so.1.0"
2439         DSO_LDOPTS='-shared'
2440     fi
2441     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2442     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2443     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2444     if test "$LIBRUNPATH"; then
2445         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2446     fi
2447     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2448     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2449     ;;
2451 *-nto*) 
2452         AC_DEFINE(NTO)  
2453         AC_DEFINE(_QNX_SOURCE)
2454         AC_DEFINE(_i386)
2455         OS_TARGET=NTO
2456         WARNINGS_AS_ERRORS=''
2457         MOZ_OPTIMIZE_FLAGS="-O"
2458         MOZ_DEBUG_FLAGS="-gstabs"
2459         USE_PTHREADS=1
2460         _PEDANTIC=
2461         LIBS="$LIBS -lsocket -lstdc++"
2462         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2463         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2464         if test "$with_x" != "yes"
2465         then
2466                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2467             TK_CFLAGS='-I/usr/include/photon'
2468                 TK_LIBS='-lph'
2469         fi
2470         case "${target_cpu}" in
2471         ppc*)
2472         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2473         ;;
2474         esac
2475         case "${host_cpu}" in
2476         i*86)
2477         USE_ELF_DYNSTR_GC=1
2478         ;;
2479         esac
2480         ;;
2482 *-openbsd*)
2483     DLL_SUFFIX=".so.1.0"
2484     DSO_CFLAGS=''
2485     DSO_PIC_CFLAGS='-fPIC'
2486     DSO_LDOPTS='-shared -fPIC'
2487     if test "$LIBRUNPATH"; then
2488         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2489     fi
2490     ;;
2492 *-openvms*) 
2493     AC_DEFINE(NO_PW_GECOS)
2494     AC_DEFINE(NO_UDSOCK)
2495     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2496     USE_PTHREADS=1
2497     MKSHLIB_FORCE_ALL='-all'
2498     MKSHLIB_UNFORCE_ALL='-none'
2499     AS='as'
2500     AS_DASH_C_FLAG='-Wc/names=as_is'
2501     AR_FLAGS='c $@'
2502     DSO_LDOPTS='-shared -auto_symvec'
2503     DSO_PIC_CFLAGS=
2504     MOZ_DEBUG_LDFLAGS='-g'
2505     COMPAQ_CXX=1
2506     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2507     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2508     ;;
2511 *-os2*)
2512     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2513     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2514     AC_DEFINE(OS2)
2515     AC_DEFINE(XP_OS2)
2516     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2517     AC_DEFINE(TCPV40HDRS)
2518     DLL_PREFIX=
2519     LIB_PREFIX=
2520     LIB_SUFFIX=lib
2521     BIN_SUFFIX=".exe"
2522     DLL_SUFFIX=".dll"
2523     IMPORT_LIB_SUFFIX=lib
2524     DSO_PIC_CFLAGS=
2525     AR=emxomfar
2526     AR_FLAGS='r $@'
2527     CFLAGS="$CFLAGS -Zomf"
2528     CXXFLAGS="$CXXFLAGS -Zomf"
2529     DSO_LDOPTS='-Zdll'
2530     BIN_FLAGS='-Zlinker /ST:0x100000'
2531     IMPLIB='emximp -o'
2532     FILTER='emxexp -o'
2533     LDFLAGS='-Zmap'
2534     WARNINGS_AS_ERRORS='-Werror'
2535     MOZ_DEBUG_FLAGS="-g -fno-inline"
2536     MOZ_OPTIMIZE_FLAGS="-O2"
2537     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2538     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2539     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2540     TARGET_MD_ARCH=os2
2541     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2542     MOZ_ENABLE_POSTSCRIPT=
2543     RC=rc.exe
2544     RCFLAGS='-n'
2545     MOZ_USER_DIR="Mozilla"
2547     if test "$MOZTOOLS"; then
2548         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2549     else
2550         AC_MSG_ERROR([MOZTOOLS is not set])
2551     fi
2552     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2553         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2554         LDFLAGS="$LDFLAGS -Zhigh-mem"
2555         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2556         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2557     fi
2559     # GCC for OS/2 currently predefines these, but we don't want them
2560     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2561     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2563     AC_CACHE_CHECK(for __declspec(dllexport),
2564         ac_os2_declspec,
2565         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2566                         [return 0;],
2567                         ac_os2_declspec="yes",
2568                         ac_os2_declspec="no")])
2569     if test "$ac_os2_declspec" = "yes"; then
2570         FILTER='true'
2571         MOZ_OS2_USE_DECLSPEC='1'
2572     fi
2573     ;;
2575 alpha*-*-osf*)
2576     if test "$GNU_CC"; then
2577       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2578       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2580     else
2581         MOZ_DEBUG_FLAGS='-g'
2582         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2583         CFLAGS="$CFLAGS -ieee"
2584         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2585         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2586         DSO_CFLAGS=
2587         DSO_PIC_CFLAGS=
2588         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2589         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2590         MKSHLIB_FORCE_ALL='-all'
2591         MKSHLIB_UNFORCE_ALL='-none'
2592         dnl Might fix the libxpcom.so breakage on this platform as well....
2593         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2594         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2595     fi
2596     if test -z "$GNU_CXX"; then
2597       COMPAQ_CXX=1
2598     fi
2599     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2600     ;;
2602 *-qnx*) 
2603     DIRENT_INO=d_stat.st_ino
2604     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2605     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2606     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2607     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2608     AC_DEFINE(STDC_HEADERS)
2609     if test "$no_x" = "yes"; then
2610             _PLATFORM_DEFAULT_TOOLKIT='photon'
2611             TK_CFLAGS='-I/usr/nto/include/photon'
2612             TK_LIBS='-lphoton -lphrender'
2613     fi
2614     ;;
2616 *-sco*) 
2617     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2618     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2619     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2620     if test ! "$GNU_CC"; then
2621        DSO_LDOPTS='-G'
2622     fi
2623     ;;
2625 *-solaris*) 
2626     AC_DEFINE(SOLARIS)
2627     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2628     SYSTEM_MAKEDEPEND=
2629     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2630     # libraries one level up (e.g. libnspr4.so)
2631     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2632     MOZ_MEMORY=1
2633     if test "$SOLARIS_SUNPRO_CC"; then
2634        LIBS="-lCrun -lCstd $LIBS"
2635        NS_USE_NATIVE=1
2636        MOZ_FIX_LINK_PATHS=
2637        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2638        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2639        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath"
2640        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2641        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2642            _SAVE_LDFLAGS=$LDFLAGS
2643            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2644            AC_TRY_LINK([#include <stdio.h>],
2645                        [printf("Hello World\n");],
2646                        ,
2647                        [LDFLAGS=$_SAVE_LDFLAGS])
2648        fi
2649        WARNINGS_AS_ERRORS='-Werror'
2650        MOZ_OPTIMIZE_FLAGS="-xO4"
2651        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2652        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2653        MKSHLIB_FORCE_ALL='-z allextract'
2654        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2655        DSO_LDOPTS='-G -z muldefs'
2656        AR_LIST="$AR t"
2657        AR_EXTRACT="$AR x"
2658        AR_DELETE="$AR d"
2659        AR='$(CXX) -xar'
2660        AR_FLAGS='-o $@'
2661        AS='/usr/ccs/bin/as'
2662        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2663        AS_DASH_C_FLAG=''
2664        TARGET_COMPILER_ABI="sunc"
2665        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2666        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2667        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2668        AC_LANG_SAVE
2669        AC_LANG_CPLUSPLUS
2670        AC_TRY_COMPILE([],
2671            [#if (__SUNPRO_CC < 0x590)
2672            #error "Denied"
2673            #endif],
2674            _BAD_COMPILER=,_BAD_COMPILER=1)
2675         if test -n "$_BAD_COMPILER"; then
2676             _res="no"
2677             AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2678         else
2679             _res="yes"
2680         fi
2681         AC_MSG_RESULT([$_res])
2682         AC_LANG_RESTORE
2683     else
2684        ASFLAGS="$ASFLAGS -fPIC"
2685        DSO_LDOPTS='-G'
2686        _WARNINGS_CFLAGS=''
2687        _WARNINGS_CXXFLAGS=''
2688        if test "$OS_RELEASE" = "5.3"; then
2689           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2690        fi
2691     fi
2692     if test "$OS_RELEASE" = "5.5.1"; then
2693        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2694     fi
2695     ;;
2697 *-sunos*) 
2698     DSO_LDOPTS='-Bdynamic'
2699     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2700     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2701     AC_DEFINE(SUNOS4)
2702     AC_DEFINE(SPRINTF_RETURNS_STRING)
2703     case "$(target_os)" in
2704     sunos4.1*)
2705         DLL_SUFFIX='.so.1.0'
2706         ;;
2707     esac
2708     ;;
2710 *-sysv4.2uw7*) 
2711         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2712     ;;
2714 *-os2*)
2715     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2716     ;;
2718 esac
2720 dnl Only one oddball right now (QNX), but this gives us flexibility
2721 dnl if any other platforms need to override this in the future.
2722 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2724 dnl ========================================================
2725 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2726 dnl by now will not have any way to link most binaries (tests
2727 dnl as well as viewer, apprunner, etc.), because some symbols
2728 dnl will be left out of the "composite" .so's by ld as unneeded.
2729 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2730 dnl they can link in the static libs that provide the missing
2731 dnl symbols.
2732 dnl ========================================================
2733 NO_LD_ARCHIVE_FLAGS=
2734 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2735     NO_LD_ARCHIVE_FLAGS=1
2737 case "$target" in
2738 *-os2*)
2739     NO_LD_ARCHIVE_FLAGS=
2740     ;;
2741 *-aix4.3*|*-aix5*)
2742     NO_LD_ARCHIVE_FLAGS=
2743     ;;
2744 *-openvms*)
2745     NO_LD_ARCHIVE_FLAGS=
2746     ;;
2747 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2748     if test -z "$GNU_CC"; then
2749         NO_LD_ARCHIVE_FLAGS=
2750     fi
2751     ;;
2752 esac
2753 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2755 dnl ========================================================
2756 dnl = Flags to strip unused symbols from .so components
2757 dnl ========================================================
2758 case "$target" in
2759     *-linux*|*-kfreebsd*-gnu)
2760         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2761         ;;
2762     *-solaris*)
2763         if test -z "$GNU_CC"; then
2764          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2765         else
2766          if test -z "$GCC_USE_GNU_LD"; then
2767           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2768          else
2769           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2770          fi
2771         fi
2772         ;;
2773     *-nto*) 
2774         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2775         ;;
2776     *-darwin*)
2777         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2778         ;;
2779     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2780         if test -n "$GNU_CC"; then
2781            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2782         fi
2783         ;;
2784 esac
2786 if test -z "$COMPILE_ENVIRONMENT"; then
2787     SKIP_COMPILER_CHECKS=1
2788     SKIP_LIBRARY_CHECKS=1
2791 if test -z "$SKIP_COMPILER_CHECKS"; then
2792 dnl Checks for typedefs, structures, and compiler characteristics.
2793 dnl ========================================================
2794 AC_LANG_C
2795 AC_HEADER_STDC
2796 AC_C_CONST
2797 AC_TYPE_MODE_T
2798 AC_TYPE_OFF_T
2799 AC_TYPE_PID_T
2800 AC_TYPE_SIZE_T
2801 AC_MSG_CHECKING(for ssize_t)
2802 AC_CACHE_VAL(ac_cv_type_ssize_t,
2803  [AC_TRY_COMPILE([#include <stdio.h>
2804                   #include <sys/types.h>],
2805                  [ssize_t foo = 0;],
2806                  [ac_cv_type_ssize_t=true],
2807                  [ac_cv_type_ssize_t=false])])
2808 if test "$ac_cv_type_ssize_t" = true ; then
2809   AC_DEFINE(HAVE_SSIZE_T)
2810   AC_MSG_RESULT(yes)
2811 else
2812   AC_MSG_RESULT(no)
2814 AC_STRUCT_ST_BLKSIZE
2815 AC_MSG_CHECKING(for siginfo_t)
2816 AC_CACHE_VAL(ac_cv_siginfo_t,
2817  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2818                   #include <signal.h>],
2819                  [siginfo_t* info;],
2820                  [ac_cv_siginfo_t=true],
2821                  [ac_cv_siginfo_t=false])])
2822 if test "$ac_cv_siginfo_t" = true ; then
2823   AC_DEFINE(HAVE_SIGINFO_T)
2824   AC_MSG_RESULT(yes)
2825 else
2826   AC_MSG_RESULT(no)
2829 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2830 dnl ========================================================
2831 AC_MSG_CHECKING(for int16_t)
2832 AC_CACHE_VAL(ac_cv_int16_t,
2833  [AC_TRY_COMPILE([#include <stdio.h>
2834                   #include <sys/types.h>],
2835                  [int16_t foo = 0;],
2836                  [ac_cv_int16_t=true],
2837                  [ac_cv_int16_t=false])])
2838 if test "$ac_cv_int16_t" = true ; then
2839   AC_DEFINE(HAVE_INT16_T)
2840   AC_MSG_RESULT(yes)
2841 else
2842   AC_MSG_RESULT(no)
2844 AC_MSG_CHECKING(for int32_t)
2845 AC_CACHE_VAL(ac_cv_int32_t,
2846  [AC_TRY_COMPILE([#include <stdio.h>
2847                   #include <sys/types.h>],
2848                  [int32_t foo = 0;],
2849                  [ac_cv_int32_t=true],
2850                  [ac_cv_int32_t=false])])
2851 if test "$ac_cv_int32_t" = true ; then
2852   AC_DEFINE(HAVE_INT32_T)
2853   AC_MSG_RESULT(yes)
2854 else
2855   AC_MSG_RESULT(no)
2857 AC_MSG_CHECKING(for int64_t)
2858 AC_CACHE_VAL(ac_cv_int64_t,
2859  [AC_TRY_COMPILE([#include <stdio.h>
2860                   #include <sys/types.h>],
2861                  [int64_t foo = 0;],
2862                  [ac_cv_int64_t=true],
2863                  [ac_cv_int64_t=false])])
2864 if test "$ac_cv_int64_t" = true ; then
2865   AC_DEFINE(HAVE_INT64_T)
2866   AC_MSG_RESULT(yes)
2867 else
2868   AC_MSG_RESULT(no)
2870 AC_MSG_CHECKING(for int64)
2871 AC_CACHE_VAL(ac_cv_int64,
2872  [AC_TRY_COMPILE([#include <stdio.h>
2873                   #include <sys/types.h>],
2874                  [int64 foo = 0;],
2875                  [ac_cv_int64=true],
2876                  [ac_cv_int64=false])])
2877 if test "$ac_cv_int64" = true ; then
2878   AC_DEFINE(HAVE_INT64)
2879   AC_MSG_RESULT(yes)
2880 else
2881   AC_MSG_RESULT(no)
2883 AC_MSG_CHECKING(for uint)
2884 AC_CACHE_VAL(ac_cv_uint,
2885  [AC_TRY_COMPILE([#include <stdio.h>
2886                   #include <sys/types.h>],
2887                  [uint foo = 0;],
2888                  [ac_cv_uint=true],
2889                  [ac_cv_uint=false])])
2890 if test "$ac_cv_uint" = true ; then
2891   AC_DEFINE(HAVE_UINT)
2892   AC_MSG_RESULT(yes)
2893 else
2894   AC_MSG_RESULT(no)
2896 AC_MSG_CHECKING(for uint_t)
2897 AC_CACHE_VAL(ac_cv_uint_t,
2898  [AC_TRY_COMPILE([#include <stdio.h>
2899                   #include <sys/types.h>],
2900                  [uint_t foo = 0;],
2901                  [ac_cv_uint_t=true],
2902                  [ac_cv_uint_t=false])])
2903 if test "$ac_cv_uint_t" = true ; then
2904   AC_DEFINE(HAVE_UINT_T)
2905   AC_MSG_RESULT(yes)
2906 else
2907   AC_MSG_RESULT(no)
2909 AC_MSG_CHECKING(for uint16_t)
2910 AC_CACHE_VAL(ac_cv_uint16_t,
2911  [AC_TRY_COMPILE([#include <stdio.h>
2912                   #include <sys/types.h>],
2913                  [uint16_t foo = 0;],
2914                  [ac_cv_uint16_t=true],
2915                  [ac_cv_uint16_t=false])])
2916 if test "$ac_cv_uint16_t" = true ; then
2917   AC_DEFINE(HAVE_UINT16_T)
2918   AC_MSG_RESULT(yes)
2919 else
2920   AC_MSG_RESULT(no)
2923 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2924 dnl are defined when compiling C++ but not C.  Since the result of this
2925 dnl test is used only in C++, do it in C++.
2926 AC_LANG_CPLUSPLUS
2928 AC_MSG_CHECKING(for uname.domainname)
2929 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2930     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2931         [ struct utsname *res; char *domain; 
2932             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2933         [ac_cv_have_uname_domainname_field=true],
2934         [ac_cv_have_uname_domainname_field=false])])
2936 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2937     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2938     AC_MSG_RESULT(yes)
2939 else
2940     AC_MSG_RESULT(no)
2943 AC_MSG_CHECKING(for uname.__domainname)
2944 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2945     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2946         [ struct utsname *res; char *domain; 
2947             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2948         [ac_cv_have_uname_us_domainname_field=true],
2949         [ac_cv_have_uname_us_domainname_field=false])])
2951 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2952     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2953     AC_MSG_RESULT(yes)
2954 else
2955     AC_MSG_RESULT(no)
2958 AC_LANG_CPLUSPLUS
2960 dnl Check for usable char16_t (2 bytes, unsigned)
2961 dnl (we might not need the unsignedness check anymore)
2962 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2963     ac_cv_have_usable_char16_t,
2964     [AC_TRY_COMPILE([$configure_static_assert_macros],
2965                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2966                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2967                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2968                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2969                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2970                     ac_cv_have_usable_char16_t="yes",
2971                     ac_cv_have_usable_char16_t="no")])
2972 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2973     AC_DEFINE(HAVE_CPP_CHAR16_T)
2974     HAVE_CPP_CHAR16_T=1
2977 dnl Check for usable wchar_t (2 bytes, unsigned)
2978 dnl (we really don't need the unsignedness check anymore)
2979 dnl ========================================================
2981 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2982     ac_cv_have_usable_wchar_v2,
2983     [AC_TRY_COMPILE([#include <stddef.h>
2984                      $configure_static_assert_macros],
2985                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2986                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2987                     ac_cv_have_usable_wchar_v2="yes",
2988                     ac_cv_have_usable_wchar_v2="no")])
2989 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2990     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2991     HAVE_CPP_2BYTE_WCHAR_T=1
2992 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2993 dnl This is really gcc-only
2994 dnl Do this test using CXX only since some versions of gcc
2995 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2996 dnl only have short-wchar support for c++.
2997 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2999     _SAVE_CXXFLAGS=$CXXFLAGS
3000     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3002     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3003         ac_cv_have_usable_wchar_option_v2,
3004         [AC_TRY_LINK([#include <stddef.h>
3005                       $configure_static_assert_macros],
3006                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3007                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3008                      ac_cv_have_usable_wchar_option_v2="yes",
3009                      ac_cv_have_usable_wchar_option_v2="no")])
3011     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3012         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3013         HAVE_CPP_2BYTE_WCHAR_T=1
3014         WCHAR_CFLAGS="-fshort-wchar"
3015     else    
3016         CXXFLAGS=$_SAVE_CXXFLAGS
3017     fi
3020 AC_LANG_C
3022 dnl Check for .hidden assembler directive and visibility attribute.
3023 dnl Borrowed from glibc configure.in
3024 dnl ===============================================================
3025 if test "$GNU_CC"; then
3026   AC_CACHE_CHECK(for visibility(hidden) attribute,
3027                  ac_cv_visibility_hidden,
3028                  [cat > conftest.c <<EOF
3029                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3031                   ac_cv_visibility_hidden=no
3032                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3033                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3034                       ac_cv_visibility_hidden=yes
3035                     fi
3036                   fi
3037                   rm -f conftest.[cs]
3038                  ])
3039   if test "$ac_cv_visibility_hidden" = "yes"; then
3040     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3042     AC_CACHE_CHECK(for visibility(default) attribute,
3043                    ac_cv_visibility_default,
3044                    [cat > conftest.c <<EOF
3045                     int foo __attribute__ ((visibility ("default"))) = 1;
3047                     ac_cv_visibility_default=no
3048                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3049                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3050                         ac_cv_visibility_default=yes
3051                       fi
3052                     fi
3053                     rm -f conftest.[cs]
3054                    ])
3055     if test "$ac_cv_visibility_default" = "yes"; then
3056       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3058       AC_CACHE_CHECK(for visibility pragma support,
3059                      ac_cv_visibility_pragma,
3060                      [cat > conftest.c <<EOF
3061 #pragma GCC visibility push(hidden)
3062                       int foo_hidden = 1;
3063 #pragma GCC visibility push(default)
3064                       int foo_default = 1;
3066                       ac_cv_visibility_pragma=no
3067                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3068                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3069                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3070                             ac_cv_visibility_pragma=yes
3071                           fi
3072                         fi
3073                       fi
3074                       rm -f conftest.[cs]
3075                     ])
3076       if test "$ac_cv_visibility_pragma" = "yes"; then
3077         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3078                        ac_cv_have_visibility_class_bug,
3079                        [cat > conftest.c <<EOF
3080 #pragma GCC visibility push(hidden)
3081 struct __attribute__ ((visibility ("default"))) TestStruct {
3082   static void Init();
3084 __attribute__ ((visibility ("default"))) void TestFunc() {
3085   TestStruct::Init();
3088                        ac_cv_have_visibility_class_bug=no
3089                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3090                          ac_cv_have_visibility_class_bug=yes
3091                        else
3092                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3093                            ac_cv_have_visibility_class_bug=yes
3094                          fi
3095                        fi
3096                        rm -rf conftest.{c,S}
3097                        ])
3099         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3100                        ac_cv_have_visibility_builtin_bug,
3101                        [cat > conftest.c <<EOF
3102 #pragma GCC visibility push(hidden)
3103 #pragma GCC visibility push(default)
3104 #include <string.h>
3105 #pragma GCC visibility pop
3107 __attribute__ ((visibility ("default"))) void Func() {
3108   char c[[100]];
3109   memset(c, 0, sizeof(c));
3112                        ac_cv_have_visibility_builtin_bug=no
3113                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3114                          ac_cv_have_visibility_builtin_bug=yes
3115                        else
3116                          if test `grep -c "@PLT" conftest.S` = 0; then
3117                            ac_cv_visibility_builtin_bug=yes
3118                          fi
3119                        fi
3120                        rm -f conftest.{c,S}
3121                        ])
3122         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3123                 "$ac_cv_have_visibility_class_bug" = "no"; then
3124           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3125           WRAP_SYSTEM_INCLUDES=1
3126         else
3127           VISIBILITY_FLAGS='-fvisibility=hidden'
3128         fi # have visibility pragma bug
3129       fi   # have visibility pragma
3130     fi     # have visibility(default) attribute
3131   fi       # have visibility(hidden) attribute
3132 fi         # GNU_CC
3134 # visibility hidden flag for Sun Studio on Solaris
3135 if test "$SOLARIS_SUNPRO_CC"; then
3136 VISIBILITY_FLAGS='-xldscope=hidden'
3137 fi         # Sun Studio on Solaris
3139 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3140 AC_SUBST(VISIBILITY_FLAGS)
3142 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3143 dnl ========================================================
3144 if test "$GNU_CC"; then
3145   CFLAGS_save="${CFLAGS}"
3146   CFLAGS="${CFLAGS} -Werror"
3147   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3148                  ac_cv_force_align_arg_pointer,
3149                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3150                                  [],
3151                                  ac_cv_force_align_arg_pointer="yes",
3152                                  ac_cv_force_align_arg_pointer="no")])
3153   CFLAGS="${CFLAGS_save}"
3154   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3155     HAVE_GCC_ALIGN_ARG_POINTER=1
3156   else
3157     HAVE_GCC_ALIGN_ARG_POINTER=
3158   fi
3160 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3162 dnl Checks for header files.
3163 dnl ========================================================
3164 AC_HEADER_DIRENT
3165 case "$target_os" in
3166 freebsd*)
3167 # for stuff like -lXshm
3168     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3169     ;;
3170 esac
3171 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3172 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3173 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3174 AC_CHECK_HEADERS(malloc.h)
3175 AC_CHECK_HEADERS(X11/XKBlib.h)
3176 AC_CHECK_HEADERS(io.h)
3178 dnl These are all the places some variant of statfs can be hiding.
3179 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3181 dnl Quota support
3182 AC_CHECK_HEADERS(sys/quota.h)
3184 dnl Try for MMX support
3185 dnl NB - later gcc versions require -mmmx for this header to be successfully
3186 dnl included (or another option which implies it, such as -march=pentium-mmx)
3187 AC_CHECK_HEADERS(mmintrin.h)
3189 dnl Check whether the compiler supports the new-style C++ standard
3190 dnl library headers (i.e. <new>) or needs the old "new.h"
3191 AC_LANG_CPLUSPLUS
3192 NEW_H=new.h
3193 AC_CHECK_HEADER(new, [NEW_H=new])
3194 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3195 AC_LANG_C
3197 AC_ARG_ENABLE(dtrace,
3198               [  --enable-dtrace         build with dtrace support if available (default=no)],
3199               [enable_dtrace="yes"],)
3200 if test "x$enable_dtrace" = "xyes"; then
3201   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3202   if test -n "$HAVE_DTRACE"; then
3203       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3204   else
3205       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3206   fi
3208 AC_SUBST(HAVE_DTRACE)
3210 case $target in
3211 *-aix4.3*|*-aix5*)
3212         ;;
3214         AC_CHECK_HEADERS(sys/cdefs.h)
3215         ;;
3216 esac
3218 dnl Checks for libraries.
3219 dnl ========================================================
3220 case $target in
3221 *-hpux11.*)
3222         ;;
3224         AC_CHECK_LIB(c_r, gethostbyname_r)
3225         ;;
3226 esac
3228 dnl We don't want to link with libdl even if it's present on OS X, since
3229 dnl it's not used and not part of the default installation.
3230 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3231 dnl We don't want to link against libm or libpthread on Darwin since
3232 dnl they both are just symlinks to libSystem and explicitly linking
3233 dnl against libSystem causes issues when debugging (see bug 299601).
3234 case $target in
3235 *-darwin*)
3236     ;;
3237 *-beos*)
3238     ;;
3239 *-os2*)
3240     ;;
3242     AC_CHECK_LIB(m, atan)
3243     AC_CHECK_LIB(dl, dlopen,
3244     AC_CHECK_HEADER(dlfcn.h, 
3245         LIBS="-ldl $LIBS"
3246         AC_DEFINE(HAVE_LIBDL)))
3247     ;;
3248 esac
3250 _SAVE_CFLAGS="$CFLAGS"
3251 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3252 AC_CHECK_FUNCS(dladdr)
3253 CFLAGS="$_SAVE_CFLAGS"
3255 if test ! "$GNU_CXX"; then
3257     case $target in
3258     *-aix*)
3259         AC_CHECK_LIB(C_r, demangle)
3260         ;;
3261      *)
3262         AC_CHECK_LIB(C, demangle)
3263         ;;
3264      esac
3267 dnl OS/2 has socket in libc.
3268 case $target in
3269 *-os2*)
3270     ;;
3272     AC_CHECK_LIB(socket, socket)
3273 esac
3275 dnl ========================================================
3276 dnl Check whether we can compile code for Core Text
3277 dnl (available on Mac OS X 10.5 or later)
3278 dnl ========================================================
3279 case "$target" in
3280 *-darwin*)
3281   AC_MSG_CHECKING([for Core Text])
3282   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3283                  [CTLineRef lineRef;],
3284                   ac_cv_have_core_text="yes",
3285                   ac_cv_have_core_text="no")
3286   AC_MSG_RESULT([$ac_cv_have_core_text])
3288   if test "$ac_cv_have_core_text" = "no"; then
3289     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3290   fi
3291   ;;
3292 esac
3294 XLDFLAGS="$X_LIBS"
3295 XLIBS="$X_EXTRA_LIBS"
3297 dnl ========================================================
3298 dnl Checks for X libraries.
3299 dnl Ordering is important.
3300 dnl Xt is dependent upon SM as of X11R6
3301 dnl ========================================================
3302 if test "$no_x" = "yes"; then
3303     AC_DEFINE(NO_X11)
3304 else
3305     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3306         XLIBS="-lX11 $XLIBS"
3307         _SAVE_LDFLAGS="$LDFLAGS"
3308         LDFLAGS="$XLDFLAGS $LDFLAGS"
3309         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3310                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3311         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3312                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3313      
3314         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3315         unset ac_cv_lib_Xt_XtFree
3316             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3317             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3318         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3319                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3320         ])
3322     # AIX needs the motif library linked before libXt to prevent
3323     # crashes in plugins linked against Motif - Bug #98892
3324     case "${target_os}" in
3325     aix*)
3326         XT_LIBS="-lXm $XT_LIBS"
3327         ;;
3328     esac
3330     dnl ========================================================
3331     dnl = Check for XShm
3332     dnl ========================================================
3333     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3334         $XLIBS $XEXT_LIBS)
3335     AC_CHECK_HEADER(X11/extensions/XShm.h)
3336     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3337         test -n "$_HAVE_XSHM_XEXT"; then
3338         AC_DEFINE(HAVE_XSHM)
3339     fi
3341     dnl ========================================================
3342     dnl = Check for XIE
3343     dnl ========================================================
3344     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3345         $XLIBS $XEXT_LIBS)
3346     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3348     if test "$MOZ_XIE_LIBS"; then
3349         dnl ====================================================
3350         dnl = If XIE is present and is desired, turn it on
3351         dnl ====================================================
3352         case $target in
3353             *-hpux*)
3354                 ;;
3355             *)
3356                 HAVE_XIE=1
3357                 ;;
3358         esac
3359     fi
3361         LDFLAGS="$_SAVE_LDFLAGS"
3363     dnl ========================================================
3364     dnl = Check for freetype2 and its functionality
3365     dnl ========================================================
3366     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3368     if test "$_HAVE_FREETYPE2"; then
3369         _SAVE_LIBS="$LIBS"
3370         _SAVE_CFLAGS="$CFLAGS"
3371         LIBS="$LIBS $FT2_LIBS"
3372         CFLAGS="$CFLAGS $FT2_CFLAGS"
3374         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3375             ac_cv_member_FT_Bitmap_Size_y_ppem,
3376             [AC_TRY_COMPILE([#include <ft2build.h>
3377                              #include FT_FREETYPE_H],
3378                             [FT_Bitmap_Size s;
3379                              if (sizeof s.y_ppem) return 0;
3380                              return 1],
3381                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3382                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3383         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3384             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3385         else
3386             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3387         fi
3388         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3389                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3390                            [FT_Bitmap_Size structure includes y_ppem field])
3392         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3394         LIBS="$_SAVE_LIBS"
3395         CFLAGS="$_SAVE_CFLAGS"
3396     fi
3398 fi # $no_x
3400 AC_SUBST(XCFLAGS)
3401 AC_SUBST(XLDFLAGS)
3402 AC_SUBST(XLIBS)
3403 AC_SUBST(XEXT_LIBS)
3404 AC_SUBST(XT_LIBS)
3406 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3407 AC_TRY_COMPILE([],
3408                [asm("uqadd8 r1, r1, r2");],
3409                result="yes", result="no")
3410 AC_MSG_RESULT("$result")
3411 if test "$result" = "yes"; then
3412     AC_DEFINE(HAVE_ARM_SIMD)
3413     HAVE_ARM_SIMD=1
3415 AC_SUBST(HAVE_ARM_SIMD)
3417 AC_MSG_CHECKING(for ARM NEON support in compiler)
3418 _SAVE_CFLAGS="$CFLAGS"
3419 if test "$GNU_CC"; then
3420   # gcc needs -mfpu=neon to recognize NEON instructions
3421   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3423 AC_TRY_COMPILE([],
3424                [asm("vadd.i8 d0, d0, d0");],
3425                result="yes", result="no")
3426 AC_MSG_RESULT("$result")
3427 if test "$result" = "yes"; then
3428     AC_DEFINE(HAVE_ARM_NEON)
3429     HAVE_ARM_NEON=1
3431 CFLAGS="$_SAVE_CFLAGS"
3432 AC_SUBST(HAVE_ARM_NEON)
3434 dnl ========================================================
3435 dnl = pthread support
3436 dnl = Start by checking whether the system support pthreads
3437 dnl ========================================================
3438 case "$target_os" in
3439 darwin*)
3440     USE_PTHREADS=1
3441     ;;
3443     MOZ_CHECK_PTHREADS(pthreads,
3444         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3445         MOZ_CHECK_PTHREADS(pthread,
3446             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3447             MOZ_CHECK_PTHREADS(c_r,
3448                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3449                 MOZ_CHECK_PTHREADS(c,
3450                     USE_PTHREADS=1
3451                 )
3452             )
3453         )
3454     )
3455     ;;
3456 esac
3458 dnl ========================================================
3459 dnl Check the command line for --with-pthreads 
3460 dnl ========================================================
3461 MOZ_ARG_WITH_BOOL(pthreads,
3462 [  --with-pthreads         Force use of system pthread library with NSPR ],
3463 [ if test "$USE_PTHREADS"x = x; then
3464     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3465 fi],
3466     USE_PTHREADS=
3467     _PTHREAD_LDFLAGS=
3470 dnl ========================================================
3471 dnl Do the platform specific pthread hackery
3472 dnl ========================================================
3473 if test "$USE_PTHREADS"x != x
3474 then
3475         dnl
3476         dnl See if -pthread is supported.
3477         dnl
3478         rm -f conftest*
3479         ac_cv_have_dash_pthread=no
3480         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3481         echo 'int main() { return 0; }' | cat > conftest.c
3482         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3483         if test $? -eq 0; then
3484                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3485                         ac_cv_have_dash_pthread=yes
3486                 case "$target_os" in
3487                 freebsd*)
3488 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3489                 ;;
3490                 *)
3491                             CFLAGS="$CFLAGS -pthread"
3492                             CXXFLAGS="$CXXFLAGS -pthread"
3493                 ;;
3494                 esac
3495                 fi
3496         fi
3497         rm -f conftest*
3498     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3500         dnl
3501         dnl See if -pthreads is supported.
3502         dnl
3503     ac_cv_have_dash_pthreads=no
3504     if test "$ac_cv_have_dash_pthread" = "no"; then
3505             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3506         echo 'int main() { return 0; }' | cat > conftest.c
3507             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3508         if test $? -eq 0; then
3509                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3510                             ac_cv_have_dash_pthreads=yes
3511                             CFLAGS="$CFLAGS -pthreads"
3512                             CXXFLAGS="$CXXFLAGS -pthreads"
3513                     fi
3514             fi
3515             rm -f conftest*
3516         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3517     fi
3519         case "$target" in
3520             *-*-freebsd*)
3521                         AC_DEFINE(_REENTRANT)
3522                         AC_DEFINE(_THREAD_SAFE)
3523                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3524                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3525                                 _PTHREAD_LDFLAGS="-pthread"
3526                         else
3527                                 _PTHREAD_LDFLAGS="-lc_r"
3528                         fi
3529                         ;;
3531             *-*-openbsd*|*-*-bsdi*)
3532                         AC_DEFINE(_REENTRANT)
3533                         AC_DEFINE(_THREAD_SAFE)
3534                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3535                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3536                 _PTHREAD_LDFLAGS="-pthread"
3537                         fi
3538                         ;;
3540             *-*-linux*|*-*-kfreebsd*-gnu)
3541                         AC_DEFINE(_REENTRANT) 
3542                         ;;
3544             *-*-nto*) 
3545                         AC_DEFINE(_REENTRANT) 
3546                         ;;
3548             *-aix4.3*|*-aix5*)
3549                         AC_DEFINE(_REENTRANT) 
3550                         ;;
3552             *-hpux11.*)
3553                         AC_DEFINE(_REENTRANT) 
3554                         ;;
3556             alpha*-*-osf*)
3557                         AC_DEFINE(_REENTRANT)
3558                         ;;
3560             *-*-solaris*) 
3561                         AC_DEFINE(_REENTRANT)
3562                         if test "$SOLARIS_SUNPRO_CC"; then
3563                                 CFLAGS="$CFLAGS -mt" 
3564                                 CXXFLAGS="$CXXFLAGS -mt" 
3565                         fi
3566                         ;;
3567         esac
3568     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3571 dnl ========================================================
3572 dnl See if mmap sees writes
3573 dnl For cross compiling, just define it as no, which is a safe default
3574 dnl ========================================================
3575 AC_MSG_CHECKING(whether mmap() sees write()s)
3577 changequote(,)
3578 mmap_test_prog='
3579     #include <stdlib.h>
3580     #include <unistd.h>
3581     #include <sys/mman.h>
3582     #include <sys/types.h>
3583     #include <sys/stat.h>
3584     #include <fcntl.h>
3586     char fname[] = "conftest.file";
3587     char zbuff[1024]; /* Fractional page is probably worst case */
3589     int main() {
3590         char *map;
3591         int fd;
3592         int i;
3593         unlink(fname);
3594         fd = open(fname, O_RDWR | O_CREAT, 0660);
3595         if(fd<0) return 1;
3596         unlink(fname);
3597         write(fd, zbuff, sizeof(zbuff));
3598         lseek(fd, 0, SEEK_SET);
3599         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3600         if(map==(char*)-1) return 2;
3601         for(i=0; fname[i]; i++) {
3602             int rc = write(fd, &fname[i], 1);
3603             if(map[i]!=fname[i]) return 4;
3604         }
3605         return 0;
3606     }
3608 changequote([,])
3610 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3612 AC_MSG_RESULT("$result")
3614 if test "$result" = "no"; then
3615     AC_DEFINE(MMAP_MISSES_WRITES)
3619 dnl Checks for library functions.
3620 dnl ========================================================
3621 AC_PROG_GCC_TRADITIONAL
3622 AC_FUNC_MEMCMP
3623 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3624 AC_CHECK_FUNCS(flockfile getpagesize)
3625 AC_CHECK_FUNCS(localtime_r strtok_r)
3627 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3628 _SAVE_LDFLAGS=$LDFLAGS
3629 LDFLAGS="$LDFLAGS -lrt"
3630 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3631                ac_cv_have_clock_monotonic,
3632                [AC_TRY_LINK([#include <time.h>],
3633                             [ struct timespec ts;
3634                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3635                             ac_cv_have_clock_monotonic=yes,
3636                             ac_cv_have_clock_monotonic=no)])
3637 LDFLAGS=$_SAVE_LDFLAGS
3638 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3639     HAVE_CLOCK_MONOTONIC=1
3640     REALTIME_LIBS=-lrt
3641     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3642     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3643     AC_SUBST(REALTIME_LIBS)
3646 dnl check for wcrtomb/mbrtowc
3647 dnl =======================================================================
3648 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3649 AC_LANG_SAVE
3650 AC_LANG_CPLUSPLUS
3651 AC_CACHE_CHECK(for wcrtomb,
3652     ac_cv_have_wcrtomb,
3653     [AC_TRY_LINK([#include <wchar.h>],
3654                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3655                  ac_cv_have_wcrtomb="yes",
3656                  ac_cv_have_wcrtomb="no")])
3657 if test "$ac_cv_have_wcrtomb" = "yes"; then
3658     AC_DEFINE(HAVE_WCRTOMB)
3660 AC_CACHE_CHECK(for mbrtowc,
3661     ac_cv_have_mbrtowc,
3662     [AC_TRY_LINK([#include <wchar.h>],
3663                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3664                  ac_cv_have_mbrtowc="yes",
3665                  ac_cv_have_mbrtowc="no")])
3666 if test "$ac_cv_have_mbrtowc" = "yes"; then
3667     AC_DEFINE(HAVE_MBRTOWC)
3669 AC_LANG_RESTORE
3672 AC_CACHE_CHECK(
3673     [for res_ninit()],
3674     ac_cv_func_res_ninit,
3675     [AC_TRY_LINK([
3676         #ifdef linux
3677         #define _BSD_SOURCE 1
3678         #endif
3679         #include <resolv.h>
3680         ],
3681         [int foo = res_ninit(&_res);],
3682         [ac_cv_func_res_ninit=yes],
3683         [ac_cv_func_res_ninit=no])
3684     ])
3686 if test "$ac_cv_func_res_ninit" = "yes"; then
3687     AC_DEFINE(HAVE_RES_NINIT)
3688 dnl must add the link line we do something as foolish as this... dougt
3689 dnl else
3690 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3691 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3694 AC_LANG_CPLUSPLUS
3695 AC_CACHE_CHECK(
3696     [for gnu_get_libc_version()],
3697     ac_cv_func_gnu_get_libc_version,
3698     [AC_TRY_LINK([
3699         #ifdef HAVE_GNU_LIBC_VERSION_H
3700         #include <gnu/libc-version.h>
3701         #endif
3702         ],
3703         [const char *glibc_version = gnu_get_libc_version();],
3704         [ac_cv_func_gnu_get_libc_version=yes],
3705         [ac_cv_func_gnu_get_libc_version=no] 
3706         )]
3707     )
3709 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3710     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3713 case $target_os in
3714     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3715         ;;
3716     *)
3717     
3718 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3719     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3720         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3721 _SAVE_LIBS=$LIBS
3722 LIBS="$LIBS $_ICONV_LIBS"
3723 AC_CACHE_CHECK(
3724     [for iconv()],
3725     ac_cv_func_iconv,
3726     [AC_TRY_LINK([
3727         #include <stdlib.h>
3728         #include <iconv.h>
3729         ],
3730         [
3731             iconv_t h = iconv_open("", "");
3732             iconv(h, NULL, NULL, NULL, NULL);
3733             iconv_close(h);
3734         ],
3735         [ac_cv_func_iconv=yes],
3736         [ac_cv_func_iconv=no] 
3737         )]
3738     )
3739 if test "$ac_cv_func_iconv" = "yes"; then
3740     AC_DEFINE(HAVE_ICONV)
3741     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3742     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3743     LIBICONV="$_ICONV_LIBS"
3744     AC_CACHE_CHECK(
3745         [for iconv() with const input],
3746         ac_cv_func_const_iconv,
3747         [AC_TRY_COMPILE([
3748             #include <stdlib.h>
3749             #include <iconv.h>
3750             ],
3751             [
3752                 const char *input = "testing";
3753                 iconv_t h = iconv_open("", "");
3754                 iconv(h, &input, NULL, NULL, NULL);
3755                 iconv_close(h);
3756             ],
3757             [ac_cv_func_const_iconv=yes],
3758             [ac_cv_func_const_iconv=no] 
3759             )]
3760         )
3761     if test "$ac_cv_func_const_iconv" = "yes"; then
3762         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3763     fi
3765 LIBS=$_SAVE_LIBS
3767     ;;
3768 esac
3770 AM_LANGINFO_CODESET
3772 AC_LANG_C
3774 dnl **********************
3775 dnl *** va_copy checks ***
3776 dnl **********************
3777 dnl we currently check for all three va_copy possibilities, so we get
3778 dnl all results in config.log for bug reports.
3779 AC_MSG_CHECKING(for an implementation of va_copy())
3780 AC_CACHE_VAL(ac_cv_va_copy,[
3781     AC_TRY_RUN([
3782         #include <stdarg.h>
3783         void f (int i, ...) {
3784             va_list args1, args2;
3785             va_start (args1, i);
3786             va_copy (args2, args1);
3787             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3788                 exit (1);
3789             va_end (args1); va_end (args2);
3790         }
3791         int main() { f (0, 42); return 0; }],
3792         ac_cv_va_copy=yes,
3793         ac_cv_va_copy=no,
3794         ac_cv_va_copy=no
3795     )
3797 AC_MSG_RESULT($ac_cv_va_copy)
3798 AC_MSG_CHECKING(for an implementation of __va_copy())
3799 AC_CACHE_VAL(ac_cv___va_copy,[
3800     AC_TRY_RUN([
3801         #include <stdarg.h>
3802         void f (int i, ...) {
3803             va_list args1, args2;
3804             va_start (args1, i);
3805             __va_copy (args2, args1);
3806             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3807                 exit (1);
3808             va_end (args1); va_end (args2);
3809         }
3810         int main() { f (0, 42); return 0; }],
3811         ac_cv___va_copy=yes,
3812         ac_cv___va_copy=no,
3813         ac_cv___va_copy=no
3814     )
3816 AC_MSG_RESULT($ac_cv___va_copy)
3817 AC_MSG_CHECKING(whether va_lists can be copied by value)
3818 AC_CACHE_VAL(ac_cv_va_val_copy,[
3819     AC_TRY_RUN([
3820         #include <stdarg.h>
3821         void f (int i, ...) {
3822             va_list args1, args2;
3823             va_start (args1, i);
3824             args2 = args1;
3825             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3826                 exit (1);
3827             va_end (args1); va_end (args2);
3828         }
3829         int main() { f (0, 42); return 0; }],
3830         ac_cv_va_val_copy=yes,
3831         ac_cv_va_val_copy=no,
3832         ac_cv_va_val_copy=yes
3833     )
3835 if test "x$ac_cv_va_copy" = "xyes"; then
3836     AC_DEFINE(VA_COPY, va_copy)
3837     AC_DEFINE(HAVE_VA_COPY)
3838 elif test "x$ac_cv___va_copy" = "xyes"; then
3839     AC_DEFINE(VA_COPY, __va_copy)
3840     AC_DEFINE(HAVE_VA_COPY)
3843 if test "x$ac_cv_va_val_copy" = "xno"; then
3844    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3846 AC_MSG_RESULT($ac_cv_va_val_copy)
3848 dnl Check for dll-challenged libc's.
3849 dnl This check is apparently only needed for Linux.
3850 case "$target" in
3851         *-linux*)
3852             dnl ===================================================================
3853             _curdir=`pwd`
3854             export _curdir
3855             rm -rf conftest* _conftest
3856             mkdir _conftest
3857             cat >> conftest.C <<\EOF
3858 #include <stdio.h>
3859 #include <link.h>
3860 #include <dlfcn.h>
3861 #ifdef _dl_loaded
3862 void __dump_link_map(void) {
3863   struct link_map *map = _dl_loaded;
3864   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3866 int main() {
3867   dlopen("./conftest1.so",RTLD_LAZY);
3868   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3869   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3870   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3871   __dump_link_map();
3873 #else
3874 /* _dl_loaded isn't defined, so this should be either a libc5 (glibc1) system, or a glibc2 system that doesn't have the multiple load bug (i.e., RH6.0).*/
3875 int main() { printf("./conftest1.so\n"); }
3876 #endif
3879             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3881             cat >> conftest1.C <<\EOF
3882 #include <stdio.h>
3883 void foo(void) {printf("foo in dll called\n");}
3885             ${CXX-g++} -fPIC -c -g conftest1.C
3886             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3887             ${CXX-g++} -g conftest.C -o conftest -ldl
3888             cp -f conftest1.so conftest _conftest
3889             cd _conftest
3890             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3891             then
3892                 echo
3893                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3894                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3895                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3896                 echo "*** will be excessive memory usage at runtime."
3897                 echo
3898             fi
3899             cd ${_curdir}
3900             rm -rf conftest* _conftest
3901             dnl ===================================================================
3902             ;;
3903 esac
3905 dnl ===================================================================
3906 dnl ========================================================
3907 dnl By default, turn rtti and exceptions off on g++/egcs
3908 dnl ========================================================
3909 if test "$GNU_CXX"; then
3911   AC_MSG_CHECKING(for C++ exceptions flag)
3913   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3914   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3915   [echo "int main() { return 0; }" | cat > conftest.C
3917   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3919   if egrep "warning.*renamed" conftest.out >/dev/null; then
3920     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3921   else
3922     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3923   fi
3925   rm -f conftest*])
3927   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3928   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3929   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3932 dnl ========================================================
3933 dnl Put your C++ language/feature checks below
3934 dnl ========================================================
3935 AC_LANG_CPLUSPLUS
3937 HAVE_GCC3_ABI=
3938 if test "$GNU_CC"; then
3939   AC_CACHE_CHECK(for gcc 3.0 ABI,
3940       ac_cv_gcc_three_abi,
3941       [AC_TRY_COMPILE([],
3942                       [
3943 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3944   return 0;
3945 #else
3946 #error Not gcc3.
3947 #endif
3948                       ],
3949                       ac_cv_gcc_three_abi="yes",
3950                       ac_cv_gcc_three_abi="no")])
3951   if test "$ac_cv_gcc_three_abi" = "yes"; then
3952       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3953       HAVE_GCC3_ABI=1
3954   else
3955       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3956   fi
3958 AC_SUBST(HAVE_GCC3_ABI)
3961 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3962                ac_cv_cpp_explicit,
3963                [AC_TRY_COMPILE(class X {
3964                                public: explicit X(int i) : i_(i) {}
3965                                private: int i_;
3966                                };,
3967                                X x(3);,
3968                                ac_cv_cpp_explicit=yes,
3969                                ac_cv_cpp_explicit=no)])
3970 if test "$ac_cv_cpp_explicit" = yes ; then
3971    AC_DEFINE(HAVE_CPP_EXPLICIT)
3974 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3975                ac_cv_cpp_typename,
3976                [AC_TRY_COMPILE(class param {
3977                                public:
3978                                    typedef unsigned long num_type;
3979                                };
3981                                template <class T> class tplt {
3982                                public:
3983                                    typedef typename T::num_type t_num_type;
3984                                    t_num_type foo(typename T::num_type num) {
3985                                        return num;
3986                                    }
3987                                };,
3988                                tplt<param> A;
3989                                A.foo(0);,
3990                                ac_cv_cpp_typename=yes,
3991                                ac_cv_cpp_typename=no)])
3992 if test "$ac_cv_cpp_typename" = yes ; then
3993    AC_DEFINE(HAVE_CPP_TYPENAME)
3996 dnl Check for support of modern template specialization syntax
3997 dnl Test code and requirement from scc@netscape.com.
3998 dnl Autoconf cut-and-paste job by waterson@netscape.com
3999 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4000                ac_cv_cpp_modern_specialize_template_syntax,
4001                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4002                                class Y {};
4003                                template <> struct X<Y> { double a; };,
4004                                X<int> int_x;
4005                                X<Y> y_x;,
4006                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4007                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4008 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4009   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4013 dnl Some compilers support only full specialization, and some don't.
4014 AC_CACHE_CHECK(whether partial template specialization works,
4015                ac_cv_cpp_partial_specialization,
4016                [AC_TRY_COMPILE(template <class T> class Foo {};
4017                                template <class T> class Foo<T*> {};,
4018                                return 0;,
4019                                ac_cv_cpp_partial_specialization=yes,
4020                                ac_cv_cpp_partial_specialization=no)])
4021 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4022   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4025 dnl Some compilers have limited support for operators with templates;
4026 dnl specifically, it is necessary to define derived operators when a base
4027 dnl class's operator declaration should suffice.
4028 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4029                ac_cv_need_derived_template_operators,
4030                [AC_TRY_COMPILE([template <class T> class Base { };
4031                                 template <class T>
4032                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4033                                 template <class T> class Derived : public Base<T> { };],
4034                                [Derived<char> a, b;
4035                                 Base<char> c = a + b;
4036                                 return 0;],
4037                                ac_cv_need_derived_template_operators=no,
4038                                ac_cv_need_derived_template_operators=yes)])
4039 if test "$ac_cv_need_derived_template_operators" = yes ; then
4040   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4044 dnl Some compilers have trouble detecting that a template class
4045 dnl that derives from another template is actually an instance
4046 dnl of the base class. This test checks for that.
4047 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4048                ac_cv_need_cpp_template_cast_to_base,
4049                [AC_TRY_COMPILE([template <class T> class Base { };
4050                                 template <class T> class Derived : public Base<T> { };
4051                                 template <class T> int foo(const Base<T>&) { return 0; }],
4052                                [Derived<char> bar; return foo(bar);],
4053                                ac_cv_need_cpp_template_cast_to_base=no,
4054                                ac_cv_need_cpp_template_cast_to_base=yes)])
4055 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4056   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4059 dnl Some compilers have trouble resolving the ambiguity between two
4060 dnl functions whose arguments differ only by cv-qualifications.
4061 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4062                ac_cv_can_resolve_const_ambiguity,
4063                [AC_TRY_COMPILE([
4064                                 template <class T> class ptrClass {
4065                                   public: T* ptr;
4066                                 };
4068                                 template <class T> T* a(ptrClass<T> *arg) {
4069                                   return arg->ptr;
4070                                 }
4072                                 template <class T>
4073                                 const T* a(const ptrClass<T> *arg) {
4074                                   return arg->ptr;
4075                                 }
4076                                ],
4077                                [ ptrClass<int> i;
4078                                  a(&i); ],
4079                                ac_cv_can_resolve_const_ambiguity=yes,
4080                                ac_cv_can_resolve_const_ambiguity=no)])
4081 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4082   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4086 dnl We don't do exceptions on unix.  The only reason this used to be here
4087 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4088 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4089 dnl So im commenting this out until someone writes some artificial 
4090 dnl intelligence to detect not only if the compiler has exceptions, but if 
4091 dnl they are enabled as well.
4092 dnl 
4093 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4094 dnl                ac_cv_cpp_exceptions,
4095 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4096 dnl                                static void F() { throw X(); },
4097 dnl                                try { F(); } catch(X & e) { },
4098 dnl                                ac_cv_cpp_exceptions=yes,
4099 dnl                                ac_cv_cpp_exceptions=no)])
4100 dnl if test $ac_cv_cpp_exceptions = yes ; then
4101 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4102 dnl fi
4104 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4105 dnl supports it well enough to allow us to use it to change access, but not
4106 dnl to resolve ambiguity. The next two tests determine how well the |using|
4107 dnl keyword is supported.
4109 dnl Check to see if we can change access with |using|.  Test both a
4110 dnl legal and an illegal example.
4111 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4112                ac_cv_cpp_access_changing_using2,
4113                [AC_TRY_COMPILE(
4114                    class A { protected: int foo() { return 0; } };
4115                    class B : public A { public: using A::foo; };,
4116                    B b; return b.foo();,
4117                    [AC_TRY_COMPILE(
4118                        class A { public: int foo() { return 1; } };
4119                        class B : public A { private: using A::foo; };,
4120                        B b; return b.foo();,
4121                        ac_cv_cpp_access_changing_using2=no,
4122                        ac_cv_cpp_access_changing_using2=yes)],
4123                    ac_cv_cpp_access_changing_using2=no)])
4124 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4125    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4128 dnl Check to see if we can resolve ambiguity with |using|.
4129 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4130                ac_cv_cpp_ambiguity_resolving_using,
4131                [AC_TRY_COMPILE(class X { 
4132                                  public: int go(const X&) {return 3;}
4133                                          int jo(const X&) {return 3;}
4134                                };
4135                                class Y : public X {
4136                                  public:  int go(int) {return 2;}
4137                                           int jo(int) {return 2;}
4138                                           using X::jo;
4139                                  private: using X::go;
4140                                };,
4141                                X x; Y y; y.jo(x);,
4142                                ac_cv_cpp_ambiguity_resolving_using=yes,
4143                                ac_cv_cpp_ambiguity_resolving_using=no)])
4144 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4145    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4148 dnl Check to see if the |std| namespace is supported. If so, we'll want
4149 dnl to qualify any standard library calls with "std::" to ensure that
4150 dnl those functions can be resolved.
4151 AC_CACHE_CHECK(for \"std::\" namespace,
4152                ac_cv_cpp_namespace_std,
4153                [AC_TRY_COMPILE([#include <algorithm>],
4154                                [return std::min(0, 1);],
4155                                ac_cv_cpp_namespace_std=yes,
4156                                ac_cv_cpp_namespace_std=no)])
4157 if test "$ac_cv_cpp_namespace_std" = yes ; then
4158    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4161 dnl Older compilers are overly ambitious with respect to using the standard
4162 dnl template library's |operator!=()| when |operator==()| is defined. In
4163 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4164 dnl ambiguity at compile-time. This test checks for that case.
4165 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4166                ac_cv_cpp_unambiguous_std_notequal,
4167                [AC_TRY_COMPILE([#include <algorithm>
4168                                 struct T1 {};
4169                                 int operator==(const T1&, const T1&) { return 0; }
4170                                 int operator!=(const T1&, const T1&) { return 0; }],
4171                                [T1 a,b; return a != b;],
4172                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4173                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4174 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4175   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4179 AC_CACHE_CHECK(for C++ reinterpret_cast,
4180                ac_cv_cpp_reinterpret_cast,
4181                [AC_TRY_COMPILE(struct X { int i; };
4182                                struct Y { int i; };,
4183                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4184                                ac_cv_cpp_reinterpret_cast=yes,
4185                                ac_cv_cpp_reinterpret_cast=no)])
4186 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4187    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4190 dnl See if a dynamic_cast to void* gives the most derived object.
4191 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4192                ac_cv_cpp_dynamic_cast_void_ptr,
4193                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4194                             class Y { int j; public: virtual ~Y() { } };
4195                             class Z : public X, public Y { int k; };
4197                             int main() {
4198                                  Z mdo;
4199                                  X *subx = (X*)&mdo;
4200                                  Y *suby = (Y*)&mdo;
4201                                  return !((((void*)&mdo != (void*)subx) &&
4202                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4203                                           (((void*)&mdo != (void*)suby) &&
4204                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4205                             }],
4206                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4207                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4208                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4209 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4210    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4214 dnl note that this one is reversed - if the test fails, then
4215 dnl we require implementations of unused virtual methods. Which
4216 dnl really blows because it means we'll have useless vtable
4217 dnl bloat.
4218 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4219                ac_cv_cpp_unused_required,
4220                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4221                                X x;,
4222                                ac_cv_cpp_unused_required=no,
4223                                ac_cv_cpp_unused_required=yes)])
4224 if test "$ac_cv_cpp_unused_required" = yes ; then
4225    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4229 dnl Some compilers have trouble comparing a constant reference to a templatized
4230 dnl class to zero, and require an explicit operator==() to be defined that takes
4231 dnl an int. This test separates the strong from the weak.
4233 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4234                ac_cv_trouble_comparing_to_zero,
4235                [AC_TRY_COMPILE([#include <algorithm>
4236                                 template <class T> class Foo {};
4237                                 class T2;
4238                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4239                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4240                                [Foo<int> f; return (0 != f);],
4241                                ac_cv_trouble_comparing_to_zero=no,
4242                                ac_cv_trouble_comparing_to_zero=yes)])
4243 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4244   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4247 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4248 _SAVE_LDFLAGS=$LDFLAGS
4249 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4250 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4251                ac_cv_thread_keyword,
4252                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4253                             [return tlsIsMainThread;],
4254                             ac_cv_thread_keyword=yes,
4255                             ac_cv_thread_keyword=no)])
4256 LDFLAGS=$_SAVE_LDFLAGS
4257 if test "$ac_cv_thread_keyword" = yes; then
4258   AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4261 dnl Check for the existence of various allocation headers/functions
4263 MALLOC_H=
4264 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4265 if test "$MALLOC_H" = ""; then
4266   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4267   if test "$MALLOC_H" = ""; then
4268     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4269   fi
4271 if test "$MALLOC_H" != ""; then
4272    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4275 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4276 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4278 dnl See if compiler supports some gcc-style attributes
4280 AC_CACHE_CHECK(for __attribute__((always_inline)),
4281                ac_cv_attribute_always_inline,
4282                [AC_TRY_COMPILE([],
4283                                [inline void f(void) __attribute__((always_inline));],
4284                                ac_cv_attribute_always_inline=yes,
4285                                ac_cv_attribute_always_inline=no)])
4287 AC_CACHE_CHECK(for __attribute__((malloc)),
4288                ac_cv_attribute_malloc,
4289                [AC_TRY_COMPILE([],
4290                                [void* f(int) __attribute__((malloc));],
4291                                ac_cv_attribute_malloc=yes,
4292                                ac_cv_attribute_malloc=no)])
4294 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4295                ac_cv_attribute_warn_unused,
4296                [AC_TRY_COMPILE([],
4297                                [int f(void) __attribute__((warn_unused_result));],
4298                                ac_cv_attribute_warn_unused=yes,
4299                                ac_cv_attribute_warn_unused=no)])
4301 AC_CACHE_CHECK(for __attribute__((noreturn)),
4302                ac_cv_attribute_noreturn,
4303                [AC_TRY_COMPILE([],
4304                                [void f(void) __attribute__((noreturn));],
4305                                ac_cv_attribute_noreturn=yes,
4306                                ac_cv_attribute_noreturn=no)])
4308 dnl End of C++ language/feature checks
4309 AC_LANG_C
4311 dnl ========================================================
4312 dnl =  Internationalization checks
4313 dnl ========================================================
4315 dnl Internationalization and Locale support is different
4316 dnl on various UNIX platforms.  Checks for specific i18n
4317 dnl features go here.
4319 dnl check for LC_MESSAGES
4320 AC_CACHE_CHECK(for LC_MESSAGES,
4321                 ac_cv_i18n_lc_messages,
4322                 [AC_TRY_COMPILE([#include <locale.h>],
4323                                 [int category = LC_MESSAGES;],
4324                                 ac_cv_i18n_lc_messages=yes,
4325                                 ac_cv_i18n_lc_messages=no)])
4326 if test "$ac_cv_i18n_lc_messages" = yes; then
4327    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4328 fi      
4330 fi # SKIP_COMPILER_CHECKS
4332 TARGET_XPCOM_ABI=
4333 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4334     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4337 dnl Mozilla specific options
4338 dnl ========================================================
4339 dnl The macros used for command line options
4340 dnl are defined in build/autoconf/altoptions.m4.
4342 dnl If the compiler supports these attributes, define them as
4343 dnl convenience macros.
4344 if test "$ac_cv_attribute_always_inline" = yes ; then
4345   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4346 else
4347   AC_DEFINE(NS_ALWAYS_INLINE,)
4350 if test "$ac_cv_attribute_malloc" = yes ; then
4351   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4352 else
4353   AC_DEFINE(NS_ATTR_MALLOC,)
4356 if test "$ac_cv_attribute_warn_unused" = yes ; then
4357   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4358 else
4359   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4362 if test "$ac_cv_attribute_noreturn" = yes ; then
4363   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4364 else
4365   AC_DEFINE(NS_NORETURN,)
4368 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4369 dnl features that Windows actually does support.
4371 if test -n "$SKIP_COMPILER_CHECKS"; then
4372    dnl Windows has malloc.h
4373    AC_DEFINE(MALLOC_H, [<malloc.h>])
4374    AC_DEFINE(HAVE_FORCEINLINE)
4375 fi # SKIP_COMPILER_CHECKS
4377 dnl ========================================================
4378 dnl =
4379 dnl = Check for external package dependencies
4380 dnl =
4381 dnl ========================================================
4382 MOZ_ARG_HEADER(External Packages)
4384 MOZ_ENABLE_LIBXUL=1
4386 MOZ_ARG_WITH_STRING(libxul-sdk,
4387 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4388   LIBXUL_SDK_DIR=$withval)
4390 if test "$LIBXUL_SDK_DIR" = "yes"; then
4391     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4392 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4393     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4395     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4396         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4397     fi
4399     MOZ_ENABLE_LIBXUL=1
4401 AC_SUBST(LIBXUL_SDK)
4403 if test -n "$LIBXUL_SDK"; then
4404     LIBXUL_DIST="$LIBXUL_SDK"
4405 else
4406     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4408 AC_SUBST(LIBXUL_DIST)
4410 SYSTEM_LIBXUL=
4412 MOZ_ARG_WITH_BOOL(system-libxul,
4413 [  --with-system-libxul   Use system installed libxul SDK],
4414     SYSTEM_LIBXUL=1)
4416 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4417     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4420 dnl ========================================================
4421 dnl = If NSPR was not detected in the system, 
4422 dnl = use the one in the source tree (mozilla/nsprpub)
4423 dnl ========================================================
4424 MOZ_ARG_WITH_BOOL(system-nspr,
4425 [  --with-system-nspr      Use system installed NSPR],
4426     _USE_SYSTEM_NSPR=1 )
4428 if test -n "$_USE_SYSTEM_NSPR"; then
4429     AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4432 if test -n "$MOZ_NATIVE_NSPR"; then
4433     _SAVE_CFLAGS=$CFLAGS
4434     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4435     AC_TRY_COMPILE([#include "prlog.h"],
4436                 [#ifndef PR_STATIC_ASSERT
4437                  #error PR_STATIC_ASSERT not defined
4438                  #endif],
4439                 [MOZ_NATIVE_NSPR=1],
4440                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4441     CFLAGS=$_SAVE_CFLAGS
4442 else
4443     if test "$OS_ARCH" = "WINCE"; then
4444         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4445         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4446     elif test "$OS_ARCH" = "WINNT"; then
4447         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4448         if test -n "$GNU_CC"; then
4449             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4450         else
4451             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4452         fi
4453     else
4454         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4455         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4456     fi
4459 dnl ========================================================
4460 dnl = If NSS was not detected in the system, 
4461 dnl = use the one in the source tree (mozilla/security/nss)
4462 dnl ========================================================
4464 MOZ_ARG_WITH_BOOL(system-nss,
4465 [  --with-system-nss      Use system installed NSS],
4466     _USE_SYSTEM_NSS=1 )
4468 if test -n "$_USE_SYSTEM_NSS"; then
4469     AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4472 if test -n "$MOZ_NATIVE_NSS"; then
4473    NSS_LIBS="$NSS_LIBS -lcrmf"
4474 else
4475    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4476    NSS_DEP_LIBS="\
4477         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4478         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4479         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4480         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4481         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4483    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4484        NSS_LIBS="\
4485         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4486         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4487         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4488         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4489         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4490    else
4491        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4492    fi
4495 if test -z "$SKIP_LIBRARY_CHECKS"; then
4496 dnl system JPEG support
4497 dnl ========================================================
4498 MOZ_ARG_WITH_STRING(system-jpeg,
4499 [  --with-system-jpeg[=PFX]
4500                           Use system libjpeg [installed at prefix PFX]],
4501     JPEG_DIR=$withval)
4503 _SAVE_CFLAGS=$CFLAGS
4504 _SAVE_LDFLAGS=$LDFLAGS
4505 _SAVE_LIBS=$LIBS
4506 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4507     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4508     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4510 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4511     SYSTEM_JPEG=
4512 else
4513     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4516 if test "$SYSTEM_JPEG" = 1; then
4517     LIBS="$JPEG_LIBS $LIBS"
4518     AC_TRY_COMPILE([ #include <stdio.h>
4519                      #include <sys/types.h>
4520                      #include <jpeglib.h> ],
4521                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4522                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4523                      #endif ],
4524                    SYSTEM_JPEG=1,
4525                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4526 fi 
4527 CFLAGS=$_SAVE_CFLAGS
4528 LDFLAGS=$_SAVE_LDFLAGS
4529 LIBS=$_SAVE_LIBS
4531 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4532     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4533     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4536 dnl system ZLIB support
4537 dnl ========================================================
4538 MOZ_ARG_WITH_STRING(system-zlib,
4539 [  --with-system-zlib[=PFX]
4540                           Use system libz [installed at prefix PFX]],
4541     ZLIB_DIR=$withval)
4543 _SAVE_CFLAGS=$CFLAGS
4544 _SAVE_LDFLAGS=$LDFLAGS
4545 _SAVE_LIBS=$LIBS
4546 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4547     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4548     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4550 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4551     SYSTEM_ZLIB=
4552 else
4553     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4554         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4556 if test "$SYSTEM_ZLIB" = 1; then
4557     LIBS="$ZLIB_LIBS $LIBS"
4558     AC_TRY_COMPILE([ #include <stdio.h>
4559                      #include <string.h>
4560                      #include <zlib.h> ],
4561                    [ #if ZLIB_VERNUM < $MOZZLIB 
4562                      #error "Insufficient zlib version ($MOZZLIB required)."
4563                      #endif ],
4564                    SYSTEM_ZLIB=1,
4565                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4567 CFLAGS=$_SAVE_CFLAGS
4568 LDFLAGS=$_SAVE_LDFLAGS
4569 LIBS=$_SAVE_LIBS
4571 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4572     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4573     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4576 dnl system BZIP2 Support
4577 dnl ========================================================
4578 MOZ_ARG_WITH_STRING(system-bz2,
4579 [  --with-system-bz2[=PFX]
4580                           Use system libbz2 [installed at prefix PFX]],
4581     BZ2_DIR=$withval)
4583 _SAVE_CFLAGS=$CFLAGS
4584 _SAVE_LDFLAGS=$LDFLAGS
4585 _SAVE_LIBS=$LIBS
4586 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4587     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4588     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4590 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4591     SYSTEM_BZ2=
4592 else
4593     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4594         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4596 CFLAGS=$_SAVE_CFLAGS
4597 LDFLAGS=$_SAVE_LDFLAGS
4598 LIBS=$_SAVE_LIBS
4600 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4601     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4602     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4605 dnl system PNG Support
4606 dnl ========================================================
4607 MOZ_ARG_WITH_STRING(system-png, 
4608 [  --with-system-png[=PFX]
4609                           Use system libpng [installed at prefix PFX]],
4610     PNG_DIR=$withval)
4612 _SAVE_CFLAGS=$CFLAGS
4613 _SAVE_LDFLAGS=$LDFLAGS
4614 _SAVE_LIBS=$LIBS
4615 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4616 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4617 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4618     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4619     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4621 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4622     SYSTEM_PNG=
4623 else
4624     _SAVE_PNG_LIBS=$PNG_LIBS
4625     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4626                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4627                  $PNG_LIBS)
4628     AC_CHECK_LIB(png, png_get_acTL, ,
4629                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4630                  $_SAVE_PNG_LIBS)
4632 if test "$SYSTEM_PNG" = 1; then
4633     LIBS="$PNG_LIBS $LIBS"
4634     AC_TRY_COMPILE([ #include <stdio.h>
4635                      #include <sys/types.h>
4636                      #include <png.h> ],
4637                    [ #if PNG_LIBPNG_VER < $MOZPNG
4638                      #error "Insufficient libpng version ($MOZPNG required)."
4639                      #endif
4640                      #ifndef PNG_UINT_31_MAX
4641                      #error "Insufficient libpng version."
4642                      #endif ],
4643                    SYSTEM_PNG=1,
4644                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4646 CFLAGS=$_SAVE_CFLAGS
4647 LDFLAGS=$_SAVE_LDFLAGS
4648 LIBS=$_SAVE_LIBS
4650 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4651     PNG_CFLAGS="-I${PNG_DIR}/include"
4652     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4655 fi # SKIP_LIBRARY_CHECKS
4657 dnl system HunSpell Support
4658 dnl ========================================================
4659 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4660 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4661     SYSTEM_HUNSPELL=1 )
4663 if test -n "$SYSTEM_HUNSPELL"; then
4664     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4667 AC_SUBST(SYSTEM_HUNSPELL)
4669 dnl ========================================================
4670 dnl Java SDK support
4671 dnl ========================================================
4672 JAVA_INCLUDE_PATH=
4673 MOZ_ARG_WITH_STRING(java-include-path,
4674 [  --with-java-include-path=dir   Location of Java SDK headers],
4675     JAVA_INCLUDE_PATH=$withval)
4677 JAVA_BIN_PATH=
4678 MOZ_ARG_WITH_STRING(java-bin-path,
4679 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4680     JAVA_BIN_PATH=$withval)
4682 dnl ========================================================
4683 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4684 dnl their usage and use them in spidermonkey.
4685 dnl ========================================================
4686 MOZ_ARG_WITH_BOOL(arm-kuser,
4687 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4688     USE_ARM_KUSER=1,
4689     USE_ARM_KUSER=)
4690 if test -n "$USE_ARM_KUSER"; then
4691    AC_DEFINE(USE_ARM_KUSER)
4694 dnl ========================================================
4695 dnl =
4696 dnl = Application
4697 dnl =
4698 dnl ========================================================
4700 MOZ_ARG_HEADER(Application)
4702 BUILD_STATIC_LIBS=
4703 ENABLE_TESTS=1
4704 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4705 MOZ_BRANDING_DIRECTORY=
4706 MOZ_OFFICIAL_BRANDING=
4707 MOZ_FEEDS=1
4708 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4709 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4710 MOZ_IPC=1
4711 MOZ_JAVAXPCOM=
4712 MOZ_JSDEBUGGER=1
4713 MOZ_JSLOADER=1
4714 MOZ_MATHML=1
4715 MOZ_MORK=1
4716 MOZ_MORKREADER=
4717 MOZ_AUTH_EXTENSION=1
4718 MOZ_NO_ACTIVEX_SUPPORT=1
4719 MOZ_NO_INSPECTOR_APIS=
4720 MOZ_NO_FAST_LOAD=
4721 MOZ_OGG=1
4722 MOZ_SYDNEYAUDIO=
4723 MOZ_WAVE=1
4724 MOZ_MEDIA=
4725 MOZ_PANGO=1
4726 MOZ_PERMISSIONS=1
4727 MOZ_PLACES=
4728 MOZ_PLAINTEXT_EDITOR_ONLY=
4729 MOZ_PLUGINS=1
4730 MOZ_PREF_EXTENSIONS=1
4731 MOZ_PROFILELOCKING=1
4732 MOZ_PSM=1
4733 MOZ_RDF=1
4734 MOZ_REFLOW_PERF=
4735 MOZ_SAFE_BROWSING=
4736 MOZ_FASTSTART=
4737 MOZ_HELP_VIEWER=
4738 MOZ_SPELLCHECK=1
4739 MOZ_SPLASHSCREEN=
4740 MOZ_STORAGE=1
4741 MOZ_SVG=1
4742 MOZ_TIMELINE=
4743 MOZ_TOOLKIT_SEARCH=1
4744 MOZ_UI_LOCALE=en-US
4745 MOZ_UNIVERSALCHARDET=1
4746 MOZ_URL_CLASSIFIER=
4747 MOZ_USE_NATIVE_UCONV=
4748 MOZ_VIEW_SOURCE=1
4749 MOZ_XPFE_COMPONENTS=1
4750 MOZ_XPINSTALL=1
4751 MOZ_XSLT_STANDALONE=
4752 MOZ_XTF=1
4753 MOZ_XUL=1
4754 MOZ_ZIPWRITER=1
4755 NS_PRINTING=1
4756 NECKO_WIFI=1
4757 NECKO_COOKIES=1
4758 NECKO_DISK_CACHE=1
4759 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4760 NECKO_SMALL_BUFFERS=
4761 BUILD_CTYPES=1
4762 XPC_IDISPATCH_SUPPORT=
4765 case "$target_os" in
4766 darwin*|*wince*|*winmo*)
4767     ACCESSIBILITY=
4768     ;;
4770     ACCESSIBILITY=1
4771     ;;
4772 esac
4774 case "$target_os" in
4775     msvc*|mks*|cygwin*|mingw*)
4776         NS_ENABLE_TSF=1
4777         if test -z "$GNU_CC"; then 
4778             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4779                 NS_ENABLE_TSF=
4780             fi
4781             XPC_IDISPATCH_SUPPORT=1
4782             MOZ_NO_ACTIVEX_SUPPORT=
4783         fi
4784         if test -n "$NS_ENABLE_TSF"; then
4785             AC_DEFINE(NS_ENABLE_TSF)
4786         fi
4787         ;;
4788 esac
4790 MOZ_ARG_ENABLE_STRING(application,
4791 [  --enable-application=APP
4792                           Options include:
4793                             browser (Firefox)
4794                             xulrunner
4795                             content/xslt (Standalone Transformiix XSLT)
4796                             netwerk (Standalone Necko)
4797                             tools/update-packaging (AUS-related packaging tools)
4798                             standalone (use this for standalone
4799                               xpcom/xpconnect or to manually drive a build)],
4800 [ MOZ_BUILD_APP=$enableval ] )
4802 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4803 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4804   XULRUNNER_STUB_NAME=$withval)
4806 if test -z "$XULRUNNER_STUB_NAME"; then
4807   case "$target_os" in
4808   darwin*)
4809     XULRUNNER_STUB_NAME=xulrunner
4810     ;;
4811   *)
4812     XULRUNNER_STUB_NAME=xulrunner-stub
4813   esac
4815 AC_SUBST(XULRUNNER_STUB_NAME)
4817 if test -z "$MOZ_BUILD_APP"; then
4818   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4819 else
4820   # We have a valid application only if it has a build.mk file in its top
4821   # directory.
4822   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4823     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4824   fi
4827 # Allow the application to influence configure with a confvars.sh script.
4829 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4830 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4831   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4832   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4833 else
4834   AC_MSG_RESULT([no])
4837 # Now is a good time to test for logic errors, define mismatches, etc.
4838 case "$MOZ_BUILD_APP" in
4839 xulrunner)
4840   if test "$LIBXUL_SDK"; then
4841     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4842   fi
4843   ;;
4844 esac
4846 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4847 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4848 # MOZ_BUILD_APP.
4849 case "$MOZ_BUILD_APP" in
4850 browser)
4851   AC_DEFINE(MOZ_PHOENIX)
4852   ;;
4854 xulrunner)
4855   AC_DEFINE(MOZ_XULRUNNER)
4856   ;;
4858 content/xslt)
4859   AC_DEFINE(TX_EXE)
4860   ;;
4862 standalone) 
4863   MOZ_APP_NAME=mozilla
4864   MOZ_APP_DISPLAYNAME=Mozilla
4865   MOZ_APP_VERSION=$MOZILLA_VERSION
4866   ;;
4868 esac
4870 AC_SUBST(MOZ_BUILD_APP)
4871 AC_SUBST(MOZ_PHOENIX)
4872 AC_SUBST(MOZ_XULRUNNER)
4874 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4876 dnl ========================================================
4877 dnl = 
4878 dnl = Toolkit Options
4879 dnl = 
4880 dnl ========================================================
4881 MOZ_ARG_HEADER(Toolkit Options)
4883     dnl ========================================================
4884     dnl = Select the default toolkit
4885     dnl ========================================================
4886         MOZ_ARG_ENABLE_STRING(default-toolkit,
4887         [  --enable-default-toolkit=TK
4888                           Select default toolkit
4889                           Platform specific defaults:
4890                             BeOS - cairo-beos
4891                             Mac OS X - cairo-cocoa
4892                             Neutrino/QNX - photon
4893                             OS/2 - cairo-os2
4894                             Win32/WinCE - cairo-windows
4895                             Gtk2 with DirectFB - cairo-gtk2-dfb
4896                             * - cairo-gtk2
4897                             * - cairo-qt],
4898     [ _DEFAULT_TOOLKIT=$enableval ],
4899     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4901     if test "$_DEFAULT_TOOLKIT" = "photon" \
4902         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4903         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4904         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4905         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4906         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4907         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4908         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4909         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4910     then
4911         dnl nglayout only supports building with one toolkit,
4912         dnl so ignore everything after the first comma (",").
4913         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4914     else
4915         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4916     fi
4918 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4920 dnl ========================================================
4921 dnl = Enable the toolkit as needed                         =
4922 dnl ========================================================
4924 case "$MOZ_WIDGET_TOOLKIT" in
4925 photon)
4926         MOZ_ENABLE_PHOTON=1
4927         AC_DEFINE(MOZ_WIDGET_PHOTON)
4928     ;;
4930 cairo-windows)
4931     MOZ_WIDGET_TOOLKIT=windows
4932     MOZ_WEBGL=1
4933     case "${target}" in
4934     *-wince*)
4935         NS_PRINTING=
4936         ;;
4937     esac
4938     ;;
4940 cairo-gtk2|cairo-gtk2-x11)
4941     MOZ_WIDGET_TOOLKIT=gtk2
4942     MOZ_ENABLE_GTK2=1
4943     MOZ_ENABLE_XREMOTE=1
4944     MOZ_WEBGL=1
4945     MOZ_WEBGL_GLX=1
4947     AC_DEFINE(MOZ_X11)
4948     MOZ_X11=1
4949     USE_FC_FREETYPE=1
4951     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4952     TK_LIBS='$(MOZ_GTK2_LIBS)'
4953     AC_DEFINE(MOZ_WIDGET_GTK2)
4954     ;;
4956 cairo-gtk2-dfb)
4957     MOZ_WIDGET_TOOLKIT=gtk2
4958     MOZ_ENABLE_GTK2=1
4959     MOZ_WEBGL=
4961     AC_DEFINE(MOZ_DFB)
4962     MOZ_DFB=1
4964     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4965     TK_LIBS='$(MOZ_GTK2_LIBS)'
4966     AC_DEFINE(MOZ_WIDGET_GTK2)
4967     if test "$no_x" != "yes"; then
4968         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4969         no_x=yes
4970     fi
4971     ;;
4973 cairo-qt)
4974     MOZ_WIDGET_TOOLKIT=qt
4975     MOZ_ENABLE_QT=1
4976     MOZ_ENABLE_XREMOTE=1
4977     USE_ELF_DYNSTR_GC=
4978     NS_PRINTING=
4980     AC_DEFINE(MOZ_X11)
4981     MOZ_X11=1
4982     USE_FC_FREETYPE=1
4984     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4985     TK_LIBS='$(MOZ_QT_LIBS)'
4986     AC_DEFINE(MOZ_WIDGET_QT)
4987     ;;
4989 cairo-beos)
4990     MOZ_WIDGET_TOOLKIT=beos
4991     USE_FC_FREETYPE=1
4992     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4993     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4994     ;;
4996 cairo-os2)
4997     MOZ_WIDGET_TOOLKIT=os2
4998     USE_FC_FREETYPE=1
4999     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5000     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5001     ;;
5003 cairo-cocoa)
5004     MOZ_WIDGET_TOOLKIT=cocoa
5005     AC_DEFINE(MOZ_WIDGET_COCOA)
5006     MOZ_USER_DIR="Mozilla"
5007     AC_DEFINE(XP_MACOSX)
5008     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
5009     TK_CFLAGS="-DNO_X11"
5010     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5011     CFLAGS="$CFLAGS $TK_CFLAGS"
5012     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5013     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5014     MOZ_FS_LAYOUT=bundle
5015     MOZ_WEBGL=1
5016     ;;
5017 esac
5019 if test "$MOZ_ENABLE_XREMOTE"; then
5020     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5023 if test "$COMPILE_ENVIRONMENT"; then
5024   if test "$MOZ_ENABLE_GTK2"; then
5025     if test "$MOZ_X11"; then
5026       GDK_PACKAGES=gdk-x11-2.0
5027     elif test "$MOZ_DFB"; then
5028       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5029       GDK_PACKAGES=directfb
5030     fi
5032     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5033   fi
5035 fi # COMPILE_ENVIRONMENT
5037 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
5038 AC_SUBST(MOZ_FS_LAYOUT)
5040 dnl ========================================================
5041 dnl = startup-notification support module
5042 dnl ========================================================
5044 if test "$MOZ_ENABLE_GTK2"
5045 then
5046     MOZ_ENABLE_STARTUP_NOTIFICATION=
5048     MOZ_ARG_ENABLE_BOOL(startup-notification,
5049     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
5050         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5051         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5052     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5053     then
5054         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5055                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5056         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5057             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5058             then
5059                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5060             fi
5061             MOZ_ENABLE_STARTUP_NOTIFICATION=
5062         ])
5063     fi
5065     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5066         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5067     fi
5069     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5071 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5072 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5073 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5075 dnl ========================================================
5076 dnl = QT support
5077 dnl ========================================================
5078 if test "$MOZ_ENABLE_QT"
5079 then
5080     MOZ_ARG_WITH_STRING(qtdir,
5081     [  --with-qtdir=\$dir       Specify Qt directory ],
5082     [ QTDIR=$withval])
5084     if test -z "$QTDIR"; then
5085         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore)
5086         AC_CHECK_PROGS(HOST_MOC, moc, "")
5087     else
5088         MOZ_QT_LIBS="-L$QTDIR/qt/lib/ -lQtGui -lQtNetwork -lQtCore"
5090         MOZ_QT_CFLAGS="-DQT_SHARED"
5091         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include"
5092         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/Qt"
5093         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtGui"
5094         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtCore"
5095         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtNetwork"
5097         HOST_MOC="$QTDIR/qt/bin/moc"
5098     fi
5099     if test -z "$HOST_MOC"; then
5100         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5101 incorrect])
5102     fi
5103     MOC=$HOST_MOC
5106 AC_SUBST(GTK_CONFIG)
5107 AC_SUBST(TK_CFLAGS)
5108 AC_SUBST(TK_LIBS)
5110 AC_SUBST(MOZ_ENABLE_GTK2)
5111 AC_SUBST(MOZ_ENABLE_PHOTON)
5112 AC_SUBST(MOZ_ENABLE_QT)
5113 AC_SUBST(MOZ_ENABLE_XREMOTE)
5114 AC_SUBST(MOZ_GTK2_CFLAGS)
5115 AC_SUBST(MOZ_GTK2_LIBS)
5116 AC_SUBST(MOZ_QT_CFLAGS)
5117 AC_SUBST(MOZ_QT_LIBS)
5119 AC_SUBST(MOC)
5121 AC_SUBST(MOZ_DFB)
5122 AC_SUBST(MOZ_X11)
5124 dnl ========================================================
5125 dnl =
5126 dnl = Components & Features
5127 dnl = 
5128 dnl ========================================================
5129 MOZ_ARG_HEADER(Components and Features)
5131 dnl ========================================================
5132 dnl = Localization
5133 dnl ========================================================
5134 MOZ_ARG_ENABLE_STRING(ui-locale,
5135 [  --enable-ui-locale=ab-CD
5136                           Select the user interface locale (default: en-US)],
5137     MOZ_UI_LOCALE=$enableval )
5138 AC_SUBST(MOZ_UI_LOCALE)
5140 dnl ========================================================
5141 dnl = Trademarked Branding 
5142 dnl ========================================================
5143 MOZ_ARG_ENABLE_BOOL(official-branding,
5144 [  --enable-official-branding Enable Official mozilla.org Branding
5145                           Do not distribute builds with
5146                           --enable-official-branding unless you have
5147                           permission to use trademarks per
5148                           http://www.mozilla.org/foundation/trademarks/ .],
5150   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5151     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5152   else
5153     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5154     MOZ_OFFICIAL_BRANDING=1
5155   fi
5156 ], MOZ_OFFICIAL_BRANDING=)
5158 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5159 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5160   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5163 MOZ_ARG_WITH_STRING(branding,
5164 [  --with-branding=dir    Use branding from the specified directory.],
5165     MOZ_BRANDING_DIRECTORY=$withval)
5167 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5168 if test -z "$REAL_BRANDING_DIRECTORY"; then
5169   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5172 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5173   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
5176 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5178 dnl ========================================================
5179 dnl = Distribution ID
5180 dnl ========================================================
5181 MOZ_ARG_WITH_STRING(distribution-id,
5182 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
5183 [ val=`echo $withval`
5184     MOZ_DISTRIBUTION_ID="$val"])
5186 if test -z "$MOZ_DISTRIBUTION_ID"; then
5187    MOZ_DISTRIBUTION_ID="org.mozilla"
5190 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5191 AC_SUBST(MOZ_DISTRIBUTION_ID)
5194 dnl ========================================================
5195 dnl complex text support off by default
5196 dnl ========================================================
5197 MOZ_ARG_DISABLE_BOOL(pango,
5198 [  --disable-pango Disable usage of Pango ],
5199     MOZ_PANGO=,
5200     MOZ_PANGO=1)
5202 dnl ========================================================
5203 dnl = Pango
5204 dnl ========================================================
5205 if test "$MOZ_ENABLE_GTK2"
5206 then
5207     AC_SUBST(MOZ_PANGO)
5209     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5211     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5212     AC_SUBST(MOZ_PANGO_CFLAGS)
5213     AC_SUBST(MOZ_PANGO_LIBS)
5214     if test "$MOZ_PANGO"
5215     then
5216         AC_DEFINE(MOZ_PANGO)
5217     else
5218         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5219         AC_SUBST(FT2_CFLAGS)
5220         AC_SUBST(FT2_LIBS)
5221     fi
5224 if test "$MOZ_ENABLE_QT"
5225 then
5226     if test "$MOZ_PANGO"
5227     then
5228         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5229         [
5230             AC_SUBST(MOZ_PANGO_CFLAGS)
5231             AC_SUBST(MOZ_PANGO_LIBS)
5232             AC_DEFINE(MOZ_PANGO)
5233         ],
5234         [
5235             echo "Pango library not found, will use FT2 font engine"
5236             MOZ_PANGO=
5237         ])
5238     fi
5239     AC_SUBST(MOZ_PANGO)
5242 dnl ========================================================
5243 dnl = GnomeVFS, GIO and GConf support module
5244 dnl ========================================================
5246 if test "$MOZ_X11"
5247 then
5248     dnl build the gnomevfs extension by default only when the
5249     dnl GTK2 toolkit is in use.
5250     if test "$MOZ_ENABLE_GTK2"
5251     then
5252         MOZ_ENABLE_GNOMEVFS=1
5253         MOZ_ENABLE_GCONF=1
5254     fi
5256     dnl ========================================================
5257     dnl = GnomeVFS support module
5258     dnl ========================================================
5259     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5260     [  --disable-gnomevfs      Disable GnomeVFS support ],
5261         MOZ_ENABLE_GNOMEVFS=,
5262         MOZ_ENABLE_GNOMEVFS=force)
5264     if test "$MOZ_ENABLE_GNOMEVFS"
5265     then
5266         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5267             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5268             MOZ_ENABLE_GNOMEVFS=1
5269             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5270         ],[
5271             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5272             then
5273                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5274             fi
5275             MOZ_ENABLE_GNOMEVFS=
5276         ])
5277     else
5278         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5279             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5280               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5281             ])
5282         fi
5283     fi
5285     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5286     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5287     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5289     dnl ========================================================
5290     dnl = GIO support module
5291     dnl ========================================================
5292     MOZ_ARG_ENABLE_BOOL(gio,
5293     [  --enable-gio            Enable GIO support (default: disabled)],
5294         MOZ_ENABLE_GIO=force,
5295         MOZ_ENABLE_GIO=)
5297     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5298     then
5299         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5300             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5301             MOZ_ENABLE_GIO=1
5302             AC_DEFINE(MOZ_ENABLE_GIO)
5303         ],[
5304             if test "$MOZ_ENABLE_GIO" = "force"
5305             then
5306                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5307             fi
5308             MOZ_ENABLE_GIO=
5309         ])
5310     fi
5312     AC_SUBST(MOZ_ENABLE_GIO)
5313     AC_SUBST(MOZ_GIO_CFLAGS)
5314     AC_SUBST(MOZ_GIO_LIBS)
5315    
5316     dnl ========================================================
5317     dnl = GConf support module
5318     dnl ========================================================
5319     if test "$MOZ_ENABLE_GCONF"
5320     then
5321         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5322             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5323             MOZ_ENABLE_GCONF=1
5324         ],[
5325             if test "$MOZ_ENABLE_GCONF" = "force"
5326             then
5327                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5328             fi
5329             MOZ_ENABLE_GCONF=
5330         ])
5331     fi
5333     if test "$MOZ_ENABLE_GCONF"; then
5334         AC_DEFINE(MOZ_ENABLE_GCONF)
5335     fi
5337     AC_SUBST(MOZ_ENABLE_GCONF)
5338     AC_SUBST(MOZ_GCONF_CFLAGS)
5339     AC_SUBST(MOZ_GCONF_LIBS)
5342 dnl ========================================================
5343 dnl = libnotify support
5344 dnl ========================================================
5346 if test "$MOZ_ENABLE_GTK2"
5347 then
5348     MOZ_ENABLE_LIBNOTIFY=1
5350     MOZ_ARG_DISABLE_BOOL(libnotify,
5351     [  --disable-libnotify       Disable libnotify support ],
5352     MOZ_ENABLE_LIBNOTIFY=,
5353     MOZ_ENABLE_LIBNOTIFY=1)
5355     if test "$MOZ_ENABLE_LIBNOTIFY"
5356     then
5357         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5358     fi
5361 if test -z "$SKIP_LIBRARY_CHECKS"
5362 then
5363     if test "$MOZ_ENABLE_GTK2"
5364     then
5365         if test "$MOZ_ENABLE_LIBNOTIFY"
5366         then
5367             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5368         fi
5369     fi
5371 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5372 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5373 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5375 dnl ========================================================
5376 dnl = GNOME component (mozgnome)
5377 dnl ========================================================
5379 # The GNOME component is built if one of 
5380 # gnome-vfs, gio, gconf or libnotify is available.
5381 if test "$MOZ_ENABLE_GCONF" || \
5382    test "$MOZ_ENABLE_GNOMEVFS" || \
5383    test "$MOZ_ENABLE_GIO" || \
5384    test "$MOZ_ENABLE_LIBNOTIFY"; then
5385     MOZ_ENABLE_GNOME_COMPONENT=1
5386 else
5387     MOZ_ENABLE_GNOME_COMPONENT=
5389 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5391 dnl ========================================================
5392 dnl = libgnomeui support module
5393 dnl ========================================================
5395 if test "$MOZ_ENABLE_GTK2"
5396 then
5397     MOZ_ENABLE_GNOMEUI=1
5399     MOZ_ARG_DISABLE_BOOL(gnomeui,
5400     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5401         MOZ_ENABLE_GNOMEUI=,
5402         MOZ_ENABLE_GNOMEUI=force)
5404     if test "$MOZ_ENABLE_GNOMEUI"
5405     then
5406         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5407         [
5408             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5409             MOZ_ENABLE_GNOMEUI=1
5410         ],[
5411             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5412             then
5413                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5414             fi
5415             MOZ_ENABLE_GNOMEUI=
5416         ])
5417     fi
5419     if test "$MOZ_ENABLE_GNOMEUI"; then
5420         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5421     fi
5424 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5425 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5426 AC_SUBST(MOZ_GNOMEUI_LIBS)
5428 dnl ========================================================
5429 dnl = dbus support
5430 dnl ========================================================
5432 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5433 then
5434     MOZ_ENABLE_DBUS=1
5436     MOZ_ARG_DISABLE_BOOL(dbus,
5437     [  --disable-dbus       Disable dbus support ],
5438         MOZ_ENABLE_DBUS=,
5439         MOZ_ENABLE_DBUS=1)
5441     if test "$MOZ_ENABLE_DBUS"
5442     then
5443         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5444         AC_DEFINE(MOZ_ENABLE_DBUS)
5445     fi
5447 AC_SUBST(MOZ_ENABLE_DBUS)
5448 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5449 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5451 dnl ========================================================
5452 dnl = Build Personal Security Manager
5453 dnl ========================================================
5454 MOZ_ARG_DISABLE_BOOL(crypto,
5455 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5456     MOZ_PSM=,
5457     MOZ_PSM=1 )
5459 dnl ========================================================
5460 dnl = JS Debugger XPCOM component (js/jsd)
5461 dnl ========================================================
5462 MOZ_ARG_DISABLE_BOOL(jsd,
5463 [  --disable-jsd           Disable JavaScript debug library],
5464     MOZ_JSDEBUGGER=,
5465     MOZ_JSDEBUGGER=1)
5468 dnl ========================================================
5469 dnl = Disable IPC support for tabs and plugins
5470 dnl ========================================================
5471 case "${target}" in
5472 powerpc-apple-darwin*)
5473     MOZ_IPC=
5474     ;;
5475 i386-apple-darwin*)
5476     MOZ_IPC=
5477     ;;
5478 *-wince*)
5479     MOZ_IPC=
5480     ;;
5481 esac
5483 MOZ_ARG_DISABLE_BOOL(ipc,
5484 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5485     MOZ_IPC=,
5486     MOZ_IPC=1)
5488 if test -n "$MOZ_IPC"; then
5489     AC_DEFINE(MOZ_IPC)
5492 AC_SUBST(MOZ_IPC)
5494 dnl ========================================================
5495 dnl = Enable IPDL's "expensive" unit tests
5496 dnl ========================================================
5497 MOZ_IPDL_TESTS=
5499 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5500 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5501     MOZ_IPDL_TESTS=1,
5502     MOZ_IPDL_TESTS=)
5504 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5505     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5508 if test -n "$MOZ_IPDL_TESTS"; then
5509     AC_DEFINE(MOZ_IPDL_TESTS)
5512 AC_SUBST(MOZ_IPDL_TESTS)
5514 dnl ========================================================
5515 dnl = Disable plugin support
5516 dnl ========================================================
5517 MOZ_ARG_DISABLE_BOOL(plugins,
5518 [  --disable-plugins       Disable plugins support],
5519     MOZ_PLUGINS=,
5520     MOZ_PLUGINS=1)
5522 dnl ========================================================
5523 dnl = Disable building dbm
5524 dnl ========================================================
5525 MOZ_ARG_DISABLE_BOOL(dbm,
5526 [  --disable-dbm       Disable building dbm],
5527     NSS_DISABLE_DBM=1,
5528     NSS_DISABLE_DBM=)
5530 dnl bi-directional support always on
5531 IBMBIDI=1
5532 AC_DEFINE(IBMBIDI)
5534 dnl ========================================================
5535 dnl view source support on by default
5536 dnl ========================================================
5537 if test "$MOZ_VIEW_SOURCE"; then
5538     AC_DEFINE(MOZ_VIEW_SOURCE)
5541 dnl ========================================================
5542 dnl accessibility support on by default on all platforms 
5543 dnl except OS X.
5544 dnl ========================================================
5545 MOZ_ARG_DISABLE_BOOL(accessibility,
5546 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5547     ACCESSIBILITY=,
5548     ACCESSIBILITY=1 )
5549 if test "$ACCESSIBILITY"; then
5550     AC_DEFINE(ACCESSIBILITY)
5553 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5554 case "$target" in
5555 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5556     if test "$ac_cv_header_atlbase_h" = "no"; then
5557         AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
5558     fi
5559     if test "$ac_cv_header_oleacc_idl" = "no"; then
5560         AC_MSG_ERROR([System header oleacc.idl is not available. See http://developer.mozilla.org/en/docs/oleacc.idl for details on fixing this problem.])
5561     fi
5562     ;;
5563 esac
5566 dnl ========================================================
5567 dnl xpfe/components on by default
5568 dnl ========================================================
5569 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5570 [  --disable-xpfe-components
5571                           Disable xpfe components],
5572     MOZ_XPFE_COMPONENTS=,
5573     MOZ_XPFE_COMPONENTS=1 )
5575 dnl ========================================================
5576 dnl xpinstall support on by default
5577 dnl ========================================================
5578 MOZ_ARG_DISABLE_BOOL(xpinstall,
5579 [  --disable-xpinstall     Disable xpinstall support],
5580     MOZ_XPINSTALL=,
5581     MOZ_XPINSTALL=1 )
5582 if test "$MOZ_XPINSTALL"; then
5583     AC_DEFINE(MOZ_XPINSTALL)
5586 dnl ========================================================
5587 dnl xpcom js loader support on by default
5588 dnl ========================================================
5589 if test "$MOZ_JSLOADER"; then
5590     AC_DEFINE(MOZ_JSLOADER)
5593 dnl ========================================================
5594 dnl Disable printing
5595 dnl ========================================================
5596 MOZ_ARG_DISABLE_BOOL(printing,
5597 [  --disable-printing  Disable printing support],
5598     NS_PRINTING=,
5599     NS_PRINTING=1 )
5601 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5602     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5603     NS_PRINTING=
5606 if test "$NS_PRINTING"; then
5607     AC_DEFINE(NS_PRINTING)
5608     AC_DEFINE(NS_PRINT_PREVIEW)
5611 dnl ========================================================
5612 dnl use native unicode converters
5613 dnl ========================================================
5614 MOZ_ARG_ENABLE_BOOL(native-uconv,
5615 [  --enable-native-uconv   Enable iconv support],
5616     MOZ_USE_NATIVE_UCONV=1,
5617     MOZ_USE_NATIVE_UCONV= )
5618 if test "$MOZ_USE_NATIVE_UCONV"; then
5619     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5621 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5622     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5626 dnl ========================================================
5627 dnl Libeditor can be build as plaintext-only,
5628 dnl or as a full html and text editing component.
5629 dnl We build both by default.
5630 dnl ========================================================
5631 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5632 [  --enable-plaintext-editor-only
5633                           Allow only plaintext editing],
5634     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5635     MOZ_PLAINTEXT_EDITOR_ONLY= )
5636 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5637 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5639 dnl ========================================================
5640 dnl = Disable Fast Load
5641 dnl ========================================================
5642 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5643 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5644     MOZ_NO_FAST_LOAD=1,
5645     MOZ_NO_FAST_LOAD=)
5647 AC_SUBST(MOZ_NO_FAST_LOAD)
5649 if test -n "$MOZ_NO_FAST_LOAD"; then
5650     AC_DEFINE(MOZ_NO_FAST_LOAD)
5653 dnl ========================================================
5654 dnl = Disable Ogg Codecs
5655 dnl ========================================================
5656 MOZ_ARG_DISABLE_BOOL(ogg,
5657 [  --disable-ogg           Disable Ogg Codec support],
5658     MOZ_OGG=,
5659     MOZ_OGG=1)
5661 AC_SUBST(MOZ_OGG)
5663 if test -n "$MOZ_OGG"; then
5664     AC_DEFINE(MOZ_OGG)
5665     MOZ_SYDNEYAUDIO=1
5666     MOZ_MEDIA=1
5668     dnl Checks for __attribute__(aligned()) directive
5669     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5670         [ac_cv_c_attribute_aligned],
5671         [ac_cv_c_attribute_aligned=0
5672          CFLAGS_save="${CFLAGS}"
5673          CFLAGS="${CFLAGS} -Werror"
5674          for ac_cv_c_attr_align_try in 64 32 16 8; do
5675            echo "trying $ac_cv_c_attr_align_try"
5676            AC_TRY_COMPILE([],
5677                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5678                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5679            if test "$ac_cv_c_attribute_aligned" != 0; then
5680              break;
5681            fi
5682          done
5683            CFLAGS="${CFLAGS_save}"])
5684     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5685       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5686                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5687     fi
5690 dnl ========================================================
5691 dnl = Disable Wave decoder support
5692 dnl ========================================================
5693 MOZ_ARG_DISABLE_BOOL(wave,
5694 [  --disable-wave          Disable Wave decoder support],
5695     MOZ_WAVE=,
5696     MOZ_WAVE=1)
5698 AC_SUBST(MOZ_WAVE)
5700 if test -n "$MOZ_WAVE"; then
5701     AC_DEFINE(MOZ_WAVE)
5702     MOZ_SYDNEYAUDIO=1
5703     MOZ_MEDIA=1
5706 dnl ========================================================
5707 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5708 dnl ========================================================
5710 AC_SUBST(MOZ_SYDNEYAUDIO)
5712 if test -n "$MOZ_SYDNEYAUDIO"; then
5713     AC_DEFINE(MOZ_SYDNEYAUDIO)
5716 AC_SUBST(MOZ_MEDIA)
5718 if test -n "$MOZ_MEDIA"; then
5719     AC_DEFINE(MOZ_MEDIA)
5722 dnl ========================================================
5723 dnl = Check alsa availability on Linux if using sydneyaudio
5724 dnl ========================================================
5726 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5727 if test -n "$MOZ_SYDNEYAUDIO"; then
5728    case "$target_os" in
5729 linux*)
5730       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5731          [echo "$MOZ_ALSA_PKG_ERRORS"
5732           AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux.  Disable with --disable-ogg --disable-wave.])])
5733       ;;
5734    esac
5736 AC_SUBST(MOZ_ALSA_LIBS)
5738 dnl ========================================================
5739 dnl Splashscreen
5740 dnl ========================================================
5741 AC_ARG_ENABLE(splashscreen,
5742               [  --enable-splashscreen   display splashscreen while loading (default=no)],
5743               [enable_splash="yes"],[enable_splash=""])
5744 if test "x$enable_splash" = "xyes"; then
5745   MOZ_SPLASHSCREEN=1
5746   AC_DEFINE(MOZ_SPLASHSCREEN)
5748 AC_SUBST(MOZ_SPLASHSCREEN)
5750 dnl ========================================================
5751 dnl Permissions System
5752 dnl ========================================================
5753 MOZ_ARG_DISABLE_BOOL(permissions,
5754 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5755     MOZ_PERMISSIONS=,
5756     MOZ_PERMISSIONS=1
5759 dnl ========================================================
5760 dnl NegotiateAuth
5761 dnl ========================================================
5762 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5763 [  --disable-negotiateauth Disable GSS-API negotiation ],
5764     MOZ_AUTH_EXTENSION=,
5765     MOZ_AUTH_EXTENSION=1 )
5767 dnl ========================================================
5768 dnl XTF
5769 dnl ========================================================
5770 MOZ_ARG_DISABLE_BOOL(xtf,
5771 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5772     MOZ_XTF=,
5773     MOZ_XTF=1 )
5774 if test "$MOZ_XTF"; then
5775   AC_DEFINE(MOZ_XTF)
5778 dnl ========================================================
5779 dnl Pref extensions (autoconfig and system-pref)
5780 dnl ========================================================
5781 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5782 [  --disable-pref-extensions
5783                           Disable pref extensions such as autoconfig and
5784                           system-pref],
5785   MOZ_PREF_EXTENSIONS=,
5786   MOZ_PREF_EXTENSIONS=1 )
5788 dnl ========================================================
5789 dnl = Universalchardet
5790 dnl ========================================================
5791 MOZ_ARG_DISABLE_BOOL(universalchardet,
5792 [  --disable-universalchardet
5793                           Disable universal encoding detection],
5794   MOZ_UNIVERSALCHARDET=,
5795   MOZ_UNIVERSALCHARDET=1 )
5797 dnl ========================================================
5798 dnl JavaXPCOM
5799 dnl ========================================================
5800 case "${target}" in
5801 *-wince*)
5802     MOZ_JAVAXPCOM=
5803     ;;
5804 esac
5806 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5807 [  --enable-javaxpcom
5808                           Enable Java-XPCOM bridge],
5809     MOZ_JAVAXPCOM=1,
5810     MOZ_JAVAXPCOM= )
5812 if test -n "${MOZ_JAVAXPCOM}"; then
5813   case "$host_os" in
5814     cygwin*|msvc*|mks*)
5815       if test -n "$JAVA_HOME"; then
5816         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5817       fi
5818       ;;
5819     *mingw*)
5820       if test -n "$JAVA_HOME"; then
5821         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5822       fi
5823       ;;
5824   esac
5826   if test -n "${JAVA_INCLUDE_PATH}"; then
5827     dnl Make sure jni.h exists in the given include path.
5828     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5829       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5830     fi
5831   else
5832     case "$target_os" in
5833       darwin*)
5834         dnl Default to java system location
5835         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5836         ;;
5837       *)
5838         dnl Try $JAVA_HOME
5839         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5840         ;;
5841     esac
5842     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5843       AC_MSG_ERROR([The header jni.h was not found.  Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
5844     fi
5845   fi
5847   if test -n "${JAVA_BIN_PATH}"; then
5848     dnl Look for javac and jar in the specified path.
5849     JAVA_PATH="$JAVA_BIN_PATH"
5850   else
5851     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5852     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5853   fi
5855   MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5856   MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5857   MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5858   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5859     AC_MSG_ERROR([The programs java, javac and jar were not found.  Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
5860   fi
5863 dnl ========================================================
5864 dnl = Breakpad crash reporting (on by default on supported platforms)
5865 dnl ========================================================
5867 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5868     || test "$OS_ARCH" = "Darwin" \
5869     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5870     || test "$OS_ARCH" = "SunOS") \
5871    && test -z "$HAVE_64BIT_OS"; then
5872    MOZ_CRASHREPORTER=1
5875 MOZ_ARG_DISABLE_BOOL(crashreporter,
5876 [  --disable-crashreporter          Disable breakpad crash reporting],
5877     MOZ_CRASHREPORTER=,
5878     MOZ_CRASHREPORTER=1)
5880 if test -n "$MOZ_CRASHREPORTER"; then
5881    AC_DEFINE(MOZ_CRASHREPORTER)
5883   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5884     test -z "$SKIP_LIBRARY_CHECKS"; then
5885     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5886     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5887     AC_SUBST(MOZ_GTHREAD_LIBS)
5889     AC_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])])
5890   fi
5893 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5894 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5895 [ val=`echo $withval | sed 's/[^0-9]//g'`
5896     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5898 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5899    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5901 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5903 dnl ========================================================
5904 dnl = Enable compilation of specific extension modules
5905 dnl ========================================================
5907 MOZ_ARG_ENABLE_STRING(extensions,
5908 [  --enable-extensions     Enable extensions],
5909 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5910     if test "$option" = "yes" || test "$option" = "all"; then
5911         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5912     elif test "$option" = "no" || test "$option" = "none"; then
5913         MOZ_EXTENSIONS=""
5914     elif test "$option" = "default"; then
5915         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5916     elif test `echo "$option" | grep -c \^-` != 0; then
5917         option=`echo $option | sed 's/^-//'`
5918         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5919     else
5920         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5921     fi
5922 done],
5923     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5925 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5926     # Suppress warning on non-X11 platforms
5927     if test -n "$MOZ_X11"; then
5928         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5929     fi
5930     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5933 dnl Do not build gnomevfs with libxul based apps
5934 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5935     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5938 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5939     # Suppress warning on non-X11 platforms
5940     if test -n "$MOZ_X11"; then
5941         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5942     fi
5943     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5946 dnl Do not build gio with libxul based apps
5947 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5948     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5951 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5952     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5953     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5956 dnl This might be temporary: build tridentprofile only on Windows
5957 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5958     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5959     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5962 dnl cookie must be built before tridentprofile. put it at list's end.
5963 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5964   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5965   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5968 dnl xforms requires xtf and schema-validation
5969 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5970     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5971     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5973 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5974     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5975     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5978 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5979     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5980     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5983 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5984     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5985     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5988 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5989     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5990     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5993 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5994     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5995     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5998 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5999     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6000     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6003 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6004     AC_MSG_WARN([spellcheck is no longer an extension.])
6005     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6008 dnl Remove dupes
6009 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6011 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6012 dnl when trying to build a non-existent extension.
6013 for extension in $MOZ_EXTENSIONS; do
6014     if test ! -d "${srcdir}/extensions/${extension}"; then
6015         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6016     fi
6017 done
6020 dnl ========================================================
6021 dnl Image decoders
6022 dnl ========================================================
6023 case "$MOZ_WIDGET_TOOLKIT" in
6024 beos|windows|os2|mac|cocoa)
6025     ;;
6027     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
6028        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6029     fi
6030     ;;
6031 esac
6033 MOZ_ARG_ENABLE_STRING(image-decoders,
6034 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
6035                           Enable specific image decoders],
6036 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6037     if test "$option" = "yes" || test "$option" = "all"; then
6038         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6039     elif test "$option" = "no" || test "$option" = "none"; then
6040         MOZ_IMG_DECODERS=""
6041     elif test "$option" = "default"; then
6042         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6043     elif test `echo "$option" | grep -c \^-` != 0; then
6044         option=`echo $option | sed 's/^-//'`
6045         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6046     else
6047         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6048     fi
6049 done],
6050     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6052 dnl Dupes are removed in the encoder section because it will also add decoders
6054 dnl ========================================================
6055 dnl Image encoders
6056 dnl ========================================================
6057 MOZ_ARG_ENABLE_STRING(image-encoders,
6058 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
6059                           Enable specific image encoders],
6060 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6061     if test "$option" = "yes" || test "$option" = "all"; then
6062         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6063     elif test "$option" = "no" || test "$option" = "none"; then
6064         MOZ_IMG_ENCODERS=""
6065         addencoder=""
6066     elif test "$option" = "default"; then
6067         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6068     elif test `echo "$option" | grep -c \^-` != 0; then
6069         option=`echo $option | sed 's/^-//'`
6070         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6071     else
6072         addencoder="$option"
6073     fi
6074     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6075 done],
6076     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6078 dnl Remove dupes
6079 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6080 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6082 dnl ========================================================
6083 dnl MathML on by default
6084 dnl ========================================================
6085 MOZ_ARG_DISABLE_BOOL(mathml,
6086 [  --disable-mathml        Disable MathML support],
6087     MOZ_MATHML=,
6088     MOZ_MATHML=1 )
6089 if test "$MOZ_MATHML"; then
6090   AC_DEFINE(MOZ_MATHML)
6093 dnl ========================================================
6094 dnl SVG
6095 dnl ========================================================
6096 MOZ_ARG_DISABLE_BOOL(svg,
6097 [  --disable-svg            Disable SVG support],
6098     MOZ_SVG=,
6099     MOZ_SVG=1 )
6100 if test -n "$MOZ_SVG"; then
6101   AC_DEFINE(MOZ_SVG)
6104 dnl ========================================================
6105 dnl SMIL
6106 dnl ========================================================
6107 MOZ_SMIL=1
6108 MOZ_ARG_DISABLE_BOOL(smil,
6109 [  --disable-smil           Disable SMIL animation support],
6110     MOZ_SMIL=,
6111     MOZ_SMIL=1 )
6112 # Automatically disable SMIL if SVG is disabled
6113 if test -z "$MOZ_SVG"; then
6114   MOZ_SMIL=
6116 if test -n "$MOZ_SMIL"; then
6117   AC_DEFINE(MOZ_SMIL)
6120 dnl ========================================================
6121 dnl Build Freetype in the tree
6122 dnl ========================================================
6123 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6124 [  --enable-tree-freetype         Enable Tree FreeType],
6125     MOZ_TREE_FREETYPE=1,
6126     MOZ_TREE_FREETYPE= )
6127 if test -n "$MOZ_TREE_FREETYPE"; then
6128    AC_DEFINE(MOZ_TREE_FREETYPE)
6129    AC_SUBST(MOZ_TREE_FREETYPE)
6130    MOZ_ENABLE_CAIRO_FT=1       
6131    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6132    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6133    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6134    FT2_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
6135    CAIRO_FT_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
6136    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6137    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6138    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6139    AC_SUBST(CAIRO_FT_CFLAGS)
6143 dnl ========================================================
6144 dnl Installer
6145 dnl ========================================================
6146 case "$target_os" in
6147     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6148         MOZ_INSTALLER=1
6149         ;;
6150 esac
6152 MOZ_ARG_DISABLE_BOOL(installer,
6153 [  --disable-installer     Disable building of installer],
6154     MOZ_INSTALLER=,
6155     MOZ_INSTALLER=1 )
6156 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6157     # Disable installer for Windows builds that use the new toolkit if NSIS
6158     # isn't in the path.
6159     MOZ_PATH_PROGS(MAKENSIS, makensis)
6160     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
6161         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
6162     fi
6163     # The Windows build for NSIS requires the iconv command line utility to
6164     # convert the charset of the locale files.
6165     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6166     if test -z "$HOST_ICONV"; then
6167         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6168     fi
6171 # Automatically disable installer if xpinstall isn't built
6172 if test -z "$MOZ_XPINSTALL"; then
6173     MOZ_INSTALLER=
6175 AC_SUBST(MOZ_INSTALLER)
6177 AC_MSG_CHECKING([for tar archiver])
6178 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6179 if test -z "$TAR"; then
6180     AC_MSG_ERROR([no tar archiver found in \$PATH])
6182 AC_MSG_RESULT([$TAR])
6183 AC_SUBST(TAR)
6185 AC_MSG_CHECKING([for wget])
6186 AC_CHECK_PROGS(WGET, wget, "")
6187 AC_MSG_RESULT([$WGET])
6188 AC_SUBST(WGET)
6190 dnl ========================================================
6191 dnl Updater
6192 dnl ========================================================
6194 MOZ_ARG_DISABLE_BOOL(updater,
6195 [  --disable-updater       Disable building of updater],
6196     MOZ_UPDATER=,
6197     MOZ_UPDATER=1 )
6198 AC_SUBST(MOZ_UPDATER)
6200 # app update channel is 'default' when not supplied.
6201 MOZ_ARG_ENABLE_STRING([update-channel],
6202 [  --enable-update-channel=CHANNEL
6203                            Select application update channel (default=default)],
6204     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6206 if test -z "$MOZ_UPDATE_CHANNEL"; then
6207     MOZ_UPDATE_CHANNEL=default
6209 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6211 # tools/update-packaging is not checked out by default.
6212 MOZ_ARG_ENABLE_BOOL(update-packaging,
6213 [  --enable-update-packaging
6214                            Enable tools/update-packaging],
6215     MOZ_UPDATE_PACKAGING=1,
6216     MOZ_UPDATE_PACKAGING= )
6217 AC_SUBST(MOZ_UPDATE_PACKAGING)
6219 dnl ========================================================
6220 dnl ActiveX
6221 dnl ========================================================
6223 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6224 [  --disable-xpconnect-idispatch
6225                           Disable building of xpconnect support for IDispatch
6226                           (win32 only)],
6227     XPC_IDISPATCH_SUPPORT=,
6228     XPC_IDISPATCH_SUPPORT=1)
6229 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6231 MOZ_ARG_DISABLE_BOOL(activex,
6232 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6233     MOZ_NO_ACTIVEX_SUPPORT=1,
6234     MOZ_NO_ACTIVEX_SUPPORT= )
6235 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6237 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6238 [  --enable-activex-scripting
6239                           Enable building of ActiveX scripting support (win32)],
6240     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6241     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6242 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6244 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6245 then
6246     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6249 if test "$COMPILE_ENVIRONMENT" = "1"; then
6250 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6251 case "$target" in
6252 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6253     if test "$ac_cv_header_atlbase_h" = "no"; then
6254         AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
6255     fi
6256     ;;
6257 esac
6261 dnl ========================================================
6262 dnl leaky
6263 dnl ========================================================
6264 MOZ_ARG_ENABLE_BOOL(leaky,
6265 [  --enable-leaky          Build leaky memory tool],
6266     MOZ_LEAKY=1,
6267     MOZ_LEAKY=)
6270 dnl ========================================================
6271 dnl xpctools
6272 dnl ========================================================
6273 MOZ_ARG_ENABLE_BOOL(xpctools,
6274 [  --enable-xpctools       Build JS profiling tool],
6275     MOZ_XPCTOOLS=1,
6276     MOZ_XPCTOOLS= )
6279 dnl ========================================================
6280 dnl build the tests by default
6281 dnl ========================================================
6282 MOZ_ARG_DISABLE_BOOL(tests,
6283 [  --disable-tests         Do not build test libraries & programs],
6284     ENABLE_TESTS=,
6285     ENABLE_TESTS=1 )
6287 dnl ========================================================
6288 dnl parental controls (for Windows Vista)
6289 dnl ========================================================
6290 MOZ_ARG_DISABLE_BOOL(parental-controls,
6291 [  --disable-parental-controls
6292                            Do not build parental controls],
6293    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6294    MOZ_DISABLE_PARENTAL_CONTROLS=)
6295 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6296     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6299 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6301 dnl ========================================================
6302 dnl =
6303 dnl = Module specific options
6304 dnl =
6305 dnl ========================================================
6306 MOZ_ARG_HEADER(Individual module options)
6308 dnl ========================================================
6309 dnl = Enable places (new history/bookmarks)
6310 dnl ========================================================
6311 MOZ_ARG_ENABLE_BOOL(places,
6312 [  --enable-places        Enable 'places' bookmark/history implementation],
6313     MOZ_PLACES=1,
6314     MOZ_PLACES= )
6315 if test -n "$MOZ_PLACES"; then
6316     AC_DEFINE(MOZ_PLACES)
6317     if test -z "$MOZ_MAIL_NEWS"; then
6318       MOZ_MORK=
6319     fi
6320     MOZ_MORKREADER=1
6321 else
6322   if test "$MOZ_BUILD_APP" = "browser"; then
6323     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
6324   fi
6327 dnl ========================================================
6328 dnl = Disable feed handling components
6329 dnl ========================================================
6330 MOZ_ARG_DISABLE_BOOL(feeds,
6331 [  --disable-feeds        Disable feed handling and processing components],
6332     MOZ_FEEDS=,
6333     MOZ_FEEDS=1 )
6334 if test -n "$MOZ_FEEDS"; then
6335     AC_DEFINE(MOZ_FEEDS)
6336 else
6337     if test "$MOZ_BUILD_APP" = "browser"; then
6338         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6339     fi
6342 dnl ========================================================
6343 dnl = Enable mozStorage
6344 dnl ========================================================
6345 dnl Implicitly enabled by default if building calendar or places
6346 MOZ_ARG_ENABLE_BOOL(storage,
6347 [  --enable-storage        Enable mozStorage module and related components],
6348     MOZ_STORAGE=1,
6349     MOZ_STORAGE= )
6350 if test -n "$MOZ_STORAGE"; then
6351     AC_DEFINE(MOZ_STORAGE)
6354 dnl ========================================================
6355 dnl Check for sqlite
6356 dnl ========================================================
6358 MOZ_NATIVE_SQLITE=
6359 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6360 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6361 MOZ_NATIVE_SQLITE=1,
6362 MOZ_NATIVE_SQLITE= )
6364 if test -z "$MOZ_NATIVE_SQLITE"
6365 then
6366     SQLITE_CFLAGS=
6367     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6368 else
6369     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6370     dnl ===================================
6371     dnl === SQLITE_SECURE_DELETE checks ===
6372     dnl ===================================
6373     dnl check to see if the system sqlite package is compiled with
6374     dnl SQLITE_SECURE_DELETE enabled.
6375     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system sqlite)
6376     _SAVE_CFLAGS="$CFLAGS"
6377     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6378     _SAVE_LIBS="$LIBS"
6379     LIBS="$LIBS $SQLITE_LIBS"
6380     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6381         AC_TRY_RUN([
6382             #include "sqlite3.h"
6383             #include <stdio.h>
6384             #include <assert.h>
6386             int main(int argc, char **argv){
6387               sqlite3 *db;
6388               sqlite3_uint64 r;
6389               char *zFilename;
6390               FILE *in;
6391               int i;
6392               int rc;
6393               char *zBuf;
6394               const int bufSize = 1024*3;
6396               zBuf = malloc(bufSize*sizeof(char));
6397               assert( zBuf );
6398               rc = sqlite3_open(":memory:", &db);
6399               assert( rc==SQLITE_OK );
6400               sqlite3_close(db);
6401               sqlite3_randomness(sizeof(r), &r);
6402               zFilename = sqlite3_mprintf("test_db_%llu.sqlite", r);
6403               rc = sqlite3_open(zFilename, &db);
6404               assert( rc==SQLITE_OK );
6405               rc = sqlite3_exec(db, 
6406                 "BEGIN;"
6407                 "CREATE TABLE t1(x);"
6408                 "INSERT INTO t1 VALUES(zeroblob(1000)||'abcdefghijklmnopqrstuvwxyz');"
6409                 "COMMIT;"
6410                 "DELETE FROM t1;",
6411                 0, 0, 0
6412               );
6413               assert( rc==SQLITE_OK );
6414               sqlite3_close(db);
6415               in = fopen(zFilename, "r");
6416               assert( in!=0 );
6417               rc = fread(zBuf, 1, bufSize, in);
6418               assert( rc==bufSize );
6419               fclose(in);
6420               unlink(zFilename);
6421               free( zBuf );
6422               for(i=0; i<bufSize-11; i++){
6423                 if( *(zBuf+i)=='h' && memcmp(zBuf+i, "hijklmnopq", 10)==0 ){
6424                   return 1;
6425                 }
6426               }
6427               return 0;
6428             }],
6429             ac_cv_sqlite_secure_delete=yes,
6430             ac_cv_sqlite_secure_delete=no,
6431             ac_cv_sqlite_secure_delete=no
6432         )
6433     ])
6434     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6435     CFLAGS="$_SAVE_CFLAGS"
6436     LIBS="$_SAVE_LIBS"
6437     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6438         AC_MSG_ERROR([System Sqlite library is not compiled with SQLITE_SECURE_DELETE.])
6439     fi
6442 AC_SUBST(MOZ_NATIVE_SQLITE)
6444 dnl ========================================================
6445 dnl = Enable help viewer (off by default)
6446 dnl ========================================================
6447 MOZ_ARG_ENABLE_BOOL(help-viewer,
6448 [  --enable-help-viewer        Enable help viewer],
6449     MOZ_HELP_VIEWER=1,
6450     MOZ_HELP_VIEWER= )
6451 if test -n "$MOZ_HELP_VIEWER"; then
6452      AC_DEFINE(MOZ_HELP_VIEWER)
6454 AC_SUBST(MOZ_HELP_VIEWER)
6455 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6456     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6459 dnl ========================================================
6460 dnl = Enable safe browsing (anti-phishing)
6461 dnl ========================================================
6462 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6463 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6464     MOZ_SAFE_BROWSING=1,
6465     MOZ_SAFE_BROWSING= )
6466 if test -n "$MOZ_SAFE_BROWSING"; then
6467     AC_DEFINE(MOZ_SAFE_BROWSING)
6469 AC_SUBST(MOZ_SAFE_BROWSING)
6471 dnl ========================================================
6472 dnl = Enable faststart component
6473 dnl ========================================================
6474 MOZ_ARG_ENABLE_BOOL(faststart,
6475 [  --enable-faststart            Enable the faststart component],
6476     MOZ_FASTSTART=1,
6477     MOZ_FASTSTART= )
6478 if test -n "$MOZ_FASTSTART"; then
6479     AC_DEFINE(MOZ_FASTSTART)
6481 AC_SUBST(MOZ_FASTSTART)
6483 dnl ========================================================
6484 dnl = Enable url-classifier
6485 dnl ========================================================
6486 dnl Implicitly enabled by default if building with safe-browsing
6487 if test -n "$MOZ_SAFE_BROWSING"; then
6488     MOZ_URL_CLASSIFIER=1
6490 MOZ_ARG_ENABLE_BOOL(url-classifier,
6491 [  --enable-url-classifier        Enable url classifier module],
6492     MOZ_URL_CLASSIFIER=1,
6493     MOZ_URL_CLASSIFIER= )
6494 if test -n "$MOZ_URL_CLASSIFIER"; then
6495     AC_DEFINE(MOZ_URL_CLASSIFIER)
6497 AC_SUBST(MOZ_URL_CLASSIFIER)
6499 dnl ========================================================
6500 dnl = Disable zipwriter
6501 dnl ========================================================
6502 MOZ_ARG_DISABLE_BOOL(zipwriter,
6503 [  --disable-zipwriter             Disable zipwriter component],
6504     MOZ_ZIPWRITER=,
6505     MOZ_ZIPWRITER=1 )
6506 AC_SUBST(MOZ_ZIPWRITER)
6508 dnl ========================================================
6509 dnl = Disable libconic
6510 dnl ========================================================
6511 MOZ_ENABLE_LIBCONIC=1
6512 MOZ_ARG_DISABLE_BOOL(libconic,
6513 [  --disable-libconic              Disable libconic],
6514     MOZ_ENABLE_LIBCONIC=,
6515     MOZ_ENABLE_LIBCONIC=1 )
6517 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6518     PKG_CHECK_MODULES(LIBCONIC, conic,
6519                       MOZ_ENABLE_LIBCONIC=1,
6520                       MOZ_ENABLE_LIBCONIC=)
6522 if test "$MOZ_ENABLE_LIBCONIC"; then
6523     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6526 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6527 AC_SUBST(LIBCONIC_CFLAGS)
6528 AC_SUBST(LIBCONIC_LIBS)
6530 dnl ========================================================
6531 dnl = Maemo checks
6532 dnl ========================================================
6534 MAEMO_SDK_TARGET_VER=-1
6536 MOZ_ARG_WITH_STRING(maemo-version,
6537 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6538                         Maemo SDK Version],
6539   MAEMO_SDK_TARGET_VER=$withval)
6541 case "$MAEMO_SDK_TARGET_VER" in
6543     MOZ_PLATFORM_MAEMO=5
6544     ;;
6547     MOZ_PLATFORM_MAEMO=6
6548     ;;
6551     dnl We aren't compiling for Maemo, move on.
6552     ;;
6554     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6555     ;;
6556 esac
6558 if test $MOZ_PLATFORM_MAEMO; then
6559    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6561    if test -z "$MOZ_ENABLE_DBUS"; then
6562        AC_MSG_ERROR([DBus is required when building for Maemo])
6563    fi
6564    
6565    MOZ_GFX_OPTIMIZE_MOBILE=1
6566    MOZ_WEBGL_GLX=
6568    if test $MOZ_PLATFORM_MAEMO = 5; then
6569       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6570       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6571                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6572       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6573                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6575       AC_SUBST(XCOMPOSITE_LIBS)
6577       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6578       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6579       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6580       if test -z "$_LIB_FOUND"; then
6581          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6582       fi
6585       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6586       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6587       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6588       if test -z "$_LIB_FOUND"; then
6589          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6590       fi
6592       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6593       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6594       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6595       if test -z "$_LIB_FOUND"; then
6596          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6597       fi
6598    fi
6600    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6601    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6604 dnl ========================================================
6605 dnl = faststripe theme
6606 dnl ========================================================
6607 MOZ_ARG_ENABLE_BOOL(faststripe,
6608 [  --enable-faststripe  Use faststripe theme],
6609     MOZ_THEME_FASTSTRIPE=1,
6610     MOZ_THEME_FASTSTRIPE= )
6611 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6613 dnl ========================================================
6614 dnl =
6615 dnl = Feature options that require extra sources to be pulled
6616 dnl =
6617 dnl ========================================================
6618 dnl MOZ_ARG_HEADER(Features that require extra sources)
6620 dnl ========================================================
6621 dnl =
6622 dnl = Debugging Options
6623 dnl = 
6624 dnl ========================================================
6625 MOZ_ARG_HEADER(Debugging and Optimizations)
6627 dnl ========================================================
6628 dnl = Disable building with debug info.
6629 dnl = Debugging is OFF by default
6630 dnl ========================================================
6631 if test -z "$MOZ_DEBUG_FLAGS"
6632 then
6633     case "$target" in
6634     *-irix*)
6635         if test "$GNU_CC"; then
6636             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6637             case "$GCC_VERSION" in
6638             2.95.*)
6639                 MOZ_DEBUG_FLAGS=""
6640                 ;;
6641             *)
6642                 MOZ_DEBUG_FLAGS="-g"
6643                 ;;
6644             esac
6645         else
6646             MOZ_DEBUG_FLAGS="-g"
6647         fi
6648         ;;
6649     *)
6650         MOZ_DEBUG_FLAGS="-g"
6651         ;;
6652     esac
6655 MOZ_ARG_ENABLE_STRING(debug,
6656 [  --enable-debug[=DBG]    Enable building with developer debug info
6657                            (using compiler flags DBG)],
6658 [ if test "$enableval" != "no"; then
6659     MOZ_DEBUG=1
6660     if test -n "$enableval" -a "$enableval" != "yes"; then
6661         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6662         _MOZ_DEBUG_FLAGS_SET=1
6663     fi
6664   else
6665     MOZ_DEBUG=
6666   fi ],
6667   MOZ_DEBUG=)
6669 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6670  case "${target_os}" in
6671     beos*)
6672         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6673         ;;
6674     msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6675         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6676         ;;
6677     *) 
6678         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6679         ;;
6680   esac
6681 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6683 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6685 if test -n "$MOZ_DEBUG"; then
6686     AC_MSG_CHECKING([for valid debug flags])
6687     _SAVE_CFLAGS=$CFLAGS
6688     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6689     AC_TRY_COMPILE([#include <stdio.h>], 
6690         [printf("Hello World\n");],
6691         _results=yes,
6692         _results=no)
6693     AC_MSG_RESULT([$_results])
6694     if test "$_results" = "no"; then
6695         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6696     fi
6697     CFLAGS=$_SAVE_CFLAGS
6700 dnl ========================================================
6701 dnl enable mobile optimizations
6702 dnl ========================================================
6703 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6704 [  --enable-mobile-optimize   Enable mobile optimizations],
6705     MOZ_GFX_OPTIMIZE_MOBILE=1)
6707 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6709 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6710     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6713 dnl ========================================================
6714 dnl = Enable code optimization. ON by default.
6715 dnl ========================================================
6716 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6717         MOZ_OPTIMIZE_FLAGS="-O"
6720 MOZ_ARG_ENABLE_STRING(optimize,
6721 [  --disable-optimize      Disable compiler optimization
6722   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6723 [ if test "$enableval" != "no"; then
6724     MOZ_OPTIMIZE=1
6725     if test -n "$enableval" && test "$enableval" != "yes"; then
6726         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6727         MOZ_OPTIMIZE=2
6728     fi
6729 else
6730     MOZ_OPTIMIZE=
6731 fi ], MOZ_OPTIMIZE=1)
6733 if test "$COMPILE_ENVIRONMENT"; then
6734 if test -n "$MOZ_OPTIMIZE"; then
6735     AC_MSG_CHECKING([for valid optimization flags])
6736     _SAVE_CFLAGS=$CFLAGS
6737     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6738     AC_TRY_COMPILE([#include <stdio.h>], 
6739         [printf("Hello World\n");],
6740         _results=yes,
6741         _results=no)
6742     AC_MSG_RESULT([$_results])
6743     if test "$_results" = "no"; then
6744         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6745     fi
6746     CFLAGS=$_SAVE_CFLAGS
6748 fi # COMPILE_ENVIRONMENT
6750 AC_SUBST(MOZ_OPTIMIZE)
6751 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6752 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6753 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6755 dnl ========================================================
6756 dnl = (Deprecated) generation of debugger info for specific modules
6757 dnl ========================================================
6758 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6759 [  --enable-debugger-info-modules
6760                           Enable/disable debugger info for specific modules],
6761 [ if test "$enableval" != "no"; then
6762     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
6763     MOZ_DEBUG_SYMBOLS=1
6764   fi ])
6766 dnl ========================================================
6767 dnl = Enable generation of debug symbols
6768 dnl ========================================================
6769 MOZ_ARG_ENABLE_STRING(debug-symbols,
6770 [  --enable-debug-symbols[=DBG]    Enable debugging symbols
6771                                    (using compiler flags DBG)],
6772 [ if test "$enableval" != "no"; then
6773       MOZ_DEBUG_SYMBOLS=1
6774       if test -n "$enableval" -a "$enableval" != "yes"; then
6775           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6776               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6777           else
6778               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6779           fi
6780       fi
6781   fi ])
6783 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6784     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6785     export MOZ_DEBUG_SYMBOLS
6788 dnl ========================================================
6789 dnl Disable runtime logging checks
6790 dnl ========================================================
6791 MOZ_ARG_DISABLE_BOOL(logging,
6792 [  --disable-logging       Disable logging facilities],
6793     NS_DISABLE_LOGGING=1,
6794     NS_DISABLE_LOGGING= )
6795 if test "$NS_DISABLE_LOGGING"; then
6796     AC_DEFINE(NS_DISABLE_LOGGING)
6797 else
6798     AC_DEFINE(MOZ_LOGGING)
6801 dnl ========================================================
6802 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6803 dnl ========================================================
6804 _ENABLE_LOGREFCNT=42
6805 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6806 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6807     _ENABLE_LOGREFCNT=1,
6808     _ENABLE_LOGREFCNT= )
6809 if test "$_ENABLE_LOGREFCNT" = "1"; then
6810     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6811 elif test -z "$_ENABLE_LOGREFCNT"; then
6812     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6815 dnl ========================================================
6816 dnl = Enable trace malloc
6817 dnl ========================================================
6818 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6819 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6820 [  --enable-trace-malloc   Enable malloc tracing],
6821     NS_TRACE_MALLOC=1,
6822     NS_TRACE_MALLOC= )
6823 if test "$NS_TRACE_MALLOC"; then
6824   # Please, Mr. Linker Man, don't take away our symbol names
6825   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6826   USE_ELF_DYNSTR_GC=
6827   AC_DEFINE(NS_TRACE_MALLOC)
6829 AC_SUBST(NS_TRACE_MALLOC)
6831 dnl ========================================================
6832 dnl = Enable jemalloc
6833 dnl ========================================================
6834 MOZ_ARG_ENABLE_BOOL(jemalloc,
6835 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6836     MOZ_MEMORY=1,
6837     MOZ_MEMORY=)
6839 if test "$NS_TRACE_MALLOC"; then
6840     MOZ_MEMORY=
6843 if test "$MOZ_MEMORY"; then
6845   dnl Don't try to run compiler tests on Windows  
6846   if test "$OS_ARCH" = "WINNT"; then
6847     if test -z "$HAVE_64BIT_OS"; then
6848       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6849     else
6850       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6851     fi
6852   else
6853     AC_CHECK_SIZEOF([int *], [4])
6854     case "${ac_cv_sizeof_int_p}" in
6855     4)
6856       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6857       ;;
6858     8)
6859       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6860       ;;
6861     *)
6862       AC_MSG_ERROR([Unexpected pointer size])
6863       ;;
6864     esac
6865   fi
6867   AC_DEFINE(MOZ_MEMORY)
6868   if test "x$MOZ_DEBUG" = "x1"; then
6869     AC_DEFINE(MOZ_MEMORY_DEBUG)
6870   fi
6871   dnl The generic feature tests that determine how to compute ncpus are long and
6872   dnl complicated.  Therefore, simply define special cpp variables for the
6873   dnl platforms we have special knowledge of.
6874   case "${target_os}" in
6875   darwin*)
6876     AC_DEFINE(MOZ_MEMORY_DARWIN)
6877     ;;
6878   *freebsd*)
6879     AC_DEFINE(MOZ_MEMORY_BSD)
6880     ;;
6881   *linux*)
6882     AC_DEFINE(MOZ_MEMORY_LINUX)
6883     ;;
6884   netbsd*)
6885     AC_DEFINE(MOZ_MEMORY_BSD)
6886     ;;
6887   solaris*)
6888     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6889     ;;
6890   msvc*|mks*|cygwin*|mingw*)
6891     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6892     dnl This is sort of awful. Will revisit if we add support for more versions
6893     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
6894         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
6895     fi
6896     if test -z "$WIN32_CRT_SRC_DIR"; then
6897       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6898         AC_MSG_ERROR([When building jemalloc, set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src, but VCINSTALLDIR is not set, so I can't autodetect it for you).])
6899       else
6900         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6901       fi
6902     fi
6903     dnl cpu check
6904     case "${target_cpu}" in
6905     i*86)
6906       _WIN32_CRT_CPU=intel
6907       ;;
6908     *)
6909       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6910       ;;
6911     esac
6913     if test ! -d "$WIN32_CRT_SRC_DIR"; then
6914       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
6915     fi
6916     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
6917     _objdir_win=`pwd -W`
6918     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$_WIN32_CRT_CPU"
6919     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
6920     dnl Also pass this to NSPR/NSS
6921     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
6922     export DLLFLAGS
6923     ;;
6924   *wince)
6925     AC_DEFINE(MOZ_MEMORY_WINCE)
6926     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6927     if test -z "$WINCE_WINDOWS_MOBILE"; then
6928       AC_DEFINE(MOZ_MEMORY_WINCE6)
6929     fi
6930     ;;
6931   *winmo)
6932     AC_DEFINE(MOZ_MEMORY_WINCE)
6933     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6934     ;;
6935   *)
6936     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6937     ;;
6938   esac
6940   if test "$OS_ARCH" != "Darwin"; then
6941     dnl NB: this must be kept in sync with jemalloc.h
6942     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
6943     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
6944     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
6945   fi
6947 AC_SUBST(MOZ_MEMORY)
6948 AC_SUBST(MOZ_MEMORY_LDFLAGS)
6949 AC_SUBST(WIN32_CRT_SRC_DIR)
6950 dnl Need to set this for make because NSS doesn't have configure
6951 AC_SUBST(DLLFLAGS)
6953 dnl ========================================================
6954 dnl = Use malloc wrapper lib
6955 dnl ========================================================
6956 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6957 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6958     _WRAP_MALLOC=1,
6959     _WRAP_MALLOC= )
6961 if test -n "$_WRAP_MALLOC"; then
6962     if test "$GNU_CC"; then
6963     WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc"
6964     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6965     fi
6968 dnl ========================================================
6969 dnl = Location of malloc wrapper lib
6970 dnl ========================================================
6971 MOZ_ARG_WITH_STRING(wrap-malloc,
6972 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6973     WRAP_MALLOC_LIB=$withval)
6975 dnl ========================================================
6976 dnl = Use TraceVis
6977 dnl ========================================================
6978 MOZ_ARG_ENABLE_BOOL(tracevis,
6979 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
6980     MOZ_TRACEVIS=1,
6981     MOZ_TRACEVIS= )
6982 if test -n "$MOZ_TRACEVIS"; then
6983     AC_DEFINE(MOZ_TRACEVIS)
6986 dnl ========================================================
6987 dnl = Use Valgrind
6988 dnl ========================================================
6989 MOZ_ARG_ENABLE_BOOL(valgrind,
6990 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
6991     MOZ_VALGRIND=1,
6992     MOZ_VALGRIND= )
6993 if test -n "$MOZ_VALGRIND"; then
6994     AC_CHECK_HEADER([valgrind/valgrind.h], [],
6995         AC_MSG_ERROR(
6996             [--enable-valgrind specified but Valgrind is not installed]))
6997     AC_DEFINE(MOZ_VALGRIND)
7000 dnl ========================================================
7001 dnl jprof
7002 dnl ========================================================
7003 MOZ_ARG_ENABLE_BOOL(jprof,
7004 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
7005     MOZ_JPROF=1,
7006     MOZ_JPROF= )
7007 if test -n "$MOZ_JPROF"; then
7008     AC_DEFINE(MOZ_JPROF)
7011 dnl ========================================================
7012 dnl shark
7013 dnl ========================================================
7014 MOZ_ARG_ENABLE_BOOL(shark,
7015 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
7016     MOZ_SHARK=1,
7017     MOZ_SHARK= )
7018 if test -n "$MOZ_SHARK"; then
7019     AC_DEFINE(MOZ_SHARK)
7022 dnl ========================================================
7023 dnl callgrind
7024 dnl ========================================================
7025 MOZ_ARG_ENABLE_BOOL(callgrind,
7026 [  --enable-callgrind      Enable callgrind profiling],
7027     MOZ_CALLGRIND=1,
7028     MOZ_CALLGRIND= )
7029 if test -n "$MOZ_CALLGRIND"; then
7030     AC_DEFINE(MOZ_CALLGRIND)
7033 dnl ========================================================
7034 dnl vtune
7035 dnl ========================================================
7036 MOZ_ARG_ENABLE_BOOL(vtune,
7037 [  --enable-vtune          Enable vtune profiling],
7038     MOZ_VTUNE=1,
7039     MOZ_VTUNE= )
7040 if test -n "$MOZ_VTUNE"; then
7041     AC_DEFINE(MOZ_VTUNE)
7044 dnl ========================================================
7045 dnl Zealous JavaScript GC
7046 dnl ========================================================
7047 MOZ_ARG_ENABLE_BOOL(gczeal,
7048 [  --enable-gczeal          Enable zealous JavaScript GCing],
7049     JS_GC_ZEAL=1,
7050     JS_GC_ZEAL= )
7051 if test -n "$JS_GC_ZEAL"; then
7052     AC_DEFINE(JS_GC_ZEAL)
7055 dnl ========================================================
7056 dnl = Enable static checking using gcc-dehydra
7057 dnl ========================================================
7059 MOZ_ARG_WITH_STRING(static-checking,
7060 [  --with-static-checking=path/to/gcc_dehydra.so
7061                             Enable static checking of code using GCC-dehydra],
7062     DEHYDRA_PATH=$withval,
7063     DEHYDRA_PATH= )
7065 if test -n "$DEHYDRA_PATH"; then
7066     if test ! -f "$DEHYDRA_PATH"; then
7067         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7068     fi
7069     AC_DEFINE(NS_STATIC_CHECKING)
7071 AC_SUBST(DEHYDRA_PATH)
7073 dnl ========================================================
7074 dnl = Enable stripping of libs & executables
7075 dnl ========================================================
7076 MOZ_ARG_ENABLE_BOOL(strip,
7077 [  --enable-strip          Enable stripping of libs & executables ],
7078     ENABLE_STRIP=1,
7079     ENABLE_STRIP= )
7081 dnl ========================================================
7082 dnl = Enable stripping of libs & executables when packaging
7083 dnl ========================================================
7084 MOZ_ARG_ENABLE_BOOL(install-strip,
7085 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7086     PKG_SKIP_STRIP= ,
7087     PKG_SKIP_STRIP=1)
7089 dnl ========================================================
7090 dnl = --enable-elf-dynstr-gc
7091 dnl ========================================================
7092 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7093 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7094     USE_ELF_DYNSTR_GC=1,
7095     USE_ELF_DYNSTR_GC= )
7097 dnl ========================================================
7098 dnl = 
7099 dnl = Profiling and Instrumenting
7100 dnl = 
7101 dnl ========================================================
7102 MOZ_ARG_HEADER(Profiling and Instrumenting)
7104 dnl ========================================================
7105 dnl = Enable timeline service, which provides lightweight
7106 dnl = instrumentation of mozilla for performance measurement.
7107 dnl = Timeline is off by default.
7108 dnl ========================================================
7109 MOZ_ARG_ENABLE_BOOL(timeline,
7110 [  --enable-timeline       Enable timeline services ],
7111     MOZ_TIMELINE=1,
7112     MOZ_TIMELINE= )
7113 if test -n "$MOZ_TIMELINE"; then
7114     AC_DEFINE(MOZ_TIMELINE)
7117 dnl ========================================================
7118 dnl Turn on reflow counting
7119 dnl ========================================================
7120 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7121 [  --enable-reflow-perf    Enable reflow performance tracing],
7122     MOZ_REFLOW_PERF=1,
7123     MOZ_REFLOW_PERF= )
7124 if test -n "$MOZ_REFLOW_PERF"; then
7125     AC_DEFINE(MOZ_REFLOW_PERF)
7128 dnl ========================================================
7129 dnl Enable code size metrics.
7130 dnl ========================================================
7131 MOZ_ARG_ENABLE_BOOL(codesighs,
7132 [  --enable-codesighs      Enable code size analysis tools],
7133     _ENABLE_CODESIGHS=1,
7134     _ENABLE_CODESIGHS= )
7135 if test -n "$_ENABLE_CODESIGHS"; then
7136     if test -d $srcdir/tools/codesighs; then 
7137         MOZ_MAPINFO=1
7138     else
7139         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7140     fi
7143 MOZ_ARG_ENABLE_BOOL(insure,
7144 [  --enable-insure         Enable insure++ instrumentation (linux only)],
7145     _ENABLE_INSURE=1,
7146     _ENABLE_INSURE= )
7147 if test -n "$_ENABLE_INSURE"; then
7148     MOZ_INSURE="insure"
7149     MOZ_INSURIFYING=1
7150     MOZ_INSURE_DIRS="."
7151     MOZ_INSURE_EXCLUDE_DIRS="config"
7154 MOZ_ARG_WITH_STRING(insure-dirs,
7155 [  --with-insure-dirs=DIRS
7156                           Dirs to instrument with insure ],
7157     MOZ_INSURE_DIRS=$withval )
7159 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
7160 [  --with-insure-exclude-dirs=DIRS
7161                           Dirs to not instrument with insure ],
7162     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
7164 dnl ========================================================
7165 dnl = Support for Quantify (Windows)
7166 dnl ========================================================
7167 MOZ_ARG_ENABLE_BOOL(quantify,
7168 [  --enable-quantify      Enable Quantify support (Windows only) ],
7169     MOZ_QUANTIFY=1,
7170     MOZ_QUANTIFY= )
7172 dnl ========================================================
7173 dnl = Support for demangling undefined symbols
7174 dnl ========================================================
7175 if test -z "$SKIP_LIBRARY_CHECKS"; then
7176     AC_LANG_SAVE
7177     AC_LANG_CPLUSPLUS
7178     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7179     AC_LANG_RESTORE
7182 # Demangle only for debug or trace-malloc builds
7183 MOZ_DEMANGLE_SYMBOLS=
7184 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7185     MOZ_DEMANGLE_SYMBOLS=1
7186     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7188 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7190 dnl ========================================================
7191 dnl = Support for gcc stack unwinding (from gcc 3.3)
7192 dnl ========================================================
7193 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7194     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7197 dnl ========================================================
7198 dnl =
7199 dnl = Misc. Options
7200 dnl = 
7201 dnl ========================================================
7202 MOZ_ARG_HEADER(Misc. Options)
7204 dnl ========================================================
7205 dnl update xterm title
7206 dnl ========================================================
7207 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7208 [  --enable-xterm-updates  Update XTERM titles with current command.],
7209     MOZ_UPDATE_XTERM=1,
7210     MOZ_UPDATE_XTERM= )
7212 dnl =========================================================
7213 dnl = Chrome format
7214 dnl =========================================================
7215 MOZ_ARG_ENABLE_STRING([chrome-format],
7216 [  --enable-chrome-format=jar|flat|both|symlink
7217                           Select FORMAT of chrome files (default=jar)],
7218     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7220 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7221     MOZ_CHROME_FILE_FORMAT=jar
7224 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7225     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7226     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7227     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
7228     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
7231 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7232    AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7234 dnl ========================================================
7235 dnl = Define default location for MOZILLA_FIVE_HOME
7236 dnl ========================================================
7237 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7238 [  --with-default-mozilla-five-home
7239                           Set the default value for MOZILLA_FIVE_HOME],
7240 [ val=`echo $withval`
7241   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7243 dnl ========================================================
7244 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7245 dnl ========================================================
7246 MOZ_ARG_WITH_STRING(user-appdir,
7247 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7248 [ val=`echo $withval`
7249 if echo "$val" | grep "\/" >/dev/null; then
7250     AC_MSG_ERROR("Homedir must be single relative path.")
7251 else 
7252     MOZ_USER_DIR="$val"
7253 fi])
7255 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7257 dnl ========================================================
7258 dnl = Doxygen configuration
7259 dnl ========================================================
7260 dnl Use commas to specify multiple dirs to this arg
7261 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7262 MOZ_ARG_WITH_STRING(doc-input-dirs,
7263 [  --with-doc-input-dirs=DIRS
7264                           Header/idl dirs to create docs from],
7265 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7266 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7268 dnl Use commas to specify multiple dirs to this arg
7269 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7270 MOZ_ARG_WITH_STRING(doc-include-dirs,
7271 [  --with-doc-include-dirs=DIRS  
7272                           Include dirs to preprocess doc headers],
7273 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7274 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7276 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7277 MOZ_ARG_WITH_STRING(doc-output-dir,
7278 [  --with-doc-output-dir=DIR
7279                           Dir to generate docs into],
7280 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7281 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7283 if test -z "$SKIP_COMPILER_CHECKS"; then
7284 dnl ========================================================
7285 dnl =
7286 dnl = Compiler Options
7287 dnl = 
7288 dnl ========================================================
7289 MOZ_ARG_HEADER(Compiler Options)
7291 dnl ========================================================
7292 dnl Check for gcc -pipe support
7293 dnl ========================================================
7294 AC_MSG_CHECKING([for gcc -pipe support])
7295 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7296     echo '#include <stdio.h>' > dummy-hello.c
7297     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7298     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7299     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7300     if test $? = 0; then
7301         _res_as_stdin="yes"
7302     else
7303         _res_as_stdin="no"
7304     fi
7305     if test "$_res_as_stdin" = "yes"; then
7306         _SAVE_CFLAGS=$CFLAGS
7307         CFLAGS="$CFLAGS -pipe"
7308         AC_TRY_COMPILE( [ #include <stdio.h> ],
7309             [printf("Hello World\n");],
7310             [_res_gcc_pipe="yes"],
7311             [_res_gcc_pipe="no"] )
7312         CFLAGS=$_SAVE_CFLAGS
7313     fi
7314     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7315         _res="yes";
7316         CFLAGS="$CFLAGS -pipe"
7317         CXXFLAGS="$CXXFLAGS -pipe"
7318     else
7319         _res="no"
7320     fi
7321     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7322     AC_MSG_RESULT([$_res])
7323 else
7324     AC_MSG_RESULT([no])
7327 dnl pass -Wno-long-long to the compiler
7328 MOZ_ARG_ENABLE_BOOL(long-long-warning,
7329 [  --enable-long-long-warning 
7330                           Warn about use of non-ANSI long long type],
7331     _IGNORE_LONG_LONG_WARNINGS=,
7332     _IGNORE_LONG_LONG_WARNINGS=1)
7334 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
7335      _SAVE_CFLAGS="$CFLAGS"
7336      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
7337      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
7338      AC_TRY_COMPILE([], [return(0);], 
7339         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7340           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7341           result="yes" ], result="no")
7342      AC_MSG_RESULT([$result])
7343      CFLAGS="$_SAVE_CFLAGS"
7346 dnl ========================================================
7347 dnl Profile guided optimization
7348 dnl ========================================================
7349 dnl Test for profiling options
7350 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7351 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7353 dnl Provide a switch to disable PGO even when called via profiledbuild.
7354 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7355 [  --disable-profile-guided-optimization
7356                            Don't build with PGO even if called via make profiledbuild],
7357 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7358 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7360 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7362 _SAVE_CFLAGS="$CFLAGS"
7363 CFLAGS="$CFLAGS -fprofile-generate"
7365 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7366 AC_TRY_COMPILE([], [return 0;],
7367                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7368                  result="yes" ], result="no")
7369 AC_MSG_RESULT([$result])
7371 if test $result = "yes"; then
7372   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7373   PROFILE_USE_CFLAGS="-fprofile-use"
7374   PROFILE_USE_LDFLAGS="-fprofile-use"
7375 else
7376   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7377   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7378   AC_TRY_COMPILE([], [return 0;],
7379                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7380                    result="yes" ], result="no")
7381   AC_MSG_RESULT([$result])
7382   if test $result = "yes"; then
7383     PROFILE_USE_CFLAGS="-fbranch-probabilities"
7384   fi
7385   # don't really care, this is an old GCC
7386   PROFILE_GEN_LDFLAGS=
7387   PROFILE_USE_LDFLAGS=
7390 CFLAGS="$_SAVE_CFLAGS"
7392 if test -n "$INTEL_CC"; then
7393   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7394   PROFILE_GEN_LDFLAGS=
7395   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7396   PROFILE_USE_LDFLAGS=
7399 dnl Sun Studio on Solaris
7400 if test "$SOLARIS_SUNPRO_CC"; then
7401   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7402   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7403   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7404   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7407 AC_SUBST(PROFILE_GEN_CFLAGS)
7408 AC_SUBST(PROFILE_GEN_LDFLAGS)
7409 AC_SUBST(PROFILE_USE_CFLAGS)
7410 AC_SUBST(PROFILE_USE_LDFLAGS)
7412 AC_LANG_CPLUSPLUS
7414 dnl ========================================================
7415 dnl Test for -pedantic bustage
7416 dnl ========================================================
7417 MOZ_ARG_DISABLE_BOOL(pedantic,
7418 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7419 _PEDANTIC= )
7420 if test "$_PEDANTIC"; then
7421     _SAVE_CXXFLAGS=$CXXFLAGS
7422     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7423     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7424     AC_TRY_COMPILE([$configure_static_assert_macros],
7425                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7426                    result="no", result="yes" )
7427     AC_MSG_RESULT([$result])
7428     CXXFLAGS="$_SAVE_CXXFLAGS"
7430     case "$result" in
7431     no)
7432         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7433         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7434         ;;
7435     yes)
7436         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7437         ;;
7438     esac
7441 dnl ========================================================
7442 dnl Test for correct temporary object destruction order
7443 dnl ========================================================
7444 dnl We want to make sure the compiler follows the C++ spec here as 
7445 dnl xpcom and the string classes depend on it (bug 235381).
7446 AC_MSG_CHECKING([for correct temporary object destruction order])
7447 AC_TRY_RUN([ class A {
7448              public:  A(int& x) : mValue(x) {}
7449                       ~A() { mValue--; }
7450                       operator char**() { return 0; }
7451              private:  int& mValue;
7452              };
7453              void func(char **arg) {}
7454              int m=2;
7455              void test() {
7456                   func(A(m));
7457                   if (m==1) m = 0;
7458              }
7459              int main() {
7460                  test();
7461                  return(m);
7462              }
7463              ],
7464      result="yes", result="no", result="maybe")
7465 AC_MSG_RESULT([$result])
7467 if test "$result" = "no"; then
7468     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7471 dnl ========================================================
7472 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7473 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7474 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7475 dnl ========================================================
7476 _SAVE_CXXFLAGS=$CXXFLAGS
7477 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7478 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7479     ac_nscap_nonconst_opeq_bug,
7480     [AC_TRY_COMPILE([
7481                       template <class T>
7482                       class Pointer
7483                         {
7484                         public:
7485                           T* myPtr;
7486                         };
7487                       
7488                       template <class T, class U>
7489                       int operator==(const Pointer<T>& rhs, U* lhs)
7490                         {
7491                           return rhs.myPtr == lhs;
7492                         }
7493                       
7494                       template <class T, class U>
7495                       int operator==(const Pointer<T>& rhs, const U* lhs)
7496                         {
7497                           return rhs.myPtr == lhs;
7498                         }
7499                     ],
7500                     [
7501                       Pointer<int> foo;
7502                       const int* bar;
7503                       return foo == bar;
7504                     ],
7505                     ac_nscap_nonconst_opeq_bug="no",
7506                     ac_nscap_nonconst_opeq_bug="yes")])
7507 CXXFLAGS="$_SAVE_CXXFLAGS"
7509 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7510     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7512 fi # SKIP_COMPILER_CHECKS
7514 dnl ========================================================
7515 dnl C++ rtti
7516 dnl Should be smarter and check that the compiler does indeed have rtti
7517 dnl ========================================================
7519 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7520 [  --enable-cpp-rtti       Enable C++ RTTI ],
7521 [ _MOZ_USE_RTTI=1 ],
7522 [ _MOZ_USE_RTTI= ])
7524 if test "$_MOZ_USE_RTTI"; then
7525    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7526 else
7527    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7530 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7532 dnl ========================================================
7533 dnl C++ exceptions (g++/egcs only - for now)
7534 dnl Should be smarter and check that the compiler does indeed have exceptions
7535 dnl ========================================================
7536 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7537 [  --enable-cpp-exceptions Enable C++ exceptions ],
7538 [ _MOZ_CPP_EXCEPTIONS=1 ],
7539 [ _MOZ_CPP_EXCEPTIONS= ])
7541 if test "$_MOZ_CPP_EXCEPTIONS"; then
7542     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7543 else
7544     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7547 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7549 # Irix & OSF native compilers do not like exception declarations 
7550 # when exceptions are disabled
7551 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7552     AC_DEFINE(CPP_THROW_NEW, [])
7553 else
7554     AC_DEFINE(CPP_THROW_NEW, [throw()])
7556 AC_LANG_C
7558 dnl ========================================================
7559 dnl =
7560 dnl = Build depencency options
7561 dnl =
7562 dnl ========================================================
7563 MOZ_ARG_HEADER(Build dependencies)
7565 dnl ========================================================
7566 dnl = Do not auto generate dependency info
7567 dnl ========================================================
7568 MOZ_AUTO_DEPS=1
7569 MOZ_ARG_DISABLE_BOOL(auto-deps,
7570 [  --disable-auto-deps     Do not automatically generate dependency info],
7571     MOZ_AUTO_DEPS=,
7572     MOZ_AUTO_DEPS=1)
7574 if test -n "$MOZ_AUTO_DEPS"; then
7575 dnl ========================================================
7576 dnl = Use mkdepend instead of $CC -MD for dependency generation
7577 dnl ========================================================
7578 _cpp_md_flag=
7579 MOZ_ARG_DISABLE_BOOL(md,
7580 [  --disable-md            Do not use compiler-based dependencies ],
7581   [_cpp_md_flag=],
7582   [_cpp_md_flag=1],
7583   [dnl Default is to turn on -MD if using GNU-compatible compilers
7584    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7585      _cpp_md_flag=1
7586    fi
7587   dnl Default is to use -xM if using Sun Studio on Solaris
7588    if test "$SOLARIS_SUNPRO_CC"; then
7589      _cpp_md_flag=1
7590    fi])
7591 if test "$_cpp_md_flag"; then
7592   COMPILER_DEPEND=1
7593   if test "$OS_ARCH" = "OpenVMS"; then
7594     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7595   else
7596     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7597   fi
7598   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7599   if test "$SOLARIS_SUNPRO_CC"; then
7600     _DEPEND_CFLAGS=
7601   fi
7602 else
7603   COMPILER_DEPEND=
7604   dnl Don't override this for MSVC
7605   if test -z "$_WIN32_MSVC"; then
7606     _USE_CPP_INCLUDE_FLAG=
7607     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7608     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7609   fi
7611 fi # MOZ_AUTO_DEPS
7612 MDDEPDIR='.deps'
7613 AC_SUBST(MOZ_AUTO_DEPS)
7614 AC_SUBST(COMPILER_DEPEND)
7615 AC_SUBST(MDDEPDIR)
7618 dnl ========================================================
7619 dnl =
7620 dnl = Static Build Options
7621 dnl =
7622 dnl ========================================================
7623 MOZ_ARG_HEADER(Static build options)
7625 MOZ_ARG_ENABLE_BOOL(static,
7626 [  --enable-static         Enable building of internal static libs],
7627     BUILD_STATIC_LIBS=1,
7628     BUILD_STATIC_LIBS=)
7630 MOZ_ARG_ENABLE_BOOL(libxul,
7631 [  --enable-libxul         Enable building of libxul],
7632     MOZ_ENABLE_LIBXUL=1,
7633     MOZ_ENABLE_LIBXUL=)
7635 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7636         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7639 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7640         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7643 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
7644     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
7647 AC_SUBST(LIBXUL_LIBS)
7649 if test -n "$MOZ_ENABLE_LIBXUL"; then
7650     XPCOM_LIBS="$LIBXUL_LIBS"
7651     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7652 else
7653     if test -n "$BUILD_STATIC_LIBS"; then
7654         AC_DEFINE(MOZ_STATIC_BUILD)
7655     fi
7656     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7659 dnl ========================================================
7660 dnl =
7661 dnl = Standalone module options
7662 dnl = 
7663 dnl ========================================================
7664 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7666 dnl Check for GLib and libIDL.
7667 dnl ========================================================
7668 case "$target_os" in
7669 msvc*|mks*|cygwin*|mingw*|wince*|winmo*)
7670     SKIP_IDL_CHECK="yes"
7671     ;;
7673     SKIP_IDL_CHECK="no"
7674     ;;
7675 esac
7677 if test -z "$COMPILE_ENVIRONMENT"; then
7678     SKIP_IDL_CHECK="yes"
7681 dnl = Allow users to disable libIDL checking for standalone modules
7682 MOZ_ARG_WITHOUT_BOOL(libIDL,
7683 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7684         SKIP_IDL_CHECK="yes")
7686 if test "$SKIP_IDL_CHECK" = "no"
7687 then
7688     _LIBIDL_FOUND=
7689     if test "$MACOS_SDK_DIR"; then 
7690       dnl xpidl, and therefore libIDL, is only needed on the build host.
7691       dnl Don't build it against the SDK, as that causes problems.
7692       _MACSAVE_CFLAGS="$CFLAGS"
7693       _MACSAVE_LIBS="$LIBS"
7694       _MACSAVE_LDFLAGS="$LDFLAGS"
7695       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7696       changequote(,)
7697       CFLAGS=`echo $CFLAGS|sed -E -e "s%((-I|-isystem )${MACOS_SDK_DIR}/usr/(include|lib/gcc)[^ ]*)|-F${MACOS_SDK_DIR}(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot ${MACOS_SDK_DIR}%%g"`
7698       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7699       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7700       changequote([,])
7701       unset NEXT_ROOT
7702     fi
7704     if test "$MOZ_ENABLE_GTK2"; then
7705         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7706     fi
7707     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7708     dnl to either libIDL1 or libIDL2.
7709     if test -z "$_LIBIDL_FOUND"; then
7710         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7711         if test -z "$_LIBIDL_FOUND"; then
7712             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7713         fi
7714     fi
7715     dnl
7716     dnl If we don't have a libIDL config program & not cross-compiling, 
7717     dnl     look for orbit-config instead.
7718     dnl
7719     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7720         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7721         if test -n "$ORBIT_CONFIG"; then
7722             AC_MSG_CHECKING([for ORBit libIDL usability])
7723                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7724             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7725             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7726             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7727             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7728             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7729             LIBIDL_CONFIG=
7730             _SAVE_CFLAGS="$CFLAGS"
7731             _SAVE_LIBS="$LIBS"
7732             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7733             LIBS="$LIBIDL_LIBS $LIBS"
7734             AC_TRY_RUN([
7735 #include <stdlib.h>
7736 #include <libIDL/IDL.h>
7737 int main() {
7738   char *s;
7739   s=strdup(IDL_get_libver_string());
7740   if(s==NULL) {
7741     exit(1);
7742   }
7743   exit(0);
7745             ], [_LIBIDL_FOUND=1
7746                 result="yes"],
7747                [LIBIDL_CFLAGS=
7748                 LIBIDL_LIBS=
7749                 result="no"],
7750                [_LIBIDL_FOUND=1
7751                 result="maybe"] )
7752             AC_MSG_RESULT($result)
7753             CFLAGS="$_SAVE_CFLAGS"
7754             LIBS="$_SAVE_LIBS"
7755         fi
7756     fi
7757     if test -z "$_LIBIDL_FOUND"; then
7758         AC_MSG_ERROR([libIDL not found.
7759         libIDL $LIBIDL_VERSION or higher is required.])
7760     fi
7761     if test "$MACOS_SDK_DIR"; then
7762       CFLAGS="$_MACSAVE_CFLAGS"
7763       LIBS="$_MACSAVE_LIBS"
7764       LDFLAGS="$_MACSAVE_LDFLAGS"
7765       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7766         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7767       fi
7768     fi
7771 if test -n "$CROSS_COMPILE"; then
7772      if test -z "$HOST_LIBIDL_CONFIG"; then
7773         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7774     fi
7775     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7776         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7777         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7778     else
7779         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7780         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7781     fi
7784 if test -z "$SKIP_PATH_CHECKS"; then
7785 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7786     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7787         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7788     else
7789         AM_PATH_GLIB(${GLIB_VERSION})
7790     fi
7794 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7795     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7798 AC_SUBST(LIBIDL_CFLAGS)
7799 AC_SUBST(LIBIDL_LIBS)
7800 AC_SUBST(STATIC_LIBIDL)
7801 AC_SUBST(GLIB_CFLAGS)
7802 AC_SUBST(GLIB_LIBS)
7803 AC_SUBST(GLIB_GMODULE_LIBS)
7804 AC_SUBST(HOST_LIBIDL_CONFIG)
7805 AC_SUBST(HOST_LIBIDL_CFLAGS)
7806 AC_SUBST(HOST_LIBIDL_LIBS)
7808 dnl ========================================================
7809 dnl Check for cairo
7810 dnl ========================================================
7811 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7813 MOZ_TREE_CAIRO=1
7814 MOZ_ARG_ENABLE_BOOL(system-cairo,
7815 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7816 MOZ_TREE_CAIRO=,
7817 MOZ_TREE_CAIRO=1 )
7819 # Check for headers defining standard int types.
7820 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7822 if test "$MOZ_TREE_CAIRO"; then
7823     AC_DEFINE(MOZ_TREE_CAIRO)
7825     # For now we assume that we will have a uint64_t available through
7826     # one of the above headers or mozstdint.h.
7827     AC_DEFINE(HAVE_UINT64_T)
7829     # Define macros for cairo-features.h
7830     if test "$MOZ_X11"; then
7831         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7832         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7833         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7834         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7835         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7836         MOZ_ENABLE_CAIRO_FT=1
7837         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7838     fi
7839     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7840         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7841     fi
7842     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7843         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7844         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7845         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7846     fi
7847     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7848         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7849         if test -z "$WINCE"; then
7850             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7851             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7852                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7853                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7854                 MOZ_ENABLE_D2D_SURFACE=1
7855                 MOZ_ENABLE_DWRITE_FONT=1
7856             else
7857                 WIN32_DWRITE_FONT_FEATURE=
7858                 WIN32_D2D_SURFACE_FEATURE=
7859             fi
7860         else
7861             WIN32_FONT_FEATURE=
7862             WIN32_DWRITE_FONT_FEATURE=
7863             WIN32_D2D_SURFACE_FEATURE=
7864         fi
7866         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
7867         if test -z "$HAS_DDRAW"; then
7868             AC_MSG_WARN([DirectDraw ddraw.h header not found or it's missing DDLOCK_WAITNOTBUSY, disabling DirectDraw surface.  If you have an older SDK (such as the CE5 SDK), try copying in ddraw.lib and ddraw.h from the WM6 SDK.])
7869             DDRAW_SURFACE_FEATURE=
7870         else
7871             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
7872         fi
7874         if test -z "$OGLES_SDK_DIR"; then
7875             OGLES_SURFACE_FEATURE=
7876         else
7877             AC_TRY_COMPILE([
7878               #include <EGL/egl.h>
7879               #include <EGL/eglext.h>
7880               #include <GLES2/gl2.h>
7881               #include <GLES2/gl2ext.h>
7882             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
7883             if test -z "$HAS_OGLES"; then
7884               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
7885               OGLES_SURFACE_FEATURE=
7886             else
7887               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
7888             fi
7889         fi
7891         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7892     fi
7893     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7894         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7895         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7896         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7897         MOZ_ENABLE_CAIRO_FT=1
7898         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7899         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7900     fi
7901     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7902         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7903         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7904         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7905         MOZ_ENABLE_CAIRO_FT=1
7906     fi
7907     if test "$USE_FC_FREETYPE"; then
7908         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7909     fi
7910     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7911     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
7912     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
7913     AC_SUBST(CAIRO_FT_CFLAGS)
7914     AC_SUBST(HAS_OGLES)
7916     if test "$MOZ_DEBUG"; then
7917       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7918     else
7919       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7920     fi
7922     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7924     AC_SUBST(PS_SURFACE_FEATURE)
7925     AC_SUBST(PDF_SURFACE_FEATURE)
7926     AC_SUBST(SVG_SURFACE_FEATURE)
7927     AC_SUBST(XLIB_SURFACE_FEATURE)
7928     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7929     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7930     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7931     AC_SUBST(XCB_SURFACE_FEATURE)
7932     AC_SUBST(WIN32_SURFACE_FEATURE)
7933     AC_SUBST(DDRAW_SURFACE_FEATURE)
7934     AC_SUBST(OGLES_SURFACE_FEATURE)    
7935     AC_SUBST(OS2_SURFACE_FEATURE)
7936     AC_SUBST(BEOS_SURFACE_FEATURE)
7937     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7938     AC_SUBST(FT_FONT_FEATURE)
7939     AC_SUBST(FC_FONT_FEATURE)
7940     AC_SUBST(WIN32_FONT_FEATURE)
7941     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
7942     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
7943     AC_SUBST(QUARTZ_FONT_FEATURE)
7944     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7945     AC_SUBST(QT_SURFACE_FEATURE)
7947     if test "$_WIN32_MSVC"; then
7948         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7949     else
7950         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
7952         if test "$MOZ_X11"; then
7953             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7954         fi
7955     fi
7957     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7958     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7960 else
7961    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
7962    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7963    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7964    if test "$MOZ_X11"; then
7965         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7966         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7967         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7968    fi
7971 AC_SUBST(MOZ_TREE_CAIRO)
7972 AC_SUBST(MOZ_CAIRO_CFLAGS)
7973 AC_SUBST(MOZ_CAIRO_LIBS)
7975 dnl qcms
7976 dnl ========================================================
7978 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7979 AC_SUBST(QCMS_LIBS)
7981 dnl ========================================================
7982 dnl disable xul
7983 dnl ========================================================
7984 MOZ_ARG_DISABLE_BOOL(xul,
7985 [  --disable-xul           Disable XUL],
7986     MOZ_XUL= )
7987 if test "$MOZ_XUL"; then
7988   AC_DEFINE(MOZ_XUL)
7989 else
7990   dnl remove extensions that require XUL
7991   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7994 AC_SUBST(MOZ_XUL)
7996 dnl ========================================================
7997 dnl disable profile locking
7998 dnl   do no use this in applications that can have more than
7999 dnl   one process accessing the profile directory.
8000 dnl ========================================================
8001 MOZ_ARG_DISABLE_BOOL(profilelocking,
8002 [  --disable-profilelocking           Disable profile locking],
8003     MOZ_PROFILELOCKING=,
8004     MOZ_PROFILELOCKING=1 )
8005 if test "$MOZ_PROFILELOCKING"; then
8006   AC_DEFINE(MOZ_PROFILELOCKING)
8009 dnl ========================================================
8010 dnl disable rdf services
8011 dnl ========================================================
8012 MOZ_ARG_DISABLE_BOOL(rdf,
8013 [  --disable-rdf           Disable RDF],
8014     MOZ_RDF= )
8015 if test "$MOZ_RDF"; then
8016   AC_DEFINE(MOZ_RDF)
8019 AC_SUBST(MOZ_RDF)
8021 dnl ========================================================
8022 dnl necko configuration options
8023 dnl ========================================================
8026 dnl option to disable various necko protocols
8028 MOZ_ARG_ENABLE_STRING(necko-protocols,
8029 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8030                           Enable/disable specific protocol handlers],
8031 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8032     if test "$option" = "yes" || test "$option" = "all"; then
8033         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8034     elif test "$option" = "no" || test "$option" = "none"; then
8035         NECKO_PROTOCOLS=""
8036     elif test "$option" = "default"; then
8037         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8038     elif test `echo "$option" | grep -c \^-` != 0; then
8039         option=`echo $option | sed 's/^-//'`
8040         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8041     else
8042         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8043     fi
8044 done],
8045     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8046 dnl Remove dupes
8047 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8048 AC_SUBST(NECKO_PROTOCOLS)
8049 for p in $NECKO_PROTOCOLS; do
8050     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8051 done
8054 dnl option to disable necko's disk cache
8056 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8057 [  --disable-necko-disk-cache
8058                           Disable necko disk cache],
8059     NECKO_DISK_CACHE=,
8060     NECKO_DISK_CACHE=1)
8061 AC_SUBST(NECKO_DISK_CACHE)
8062 if test "$NECKO_DISK_CACHE"; then
8063     AC_DEFINE(NECKO_DISK_CACHE)
8067 dnl option to disable necko's wifi scanner
8069 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8070 [  --disable-necko-wifi   Disable necko wifi scanner],
8071     NECKO_WIFI=,
8072     NECKO_WIFI=1
8075 if test "$OS_ARCH" = "OS2"; then
8076   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8077   NECKO_WIFI=
8079 if test "$NECKO_WIFI" -a \
8080         "$OS_ARCH" != "Linux" -a \
8081         "$OS_ARCH" != "Darwin" -a \
8082         "$OS_ARCH" != "SunOS" -a \
8083         "$OS_ARCH" != "WINNT" -a \
8084         "$OS_ARCH" != "WINCE"; then
8085   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8088 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8089 then
8090   AC_CHECK_HEADER([iwlib.h])
8091   if test "$ac_cv_header_iwlib_h" != "yes"; then
8092     AC_MSG_ERROR([Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora)); use --disable-necko-wifi to disable])
8093   fi
8096 if test "$NECKO_WIFI"; then
8097   AC_DEFINE(NECKO_WIFI)
8099 AC_SUBST(NECKO_WIFI)
8102 dnl option to minimize size of necko's i/o buffers
8104 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
8105 [  --enable-necko-small-buffers
8106                           Minimize size of necko's i/o buffers],
8107     NECKO_SMALL_BUFFERS=1,
8108     NECKO_SMALL_BUFFERS=)
8109 AC_SUBST(NECKO_SMALL_BUFFERS)
8110 if test "$NECKO_SMALL_BUFFERS"; then
8111     AC_DEFINE(NECKO_SMALL_BUFFERS)
8112 fi 
8115 dnl option to disable cookies
8117 MOZ_ARG_DISABLE_BOOL(cookies,
8118 [  --disable-cookies       Disable cookie support],
8119     NECKO_COOKIES=,
8120     NECKO_COOKIES=1)
8121 AC_SUBST(NECKO_COOKIES)
8122 if test "$NECKO_COOKIES"; then
8123     AC_DEFINE(NECKO_COOKIES)
8127 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8129 MOZ_ARG_DISABLE_BOOL(ctypes,
8130 [  --disable-ctypes        Disable js-ctypes],
8131     BUILD_CTYPES=,
8132     BUILD_CTYPES=1)
8133 AC_SUBST(BUILD_CTYPES)
8134 if test "$BUILD_CTYPES"; then
8135   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8136     # Disable ctypes for arm/wince.
8137     BUILD_CTYPES=
8138   elif test "$_MSC_VER" && test -z $AS; then
8139     # Disable ctypes if we're on MSVC and MASM is unavailable.
8140     AC_MSG_ERROR([No suitable assembler found. An assembler is required to build js-ctypes. You may --disable-ctypes to avoid this. If you are building with MS Visual Studio 8 Express, you may download the MASM 8.0 package, upgrade to Visual Studio 9 Express, or install the Vista SDK.])
8141   else
8142     AC_DEFINE(BUILD_CTYPES)
8143   fi
8146 dnl NECKO_ configuration options are not global
8147 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8149 dnl Only build Mork if it's required
8150 AC_SUBST(MOZ_MORK)
8151 if test "$MOZ_MORK"; then
8152   AC_DEFINE(MOZ_MORK)
8155 dnl Build the lightweight Mork reader if required
8156 AC_SUBST(MOZ_MORKREADER)
8157 if test "$MOZ_MORKREADER"; then
8158   AC_DEFINE(MOZ_MORKREADER)
8161 dnl ========================================================
8162 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8163     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8166 dnl ========================================================
8167 dnl =
8168 dnl = Maintainer debug option (no --enable equivalent)
8169 dnl =
8170 dnl ========================================================
8172 AC_SUBST(AR)
8173 AC_SUBST(AR_FLAGS)
8174 AC_SUBST(AR_LIST)
8175 AC_SUBST(AR_EXTRACT)
8176 AC_SUBST(AR_DELETE)
8177 AC_SUBST(AS)
8178 AC_SUBST(ASFLAGS)
8179 AC_SUBST(AS_DASH_C_FLAG)
8180 AC_SUBST(LD)
8181 AC_SUBST(RC)
8182 AC_SUBST(RCFLAGS)
8183 AC_SUBST(WINDRES)
8184 AC_SUBST(IMPLIB)
8185 AC_SUBST(FILTER)
8186 AC_SUBST(BIN_FLAGS)
8187 AC_SUBST(NS_USE_NATIVE)
8188 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8189 AC_SUBST(MOZ_UPDATE_XTERM)
8190 AC_SUBST(MINIMO)
8191 AC_SUBST(MOZ_PLATFORM_MAEMO)
8192 AC_SUBST(MOZ_AUTH_EXTENSION)
8193 AC_SUBST(MOZ_MATHML)
8194 AC_SUBST(MOZ_PERMISSIONS)
8195 AC_SUBST(MOZ_XTF)
8196 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8197 AC_SUBST(MOZ_PREF_EXTENSIONS)
8198 AC_SUBST(MOZ_SVG)
8199 AC_SUBST(MOZ_SMIL)
8200 AC_SUBST(MOZ_XSLT_STANDALONE)
8201 AC_SUBST(MOZ_JS_LIBS)
8202 AC_SUBST(MOZ_PSM)
8203 AC_SUBST(MOZ_DEBUG)
8204 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8205 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8206 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8207 AC_SUBST(MOZ_DEBUG_FLAGS)
8208 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8209 AC_SUBST(WARNINGS_AS_ERRORS)
8210 AC_SUBST(MOZ_EXTENSIONS)
8211 AC_SUBST(MOZ_IMG_DECODERS)
8212 AC_SUBST(MOZ_IMG_ENCODERS)
8213 AC_SUBST(MOZ_JSDEBUGGER)
8214 AC_SUBST(MOZ_PLUGINS)
8215 AC_SUBST(MOZ_LOG_REFCNT)
8216 AC_SUBST(MOZ_LEAKY)
8217 AC_SUBST(MOZ_JPROF)
8218 AC_SUBST(MOZ_SHARK)
8219 AC_SUBST(MOZ_CALLGRIND)
8220 AC_SUBST(MOZ_VTUNE)
8221 AC_SUBST(MOZ_XPCTOOLS)
8222 AC_SUBST(MOZ_JSLOADER)
8223 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8224 AC_SUBST(MOZ_INSURE)
8225 AC_SUBST(MOZ_INSURE_DIRS)
8226 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
8227 AC_SUBST(MOZ_QUANTIFY)
8228 AC_SUBST(MOZ_INSURIFYING)
8229 AC_SUBST(LIBICONV)
8230 AC_SUBST(MOZ_PLACES)
8231 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8232 AC_SUBST(MOZ_STORAGE)
8233 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8234 AC_SUBST(MOZ_FEEDS)
8235 AC_SUBST(NS_PRINTING)
8236 AC_SUBST(MOZ_WEBGL)
8238 AC_SUBST(MOZ_JAVAXPCOM)
8239 AC_SUBST(JAVA_INCLUDE_PATH)
8240 AC_SUBST(JAVA)
8241 AC_SUBST(JAVAC)
8242 AC_SUBST(JAR)
8244 AC_SUBST(MOZ_PROFILELOCKING)
8246 AC_SUBST(HAVE_XIE)
8247 AC_SUBST(MOZ_XIE_LIBS)
8248 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8250 AC_SUBST(BUILD_STATIC_LIBS)
8251 AC_SUBST(MOZ_ENABLE_LIBXUL)
8252 AC_SUBST(ENABLE_TESTS)
8253 AC_SUBST(IBMBIDI)
8254 AC_SUBST(MOZ_UNIVERSALCHARDET)
8255 AC_SUBST(ACCESSIBILITY)
8256 AC_SUBST(MOZ_XPINSTALL)
8257 AC_SUBST(MOZ_VIEW_SOURCE)
8258 AC_SUBST(MOZ_SPELLCHECK)
8259 AC_SUBST(MOZ_XPFE_COMPONENTS)
8260 AC_SUBST(MOZ_USER_DIR)
8261 AC_SUBST(MOZ_CRASHREPORTER)
8263 AC_SUBST(ENABLE_STRIP)
8264 AC_SUBST(PKG_SKIP_STRIP)
8265 AC_SUBST(USE_ELF_DYNSTR_GC)
8266 AC_SUBST(INCREMENTAL_LINKER)
8267 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8268 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8270 AC_SUBST(MOZ_FIX_LINK_PATHS)
8271 AC_SUBST(XPCOM_LIBS)
8272 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8273 AC_SUBST(XPCOM_GLUE_LDOPTS)
8274 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8276 AC_SUBST(USE_DEPENDENT_LIBS)
8278 AC_SUBST(MOZ_BUILD_ROOT)
8279 AC_SUBST(MOZ_OS2_TOOLS)
8280 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8282 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8283 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8284 AC_SUBST(MOZ_TIMELINE)
8285 AC_SUBST(OGLES_SDK_DIR)
8287 AC_SUBST(MOZ_APP_NAME)
8288 AC_SUBST(MOZ_APP_DISPLAYNAME)
8289 AC_SUBST(MOZ_APP_VERSION)
8290 AC_SUBST(MOZ_APP_UA_EXTRA)
8291 AC_SUBST(FIREFOX_VERSION)
8293 AC_SUBST(MOZ_PKG_SPECIAL)
8295 AC_SUBST(MOZILLA_OFFICIAL)
8297 dnl win32 options
8298 AC_SUBST(MOZ_MAPINFO)
8299 AC_SUBST(MOZ_BROWSE_INFO)
8300 AC_SUBST(MOZ_TOOLS_DIR)
8301 AC_SUBST(CYGWIN_WRAPPER)
8302 AC_SUBST(AS_PERL)
8303 AC_SUBST(WIN32_REDIST_DIR)
8304 AC_SUBST(PYTHON)
8306 AC_SUBST(WINCE)
8307 AC_SUBST(WINCE_SDK_DIR)
8308 AC_SUBST(WINCE_WINDOWS_MOBILE)
8310 dnl Echo the CFLAGS to remove extra whitespace.
8311 CFLAGS=`echo \
8312         $_WARNINGS_CFLAGS \
8313         $CFLAGS`
8315 CXXFLAGS=`echo \
8316         $_MOZ_RTTI_FLAGS \
8317         $_MOZ_EXCEPTIONS_FLAGS \
8318         $_WARNINGS_CXXFLAGS \
8319         $CXXFLAGS`
8321 COMPILE_CFLAGS=`echo \
8322     $_DEFINES_CFLAGS \
8323         $_DEPEND_CFLAGS \
8324     $COMPILE_CFLAGS`
8326 COMPILE_CXXFLAGS=`echo \
8327     $_DEFINES_CXXFLAGS \
8328         $_DEPEND_CFLAGS \
8329     $COMPILE_CXXFLAGS`
8331 AC_SUBST(SYSTEM_MAKEDEPEND)
8332 AC_SUBST(SYSTEM_LIBXUL)
8333 AC_SUBST(SYSTEM_JPEG)
8334 AC_SUBST(SYSTEM_PNG)
8335 AC_SUBST(SYSTEM_ZLIB)
8336 AC_SUBST(SYSTEM_BZ2)
8338 AC_SUBST(JPEG_CFLAGS)
8339 AC_SUBST(JPEG_LIBS)
8340 AC_SUBST(ZLIB_CFLAGS)
8341 AC_SUBST(ZLIB_LIBS)
8342 AC_SUBST(BZ2_CFLAGS)
8343 AC_SUBST(BZ2_LIBS)
8344 AC_SUBST(PNG_CFLAGS)
8345 AC_SUBST(PNG_LIBS)
8347 AC_SUBST(MOZ_JPEG_CFLAGS)
8348 AC_SUBST(MOZ_JPEG_LIBS)
8349 AC_SUBST(MOZ_ZLIB_CFLAGS)
8350 AC_SUBST(MOZ_ZLIB_LIBS)
8351 AC_SUBST(MOZ_BZ2_CFLAGS)
8352 AC_SUBST(MOZ_BZ2_LIBS)
8353 AC_SUBST(MOZ_PNG_CFLAGS)
8354 AC_SUBST(MOZ_PNG_LIBS)
8356 AC_SUBST(NSPR_CFLAGS)
8357 AC_SUBST(NSPR_LIBS)
8358 AC_SUBST(MOZ_NATIVE_NSPR)
8360 AC_SUBST(NSS_CFLAGS)
8361 AC_SUBST(NSS_LIBS)
8362 AC_SUBST(NSS_DEP_LIBS)
8363 AC_SUBST(MOZ_NATIVE_NSS)
8364 AC_SUBST(NSS_DISABLE_DBM)
8366 AC_SUBST(CFLAGS)
8367 AC_SUBST(CXXFLAGS)
8368 AC_SUBST(CPPFLAGS)
8369 AC_SUBST(COMPILE_CFLAGS)
8370 AC_SUBST(COMPILE_CXXFLAGS)
8371 AC_SUBST(LDFLAGS)
8372 AC_SUBST(LIBS)
8373 AC_SUBST(CROSS_COMPILE)
8374 AC_SUBST(WCHAR_CFLAGS)
8376 AC_SUBST(HOST_CC)
8377 AC_SUBST(HOST_CXX)
8378 AC_SUBST(HOST_CFLAGS)
8379 AC_SUBST(HOST_CXXFLAGS)
8380 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8381 AC_SUBST(HOST_AR)
8382 AC_SUBST(HOST_AR_FLAGS)
8383 AC_SUBST(HOST_LD)
8384 AC_SUBST(HOST_RANLIB)
8385 AC_SUBST(HOST_NSPR_MDCPUCFG)
8386 AC_SUBST(HOST_BIN_SUFFIX)
8387 AC_SUBST(HOST_OS_ARCH)
8389 AC_SUBST(TARGET_CPU)
8390 AC_SUBST(TARGET_VENDOR)
8391 AC_SUBST(TARGET_OS)
8392 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8393 AC_SUBST(TARGET_MD_ARCH)
8394 AC_SUBST(TARGET_XPCOM_ABI)
8395 AC_SUBST(OS_TARGET)
8396 AC_SUBST(OS_ARCH)
8397 AC_SUBST(OS_RELEASE)
8398 AC_SUBST(OS_TEST)
8400 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8401 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8403 AC_SUBST(WRAP_MALLOC_CFLAGS)
8404 AC_SUBST(WRAP_MALLOC_LIB)
8405 AC_SUBST(MKSHLIB)
8406 AC_SUBST(MKCSHLIB)
8407 AC_SUBST(MKSHLIB_FORCE_ALL)
8408 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8409 AC_SUBST(DSO_CFLAGS)
8410 AC_SUBST(DSO_PIC_CFLAGS)
8411 AC_SUBST(DSO_LDOPTS)
8412 AC_SUBST(LIB_PREFIX)
8413 AC_SUBST(DLL_PREFIX)
8414 AC_SUBST(DLL_SUFFIX)
8415 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8416 AC_SUBST(LIB_SUFFIX)
8417 AC_SUBST(OBJ_SUFFIX)
8418 AC_SUBST(BIN_SUFFIX)
8419 AC_SUBST(ASM_SUFFIX)
8420 AC_SUBST(IMPORT_LIB_SUFFIX)
8421 AC_SUBST(USE_N32)
8422 AC_SUBST(CC_VERSION)
8423 AC_SUBST(CXX_VERSION)
8424 AC_SUBST(MSMANIFEST_TOOL)
8425 AC_SUBST(NS_ENABLE_TSF)
8426 AC_SUBST(MOZ_NSS_PATCH)
8428 if test "$USING_HCC"; then
8429    CC='${topsrcdir}/build/hcc'
8430    CC="$CC '$_OLDCC'"
8431    CXX='${topsrcdir}/build/hcpp'
8432    CXX="$CXX '$_OLDCXX'"
8433    AC_SUBST(CC)
8434    AC_SUBST(CXX)
8437 dnl Check for missing components
8438 if test "$COMPILE_ENVIRONMENT"; then
8439 if test "$MOZ_X11"; then
8440     dnl ====================================================
8441     dnl = Check if X headers exist
8442     dnl ====================================================
8443     _SAVE_CFLAGS=$CFLAGS
8444     CFLAGS="$CFLAGS $XCFLAGS"
8445     AC_TRY_COMPILE([
8446         #include <stdio.h>
8447         #include <stdlib.h>
8448         #include <X11/Xlib.h>
8449         #include <X11/Intrinsic.h>
8450     ],
8451     [
8452         Display *dpy = 0;
8453         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8454             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8455             exit(1);
8456         }
8457     ], [], 
8458     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8459     CFLAGS="$_SAVE_CFLAGS"
8461     if test ! -z "$MISSING_X"; then
8462         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8463     fi
8465 fi # MOZ_X11
8467 dnl Check for headers, etc. needed by WebGL.
8468 if test -n "$MOZ_WEBGL_GLX"; then
8469     AC_CHECK_HEADER(GL/glx.h)
8470     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8471         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8472     fi
8473 fi # MOZ_WEBGL_GLX
8474 fi # COMPILE_ENVIRONMENT
8476 if test "$USE_FC_FREETYPE"; then
8477     if test "$COMPILE_ENVIRONMENT"; then
8478         _SAVE_CPPFLAGS="$CPPFLAGS"
8479         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8480         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
8481             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8482         CPPFLAGS="$_SAVE_CPPFLAGS"
8483     else
8484         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8485     fi
8488 dnl Set various defines and substitutions
8489 dnl ========================================================
8491 if test "$OS_ARCH" = "BeOS"; then
8492   AC_DEFINE(XP_BEOS)
8493 elif test "$OS_ARCH" = "Darwin"; then
8494   AC_DEFINE(XP_UNIX)
8495   AC_DEFINE(UNIX_ASYNC_DNS)
8496 elif test "$OS_ARCH" = "OpenVMS"; then
8497   AC_DEFINE(XP_UNIX)
8498 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8499   AC_DEFINE(XP_UNIX)
8500   AC_DEFINE(UNIX_ASYNC_DNS)
8503 if test "$MOZ_DEBUG"; then
8504     AC_DEFINE(MOZ_REFLOW_PERF)
8505     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8508 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8509     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8510     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8511     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8512     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8513     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8514     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8515     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8516     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8519 dnl ========================================================
8520 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8521 dnl ========================================================
8522 case "$host_os" in
8523 mingw*)
8524     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8525     ;;
8526 cygwin*|msvc*|mks*)
8527     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8528     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8529     CC="\$(CYGWIN_WRAPPER) $CC"
8530     CXX="\$(CYGWIN_WRAPPER) $CXX"
8531     CPP="\$(CYGWIN_WRAPPER) $CPP"
8532     LD="\$(CYGWIN_WRAPPER) $LD"
8533     AS="\$(CYGWIN_WRAPPER) $AS"
8534     RC="\$(CYGWIN_WRAPPER) $RC"
8535     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8536     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8537     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8538     ;;
8539 esac
8541 AC_SUBST(CYGDRIVE_MOUNT)
8542 AC_SUBST(WIN_TOP_SRC)
8544 AC_SUBST(MOZILLA_VERSION)
8546 AC_SUBST(ac_configure_args)
8548 dnl Spit out some output
8549 dnl ========================================================
8551 dnl The following defines are used by xpcom
8552 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8553 CPP_THROW_NEW
8554 HAVE_CPP_2BYTE_WCHAR_T
8555 HAVE_CPP_ACCESS_CHANGING_USING
8556 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8557 HAVE_CPP_BOOL
8558 HAVE_CPP_CHAR16_T
8559 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8560 HAVE_CPP_EXPLICIT
8561 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8562 HAVE_CPP_NAMESPACE_STD
8563 HAVE_CPP_NEW_CASTS
8564 HAVE_CPP_PARTIAL_SPECIALIZATION
8565 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8566 HAVE_CPP_TYPENAME
8567 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8568 HAVE_STATVFS
8569 NEED_CPP_UNUSED_IMPLEMENTATIONS
8570 NEW_H
8571 HAVE_GETPAGESIZE
8572 HAVE_ICONV
8573 HAVE_ICONV_WITH_CONST_INPUT
8574 HAVE_MBRTOWC
8575 HAVE_SYS_MOUNT_H
8576 HAVE_SYS_VFS_H
8577 HAVE_WCRTOMB
8580 AC_CONFIG_HEADER(
8581 netwerk/necko-config.h
8582 xpcom/xpcom-config.h
8583 xpcom/xpcom-private.h
8586 # Save the defines header file before autoconf removes it.
8587 # (Do not add AC_DEFINE calls after this line.)
8588   _CONFIG_TMP=confdefs-tmp.h
8589   _CONFIG_DEFS_H=mozilla-config.h
8591   cat > $_CONFIG_TMP <<\EOF
8592 /* List of defines generated by configure. Included with preprocessor flag,
8593  * -include, to avoid long list of -D defines on the compile command-line.
8594  * Do not edit.
8595  */
8597 #ifndef _MOZILLA_CONFIG_H_
8598 #define _MOZILLA_CONFIG_H_
8601 _EGREP_PATTERN='^#define ('
8602 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8603     for f in $_NON_GLOBAL_ACDEFINES; do
8604         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8605     done
8607 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8609   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8611   cat >> $_CONFIG_TMP <<\EOF
8613 #endif /* _MOZILLA_CONFIG_H_ */
8617   # Only write mozilla-config.h when something changes (or it doesn't exist)
8618   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8619     rm $_CONFIG_TMP
8620   else
8621     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8622     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8624     echo ==== $_CONFIG_DEFS_H =================================
8625     cat $_CONFIG_DEFS_H
8626   fi
8628 dnl Probably shouldn't call this manually but we always want the output of DEFS
8629 rm -f confdefs.h.save
8630 mv confdefs.h confdefs.h.save
8631 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8632 AC_OUTPUT_MAKE_DEFS()
8633 MOZ_DEFINES=$DEFS
8634 AC_SUBST(MOZ_DEFINES)
8635 rm -f confdefs.h
8636 mv confdefs.h.save confdefs.h
8638 dnl Load the list of Makefiles to generate.
8639 dnl   To add new Makefiles, edit allmakefiles.sh.
8640 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8641 . ${srcdir}/allmakefiles.sh
8642 dnl 
8643 dnl Run a perl script to quickly create the makefiles.
8644 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8645 dnl   for the files it cannot handle correctly. This way, config.status
8646 dnl   will handle these files.
8647 dnl If it fails, nothing is set and config.status will run as usual.
8649 dnl This does not change the $MAKEFILES variable.
8651 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8653 if test -z "${AS_PERL}"; then
8654 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8655 else
8656 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8658 . ./conftest.sh
8659 rm conftest.sh
8661 echo $MAKEFILES > unallmakefiles
8663 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8665 AC_OUTPUT($MAKEFILES)
8667 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8668 if test "$CAIRO_FEATURES_H"; then
8669   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8670     echo "$CAIRO_FEATURES_H is unchanged"
8671     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8672   else
8673     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8674   fi
8677 dnl ========================================================
8678 dnl = Setup a nice relatively clean build environment for
8679 dnl = sub-configures.
8680 dnl ========================================================
8681 CC="$_SUBDIR_CC" 
8682 CXX="$_SUBDIR_CXX" 
8683 CFLAGS="$_SUBDIR_CFLAGS" 
8684 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8685 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8686 LDFLAGS="$_SUBDIR_LDFLAGS"
8687 HOST_CC="$_SUBDIR_HOST_CC" 
8688 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8689 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8692 unset MAKEFILES
8693 unset CONFIG_FILES
8695 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8696 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8698 if test -z "$MOZ_NATIVE_NSPR"; then
8699     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8700     if test -z "$MOZ_DEBUG"; then
8701         ac_configure_args="$ac_configure_args --disable-debug"
8702     fi
8703     if test "$MOZ_OPTIMIZE" = "1"; then
8704         ac_configure_args="$ac_configure_args --enable-optimize"
8705     fi
8706     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8707        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8708     fi
8709     if test -n "$HAVE_64BIT_OS"; then
8710         ac_configure_args="$ac_configure_args --enable-64bit"
8711     fi
8712     if test -n "$USE_ARM_KUSER"; then
8713         ac_configure_args="$ac_configure_args --with-arm-kuser"
8714     fi
8715     AC_OUTPUT_SUBDIRS(nsprpub)
8716     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8719 if test -z "$MOZ_NATIVE_NSPR"; then
8720     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8721     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8722     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8723        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8724        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8725        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8726        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8727     fi
8728     rm -f config/autoconf.mk.bak
8731 # Run the SpiderMonkey 'configure' script.
8732 dist=$MOZ_BUILD_ROOT/dist
8733 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8734 ac_configure_args="$ac_configure_args --enable-threadsafe"
8735 if test -z "$MOZ_NATIVE_NSPR"; then
8736     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8737     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8739 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8740 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8741 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8742 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8743 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8744 if test "$MOZ_MEMORY"; then
8745    ac_configure_args="$ac_configure_args --enable-jemalloc"
8746    if test -n "$MOZ_MEMORY_LDFLAGS"; then
8747      export MOZ_MEMORY_LDFLAGS
8748    fi
8750 AC_OUTPUT_SUBDIRS(js/src)
8751 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8753 # Build jsctypes on the platforms we can.
8754 if test "$BUILD_CTYPES"; then
8755   # Run the libffi 'configure' script.
8756   ac_configure_args="--disable-shared --enable-static --disable-raw-api"
8757   if test "$MOZ_DEBUG"; then
8758     ac_configure_args="$ac_configure_args --enable-debug"
8759   fi
8760   if test "$DSO_PIC_CFLAGS"; then
8761     ac_configure_args="$ac_configure_args --with-pic"
8762   fi
8763   if test "$CROSS_COMPILE"; then
8764     case "$target" in
8765     *-mingw*)
8766       ac_configure_args="$ac_configure_args --build=$build --host=${target_cpu}-${target_os} HOST_CC=\"$HOST_CC\" CC=\"$CC\""
8767       ;;
8768     *)
8769       ac_configure_args="$ac_configure_args --build=$build --host=$target HOST_CC=\"$HOST_CC\" CC=\"$CC\""
8770       ;;
8771     esac
8772   fi
8773   if test "$_MSC_VER"; then
8774     # Use a wrapper script for cl and ml that looks more like gcc.
8775     # autotools can't quite handle an MSVC build environment yet.
8776     ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" SHELL=sh.exe"
8777     case "${target_cpu}" in
8778     x86_64)
8779       # Need target since MSYS tools into mozilla-build may be 32bit
8780       ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/js/ctypes/libffi/msvcc.sh -m64\" --build=$build --host=$target"
8781       ;;
8782     *)
8783       ac_configure_args="$ac_configure_args CC=$_topsrcdir/js/ctypes/libffi/msvcc.sh"
8784       ;;
8785     esac
8786   fi
8787   if test "$SOLARIS_SUNPRO_CC"; then
8788     # Always use gcc for libffi on Solaris
8789     ac_configure_args="$ac_configure_args CC=gcc"
8790   fi
8792   # Use a separate cache file for libffi, since it does things differently
8793   # from our configure.
8794   old_cache_file=$cache_file
8795   cache_file=js/ctypes/libffi/config.cache
8796   AC_OUTPUT_SUBDIRS(js/ctypes/libffi)
8797   cache_file=$old_cache_file
8798   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8801 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8803 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8804 dnl Needs to be at the end to respect possible changes from NSPR configure
8805 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8806   echo "config/autoconf.mk is unchanged"
8807   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8808 else
8809   rm -f config/autoconf.mk.orig 2> /dev/null