[JAEGER] Fixed GETPROP resyncing to the wrong type (bug 589108, r=dmandelin).
[mozilla-central.git] / configure.in
blob5e8f585227b1b6b17d624ab26e42438964692ab4
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}"
73 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1` 
74 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
77 dnl =
78 dnl = Don't change the following two lines.  Doing so breaks:
79 dnl =
80 dnl = CFLAGS="-foo" ./configure
81 dnl =
82 dnl ========================================================
83 CFLAGS="${CFLAGS=}"
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
86 LDFLAGS="${LDFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
96 _SUBDIR_CC="$CC"
97 _SUBDIR_CXX="$CXX"
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
110 MOZJPEG=62
111 MOZPNG=10401
112 MOZZLIB=0x1230
113 NSPR_VERSION=4
114 NSS_VERSION=3
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
118 GLIB_VERSION=1.2.0
119 LIBIDL_VERSION=0.6.3
120 PERL_VERSION=5.006
121 PYTHON_VERSION=2.5
122 CAIRO_VERSION=1.8.8
123 PANGO_VERSION=1.14.0
124 GTK2_VERSION=2.10.0
125 WINDRES_VERSION=2.14.90
126 W32API_VERSION=3.8
127 GNOMEVFS_VERSION=2.0
128 GNOMEUI_VERSION=2.2.0
129 GCONF_VERSION=1.2.1
130 GIO_VERSION=2.0
131 STARTUP_NOTIFICATION_VERSION=0.8
132 DBUS_VERSION=0.60
133 SQLITE_VERSION=3.6.23.1
134 LIBNOTIFY_VERSION=0.4
136 MSMANIFEST_TOOL=
138 dnl Set various checks
139 dnl ========================================================
140 MISSING_X=
141 AC_PROG_AWK
143 dnl Initialize the Pthread test variables early so they can be
144 dnl  overridden by each platform.
145 dnl ========================================================
146 USE_PTHREADS=
147 _PTHREAD_LDFLAGS=""
149 dnl Do not allow a separate objdir build if a srcdir build exists.
150 dnl ==============================================================
151 _topsrcdir=`cd \`dirname $0\`; pwd`
152 _objdir=`pwd`
154 if test "$_topsrcdir" != "$_objdir"
155 then
156   # Check for a couple representative files in the source tree
157   _conflict_files=
158   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
159     if test -f $file; then
160       _conflict_files="$_conflict_files $file"
161     fi
162   done
163   if test "$_conflict_files"; then
164     echo "***"
165     echo "*   Your source tree contains these files:"
166     for file in $_conflict_files; do
167       echo "*         $file"
168     done
169     cat 1>&2 <<-EOF
170         *   This indicates that you previously built in the source tree.
171         *   A source tree build can confuse the separate objdir build.
172         *
173         *   To clean up the source tree:
174         *     1. cd $_topsrcdir
175         *     2. gmake distclean
176         ***
177         EOF
178     exit 1
179     break
180   fi
182 MOZ_BUILD_ROOT=`pwd`
184 dnl Default to MSVC for win32 and gcc-4.2 for darwin
185 dnl ==============================================================
186 if test -z "$CROSS_COMPILE"; then
187 case "$target" in
188 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
189     if test -z "$CC"; then CC=cl; fi
190     if test -z "$CXX"; then CXX=cl; fi
191     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
192     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
193     if test -z "$LD"; then LD=link; fi
194     if test -z "$AS"; then
195         case "${target_cpu}" in
196         i*86)
197             AS=ml;
198             ;;
199         x86_64)
200             AS=ml64;
201             ;;
202         esac
203     fi
204     if test -z "$MIDL"; then MIDL=midl; fi
205     ;;
206 *-darwin*)
207     if test -z "$CC"; then CC=gcc-4.2; fi
208     if test -z "$CXX"; then CXX=g++-4.2; fi
209     ;;
210 esac
213 COMPILE_ENVIRONMENT=1
214 MOZ_ARG_DISABLE_BOOL(compile-environment,
215 [  --disable-compile-environment
216                           Disable compiler/library checks.],
217     COMPILE_ENVIRONMENT= )
218 AC_SUBST(COMPILE_ENVIRONMENT)
220 MOZ_ARG_WITH_STRING(l10n-base,
221 [  --with-l10n-base=DIR    path to l10n repositories],
222     L10NBASEDIR=$withval)
223 if test ! -z "$L10NBASEDIR"; then
224     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
225         AC_MSG_ERROR([--with-l10n-base must specify a path])
226     elif test -d "$L10NBASEDIR"; then
227         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
228     else
229         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
230     fi
232 AC_SUBST(L10NBASEDIR)
234 dnl Check for Perl first -- needed for win32 SDK checks
235 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
236 if test -z "$PERL" -o "$PERL" = ":"; then
237     AC_MSG_ERROR([perl not found in \$PATH])
240 dnl ========================================================
241 dnl = Android uses a very custom (hacky) toolchain; we need to do this
242 dnl = here, so that the compiler checks can succeed
243 dnl ========================================================
245 MOZ_ARG_WITH_STRING(android-ndk,
246 [  --with-android-ndk=DIR
247                           location where the Android NDK can be found],
248     android_ndk=$withval)
250 MOZ_ARG_WITH_STRING(android-toolchain,
251 [  --with-android-toolchain=DIR
252                           location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
253     android_toolchain=$withval)
256 MOZ_ARG_WITH_STRING(android-version,
257 [  --with-android-version=VER
258                           android platform version, default 5],
259     android_version=$withval,
260     android_version=5)
262 MOZ_ARG_WITH_STRING(android-sdk,
263 [  --with-android-sdk=DIR
264                           location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
265     android_sdk=$withval)
267 MOZ_ARG_WITH_STRING(android-tools,
268 [  --with-android-tools=DIR
269                           location where the Android Tools can be found (base directory, e.g. .../android/tools)],
270     android_tools=$withval)
272 if test "$target" = "arm-android-eabi" ; then
273     if test -z "$android_ndk" ; then
274         AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
275     fi
277     if test -z "$android_sdk" ; then
278         AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
279     fi
281     if test -z "$android_tools" ; then
282         AC_MSG_ERROR([You must specify --with-android-tools=/path/to/sdk/tools when targeting Android.])
283     fi
285     if test -z "$android_toolchain" ; then
286         android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
287     fi
289     if test -z "$android_platform" ; then
290        android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
291     fi
293     dnl set up compilers
294     AS="$android_toolchain"/bin/arm-eabi-as
295     CC="$android_toolchain"/bin/arm-eabi-gcc
296     CXX="$android_toolchain"/bin/arm-eabi-g++
297     CPP="$android_toolchain"/bin/arm-eabi-cpp
298     LD="$android_toolchain"/bin/arm-eabi-ld
299     AR="$android_toolchain"/bin/arm-eabi-ar
300     RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
301     STRIP="$android_toolchain"/bin/arm-eabi-strip
303     CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
304     CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS"
305     CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CXXFLAGS"
307     dnl Add -llog by default, since we use it all over the place.
308     dnl Add --allow-shlib-undefined, because libGLESv2 links to an
309     dnl undefined symbol (present on the hardware, just not in the
310     dnl NDK.)
311     LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
313     dnl prevent cross compile section from using these flags as host flags
314     if test -z "$HOST_CPPFLAGS" ; then
315         HOST_CPPFLAGS=" "
316     fi
317     if test -z "$HOST_CFLAGS" ; then
318         HOST_CFLAGS=" "
319     fi
320     if test -z "$HOST_CXXFLAGS" ; then
321         HOST_CXXFLAGS=" "
322     fi
323     if test -z "$HOST_LDFLAGS" ; then
324         HOST_LDFLAGS=" "
325     fi
327     ANDROID_NDK="${android_ndk}"
328     ANDROID_TOOLCHAIN="{android_toolchain}"
329     ANDROID_PLATFORM="{android_platform}"
330     ANDROID_SDK="${android_sdk}"
331     ANDROID_TOOLS="${android_tools}"
332     ANDROID_VERSION="${android_version}"
334     AC_DEFINE(ANDROID)
335     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
336     AC_SUBST(ANDROID_VERSION)
337     CROSS_COMPILE=1
338     MOZ_CHROME_FILE_FORMAT=omni
341 AC_SUBST(ANDROID_NDK)
342 AC_SUBST(ANDROID_TOOLCHAIN)
343 AC_SUBST(ANDROID_PLATFORM)
344 AC_SUBST(ANDROID_SDK)
345 AC_SUBST(ANDROID_TOOLS)
347 dnl ========================================================
348 dnl Checks for compilers.
349 dnl ========================================================
350 dnl Set CROSS_COMPILE in the environment when running configure
351 dnl to use the cross-compile setup for now
352 dnl ========================================================
354 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
355 AR_FLAGS='cr $@'
357 if test "$COMPILE_ENVIRONMENT"; then
359 dnl Do some special WinCE toolchain stuff
360 case "$target" in
361 *wince|*winmo)
363     MOZ_ARG_WITH_STRING(wince-sdk,
364     [  --with-wince-sdk=WINCE_SDK_DIR
365                           The path to the Windows CE SDK],
366     WINCE_SDK_DIR=$withval)
368     MOZ_ARG_WITH_STRING(ogles-sdk,
369     [  --with-ogles-sdk=OGLES_SDK_DIR
370                           The path to the OGLES SDK],
371     OGLES_SDK_DIR=$withval)
373     AC_DEFINE(WINCE)
374     
375     export WINCE=1
377     echo -----------------------------------------------------------------------------
378     echo Building Windows CE Shunt Library and Tool Chain
379     echo Using SDK in:
380     echo $WINCE_SDK_DIR
382     ac_exeext=.exe
384     _pwd=`pwd -W`
385     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
386     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
387     TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
388     -C $srcdir/build/wince/tools
390     CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
391     CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
392     CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
393     CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
394     LD="$_pwd/dist/sdk/bin/$target-link.exe"
395     AR="$_pwd/dist/sdk/bin/$target-lib.exe"
396     AS="$_pwd/dist/sdk/bin/$target-as.exe"
397     RC="$_pwd/dist/sdk/bin/$target-res.exe"
400     echo -----------------------------------------------------------------------------
402     ;;
403 esac
405 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
406     echo "cross compiling from $host to $target"
407     cross_compiling=yes
409     _SAVE_CC="$CC"
410     _SAVE_CFLAGS="$CFLAGS"
411     _SAVE_LDFLAGS="$LDFLAGS"
413     AC_MSG_CHECKING([for host c compiler])
414     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
415     if test -z "$HOST_CC"; then
416         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
417     fi
418     AC_MSG_RESULT([$HOST_CC])
419     AC_MSG_CHECKING([for host c++ compiler])
420     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
421     if test -z "$HOST_CXX"; then
422         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
423     fi
424     AC_MSG_RESULT([$HOST_CXX])
426     if test -z "$HOST_CFLAGS"; then
427         HOST_CFLAGS="$CFLAGS"
428     fi
429     if test -z "$HOST_CXXFLAGS"; then
430         HOST_CXXFLAGS="$CXXFLAGS"
431     fi
432     if test -z "$HOST_LDFLAGS"; then
433         HOST_LDFLAGS="$LDFLAGS"
434     fi
435     if test -z "$HOST_AR_FLAGS"; then
436         HOST_AR_FLAGS="$AR_FLAGS"
437     fi
438     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
439     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
440     CC="$HOST_CC"
441     CFLAGS="$HOST_CFLAGS"
442     LDFLAGS="$HOST_LDFLAGS"
444     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
445     AC_TRY_COMPILE([], [return(0);], 
446         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
447         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
449     CC="$HOST_CXX"
450     CFLAGS="$HOST_CXXFLAGS"
452     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
453     AC_TRY_COMPILE([], [return(0);], 
454         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
455         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
456     
457     CC=$_SAVE_CC
458     CFLAGS=$_SAVE_CFLAGS
459     LDFLAGS=$_SAVE_LDFLAGS
461     case "$build:$target" in
462       powerpc-apple-darwin8*:i?86-apple-darwin*)
463         dnl The Darwin cross compiler doesn't necessarily point itself at a
464         dnl root that has libraries for the proper architecture, it defaults
465         dnl to the system root.  The libraries in the system root on current
466         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
467         dnl checks will fail.  Fake a working SDK in that case.
468         _SAVE_CFLAGS=$CFLAGS
469         _SAVE_CXXFLAGS=$CXXLAGS
470         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
471         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
472         ;;
473     esac
475     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
476     unset ac_cv_prog_CC
477     AC_PROG_CC
478     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
479     unset ac_cv_prog_CXX
480     AC_PROG_CXX
482     case "$build:$target" in
483       powerpc-apple-darwin8*:i?86-apple-darwin*)
484         dnl Revert the changes made above.  From this point on, the target
485         dnl compiler will never be used without applying the SDK to CFLAGS
486         dnl (see --with-macos-sdk below).
487         CFLAGS=$_SAVE_CFLAGS
488         CXXFLAGS=$_SAVE_CXXFLAGS
489         ;;
490     esac
492     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
493     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
494     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
495     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
496     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
497     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
498     AC_DEFINE(CROSS_COMPILE)
499 else
500     AC_PROG_CC
501     AC_PROG_CXX
502     AC_PROG_RANLIB
503     MOZ_PATH_PROGS(AS, $AS as, $CC)
504     AC_CHECK_PROGS(AR, ar, :)
505     AC_CHECK_PROGS(LD, ld, :)
506     AC_CHECK_PROGS(STRIP, strip, :)
507     AC_CHECK_PROGS(WINDRES, windres, :)
508     if test -z "$HOST_CC"; then
509         HOST_CC='$(CC)'
510     fi
511     if test -z "$HOST_CFLAGS"; then
512         HOST_CFLAGS='$(CFLAGS)'
513     fi
514     if test -z "$HOST_CXX"; then
515         HOST_CXX='$(CXX)'
516     fi
517     if test -z "$HOST_CXXFLAGS"; then
518         HOST_CXXFLAGS='$(CXXFLAGS)'
519     fi
520     if test -z "$HOST_LDFLAGS"; then
521         HOST_LDFLAGS='$(LDFLAGS)'
522     fi
523     if test -z "$HOST_RANLIB"; then
524         HOST_RANLIB='$(RANLIB)'
525     fi
526     if test -z "$HOST_AR"; then
527         HOST_AR='$(AR)'
528     fi
529     if test -z "$HOST_AR_FLAGS"; then
530         HOST_AR_FLAGS='$(AR_FLAGS)'
531     fi
534 GNU_AS=
535 GNU_LD=
536 GNU_CC=
537 GNU_CXX=
538 CC_VERSION='N/A'
539 CXX_VERSION='N/A'
540 if test "$GCC" = "yes"; then
541     GNU_CC=1
542     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
544 if test "$GXX" = "yes"; then
545     GNU_CXX=1
546     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
548 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
549     GNU_AS=1
551 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
552     GNU_LD=1
554 if test "$GNU_CC"; then
555     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
556         GCC_USE_GNU_LD=1
557     fi
560 INTEL_CC=
561 INTEL_CXX=
562 if test "$GCC" = yes; then
563    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
564      INTEL_CC=1
565    fi
568 if test "$GXX" = yes; then
569    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
570      INTEL_CXX=1
571    fi
574 dnl Special win32 checks
575 dnl ========================================================
576 case "$target" in
577 *-wince|*-winmo)
578     WINVER=500
579     WINSDK_TARGETVER=502
580     ;;
582     WINVER=502
583     dnl Target the Windows 7 SDK by default
584     WINSDK_TARGETVER=601
585     ;;
586 esac
588 MOZ_ARG_WITH_STRING(windows-version,
589 [  --with-windows-version=WINSDK_TARGETVER
590                           Highest Windows version to target using this SDK
591                               502: Windows Server 2003
592                               600: Windows Vista
593                               601: Windows 7],
594   WINSDK_TARGETVER=$withval)
596 case "$WINSDK_TARGETVER" in
597 502|600|601)
598     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
599     ;;
602     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
603     ;;
605 esac
607 if test -n "$COMPILE_ENVIRONMENT"; then
608 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
609     # We can't build parental controls either
610     MOZ_DISABLE_PARENTAL_CONTROLS=1
614 case "$target" in
615 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
616     if test "$GCC" != "yes"; then
617         # Check to see if we are really running in a msvc environemnt
618         _WIN32_MSVC=1
619         AC_CHECK_PROGS(MIDL, midl)
621         # Make sure compilers are valid
622         CFLAGS="$CFLAGS -TC -nologo"
623         CXXFLAGS="$CXXFLAGS -TP -nologo"
624         AC_LANG_SAVE
625         AC_LANG_C
626         AC_TRY_COMPILE([#include <stdio.h>],
627             [ printf("Hello World\n"); ],,
628             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
630         AC_LANG_CPLUSPLUS
631         AC_TRY_COMPILE([#include <new.h>],
632             [ unsigned *test = new unsigned(42); ],,
633             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
634         AC_LANG_RESTORE
635         
636         changequote(,)
637         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
638         changequote([,])
639         
640         # Determine compiler version
641         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
642         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
643         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
644         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
645         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
646         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
648         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
649         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
651         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
652             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
653         fi
654         if test "$_CC_MAJOR_VERSION" = "13"; then
655             _CC_SUITE=7
656         elif test "$_CC_MAJOR_VERSION" = "14"; then
657             _CC_SUITE=8
658             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
659             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
660             dnl so be very specific here!
661             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
662             if test $_CC_RELEASE -gt 50727; then
663                _USE_DYNAMICBASE=1
664             elif test $_CC_BUILD -ge 762; then
665                _USE_DYNAMICBASE=1
666             fi
667             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
668             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
669         elif test "$_CC_MAJOR_VERSION" = "15"; then
670             _CC_SUITE=9
671             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
672             _USE_DYNAMICBASE=1
673             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
674             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
675         elif test "$_CC_MAJOR_VERSION" = "16"; then
676             _CC_SUITE=10
677             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
678             _USE_DYNAMICBASE=1
679             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
680             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
681         else
682             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
683         fi
685         _MOZ_RTTI_FLAGS_ON='-GR'
686         _MOZ_RTTI_FLAGS_OFF='-GR-'
687         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
688         _MOZ_EXCEPTIONS_FLAGS_OFF=''
690         if test -n "$WIN32_REDIST_DIR"; then
691             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
692         fi
693         
694         # bug #249782
695         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
696         if test "$_CC_SUITE" -ge "8"; then
697                 changequote(,)
698                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
699                 changequote([,])
701                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
702                 if test -n "$MSMT_TOOL"; then
703                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
704                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
705                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
706                         fi
707                         MSMANIFEST_TOOL=1
708                         unset MSMT_TOOL
709                 else
710                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
711                 fi
712         fi
714         # Check linker version
715         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
716         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
717         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
718             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
719         fi
720         INCREMENTAL_LINKER=1
722         # Check midl version
723         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
724         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
725         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
726         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
727         # Add flags if necessary
728         AC_MSG_CHECKING([for midl flags])
729         case "$target" in
730         i*86-*)
731             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
732                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
733                 # MIDL version 7.00.0500 or later has no problem.
734                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
735                 AC_MSG_RESULT([need -env win32])
736             else
737                 AC_MSG_RESULT([none needed])
738             fi
739             ;;
740         x86_64-*)
741             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
742             ;;
743         *)
744             AC_MSG_RESULT([none needed])
745             ;;
746         esac
748         # Identify which version of the SDK we're building with
749         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
750         # from there
751         AC_CHECK_HEADERS([winsdkver.h])
752         if test "$ac_cv_header_winsdkver_h" = "yes"; then
753             # Get the highest _WIN32_WINNT and NTDDI versions supported
754             # Take the higher of the two
755             # This is done because the Windows 7 beta SDK reports its
756             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
757             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
758                            ac_cv_winsdk_maxver,
759                            [cat > conftest.h <<EOF
760 #include <winsdkver.h>
761 #include <sdkddkver.h>
763 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
764 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
765 #else
766 #define WINSDK_MAXVER NTDDI_MAXVER
767 #endif
769 WINSDK_MAXVER
771                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
772                             rm -f conftest.h
773                            ])
774             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
775         else
776             # The Vista SDK is the only one to have sdkddkver.h but not
777             # WinSDKVer.h
778             AC_CHECK_HEADERS([sdkddkver.h])
779             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
780                 MOZ_WINSDK_MAXVER=0x06000000
781             else
782                 # Assume the Server 2003 Platform SDK
783                 MOZ_WINSDK_MAXVER=0x05020000
784             fi
785         fi
787         unset _MSVC_VER_FILTER
789         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
790             [
791                 AC_LANG_SAVE
792                 AC_LANG_CPLUSPLUS
793                 _SAVE_CXXFLAGS="$CXXFLAGS"
794                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
795                 AC_TRY_COMPILE([#include <exception>],
796                             [std::_Throw(std::exception()); return 0;],
797                             ac_cv_have_std__Throw="yes",
798                             ac_cv_have_std__Throw="no")
799                 CXXFLAGS="$_SAVE_CXXFLAGS"
800                 AC_LANG_RESTORE
801             ])
803         if test "$ac_cv_have_std__Throw" == "yes"; then
804             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
805                            ac_cv_have_dllimport_exception_bug,
806                 [
807                     AC_LANG_SAVE
808                     AC_LANG_CPLUSPLUS
809                     _SAVE_CXXFLAGS="$CXXFLAGS"
810                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
811                     AC_TRY_LINK([#include <vector>],
812                                 [std::vector<int> v; return v.at(1);],
813                                 ac_cv_have_dllimport_exception_bug="no",
814                                 ac_cv_have_dllimport_exception_bug="yes")
815                     CXXFLAGS="$_SAVE_CXXFLAGS"
816                     AC_LANG_RESTORE
817                 ])
818             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
819                 WRAP_STL_INCLUDES=1
820                 MOZ_MSVC_STL_WRAP__Throw=1
821                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
822             fi
823         else
824             AC_CACHE_CHECK(for overridable _RAISE,
825                            ac_cv_have__RAISE,
826                 [
827                     AC_LANG_SAVE
828                     AC_LANG_CPLUSPLUS
829                     _SAVE_CXXFLAGS="$CXXFLAGS"
830                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
831                     AC_TRY_COMPILE([#include <xstddef>
832                                     #undef _RAISE
833                                     #define _RAISE(x) externallyDefinedFunction((x).what())
834                                     #include <vector>
835                                    ],
836                                    [std::vector<int> v; return v.at(1);],
837                                    ac_cv_have__RAISE="no",
838                                    ac_cv_have__RAISE="yes")
839                     CXXFLAGS="$_SAVE_CXXFLAGS"
840                     AC_LANG_RESTORE
841                 ])
842             if test "$ac_cv_have__RAISE" = "yes"; then
843                 WRAP_STL_INCLUDES=1
844                 MOZ_MSVC_STL_WRAP__RAISE=1
845                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
846             else
847                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
848             fi
849         fi
851         if test "$WRAP_STL_INCLUDES" = "1"; then
852             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
853         fi
854     else
855         # Check w32api version
856         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
857         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
858         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
859         AC_TRY_COMPILE([#include <w32api.h>],
860             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
861                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
862                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
863                 #error "test failed."
864             #endif
865             , [ res=yes ], [ res=no ])
866         AC_MSG_RESULT([$res])
867         if test "$res" != "yes"; then
868             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
869         fi
870         # Check windres version
871         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
872         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
873         AC_MSG_RESULT([$_WINDRES_VERSION])
874         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
875         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
876         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
877         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
878         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
879         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
880         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
881                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
882                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
883                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
884                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
885                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
886         then
887             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
888         fi
890         # Server 2003 is the highest version supported
891         MOZ_WINSDK_MAXVER=0x05020000
892     fi # !GNU_CC
894     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
895     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
896     # Require OS features provided by IE 5.0
897     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
899     # If the maximum version supported by this SDK is lower than the target
900     # version, error out
901     AC_MSG_CHECKING([for Windows SDK being recent enough])
902     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
903         AC_MSG_RESULT("yes")
904     else
905         AC_MSG_RESULT("no")
906         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. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
907     fi
909     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
910     # Definitions matching sdkddkver.h
911     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
912     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
913     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
914     ;;
915 esac
917 dnl Test breaks icc on OS/2 && MSVC
918 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
919     AC_PROG_CC_C_O
920     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
921         USING_HCC=1
922         _OLDCC=$CC
923         _OLDCXX=$CXX
924         CC="${srcdir}/build/hcc '$CC'"
925         CXX="${srcdir}/build/hcpp '$CXX'"
926     fi
929 AC_PROG_CPP
930 AC_PROG_CXXCPP
932 if test -n "$_WIN32_MSVC"; then
933     SKIP_PATH_CHECKS=1
934     SKIP_COMPILER_CHECKS=1
935     SKIP_LIBRARY_CHECKS=1
937     # Since we're skipping compiler and library checks, hard-code
938     # some facts here.
939     case "$target" in
940     *-wince|*-winmo)
941         ;;
942     *)
943         AC_DEFINE(HAVE_IO_H)
944         AC_DEFINE(HAVE_SETBUF)
945         AC_DEFINE(HAVE_ISATTY)
946         ;;
947     esac
950 fi # COMPILE_ENVIRONMENT
952 AC_SUBST(MIDL_FLAGS)
953 AC_SUBST(_MSC_VER)
955 AC_SUBST(GNU_AS)
956 AC_SUBST(GNU_LD)
957 AC_SUBST(GNU_CC)
958 AC_SUBST(GNU_CXX)
959 AC_SUBST(INTEL_CC)
960 AC_SUBST(INTEL_CXX)
962 AC_SUBST(STL_FLAGS)
963 AC_SUBST(WRAP_STL_INCLUDES)
964 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
965 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
967 dnl ========================================================
968 dnl Checks for programs.
969 dnl ========================================================
970 AC_PROG_INSTALL
971 AC_PROG_LN_S
973 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
974 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
975 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
976 _perl_res=$?
977 AC_MSG_RESULT([$_perl_version])
979 if test "$_perl_res" != 0; then
980     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
984 AC_MSG_CHECKING([for full perl installation])
985 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
986 _perl_res=$?
987 if test "$_perl_res" != 0; then
988     AC_MSG_RESULT([no])
989     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
990 else
991     AC_MSG_RESULT([yes])    
994 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.6 python2.5 python2.4 python)
995 if test -z "$PYTHON"; then
996     AC_MSG_ERROR([python was not found in \$PATH])
999 if test -z "$COMPILE_ENVIRONMENT"; then
1000     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1002 AC_SUBST(NSINSTALL_BIN)
1004 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1005 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1006 MOZ_PATH_PROG(UNZIP, unzip, :)
1007 MOZ_PATH_PROGS(ZIP, zip)
1008 if test -z "$ZIP" -o "$ZIP" = ":"; then
1009     AC_MSG_ERROR([zip not found in \$PATH])
1011 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1012 MOZ_PATH_PROG(XARGS, xargs)
1013 if test -z "$XARGS" -o "$XARGS" = ":"; then
1014     AC_MSG_ERROR([xargs not found in \$PATH .])
1017 if test "$COMPILE_ENVIRONMENT"; then
1019 dnl ========================================================
1020 dnl = Mac OS X toolchain support
1021 dnl ========================================================
1023 case "$target_os" in
1024 darwin*)
1025     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1026     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1027     dnl the environment and includedir purposes (when using an SDK, below),
1028     dnl but remember the full version number for the libdir (SDK).
1029     changequote(,)
1030     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1031     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1032     changequote([,])
1033     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1034         dnl Bug 280479, but this keeps popping up in bug 292530 too because
1035         dnl 4.0.0/4061 is the default compiler in Tiger.
1036         changequote(,)
1037         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1038         changequote([,])
1039         if test "$GCC_BUILD" = "4061" ; then
1040             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1041 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1042 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1043         fi
1044     fi
1046     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1047     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
1048     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1049     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1051     case "$PBBUILD" in
1052       *xcodebuild*)
1053         changequote(,)
1054         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1055         changequote([,])
1056         if test -n "$XCODEBUILD_VERSION" -a "$XCODEBUILD_VERSION" -ge 620 ; then
1057           HAS_XCODE_2_1=1;
1058         fi
1059       ;;
1060     esac
1062     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
1063     dnl it has moved into /usr/bin.
1064     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1065     ;;
1066 esac
1068 AC_SUBST(GCC_VERSION)
1069 AC_SUBST(XCODEBUILD_VERSION)
1070 AC_SUBST(HAS_XCODE_2_1)
1072 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1073 dnl that a universal binary is being produced.
1074 AC_SUBST(UNIVERSAL_BINARY)
1076 dnl ========================================================
1077 dnl Check for MacOS deployment target version
1078 dnl ========================================================
1080 MOZ_ARG_ENABLE_STRING(macos-target,
1081                       [  --enable-macos-target=VER (default=10.5)
1082                           Set the minimum MacOS version needed at runtime],
1083                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1085 case "$target" in
1086 *-darwin*)
1087     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1088         dnl Use the specified value
1089         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1090         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1091     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
1092         dnl No value specified on the command line or in the environment,
1093         dnl use architecture minimum.
1094         export MACOSX_DEPLOYMENT_TARGET=10.5
1095     fi
1096     ;;
1097 esac
1099 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1101 dnl ========================================================
1102 dnl = Mac OS X SDK support
1103 dnl ========================================================
1104 MACOS_SDK_DIR=
1105 NEXT_ROOT=
1106 MOZ_ARG_WITH_STRING(macos-sdk,
1107 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
1108     MACOS_SDK_DIR=$withval)
1110 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1111 dnl NEXT_ROOT will be set and exported only if it's needed.
1112 AC_SUBST(MACOS_SDK_DIR)
1113 AC_SUBST(NEXT_ROOT)
1115 if test "$MACOS_SDK_DIR"; then
1116   dnl Sync this section with the ones in NSPR and NSS.
1117   dnl Changes to the cross environment here need to be accounted for in
1118   dnl the libIDL checks (below) and xpidl build.
1120   if test ! -d "$MACOS_SDK_DIR"; then
1121     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1122 specify a valid SDK.  SDKs are installed when the optional cross-development
1123 tools are selected during the Xcode/Developer Tools installation.])
1124   fi
1126   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1127   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1128     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1129   else
1130     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1131     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1133     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1134     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1135     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1137     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1138       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1139       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1140       dnl be ignored and cause warnings when -syslibroot is specified.
1141       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1142       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1143       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1144     fi
1145   fi
1147   AC_LANG_SAVE
1148   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1149   AC_LANG_CPLUSPLUS
1150   AC_TRY_COMPILE([#include <new>
1151                  int main() { return 0; }],
1152    result=yes,
1153    result=no)
1154   AC_LANG_RESTORE
1155   AC_MSG_RESULT($result)
1157   if test "$result" = "no" ; then
1158     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1159   fi
1162 fi # COMPILE_ENVIRONMENT
1164 if test -n "$MAKE"; then
1165   if test `echo $MAKE | grep -c make.py` != 1; then
1166      NOT_PYMAKE=$MAKE
1167   fi
1170 case "$host_os" in
1171 cygwin*|mingw*|mks*|msvc*)
1172     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1173     ;;
1175     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1176     ;;
1177 esac
1178 if test "$GMAKE" = ":"; then
1179    AC_MSG_ERROR([GNU make not found])
1181 AC_SUBST(GMAKE)
1183 if test "$COMPILE_ENVIRONMENT"; then
1185 AC_PATH_XTRA
1187 XCFLAGS="$X_CFLAGS"
1189 fi # COMPILE_ENVIRONMENT
1191 dnl ========================================================
1192 dnl set the defaults first
1193 dnl ========================================================
1194 AS_BIN=$AS
1195 AR_LIST='$(AR) t'
1196 AR_EXTRACT='$(AR) x'
1197 AR_DELETE='$(AR) d'
1198 AS='$(CC)'
1199 AS_DASH_C_FLAG='-c'
1200 DLL_PREFIX=lib
1201 LIB_PREFIX=lib
1202 DLL_SUFFIX=.so
1203 OBJ_SUFFIX=o
1204 LIB_SUFFIX=a
1205 ASM_SUFFIX=s
1206 IMPORT_LIB_SUFFIX=
1207 TARGET_MD_ARCH=unix
1208 DIRENT_INO=d_ino
1209 CYGWIN_WRAPPER=
1210 WIN_TOP_SRC=
1211 MOZ_USER_DIR=".mozilla"
1213 MOZ_JPEG_CFLAGS=
1214 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1215 MOZ_ZLIB_CFLAGS=
1216 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1217 MOZ_BZ2_CFLAGS=
1218 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1219 MOZ_PNG_CFLAGS=
1220 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1222 MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
1223 MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1224 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1225 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1226 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1227 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1228 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1229 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1231 MOZ_FS_LAYOUT=unix
1233 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1235 USE_DEPENDENT_LIBS=1
1237 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1239 if test -n "$CROSS_COMPILE"; then
1240     OS_TARGET="${target_os}"
1241     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1242     OS_RELEASE=
1243     case "${target_os}" in
1244         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1245         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1246         gnu*)         OS_ARCH=GNU ;;
1247         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1248         mingw*)       OS_ARCH=WINNT ;;
1249         wince*)       OS_ARCH=WINCE ;;
1250         winmo*)       OS_ARCH=WINCE ;;
1251         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1252     esac
1253     case "${target}" in
1254         arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1255     esac
1256 else
1257     OS_TARGET=`uname -s`
1258     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1259     OS_RELEASE=`uname -r`
1262 # Before this used `uname -m` when not cross compiling
1263 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1264 OS_TEST="${target_cpu}"
1266 _COMPILER_PREFIX=
1268 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1270 #######################################################################
1271 # Master "Core Components" macros for getting the OS target           #
1272 #######################################################################
1275 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1276 # cross-compilation.
1280 # Define and override various archtecture-specific variables, including
1281 # HOST_OS_ARCH
1282 # OS_ARCH
1283 # OS_TEST
1284 # OS_TARGET
1285 # OS_RELEASE
1286 # OS_MINOR_RELEASE
1289 case "$HOST_OS_ARCH" in
1290 cygwin*|mingw*|mks*|msvc*)
1291     HOST_OS_ARCH=WINNT
1292     ;;
1293 darwin*)
1294     HOST_OS_ARCH=Darwin
1295     ;;
1296 linux*)
1297     HOST_OS_ARCH=Linux
1298     ;;
1299 solaris*)
1300     HOST_OS_ARCH=SunOS
1301     SOLARIS_SUNPRO_CC=
1302     SOLARIS_SUNPRO_CXX=
1303     if test -z "$GNU_CC"; then
1304         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1305             SOLARIS_SUNPRO_CC=1
1306        fi
1307     fi
1309     if test -z "$GNU_CXX"; then
1310        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1311            SOLARIS_SUNPRO_CXX=1
1312        fi
1313     fi
1314     AC_SUBST(SOLARIS_SUNPRO_CC)
1315     AC_SUBST(SOLARIS_SUNPRO_CXX)
1316     ;;
1317 BSD_386)
1318     HOST_OS_ARCH=BSD
1319     ;;
1320 dgux)
1321     HOST_OS_ARCH=DGUX
1322     ;;
1323 IRIX64)
1324     HOST_OS_ARCH=IRIX
1325     ;;
1326 UNIX_SV)
1327     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1328         HOST_OS_ARCH=NCR
1329     else
1330         HOST_OS_ARCH=UNIXWARE
1331     fi
1332     ;;
1333 ncr)
1334     HOST_OS_ARCH=NCR
1335     ;;
1336 UNIX_SYSTEM_V)
1337     HOST_OS_ARCH=NEC
1338     ;;
1339 OSF1)
1340     ;;
1341 *OpenVMS*)
1342     HOST_OS_ARCH=OpenVMS
1343     ;;
1344 OS_2)
1345     HOST_OS_ARCH=OS2
1346     ;;
1347 QNX)
1348     ;;
1349 SCO_SV)
1350     HOST_OS_ARCH=SCOOS
1351     ;;
1352 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1353     HOST_OS_ARCH=SINIX
1354     ;;
1355 UnixWare)
1356     HOST_OS_ARCH=UNIXWARE
1357     ;;
1358 esac
1360 case "$OS_ARCH" in
1361 WINNT)
1362     if test -z "$CROSS_COMPILE" ; then
1363         OS_TEST=`uname -p`
1364     fi
1365     ;;
1366 Windows_NT)
1368 # If uname -s returns "Windows_NT", we assume that we are using
1369 # the uname.exe in MKS toolkit.
1371 # The -r option of MKS uname only returns the major version number.
1372 # So we need to use its -v option to get the minor version number.
1373 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1375     OS_ARCH=WINNT
1376     OS_TARGET=WINNT
1377     OS_MINOR_RELEASE=`uname -v`
1378     if test "$OS_MINOR_RELEASE" = "00"; then
1379         OS_MINOR_RELEASE=0
1380     fi
1381     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1382     ;;
1383 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1385 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1386 # the uname.exe in the Cygwin tools.
1387 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1388 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1389 # the uname.exe in the GNU-Win32 tools.
1390 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1391 # the uname.exe in the MSYS tools.
1393     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1394     OS_ARCH=WINNT
1395     OS_TARGET=WINNT
1396     ;;
1397 AIX)
1398     OS_RELEASE=`uname -v`.`uname -r`
1399     OS_TEST=${target_cpu}
1400     ;;
1401 BSD_386)
1402     OS_ARCH=BSD
1403     ;;
1404 dgux)
1405     OS_ARCH=DGUX
1406     ;;
1407 IRIX64)
1408     OS_ARCH=IRIX
1409     ;;
1410 UNIX_SV)
1411     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1412         OS_ARCH=NCR
1413     else
1414         OS_ARCH=UNIXWARE
1415         OS_RELEASE=`uname -v`
1416     fi
1417     ;;
1418 ncr)
1419     OS_ARCH=NCR
1420     ;;
1421 UNIX_SYSTEM_V)
1422     OS_ARCH=NEC
1423     ;;
1424 OSF1)
1425     case `uname -v` in
1426     148)
1427         OS_RELEASE=V3.2C
1428         ;;
1429     564)
1430         OS_RELEASE=V4.0B
1431         ;;
1432     878)
1433         OS_RELEASE=V4.0D
1434         ;;
1435     esac
1436     ;;
1437 *OpenVMS*)
1438     OS_ARCH=OpenVMS
1439     OS_RELEASE=`uname -v`
1440     OS_TEST=`uname -p`
1441     ;;
1442 OS_2)
1443     OS_ARCH=OS2
1444     OS_TARGET=OS2
1445     OS_RELEASE=`uname -v`
1446     ;;
1447 QNX)
1448     if test "$OS_TARGET" != "NTO"; then
1449         changequote(,)
1450         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1451         changequote([,])
1452     fi
1453     OS_TEST=x86
1454     ;;
1455 SCO_SV)
1456     OS_ARCH=SCOOS
1457     OS_RELEASE=5.0
1458     ;;
1459 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1460     OS_ARCH=SINIX
1461     OS_TEST=`uname -p`
1462     ;;
1463 UnixWare)
1464     OS_ARCH=UNIXWARE
1465     OS_RELEASE=`uname -v`
1466     ;;
1467 WINCE)
1468     OS_ARCH=WINCE
1469     case "${target_os}" in
1470     *winmo)
1471         OS_TARGET=WINMO
1472         WINCE_WINDOWS_MOBILE=1
1473         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1474         ;;
1475     *)
1476         OS_TARGET=WINCE
1477         ;;
1478     esac
1479     ;;
1480 Darwin)
1481     case "${target_cpu}" in
1482     powerpc*)
1483         OS_TEST=ppc
1484         ;;
1485     i*86*)
1486         OS_TEST=i386 
1487         ;;
1488     x86_64)
1489         OS_TEST=x86_64
1490         ;;
1491     *)
1492         if test -z "$CROSS_COMPILE" ; then
1493             OS_TEST=`uname -p`
1494         fi
1495         ;;
1496     esac
1497     ;;
1498 esac
1500 if test "$OS_ARCH" = "NCR"; then
1501     changequote(,)
1502     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1503     changequote([,])
1506 # Only set CPU_ARCH if we recognize the value of OS_TEST
1508 case "$OS_TEST" in
1509 *86 | i86pc)
1510     CPU_ARCH=x86
1511     ;;
1513 powerpc64 | ppc64)
1514     CPU_ARCH=ppc64
1515     ;;
1517 powerpc | ppc | rs6000)
1518     CPU_ARCH=ppc
1519     ;;
1521 Alpha | alpha | ALPHA)
1522     CPU_ARCH=Alpha
1523     ;;
1525 s390)
1526     CPU_ARCH=s390
1527     ;;
1529 s390x)
1530     CPU_ARCH=s390x
1531     ;;
1533 hppa* | parisc)
1534     CPU_ARCH=hppa
1535     ;;
1537 sun4u | sparc*)
1538     CPU_ARCH=sparc
1539     ;;
1541 x86_64 | ia64)
1542     CPU_ARCH="$OS_TEST"
1543     ;;
1545 arm*)
1546     CPU_ARCH=arm
1547     ;;
1548 esac
1550 if test -z "$OS_TARGET"; then
1551     OS_TARGET=$OS_ARCH
1553 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1555 dnl ========================================================
1556 dnl GNU specific defaults
1557 dnl ========================================================
1558 if test "$GNU_CC"; then
1559     # FIXME: Let us build with strict aliasing. bug 414641.
1560     CFLAGS="$CFLAGS -fno-strict-aliasing"
1561     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1562     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1563     DSO_LDOPTS='-shared'
1564     if test "$GCC_USE_GNU_LD"; then
1565         # Don't allow undefined symbols in libraries
1566         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1567     fi
1568     WARNINGS_AS_ERRORS='-Werror'
1569     DSO_CFLAGS=''
1570     DSO_PIC_CFLAGS='-fPIC'
1571     ASFLAGS="$ASFLAGS -fPIC"
1572     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1573     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1574     _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1575     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1577     # Turn on GNU specific features
1578     # -Wall - turn on all warnings
1579     # -pedantic - make compiler warn about non-ANSI stuff, and
1580     #             be a little bit stricter
1581     # Warnings slamm took out for now (these were giving more noise than help):
1582     # -Wbad-function-cast - warns when casting a function to a new return type
1583     # -Wshadow - removed because it generates more noise than help --pete
1584     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1585     if test -z "$INTEL_CC"; then
1586        # Don't use -Wcast-align with ICC
1587        case "$CPU_ARCH" in
1588            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1589            hppa | ia64 | sparc | arm)
1590            ;;
1591            *)
1592         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1593            ;;
1594        esac
1595     fi
1597     dnl Turn pedantic on but disable the warnings for long long
1598     _PEDANTIC=1
1600     if test -z "$INTEL_CC"; then
1601       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1602     fi
1604     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1605     _USE_CPP_INCLUDE_FLAG=1
1606 elif test "$SOLARIS_SUNPRO_CC"; then
1607     DSO_CFLAGS=''
1608     if test "$CPU_ARCH" = "sparc"; then
1609         # for Sun Studio on Solaris/SPARC
1610         DSO_PIC_CFLAGS='-xcode=pic32'
1611     else
1612         DSO_PIC_CFLAGS='-KPIC'
1613     fi
1614     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1615 else
1616     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1617     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1619     DSO_LDOPTS='-shared'
1620     if test "$GNU_LD"; then
1621         # Don't allow undefined symbols in libraries
1622         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1623     fi
1625     DSO_CFLAGS=''
1626     DSO_PIC_CFLAGS='-KPIC'
1627     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1630 if test "$GNU_CXX"; then
1631     # FIXME: Let us build with strict aliasing. bug 414641.
1632     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1633     # Turn on GNU specific features
1634     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1635     if test -z "$INTEL_CC"; then
1636        # Don't use -Wcast-align with ICC
1637        case "$CPU_ARCH" in
1638            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1639            hppa | ia64 | sparc | arm)
1640            ;;
1641            *)
1642         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1643            ;;
1644        esac
1645     fi
1647     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1648     _USE_CPP_INCLUDE_FLAG=1
1650     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1651                    ac_has_wno_invalid_offsetof,
1652         [
1653             AC_LANG_SAVE
1654             AC_LANG_CPLUSPLUS
1655             _SAVE_CXXFLAGS="$CXXFLAGS"
1656             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1657             AC_TRY_COMPILE([],
1658                            [return(0);],
1659                            ac_has_wno_invalid_offsetof="yes",
1660                            ac_has_wno_invalid_offsetof="no")
1661             CXXFLAGS="$_SAVE_CXXFLAGS"
1662             AC_LANG_RESTORE
1663         ])
1664     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1665         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1666     fi
1668     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1669                    ac_has_wno_variadic_macros,
1670         [
1671             AC_LANG_SAVE
1672             AC_LANG_CPLUSPLUS
1673             _SAVE_CXXFLAGS="$CXXFLAGS"
1674             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1675             AC_TRY_COMPILE([],
1676                            [return(0);],
1677                            ac_has_wno_variadic_macros="yes",
1678                            ac_has_wno_variadic_macros="no")
1679             CXXFLAGS="$_SAVE_CXXFLAGS"
1680             AC_LANG_RESTORE
1681         ])
1682     if test "$ac_has_wno_variadic_macros" = "yes"; then
1683         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1684     fi
1686     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1687                    ac_has_werror_return_type,
1688         [
1689             AC_LANG_SAVE
1690             AC_LANG_CPLUSPLUS
1691             _SAVE_CXXFLAGS="$CXXFLAGS"
1692             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1693             AC_TRY_COMPILE([],
1694                            [return(0);],
1695                            ac_has_werror_return_type="yes",
1696                            ac_has_werror_return_type="no")
1697             CXXFLAGS="$_SAVE_CXXFLAGS"
1698             AC_LANG_RESTORE
1699         ])
1700     if test "$ac_has_werror_return_type" = "yes"; then
1701         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1702     fi
1704 else
1705     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1708 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1709 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1710 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1711 dnl normal behavior.
1712 dnl ========================================================
1713 MKSHLIB_FORCE_ALL=
1714 MKSHLIB_UNFORCE_ALL=
1716 if test "$COMPILE_ENVIRONMENT"; then
1717 if test "$GNU_CC"; then
1718   AC_MSG_CHECKING(whether ld has archive extraction flags)
1719   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1720    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1721     ac_cv_mkshlib_force_and_unforce="no"
1722     exec 3<&0 <<LOOP_INPUT
1723         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1724         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1725         force="-Wl,-all";              unforce="-Wl,-none"
1726 LOOP_INPUT
1727     while read line
1728     do
1729       eval $line
1730       LDFLAGS=$force
1731       LIBS=$unforce
1732       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1733     done
1734     exec 0<&3 3<&-
1735     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1736    ])
1737   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1738     AC_MSG_RESULT(no)
1739   else
1740     AC_MSG_RESULT(yes)
1741     eval $ac_cv_mkshlib_force_and_unforce
1742     MKSHLIB_FORCE_ALL=$force
1743     MKSHLIB_UNFORCE_ALL=$unforce
1744   fi
1745 fi # GNU_CC
1746 fi # COMPILE_ENVIRONMENT
1748 dnl =================================================================
1749 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1750 dnl which is bad when cross compiling.
1751 dnl =================================================================
1752 if test "$COMPILE_ENVIRONMENT"; then
1753 configure_static_assert_macros='
1754 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1755 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1756 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1759 dnl test that the macros actually work:
1760 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1761 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1762  [AC_LANG_SAVE
1763   AC_LANG_C
1764   ac_cv_static_assertion_macros_work="yes"
1765   AC_TRY_COMPILE([$configure_static_assert_macros],
1766                  [CONFIGURE_STATIC_ASSERT(1)],
1767                  ,
1768                  ac_cv_static_assertion_macros_work="no")
1769   AC_TRY_COMPILE([$configure_static_assert_macros],
1770                  [CONFIGURE_STATIC_ASSERT(0)],
1771                  ac_cv_static_assertion_macros_work="no",
1772                  )
1773   AC_LANG_CPLUSPLUS
1774   AC_TRY_COMPILE([$configure_static_assert_macros],
1775                  [CONFIGURE_STATIC_ASSERT(1)],
1776                  ,
1777                  ac_cv_static_assertion_macros_work="no")
1778   AC_TRY_COMPILE([$configure_static_assert_macros],
1779                  [CONFIGURE_STATIC_ASSERT(0)],
1780                  ac_cv_static_assertion_macros_work="no",
1781                  )
1782   AC_LANG_RESTORE
1783  ])
1784 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1785 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1786     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1788 fi # COMPILE_ENVIRONMENT
1790 dnl ========================================================
1791 dnl Checking for 64-bit OS
1792 dnl ========================================================
1793 if test "$COMPILE_ENVIRONMENT"; then
1794 AC_LANG_SAVE
1795 AC_LANG_C
1796 AC_MSG_CHECKING(for 64-bit OS)
1797 AC_TRY_COMPILE([$configure_static_assert_macros],
1798                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1799                result="yes", result="no")
1800 AC_MSG_RESULT("$result")
1801 if test "$result" = "yes"; then
1802     AC_DEFINE(HAVE_64BIT_OS)
1803     HAVE_64BIT_OS=1
1805 AC_SUBST(HAVE_64BIT_OS)
1806 AC_LANG_RESTORE
1807 fi # COMPILE_ENVIRONMENT
1809 dnl ========================================================
1810 dnl Enable high-memory support on OS/2 by default.
1811 dnl ========================================================
1812 MOZ_OS2_HIGH_MEMORY=1
1813 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1814 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1815     MOZ_OS2_HIGH_MEMORY=,
1816     MOZ_OS2_HIGH_MEMORY=1 )
1817 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1819 dnl ========================================================
1820 dnl System overrides of the defaults for host
1821 dnl ========================================================
1822 case "$host" in
1823 *-beos*)
1824     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1825     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1826     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1827     ;;
1829 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1830     # we need Python 2.5 on Windows
1831     PYTHON_VERSION=2.5
1832     if test -n "$_WIN32_MSVC"; then
1833         HOST_AR=lib
1834         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1835         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1836         HOST_RANLIB='echo ranlib'
1837     else
1838         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1839     fi
1840     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1841     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1842     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1843     HOST_BIN_SUFFIX=.exe
1844     case "$host" in
1845     *mingw*)
1846     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1847         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1848         ;;
1849     *)
1850         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1851         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1852             _pwd=`pwd`
1853             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1854         fi
1855         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1856             AS_PERL=1
1857             PERL="${CYGWIN_WRAPPER} $PERL"
1858         fi
1860         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1861             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1862         fi
1863         ;;
1864     esac
1866     case "${host_cpu}" in
1867     x86_64)
1868         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1869         ;;
1870     esac
1871     ;;
1873 *-darwin*)
1874     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1875     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1876     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1877     ;;
1879 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1880     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1881     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1882     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1883     ;;
1885 *os2*)
1886     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1887     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1888     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1889     HOST_BIN_SUFFIX=.exe
1890     MOZ_FIX_LINK_PATHS=
1891     ;;
1893 *-osf*)
1894     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1895     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1896     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1897     ;;
1900     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1901     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1902     ;;
1903 esac
1905 dnl We require version 2.4 or newer of Python to build,
1906 dnl and 2.5 or newer on Windows.
1907 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1908 changequote(,)
1909 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1910 _python_res=$?
1911 changequote([,])
1912 if test "$_python_res" != 0; then
1913     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1915 AC_MSG_RESULT([yes])
1917 dnl Get mozilla version from central milestone file
1918 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1920 dnl Get version of various core apps from the version files.
1921 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1923 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1924 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1926 dnl ========================================================
1927 dnl System overrides of the defaults for target
1928 dnl ========================================================
1930 case "$target" in
1931 *-aix*)
1932     AC_DEFINE(AIX)
1933     if test ! "$GNU_CC"; then
1934         if test ! "$HAVE_64BIT_OS"; then
1935             # Compiling with Visual Age C++ object model compat is the
1936             # default. To compile with object model ibm, add 
1937             # AIX_OBJMODEL=ibm to .mozconfig.
1938             if test "$AIX_OBJMODEL" = "ibm"; then
1939                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1940             else
1941                 AIX_OBJMODEL=compat
1942             fi
1943         else
1944             AIX_OBJMODEL=compat
1945         fi
1946         AC_SUBST(AIX_OBJMODEL)
1947         DSO_LDOPTS='-qmkshrobj=1'
1948         DSO_CFLAGS='-qflag=w:w'
1949         DSO_PIC_CFLAGS=
1950         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1951         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1952         MOZ_FIX_LINK_PATHS=
1953         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1954         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1955         if test "$COMPILE_ENVIRONMENT"; then
1956             AC_LANG_SAVE
1957             AC_LANG_CPLUSPLUS
1958             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1959             AC_TRY_COMPILE([],
1960                 [#if (__IBMCPP__ < 600)
1961                  #error "Bad compiler"
1962                  #endif],
1963                 _BAD_COMPILER=,_BAD_COMPILER=1)
1964             if test -n "$_BAD_COMPILER"; then
1965                 AC_MSG_RESULT([no])    
1966                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1967             else
1968                 AC_MSG_RESULT([yes])    
1969             fi
1970             AC_LANG_RESTORE
1971             TARGET_COMPILER_ABI="ibmc"
1972             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1973             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1974         fi
1975     fi
1976     case "${target_os}" in
1977     aix4.1*)
1978         DLL_SUFFIX='_shr.a'
1979         ;;
1980     esac
1981     if test "$COMPILE_ENVIRONMENT"; then
1982         AC_CHECK_HEADERS(sys/inttypes.h)
1983     fi
1984     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1985     ;;
1987 *-beos*)
1988     no_x=yes
1989     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1990     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1991     DSO_LDOPTS='-nostart'
1992     TK_LIBS='-lbe -lroot'
1993     LIBS="$LIBS -lbe"
1994     if test "$COMPILE_ENVIRONMENT"; then
1995         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1996         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1997     fi
1998     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1999     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
2000     _MOZ_USE_RTTI=1
2001     USE_DEPENDENT_LIBS=
2002     MOZ_USER_DIR="Mozilla"
2003     ;;
2005 *-bsdi*)
2006     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2007     _PEDANTIC=
2008     case $OS_RELEASE in
2009         4.*|5.*)
2010             STRIP="$STRIP -d"
2011             ;;
2012         *)
2013             DSO_CFLAGS=''
2014             DSO_LDOPTS='-r'
2015             _WARNINGS_CFLAGS="-Wall"
2016             _WARNINGS_CXXFLAGS="-Wall"
2017             # The test above doesn't work properly, at least on 3.1.
2018             MKSHLIB_FORCE_ALL=''
2019             MKSHLIB_UNFORCE_ALL=''
2020         ;;
2021     esac
2022     ;;
2024 *-darwin*) 
2025     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2026     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2027     MOZ_OPTIMIZE_FLAGS="-O3"
2028     _PEDANTIC=
2029     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2030     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2031     DLL_SUFFIX=".dylib"
2032     DSO_LDOPTS=''
2033     STRIP="$STRIP -x -S"
2034     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2035     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2036     # The ExceptionHandling framework is needed for Objective-C exception
2037     # logging code in nsObjCExceptions.h. Currently we only use that in debug
2038     # builds.
2039     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2041     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2042     dnl ===================================================================
2043     if test "x$enable_dtrace" = "xyes"; then
2044         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2045     else
2046         dnl check for the presence of the -dead_strip linker flag
2047         AC_MSG_CHECKING([for -dead_strip option to ld])
2048         _SAVE_LDFLAGS=$LDFLAGS
2049         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2050         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2051         if test -n "$_HAVE_DEAD_STRIP" ; then
2052             AC_MSG_RESULT([yes])
2053             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2054         else
2055             AC_MSG_RESULT([no])
2056         fi
2057         
2058         LDFLAGS=$_SAVE_LDFLAGS
2059     fi
2060     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2061     ;;
2063 *-freebsd*)
2064     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2065         DLL_SUFFIX=".so.1.0"
2066         DSO_LDOPTS="-shared"
2067     fi
2068     if test ! "$GNU_CC"; then
2069         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2070     fi
2071     ;; 
2073 ia64*-hpux*)
2074     DLL_SUFFIX=".so"
2075     if test ! "$GNU_CC"; then
2076        DSO_LDOPTS='-b'
2077        DSO_CFLAGS=""
2078        DSO_PIC_CFLAGS=
2079        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2080        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2081        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2082     else
2083        DSO_LDOPTS='-b -E'
2084        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2085        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2086     fi
2087     MOZ_FIX_LINK_PATHS=
2088     SYSTEM_MAKEDEPEND=
2089     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2090     AC_DEFINE(_LARGEFILE64_SOURCE)
2091     ;;
2093 *-hpux*)
2094     DLL_SUFFIX=".sl"
2095     if test ! "$GNU_CC"; then
2096         DSO_LDOPTS='-b -Wl,+s'
2097         DSO_CFLAGS=""
2098         DSO_PIC_CFLAGS="+Z"
2099         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2100         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2101         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2102     else
2103         DSO_LDOPTS='-b -E +s'
2104         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2105         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2106     fi
2107     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2108     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2109     ;;
2111 *-irix5*)
2112     AC_DEFINE(IRIX)
2113     DSO_LDOPTS='-elf -shared'
2115     if test "$GNU_CC"; then
2116        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2117        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2118        MKSHLIB_FORCE_ALL='-Wl,-all'
2119        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2120        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2121     else
2122        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2123        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2124        MKSHLIB_FORCE_ALL='-all'
2125        MKSHLIB_UNFORCE_ALL='-none'
2126     fi
2127     ;;
2129 *-irix6*)
2130     AC_DEFINE(IRIX)
2131     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2132     dnl compile and link using -n32
2133     USE_N32=1
2134     TARGET_COMPILER_ABI=n32
2135     DSO_LDOPTS='-elf -shared'
2136     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2137     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2138     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2139     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2140     if test "$GNU_CC"; then
2141        MKSHLIB_FORCE_ALL='-Wl,-all'
2142        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2143        _WARNINGS_CFLAGS="-Wall"
2144        _WARNINGS_CXXFLAGS="-Wall"
2145        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2146     else
2147        MKSHLIB_FORCE_ALL='-all'
2148        MKSHLIB_UNFORCE_ALL='-none'
2149            AR_LIST="$AR t"
2150            AR_EXTRACT="$AR x"
2151            AR_DELETE="$AR d"
2152            AR='$(CXX) -ar'
2153            AR_FLAGS='-o $@'
2154        CFLAGS="$CFLAGS -woff 3262 -G 4"
2155        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2156        if test -n "$USE_N32"; then
2157            ASFLAGS="$ASFLAGS -n32"
2158            CFLAGS="$CFLAGS -n32"
2159            CXXFLAGS="$CXXFLAGS -n32"
2160            LDFLAGS="$LDFLAGS -n32"
2161        fi
2162        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2163        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2164        MOZ_FIX_LINK_PATHS=
2165     fi
2166     if test -z "$GNU_CXX"; then
2167       MIPSPRO_CXX=1
2168     fi
2169     ;;
2171 *-*linux*)
2172     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2173     # Similarly for GNU_CXX and INTEL_CXX.
2174     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2175         # -Os has been broken on Intel's C/C++ compilers for quite a
2176         # while; Intel recommends against using it.
2177         MOZ_OPTIMIZE_FLAGS="-O2"
2178         MOZ_DEBUG_FLAGS="-g"
2179     elif test "$GNU_CC" -o "$GNU_CXX"; then
2180         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2181         case $GCC_VERSION in
2182         4.1.*|4.2.*|4.5.*)
2183             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2184             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2185         esac
2186         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2187         MOZ_DEBUG_FLAGS="-g"
2188     fi
2190     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2192     MOZ_MEMORY=1
2194     case "${target_cpu}" in
2195     alpha*)
2196         CFLAGS="$CFLAGS -mieee"
2197         CXXFLAGS="$CXXFLAGS -mieee"
2198     ;;
2199     i*86)
2200         USE_ELF_DYNSTR_GC=1
2201     ;;
2202     mips*)
2203         MOZ_DEBUG_FLAGS="-g" # We want inlining
2204     ;;
2205     esac
2206     ;;
2208 *-wince*|*-winmo*)
2209     TARGET_COMPILER_ABI=msvc
2210     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2211     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2212     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2213     AR_LIST="$AR -list"
2214     AR_EXTRACT="$AR -extract"
2215     AR_DELETE="$AR d"
2216     AR_FLAGS='-OUT:"$@"'
2217     MOZ_MEMORY=1
2218     NSS_DISABLE_DBM=1
2219     MOZ_OGG=
2220     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2222     if test "$AS_BIN"; then
2223         AS="$AS_BIN"
2224     fi
2225     DSO_CFLAGS=
2226     DSO_PIC_CFLAGS=
2227     DLL_SUFFIX=.dll
2228     BIN_SUFFIX='.exe'
2229     if test -z "$RC"; then 
2230         RC=rc.exe  
2231     fi
2232     # certain versions of cygwin's makedepend barf on the 
2233     # #include <string> vs -I./dist/include/string issue so don't use it
2234     SYSTEM_MAKEDEPEND=
2236     HOST_CC=cl
2237     HOST_CXX=cl
2238     HOST_LD=link
2239     HOST_AR='lib -OUT:$@'
2240     HOST_RANLIB='echo ranlib'
2241     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2242         
2243         
2244     WARNINGS_AS_ERRORS='-WX'
2245     MOZ_OPTIMIZE_FLAGS='-Ox'
2246     AR_FLAGS='-NOLOGO -OUT:"$@"'
2247     ASM_SUFFIX=asm
2248     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2249     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2250     DLL_PREFIX=
2251     DOXYGEN=:
2252     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2253     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2254     GARBAGE=
2255     IMPORT_LIB_SUFFIX=lib
2256     dnl Need to force-link against mozalloc because it's used in the shunt
2257     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2258     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2259     LIB_PREFIX=
2260     LIB_SUFFIX=lib 
2261     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2262     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2263     MKSHLIB_FORCE_ALL=
2264     MKSHLIB_UNFORCE_ALL=
2265     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2266     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2267     MOZ_DEBUG_FLAGS='-Zi'
2268     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2269     MOZ_FIX_LINK_PATHS=
2270     MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2271     MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2272     OBJ_SUFFIX=obj
2273     RANLIB='echo not_ranlib'
2274     STRIP='echo not_strip'
2275     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2276     UNZIP=unzip
2277     XARGS=xargs
2278     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2279     ZIP=zip
2280     MOZ_TREE_FREETYPE=1
2282     AC_DEFINE(HAVE_SNPRINTF)
2283     AC_DEFINE(_WINDOWS)
2284     AC_DEFINE(WIN32)
2285     AC_DEFINE(XP_WIN)
2286     AC_DEFINE(XP_WIN32)
2287     AC_DEFINE(HW_THREADS)
2288     AC_DEFINE(STDC_HEADERS)
2289     AC_DEFINE(NEW_H, <new>)
2290     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2291     AC_DEFINE(HAVE_LOCALTIME_R)
2293     TARGET_MD_ARCH=win32
2294     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2295     BIN_SUFFIX='.exe'
2296     MOZ_USER_DIR="Mozilla"
2298     MOZ_GFX_OPTIMIZE_MOBILE=1
2300     # Sanity check for WINCE_WINDOWS_MOBILE
2301     # XXX disabled until we can fix the mobile tinderbox
2302     ##if test "$WINCE_WINDOWS_MOBILE"; then
2303     ##   AC_CHECK_HEADER(tpcshell.h, [],
2304     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2305     ##fi
2309 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2310     DSO_CFLAGS=
2311     DSO_PIC_CFLAGS=
2312     DLL_SUFFIX=.dll
2313     RC=rc.exe
2314     # certain versions of cygwin's makedepend barf on the 
2315     # #include <string> vs -I./dist/include/string issue so don't use it
2316     SYSTEM_MAKEDEPEND=
2317     if test -n "$GNU_CC"; then
2318         CC="$CC -mno-cygwin"
2319         CXX="$CXX -mno-cygwin"
2320         CPP="$CPP -mno-cygwin"
2321         CFLAGS="$CFLAGS -mms-bitfields"
2322         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2323         DSO_LDOPTS='-shared'
2324         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2325         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2326         RC='$(WINDRES)'
2327         # Use temp file for windres (bug 213281)
2328         RCFLAGS='-O coff --use-temp-file'
2329         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2330         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2331         MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
2332         MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
2333         MOZ_FIX_LINK_PATHS=
2334         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2335         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2336         DLL_PREFIX=
2337         IMPORT_LIB_SUFFIX=dll.a
2338         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2339     else
2340         TARGET_COMPILER_ABI=msvc
2341         HOST_CC='$(CC)'
2342         HOST_CXX='$(CXX)'
2343         HOST_LD='$(LD)'
2344         if test "$AS_BIN"; then
2345             AS="$(basename "$AS_BIN")"
2346         fi
2347         AR='lib -NOLOGO -OUT:"$@"'
2348         AR_FLAGS=
2349         RANLIB='echo not_ranlib'
2350         STRIP='echo not_strip'
2351         XARGS=xargs
2352         ZIP=zip
2353         UNZIP=unzip
2354         DOXYGEN=:
2355         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2356         ASM_SUFFIX=asm
2357         OBJ_SUFFIX=obj
2358         LIB_SUFFIX=lib
2359         DLL_PREFIX=
2360         LIB_PREFIX=
2361         IMPORT_LIB_SUFFIX=lib
2362         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2363         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2364         MKSHLIB_FORCE_ALL=
2365         MKSHLIB_UNFORCE_ALL=
2366         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2367         _USE_CPP_INCLUDE_FLAG=1
2368         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2369         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2370         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2371         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2372         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2373         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2374         MOZ_DEBUG_FLAGS='-Zi'
2375         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2376         WARNINGS_AS_ERRORS='-WX'
2377         MOZ_OPTIMIZE_FLAGS='-O1'
2378         MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2379         MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2380         MOZ_FIX_LINK_PATHS=
2381         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2382         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2383         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2384         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2385         if test $_MSC_VER -ge 1400; then
2386             LDFLAGS="$LDFLAGS -NXCOMPAT"
2387             dnl For profile-guided optimization
2388             PROFILE_GEN_CFLAGS="-GL"
2389             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2390             dnl XXX: PGO builds can fail with warnings treated as errors,
2391             dnl specifically "no profile data available" appears to be
2392             dnl treated as an error sometimes. This might be a consequence
2393             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2394             dnl with the linker doing most of the work in the whole-program
2395             dnl optimization/PGO case. I think it's probably a compiler bug,
2396             dnl but we work around it here.
2397             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2398             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2399             dnl Probably also a compiler bug, but what can you do?
2400             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2401             if test -n "$_USE_DYNAMICBASE"; then
2402                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2403             fi
2404         fi
2405     fi
2406     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2407     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2408     AC_DEFINE(HAVE_SNPRINTF)
2409     AC_DEFINE(_WINDOWS)
2410     AC_DEFINE(WIN32)
2411     AC_DEFINE(XP_WIN)
2412     AC_DEFINE(XP_WIN32)
2413     AC_DEFINE(HW_THREADS)
2414     AC_DEFINE(STDC_HEADERS)
2415     AC_DEFINE(NEW_H, <new>)
2416     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2417     TARGET_MD_ARCH=win32
2418     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2419     BIN_SUFFIX='.exe'
2420     MOZ_USER_DIR="Mozilla"
2422     dnl Hardcode to win95 for now - cls
2423     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2425     dnl set NO_X11 defines here as the general check is skipped on win32
2426     no_x=yes
2427     AC_DEFINE(NO_X11)
2429     dnl MinGW/MSYS doesn't provide or need cygpath
2430     case "$host" in
2431     *-mingw*)
2432         CYGPATH_W=echo
2433         CYGPATH_S=cat
2434         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2435         ;;
2436     *-cygwin*|*-msvc*|*-mks*)
2437         CYGPATH_W="cygpath -a -w"
2438         CYGPATH_S="sed -e s|\\\\|/|g"
2439         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2440         ;;
2441     esac
2442     case "$host" in
2443     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2445     if test -z "$MOZ_TOOLS"; then
2446         AC_MSG_ERROR([MOZ_TOOLS is not set])
2447     fi
2449     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2450     if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2451         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2452     fi
2453     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2454     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2455         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2456     fi
2457     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2458     ;;
2459     esac 
2462     case "$host_os" in
2463     cygwin*|msvc*|mks*)
2464         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])
2465         ;;
2467     *)
2468         AC_CHECK_HEADERS(oleacc.idl)
2470         AC_LANG_SAVE
2471         AC_LANG_CPLUSPLUS
2472         AC_CHECK_HEADERS(atlbase.h)
2473         AC_LANG_RESTORE
2474         ;;
2475     esac
2477     case "$target" in
2478     i*86-*)
2479         if test "$HAVE_64BIT_OS"; then
2480             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2481         fi
2483         if test $_MSC_VER -ge 1400; then
2484             LDFLAGS="$LDFLAGS -SAFESEH"
2485         fi
2486         AC_CHECK_HEADERS(mmintrin.h)
2487         AC_DEFINE(_X86_)
2488         ;;
2489     alpha-*)
2490         AC_DEFINE(_ALPHA_)
2491         ;;
2492     mips-*)
2493         AC_DEFINE(_MIPS_)
2494         ;;
2495     x86_64-*)
2496         AC_DEFINE(_AMD64_)
2497         ;;
2498     *)
2499         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2500         ;;
2501     esac
2503     if test "$HAVE_64BIT_OS"; then
2504         AC_DEFINE(_WIN64)
2505     fi
2506     ;;
2508 *-netbsd*)
2509     DSO_CFLAGS=''
2510     CFLAGS="$CFLAGS -Dunix"
2511     CXXFLAGS="$CXXFLAGS -Dunix"
2512     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2513         DLL_SUFFIX=".so"
2514         DSO_PIC_CFLAGS='-fPIC -DPIC'
2515         DSO_LDOPTS='-shared'
2516         BIN_FLAGS='-Wl,--export-dynamic'
2517     else
2518         DSO_PIC_CFLAGS='-fPIC -DPIC'
2519         DLL_SUFFIX=".so.1.0"
2520         DSO_LDOPTS='-shared'
2521     fi
2522     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2523     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2524     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2525     if test "$LIBRUNPATH"; then
2526         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2527     fi
2528     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2529     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2530     ;;
2532 *-nto*) 
2533         AC_DEFINE(NTO)  
2534         AC_DEFINE(_QNX_SOURCE)
2535         AC_DEFINE(_i386)
2536         OS_TARGET=NTO
2537         WARNINGS_AS_ERRORS=''
2538         MOZ_OPTIMIZE_FLAGS="-O"
2539         MOZ_DEBUG_FLAGS="-gstabs"
2540         USE_PTHREADS=1
2541         _PEDANTIC=
2542         LIBS="$LIBS -lsocket -lstdc++"
2543         _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2544         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2545         if test "$with_x" != "yes"
2546         then
2547                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2548             TK_CFLAGS='-I/usr/include/photon'
2549                 TK_LIBS='-lph'
2550         fi
2551         case "${target_cpu}" in
2552         ppc*)
2553         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2554         ;;
2555         esac
2556         case "${host_cpu}" in
2557         i*86)
2558         USE_ELF_DYNSTR_GC=1
2559         ;;
2560         esac
2561         ;;
2563 *-openbsd*)
2564     DLL_SUFFIX=".so.1.0"
2565     DSO_CFLAGS=''
2566     DSO_PIC_CFLAGS='-fPIC'
2567     DSO_LDOPTS='-shared -fPIC'
2568     if test "$LIBRUNPATH"; then
2569         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2570     fi
2571     ;;
2573 *-openvms*) 
2574     AC_DEFINE(NO_PW_GECOS)
2575     AC_DEFINE(NO_UDSOCK)
2576     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2577     USE_PTHREADS=1
2578     MKSHLIB_FORCE_ALL='-all'
2579     MKSHLIB_UNFORCE_ALL='-none'
2580     AS='as'
2581     AS_DASH_C_FLAG='-Wc/names=as_is'
2582     AR_FLAGS='c $@'
2583     DSO_LDOPTS='-shared -auto_symvec'
2584     DSO_PIC_CFLAGS=
2585     MOZ_DEBUG_LDFLAGS='-g'
2586     COMPAQ_CXX=1
2587     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2588     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2589     ;;
2592 *-os2*)
2593     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2594     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2595     AC_DEFINE(OS2)
2596     AC_DEFINE(XP_OS2)
2597     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2598     AC_DEFINE(TCPV40HDRS)
2599     DLL_PREFIX=
2600     LIB_PREFIX=
2601     LIB_SUFFIX=lib
2602     BIN_SUFFIX=".exe"
2603     DLL_SUFFIX=".dll"
2604     IMPORT_LIB_SUFFIX=lib
2605     DSO_PIC_CFLAGS=
2606     AR=emxomfar
2607     AR_FLAGS='r $@'
2608     CFLAGS="$CFLAGS -Zomf"
2609     CXXFLAGS="$CXXFLAGS -Zomf"
2610     DSO_LDOPTS='-Zdll'
2611     BIN_FLAGS='-Zlinker /ST:0x100000'
2612     IMPLIB='emximp -o'
2613     FILTER='emxexp -o'
2614     LDFLAGS='-Zmap'
2615     WARNINGS_AS_ERRORS='-Werror'
2616     MOZ_DEBUG_FLAGS="-g -fno-inline"
2617     MOZ_OPTIMIZE_FLAGS="-O2"
2618     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2619     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2620     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2621     TARGET_MD_ARCH=os2
2622     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2623     RC=rc.exe
2624     RCFLAGS='-n'
2625     MOZ_USER_DIR="Mozilla"
2627     if test "$MOZTOOLS"; then
2628         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2629     else
2630         AC_MSG_ERROR([MOZTOOLS is not set])
2631     fi
2632     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2633         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2634         LDFLAGS="$LDFLAGS -Zhigh-mem"
2635         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2636         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2637     fi
2639     # GCC for OS/2 currently predefines these, but we don't want them
2640     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2641     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2643     AC_CACHE_CHECK(for __declspec(dllexport),
2644         ac_os2_declspec,
2645         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2646                         [return 0;],
2647                         ac_os2_declspec="yes",
2648                         ac_os2_declspec="no")])
2649     if test "$ac_os2_declspec" = "yes"; then
2650         FILTER='true'
2651         MOZ_OS2_USE_DECLSPEC='1'
2652     fi
2653     ;;
2655 alpha*-*-osf*)
2656     if test "$GNU_CC"; then
2657       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2658       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2660     else
2661         MOZ_DEBUG_FLAGS='-g'
2662         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2663         CFLAGS="$CFLAGS -ieee"
2664         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2665         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2666         DSO_CFLAGS=
2667         DSO_PIC_CFLAGS=
2668         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2669         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2670         MKSHLIB_FORCE_ALL='-all'
2671         MKSHLIB_UNFORCE_ALL='-none'
2672         dnl Might fix the libxpcom.so breakage on this platform as well....
2673         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2674         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2675     fi
2676     if test -z "$GNU_CXX"; then
2677       COMPAQ_CXX=1
2678     fi
2679     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2680     ;;
2682 *-qnx*) 
2683     DIRENT_INO=d_stat.st_ino
2684     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2685     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2686     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2687     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2688     AC_DEFINE(STDC_HEADERS)
2689     if test "$no_x" = "yes"; then
2690             _PLATFORM_DEFAULT_TOOLKIT='photon'
2691             TK_CFLAGS='-I/usr/nto/include/photon'
2692             TK_LIBS='-lphoton -lphrender'
2693     fi
2694     ;;
2696 *-sco*) 
2697     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2698     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2699     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2700     if test ! "$GNU_CC"; then
2701        DSO_LDOPTS='-G'
2702     fi
2703     ;;
2705 *-solaris*) 
2706     AC_DEFINE(SOLARIS)
2707     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2708     SYSTEM_MAKEDEPEND=
2709     MOZ_FIX_LINK_PATHS=
2710     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2711     # libraries one level up (e.g. libnspr4.so)
2712     if test "$SOLARIS_SUNPRO_CC"; then
2713        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2714        LIBS="-lCrun -lCstd -lc $LIBS"
2715        NS_USE_NATIVE=1
2716        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2717        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2718        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2719        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2720        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2721        LDFLAGS="-xildoff $LDFLAGS"
2722        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2723            _SAVE_LDFLAGS=$LDFLAGS
2724            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2725            AC_TRY_LINK([#include <stdio.h>],
2726                        [printf("Hello World\n");],
2727                        ,
2728                        [LDFLAGS=$_SAVE_LDFLAGS])
2729        fi
2730        WARNINGS_AS_ERRORS='-Werror'
2731        MOZ_OPTIMIZE_FLAGS="-xO4"
2732        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2733        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2734        MKSHLIB_FORCE_ALL='-z allextract'
2735        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2736        DSO_LDOPTS='-G'
2737        AR_LIST="$AR t"
2738        AR_EXTRACT="$AR x"
2739        AR_DELETE="$AR d"
2740        AR='$(CXX) -xar'
2741        AR_FLAGS='-o $@'
2742        AS='/usr/ccs/bin/as'
2743        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2744        AS_DASH_C_FLAG=''
2745        TARGET_COMPILER_ABI="sunc"
2746        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2747        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2748        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2749        AC_LANG_SAVE
2750        AC_LANG_CPLUSPLUS
2751        AC_TRY_COMPILE([],
2752            [#if (__SUNPRO_CC < 0x590)
2753            #error "Denied"
2754            #endif],
2755            _BAD_COMPILER=,_BAD_COMPILER=1)
2756        if test -n "$_BAD_COMPILER"; then
2757            _res="no"
2758            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2759        else
2760            _res="yes"
2761        fi
2762        AC_TRY_COMPILE([],
2763            [#if (__SUNPRO_CC >= 0x5100)
2764            #error "Sun C++ 5.10 or above"
2765            #endif],
2766            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2767        if test "$_ABOVE_SS12U1"; then
2768            # disable xannotate
2769            CXXFLAGS="$CXXFLAGS -xannotate=no"
2770        fi
2771        AC_MSG_RESULT([$_res])
2772        AC_LANG_RESTORE
2773     else
2774        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2775        LIBS="-lc $LIBS"
2776        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2777        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2778        ASFLAGS="$ASFLAGS -fPIC"
2779        DSO_LDOPTS='-shared'
2780        _WARNINGS_CFLAGS=''
2781        _WARNINGS_CXXFLAGS=''
2782        if test "$OS_RELEASE" = "5.3"; then
2783            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2784        fi
2785     fi
2786     if test "$OS_RELEASE" = "5.5.1"; then
2787         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2788     fi
2789     ;;
2791 *-sunos*) 
2792     DSO_LDOPTS='-Bdynamic'
2793     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2794     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2795     AC_DEFINE(SUNOS4)
2796     AC_DEFINE(SPRINTF_RETURNS_STRING)
2797     case "$(target_os)" in
2798     sunos4.1*)
2799         DLL_SUFFIX='.so.1.0'
2800         ;;
2801     esac
2802     ;;
2804 *-sysv4.2uw7*) 
2805         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2806     ;;
2808 *-os2*)
2809     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2810     ;;
2812 *-android*)
2813     AC_DEFINE(NO_PW_GECOS)
2814     no_x=yes
2815     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2816     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2818     MOZ_GFX_OPTIMIZE_MOBILE=1
2819     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2820     ;;
2822 esac
2824 dnl Only one oddball right now (QNX), but this gives us flexibility
2825 dnl if any other platforms need to override this in the future.
2826 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2828 dnl ========================================================
2829 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2830 dnl by now will not have any way to link most binaries (tests
2831 dnl as well as viewer, apprunner, etc.), because some symbols
2832 dnl will be left out of the "composite" .so's by ld as unneeded.
2833 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2834 dnl they can link in the static libs that provide the missing
2835 dnl symbols.
2836 dnl ========================================================
2837 NO_LD_ARCHIVE_FLAGS=
2838 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2839     NO_LD_ARCHIVE_FLAGS=1
2841 case "$target" in
2842 *-os2*)
2843     NO_LD_ARCHIVE_FLAGS=
2844     ;;
2845 *-aix4.3*|*-aix5*)
2846     NO_LD_ARCHIVE_FLAGS=
2847     ;;
2848 *-openvms*)
2849     NO_LD_ARCHIVE_FLAGS=
2850     ;;
2851 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2852     if test -z "$GNU_CC"; then
2853         NO_LD_ARCHIVE_FLAGS=
2854     fi
2855     ;;
2856 esac
2857 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2859 dnl ========================================================
2860 dnl = Flags to strip unused symbols from .so components
2861 dnl ========================================================
2862 case "$target" in
2863     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2864         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2865         ;;
2866     *-solaris*)
2867         if test -z "$GNU_CC"; then
2868          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2869         else
2870          if test -z "$GCC_USE_GNU_LD"; then
2871           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2872          else
2873           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2874          fi
2875         fi
2876         ;;
2877     *-nto*) 
2878         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2879         ;;
2880     *-darwin*)
2881         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2882         ;;
2883     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2884         if test -n "$GNU_CC"; then
2885            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2886         fi
2887         ;;
2888 esac
2890 if test -z "$COMPILE_ENVIRONMENT"; then
2891     SKIP_COMPILER_CHECKS=1
2892     SKIP_LIBRARY_CHECKS=1
2895 if test -z "$SKIP_COMPILER_CHECKS"; then
2896 dnl Checks for typedefs, structures, and compiler characteristics.
2897 dnl ========================================================
2898 AC_HEADER_STDC
2899 AC_C_CONST
2900 AC_TYPE_MODE_T
2901 AC_TYPE_OFF_T
2902 AC_TYPE_PID_T
2903 AC_TYPE_SIZE_T
2904 AC_LANG_CPLUSPLUS
2905 AC_MSG_CHECKING(for __stdcall)
2906 AC_CACHE_VAL(ac_cv___stdcall,
2907  [AC_TRY_COMPILE([template <typename Method> struct foo;
2908                   template <> struct foo<void (*)()> {};
2909                   template <> struct foo<void (__stdcall*)()> {};],
2910                  [],
2911                  [ac_cv___stdcall=true],
2912                  [ac_cv___stdcall=false])])
2913 if test "$ac_cv___stdcall" = true ; then
2914   AC_DEFINE(HAVE_STDCALL)
2915   AC_MSG_RESULT(yes)
2916 else
2917   AC_MSG_RESULT(no)
2919 AC_LANG_C
2920 AC_MSG_CHECKING(for ssize_t)
2921 AC_CACHE_VAL(ac_cv_type_ssize_t,
2922  [AC_TRY_COMPILE([#include <stdio.h>
2923                   #include <sys/types.h>],
2924                  [ssize_t foo = 0;],
2925                  [ac_cv_type_ssize_t=true],
2926                  [ac_cv_type_ssize_t=false])])
2927 if test "$ac_cv_type_ssize_t" = true ; then
2928   AC_DEFINE(HAVE_SSIZE_T)
2929   AC_MSG_RESULT(yes)
2930 else
2931   AC_MSG_RESULT(no)
2933 AC_STRUCT_ST_BLKSIZE
2934 AC_MSG_CHECKING(for siginfo_t)
2935 AC_CACHE_VAL(ac_cv_siginfo_t,
2936  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2937                   #include <signal.h>],
2938                  [siginfo_t* info;],
2939                  [ac_cv_siginfo_t=true],
2940                  [ac_cv_siginfo_t=false])])
2941 if test "$ac_cv_siginfo_t" = true ; then
2942   AC_DEFINE(HAVE_SIGINFO_T)
2943   AC_MSG_RESULT(yes)
2944 else
2945   AC_MSG_RESULT(no)
2948 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2949 dnl ========================================================
2950 AC_MSG_CHECKING(for int16_t)
2951 AC_CACHE_VAL(ac_cv_int16_t,
2952  [AC_TRY_COMPILE([#include <stdio.h>
2953                   #include <sys/types.h>],
2954                  [int16_t foo = 0;],
2955                  [ac_cv_int16_t=true],
2956                  [ac_cv_int16_t=false])])
2957 if test "$ac_cv_int16_t" = true ; then
2958   AC_DEFINE(HAVE_INT16_T)
2959   AC_MSG_RESULT(yes)
2960 else
2961   AC_MSG_RESULT(no)
2963 AC_MSG_CHECKING(for int32_t)
2964 AC_CACHE_VAL(ac_cv_int32_t,
2965  [AC_TRY_COMPILE([#include <stdio.h>
2966                   #include <sys/types.h>],
2967                  [int32_t foo = 0;],
2968                  [ac_cv_int32_t=true],
2969                  [ac_cv_int32_t=false])])
2970 if test "$ac_cv_int32_t" = true ; then
2971   AC_DEFINE(HAVE_INT32_T)
2972   AC_MSG_RESULT(yes)
2973 else
2974   AC_MSG_RESULT(no)
2976 AC_MSG_CHECKING(for int64_t)
2977 AC_CACHE_VAL(ac_cv_int64_t,
2978  [AC_TRY_COMPILE([#include <stdio.h>
2979                   #include <sys/types.h>],
2980                  [int64_t foo = 0;],
2981                  [ac_cv_int64_t=true],
2982                  [ac_cv_int64_t=false])])
2983 if test "$ac_cv_int64_t" = true ; then
2984   AC_DEFINE(HAVE_INT64_T)
2985   AC_MSG_RESULT(yes)
2986 else
2987   AC_MSG_RESULT(no)
2989 AC_MSG_CHECKING(for int64)
2990 AC_CACHE_VAL(ac_cv_int64,
2991  [AC_TRY_COMPILE([#include <stdio.h>
2992                   #include <sys/types.h>],
2993                  [int64 foo = 0;],
2994                  [ac_cv_int64=true],
2995                  [ac_cv_int64=false])])
2996 if test "$ac_cv_int64" = true ; then
2997   AC_DEFINE(HAVE_INT64)
2998   AC_MSG_RESULT(yes)
2999 else
3000   AC_MSG_RESULT(no)
3002 AC_MSG_CHECKING(for uint)
3003 AC_CACHE_VAL(ac_cv_uint,
3004  [AC_TRY_COMPILE([#include <stdio.h>
3005                   #include <sys/types.h>],
3006                  [uint foo = 0;],
3007                  [ac_cv_uint=true],
3008                  [ac_cv_uint=false])])
3009 if test "$ac_cv_uint" = true ; then
3010   AC_DEFINE(HAVE_UINT)
3011   AC_MSG_RESULT(yes)
3012 else
3013   AC_MSG_RESULT(no)
3015 AC_MSG_CHECKING(for uint_t)
3016 AC_CACHE_VAL(ac_cv_uint_t,
3017  [AC_TRY_COMPILE([#include <stdio.h>
3018                   #include <sys/types.h>],
3019                  [uint_t foo = 0;],
3020                  [ac_cv_uint_t=true],
3021                  [ac_cv_uint_t=false])])
3022 if test "$ac_cv_uint_t" = true ; then
3023   AC_DEFINE(HAVE_UINT_T)
3024   AC_MSG_RESULT(yes)
3025 else
3026   AC_MSG_RESULT(no)
3028 AC_MSG_CHECKING(for uint16_t)
3029 AC_CACHE_VAL(ac_cv_uint16_t,
3030  [AC_TRY_COMPILE([#include <stdio.h>
3031                   #include <sys/types.h>],
3032                  [uint16_t foo = 0;],
3033                  [ac_cv_uint16_t=true],
3034                  [ac_cv_uint16_t=false])])
3035 if test "$ac_cv_uint16_t" = true ; then
3036   AC_DEFINE(HAVE_UINT16_T)
3037   AC_MSG_RESULT(yes)
3038 else
3039   AC_MSG_RESULT(no)
3042 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3043 dnl are defined when compiling C++ but not C.  Since the result of this
3044 dnl test is used only in C++, do it in C++.
3045 AC_LANG_CPLUSPLUS
3047 AC_MSG_CHECKING(for uname.domainname)
3048 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3049     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3050         [ struct utsname *res; char *domain; 
3051             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3052         [ac_cv_have_uname_domainname_field=true],
3053         [ac_cv_have_uname_domainname_field=false])])
3055 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3056     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3057     AC_MSG_RESULT(yes)
3058 else
3059     AC_MSG_RESULT(no)
3062 AC_MSG_CHECKING(for uname.__domainname)
3063 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3064     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3065         [ struct utsname *res; char *domain; 
3066             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3067         [ac_cv_have_uname_us_domainname_field=true],
3068         [ac_cv_have_uname_us_domainname_field=false])])
3070 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3071     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3072     AC_MSG_RESULT(yes)
3073 else
3074     AC_MSG_RESULT(no)
3077 AC_LANG_CPLUSPLUS
3079 dnl Check for usable char16_t (2 bytes, unsigned)
3080 dnl (we might not need the unsignedness check anymore)
3081 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3082     ac_cv_have_usable_char16_t,
3083     [AC_TRY_COMPILE([$configure_static_assert_macros],
3084                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3085                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3086                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3087                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3088                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3089                     ac_cv_have_usable_char16_t="yes",
3090                     ac_cv_have_usable_char16_t="no")])
3091 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3092     AC_DEFINE(HAVE_CPP_CHAR16_T)
3093     HAVE_CPP_CHAR16_T=1
3096 dnl Check for usable wchar_t (2 bytes, unsigned)
3097 dnl (we really don't need the unsignedness check anymore)
3098 dnl ========================================================
3100 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3101     ac_cv_have_usable_wchar_v2,
3102     [AC_TRY_COMPILE([#include <stddef.h>
3103                      $configure_static_assert_macros],
3104                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3105                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3106                     ac_cv_have_usable_wchar_v2="yes",
3107                     ac_cv_have_usable_wchar_v2="no")])
3108 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3109     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3110     HAVE_CPP_2BYTE_WCHAR_T=1
3111 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3112 dnl This is really gcc-only
3113 dnl Do this test using CXX only since some versions of gcc
3114 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3115 dnl only have short-wchar support for c++.
3116 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3118     _SAVE_CXXFLAGS=$CXXFLAGS
3119     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3121     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3122         ac_cv_have_usable_wchar_option_v2,
3123         [AC_TRY_LINK([#include <stddef.h>
3124                       $configure_static_assert_macros],
3125                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3126                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3127                      ac_cv_have_usable_wchar_option_v2="yes",
3128                      ac_cv_have_usable_wchar_option_v2="no")])
3130     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3131         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3132         HAVE_CPP_2BYTE_WCHAR_T=1
3133         WCHAR_CFLAGS="-fshort-wchar"
3134     else    
3135         CXXFLAGS=$_SAVE_CXXFLAGS
3136     fi
3139 AC_LANG_C
3141 dnl Check for .hidden assembler directive and visibility attribute.
3142 dnl Borrowed from glibc configure.in
3143 dnl ===============================================================
3144 if test "$GNU_CC"; then
3145   AC_CACHE_CHECK(for visibility(hidden) attribute,
3146                  ac_cv_visibility_hidden,
3147                  [cat > conftest.c <<EOF
3148                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3150                   ac_cv_visibility_hidden=no
3151                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3152                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3153                       ac_cv_visibility_hidden=yes
3154                     fi
3155                   fi
3156                   rm -f conftest.[cs]
3157                  ])
3158   if test "$ac_cv_visibility_hidden" = "yes"; then
3159     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3161     AC_CACHE_CHECK(for visibility(default) attribute,
3162                    ac_cv_visibility_default,
3163                    [cat > conftest.c <<EOF
3164                     int foo __attribute__ ((visibility ("default"))) = 1;
3166                     ac_cv_visibility_default=no
3167                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3168                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3169                         ac_cv_visibility_default=yes
3170                       fi
3171                     fi
3172                     rm -f conftest.[cs]
3173                    ])
3174     if test "$ac_cv_visibility_default" = "yes"; then
3175       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3177       AC_CACHE_CHECK(for visibility pragma support,
3178                      ac_cv_visibility_pragma,
3179                      [cat > conftest.c <<EOF
3180 #pragma GCC visibility push(hidden)
3181                       int foo_hidden = 1;
3182 #pragma GCC visibility push(default)
3183                       int foo_default = 1;
3185                       ac_cv_visibility_pragma=no
3186                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3187                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3188                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3189                             ac_cv_visibility_pragma=yes
3190                           fi
3191                         fi
3192                       fi
3193                       rm -f conftest.[cs]
3194                     ])
3195       if test "$ac_cv_visibility_pragma" = "yes"; then
3196         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3197                        ac_cv_have_visibility_class_bug,
3198                        [cat > conftest.c <<EOF
3199 #pragma GCC visibility push(hidden)
3200 struct __attribute__ ((visibility ("default"))) TestStruct {
3201   static void Init();
3203 __attribute__ ((visibility ("default"))) void TestFunc() {
3204   TestStruct::Init();
3207                        ac_cv_have_visibility_class_bug=no
3208                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3209                          ac_cv_have_visibility_class_bug=yes
3210                        else
3211                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3212                            ac_cv_have_visibility_class_bug=yes
3213                          fi
3214                        fi
3215                        rm -rf conftest.{c,S}
3216                        ])
3218         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3219                        ac_cv_have_visibility_builtin_bug,
3220                        [cat > conftest.c <<EOF
3221 #pragma GCC visibility push(hidden)
3222 #pragma GCC visibility push(default)
3223 #include <string.h>
3224 #pragma GCC visibility pop
3226 __attribute__ ((visibility ("default"))) void Func() {
3227   char c[[100]];
3228   memset(c, 0, sizeof(c));
3231                        ac_cv_have_visibility_builtin_bug=no
3232                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3233                          ac_cv_have_visibility_builtin_bug=yes
3234                        else
3235                          if test `grep -c "@PLT" conftest.S` = 0; then
3236                            ac_cv_visibility_builtin_bug=yes
3237                          fi
3238                        fi
3239                        rm -f conftest.{c,S}
3240                        ])
3241         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3242                 "$ac_cv_have_visibility_class_bug" = "no"; then
3243           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3244           WRAP_SYSTEM_INCLUDES=1
3245           STL_FLAGS='-I$(DIST)/stl_wrappers'
3246           WRAP_STL_INCLUDES=1
3247         else
3248           VISIBILITY_FLAGS='-fvisibility=hidden'
3249         fi # have visibility pragma bug
3250       fi   # have visibility pragma
3251     fi     # have visibility(default) attribute
3252   fi       # have visibility(hidden) attribute
3253 fi         # GNU_CC
3255 # visibility hidden flag for Sun Studio on Solaris
3256 if test "$SOLARIS_SUNPRO_CC"; then
3257 VISIBILITY_FLAGS='-xldscope=hidden'
3258 fi         # Sun Studio on Solaris
3260 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3261 AC_SUBST(VISIBILITY_FLAGS)
3263 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3264 dnl ========================================================
3265 if test "$GNU_CC"; then
3266   CFLAGS_save="${CFLAGS}"
3267   CFLAGS="${CFLAGS} -Werror"
3268   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3269                  ac_cv_force_align_arg_pointer,
3270                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3271                                  [],
3272                                  ac_cv_force_align_arg_pointer="yes",
3273                                  ac_cv_force_align_arg_pointer="no")])
3274   CFLAGS="${CFLAGS_save}"
3275   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3276     HAVE_GCC_ALIGN_ARG_POINTER=1
3277   else
3278     HAVE_GCC_ALIGN_ARG_POINTER=
3279   fi
3281 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3283 dnl Checks for header files.
3284 dnl ========================================================
3285 AC_HEADER_DIRENT
3286 case "$target_os" in
3287 freebsd*)
3288 # for stuff like -lXshm
3289     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3290     ;;
3291 esac
3292 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3293 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3294 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3295 AC_CHECK_HEADERS(malloc.h)
3296 AC_CHECK_HEADERS(X11/XKBlib.h)
3297 AC_CHECK_HEADERS(io.h)
3299 dnl These are all the places some variant of statfs can be hiding.
3300 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3302 dnl Quota support
3303 AC_CHECK_HEADERS(sys/quota.h)
3304 AC_CHECK_HEADERS(linux/quota.h)
3306 dnl Try for MMX support
3307 dnl NB - later gcc versions require -mmmx for this header to be successfully
3308 dnl included (or another option which implies it, such as -march=pentium-mmx)
3309 AC_CHECK_HEADERS(mmintrin.h)
3311 dnl Check whether the compiler supports the new-style C++ standard
3312 dnl library headers (i.e. <new>) or needs the old "new.h"
3313 AC_LANG_CPLUSPLUS
3314 NEW_H=new.h
3315 AC_CHECK_HEADER(new, [NEW_H=new])
3316 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3317 AC_LANG_C
3319 AC_ARG_ENABLE(dtrace,
3320               [  --enable-dtrace         build with dtrace support if available (default=no)],
3321               [enable_dtrace="yes"],)
3322 if test "x$enable_dtrace" = "xyes"; then
3323   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3324   if test -n "$HAVE_DTRACE"; then
3325       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3326   else
3327       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3328   fi
3330 AC_SUBST(HAVE_DTRACE)
3332 case $target in
3333 *-aix4.3*|*-aix5*)
3334         ;;
3336         AC_CHECK_HEADERS(sys/cdefs.h)
3337         ;;
3338 esac
3340 dnl Checks for libraries.
3341 dnl ========================================================
3342 case $target in
3343 *-hpux11.*)
3344         ;;
3346         AC_CHECK_LIB(c_r, gethostbyname_r)
3347         ;;
3348 esac
3350 dnl We don't want to link with libdl even if it's present on OS X, since
3351 dnl it's not used and not part of the default installation.
3352 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3353 dnl We don't want to link against libm or libpthread on Darwin since
3354 dnl they both are just symlinks to libSystem and explicitly linking
3355 dnl against libSystem causes issues when debugging (see bug 299601).
3356 case $target in
3357 *-darwin*)
3358     ;;
3359 *-beos*)
3360     ;;
3361 *-os2*)
3362     ;;
3364     AC_CHECK_LIB(m, atan)
3365     AC_CHECK_LIB(dl, dlopen,
3366     AC_CHECK_HEADER(dlfcn.h, 
3367         LIBS="-ldl $LIBS"
3368         AC_DEFINE(HAVE_LIBDL)))
3369     ;;
3370 esac
3372 _SAVE_CFLAGS="$CFLAGS"
3373 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3374 AC_CHECK_FUNCS(dladdr)
3375 CFLAGS="$_SAVE_CFLAGS"
3377 if test ! "$GNU_CXX"; then
3379     case $target in
3380     *-aix*)
3381         AC_CHECK_LIB(C_r, demangle)
3382         ;;
3383      *)
3384         AC_CHECK_LIB(C, demangle)
3385         ;;
3386      esac
3389 dnl OS/2 has socket in libc.
3390 case $target in
3391 *-os2*)
3392     ;;
3394     AC_CHECK_LIB(socket, socket)
3395 esac
3397 dnl ========================================================
3398 dnl Check whether we can compile code for Core Text
3399 dnl (available on Mac OS X 10.5 or later)
3400 dnl ========================================================
3401 case "$target" in
3402 *-darwin*)
3403   AC_MSG_CHECKING([for Core Text])
3404   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3405                  [CTLineRef lineRef;],
3406                   ac_cv_have_core_text="yes",
3407                   ac_cv_have_core_text="no")
3408   AC_MSG_RESULT([$ac_cv_have_core_text])
3410   if test "$ac_cv_have_core_text" = "no"; then
3411     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3412   fi
3413   ;;
3414 esac
3416 XLDFLAGS="$X_LIBS"
3417 XLIBS="$X_EXTRA_LIBS"
3419 dnl ========================================================
3420 dnl Checks for X libraries.
3421 dnl Ordering is important.
3422 dnl Xt is dependent upon SM as of X11R6
3423 dnl ========================================================
3424 if test "$no_x" = "yes"; then
3425     AC_DEFINE(NO_X11)
3426 else
3427     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3428         XLIBS="-lX11 $XLIBS"
3429         _SAVE_LDFLAGS="$LDFLAGS"
3430         LDFLAGS="$XLDFLAGS $LDFLAGS"
3431         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3432                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3433         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3434                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3435      
3436         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3437         unset ac_cv_lib_Xt_XtFree
3438             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3439             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3440         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3441                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3442         ])
3444     # AIX needs the motif library linked before libXt to prevent
3445     # crashes in plugins linked against Motif - Bug #98892
3446     case "${target_os}" in
3447     aix*)
3448         XT_LIBS="-lXm $XT_LIBS"
3449         ;;
3450     esac
3452     dnl ========================================================
3453     dnl = Check for XShm
3454     dnl ========================================================
3455     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3456         $XLIBS $XEXT_LIBS)
3457     AC_CHECK_HEADER(X11/extensions/XShm.h)
3458     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3459         test -n "$_HAVE_XSHM_XEXT"; then
3460         AC_DEFINE(HAVE_XSHM)
3461     fi
3463     dnl ========================================================
3464     dnl = Check for XIE
3465     dnl ========================================================
3466     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3467         $XLIBS $XEXT_LIBS)
3468     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3470     if test "$MOZ_XIE_LIBS"; then
3471         dnl ====================================================
3472         dnl = If XIE is present and is desired, turn it on
3473         dnl ====================================================
3474         case $target in
3475             *-hpux*)
3476                 ;;
3477             *)
3478                 HAVE_XIE=1
3479                 ;;
3480         esac
3481     fi
3483         LDFLAGS="$_SAVE_LDFLAGS"
3485     dnl ========================================================
3486     dnl = Check for freetype2 and its functionality
3487     dnl ========================================================
3488     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3490     if test "$_HAVE_FREETYPE2"; then
3491         _SAVE_LIBS="$LIBS"
3492         _SAVE_CFLAGS="$CFLAGS"
3493         LIBS="$LIBS $FT2_LIBS"
3494         CFLAGS="$CFLAGS $FT2_CFLAGS"
3496         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3497             ac_cv_member_FT_Bitmap_Size_y_ppem,
3498             [AC_TRY_COMPILE([#include <ft2build.h>
3499                              #include FT_FREETYPE_H],
3500                             [FT_Bitmap_Size s;
3501                              if (sizeof s.y_ppem) return 0;
3502                              return 1],
3503                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3504                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3505         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3506             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3507         else
3508             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3509         fi
3510         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3511                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3512                            [FT_Bitmap_Size structure includes y_ppem field])
3514         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3516         LIBS="$_SAVE_LIBS"
3517         CFLAGS="$_SAVE_CFLAGS"
3518     fi
3520 fi # $no_x
3522 AC_SUBST(XCFLAGS)
3523 AC_SUBST(XLDFLAGS)
3524 AC_SUBST(XLIBS)
3525 AC_SUBST(XEXT_LIBS)
3526 AC_SUBST(XT_LIBS)
3528 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3529 AC_TRY_COMPILE([],
3530                [asm("uqadd8 r1, r1, r2");],
3531                result="yes", result="no")
3532 AC_MSG_RESULT("$result")
3533 if test "$result" = "yes"; then
3534     AC_DEFINE(HAVE_ARM_SIMD)
3535     HAVE_ARM_SIMD=1
3537 AC_SUBST(HAVE_ARM_SIMD)
3539 AC_MSG_CHECKING(for ARM NEON support in compiler)
3540 _SAVE_CFLAGS="$CFLAGS"
3541 if test "$GNU_CC"; then
3542   # gcc needs -mfpu=neon to recognize NEON instructions
3543   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3545 AC_TRY_COMPILE([],
3546                [asm("vadd.i8 d0, d0, d0");],
3547                result="yes", result="no")
3548 AC_MSG_RESULT("$result")
3549 if test "$result" = "yes"; then
3550     AC_DEFINE(HAVE_ARM_NEON)
3551     HAVE_ARM_NEON=1
3553 CFLAGS="$_SAVE_CFLAGS"
3554 AC_SUBST(HAVE_ARM_NEON)
3556 dnl ========================================================
3557 dnl = pthread support
3558 dnl = Start by checking whether the system support pthreads
3559 dnl ========================================================
3560 case "$target_os" in
3561 darwin*)
3562     USE_PTHREADS=1
3563     ;;
3565     MOZ_CHECK_PTHREADS(pthreads,
3566         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3567         MOZ_CHECK_PTHREADS(pthread,
3568             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3569             MOZ_CHECK_PTHREADS(c_r,
3570                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3571                 MOZ_CHECK_PTHREADS(c,
3572                     USE_PTHREADS=1
3573                 )
3574             )
3575         )
3576     )
3577     ;;
3578 esac
3580 dnl ========================================================
3581 dnl Check the command line for --with-pthreads 
3582 dnl ========================================================
3583 MOZ_ARG_WITH_BOOL(pthreads,
3584 [  --with-pthreads         Force use of system pthread library with NSPR ],
3585 [ if test "$USE_PTHREADS"x = x; then
3586     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3587 fi],
3588     USE_PTHREADS=
3589     _PTHREAD_LDFLAGS=
3592 dnl ========================================================
3593 dnl Do the platform specific pthread hackery
3594 dnl ========================================================
3595 if test "$USE_PTHREADS"x != x
3596 then
3597         dnl
3598         dnl See if -pthread is supported.
3599         dnl
3600         rm -f conftest*
3601         ac_cv_have_dash_pthread=no
3602         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3603         echo 'int main() { return 0; }' | cat > conftest.c
3604         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3605         if test $? -eq 0; then
3606                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3607                         ac_cv_have_dash_pthread=yes
3608                 case "$target_os" in
3609                 freebsd*)
3610 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3611                 ;;
3612                 *)
3613                             CFLAGS="$CFLAGS -pthread"
3614                             CXXFLAGS="$CXXFLAGS -pthread"
3615                 ;;
3616                 esac
3617                 fi
3618         fi
3619         rm -f conftest*
3620     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3622         dnl
3623         dnl See if -pthreads is supported.
3624         dnl
3625     ac_cv_have_dash_pthreads=no
3626     if test "$ac_cv_have_dash_pthread" = "no"; then
3627             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3628         echo 'int main() { return 0; }' | cat > conftest.c
3629             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3630         if test $? -eq 0; then
3631                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3632                             ac_cv_have_dash_pthreads=yes
3633                             CFLAGS="$CFLAGS -pthreads"
3634                             CXXFLAGS="$CXXFLAGS -pthreads"
3635                     fi
3636             fi
3637             rm -f conftest*
3638         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3639     fi
3641         case "$target" in
3642             *-*-freebsd*)
3643                         AC_DEFINE(_REENTRANT)
3644                         AC_DEFINE(_THREAD_SAFE)
3645                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3646                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3647                                 _PTHREAD_LDFLAGS="-pthread"
3648                         else
3649                                 _PTHREAD_LDFLAGS="-lc_r"
3650                         fi
3651                         ;;
3653             *-*-openbsd*|*-*-bsdi*)
3654                         AC_DEFINE(_REENTRANT)
3655                         AC_DEFINE(_THREAD_SAFE)
3656                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3657                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3658                 _PTHREAD_LDFLAGS="-pthread"
3659                         fi
3660                         ;;
3662             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3663                         AC_DEFINE(_REENTRANT) 
3664                         ;;
3666             *-*-nto*) 
3667                         AC_DEFINE(_REENTRANT) 
3668                         ;;
3670             *-aix4.3*|*-aix5*)
3671                         AC_DEFINE(_REENTRANT) 
3672                         ;;
3674             *-hpux11.*)
3675                         AC_DEFINE(_REENTRANT) 
3676                         ;;
3678             alpha*-*-osf*)
3679                         AC_DEFINE(_REENTRANT)
3680                         ;;
3682             *-*-solaris*) 
3683                         AC_DEFINE(_REENTRANT)
3684                         if test "$SOLARIS_SUNPRO_CC"; then
3685                                 CFLAGS="$CFLAGS -mt" 
3686                                 CXXFLAGS="$CXXFLAGS -mt" 
3687                         fi
3688                         ;;
3689         esac
3690     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3693 dnl ========================================================
3694 dnl See if mmap sees writes
3695 dnl For cross compiling, just define it as no, which is a safe default
3696 dnl ========================================================
3697 AC_MSG_CHECKING(whether mmap() sees write()s)
3699 changequote(,)
3700 mmap_test_prog='
3701     #include <stdlib.h>
3702     #include <unistd.h>
3703     #include <sys/mman.h>
3704     #include <sys/types.h>
3705     #include <sys/stat.h>
3706     #include <fcntl.h>
3708     char fname[] = "conftest.file";
3709     char zbuff[1024]; /* Fractional page is probably worst case */
3711     int main() {
3712         char *map;
3713         int fd;
3714         int i;
3715         unlink(fname);
3716         fd = open(fname, O_RDWR | O_CREAT, 0660);
3717         if(fd<0) return 1;
3718         unlink(fname);
3719         write(fd, zbuff, sizeof(zbuff));
3720         lseek(fd, 0, SEEK_SET);
3721         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3722         if(map==(char*)-1) return 2;
3723         for(i=0; fname[i]; i++) {
3724             int rc = write(fd, &fname[i], 1);
3725             if(map[i]!=fname[i]) return 4;
3726         }
3727         return 0;
3728     }
3730 changequote([,])
3732 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3734 AC_MSG_RESULT("$result")
3736 if test "$result" = "no"; then
3737     AC_DEFINE(MMAP_MISSES_WRITES)
3741 dnl Checks for library functions.
3742 dnl ========================================================
3743 AC_PROG_GCC_TRADITIONAL
3744 AC_FUNC_MEMCMP
3745 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3746 AC_CHECK_FUNCS(flockfile getpagesize)
3747 AC_CHECK_FUNCS(localtime_r strtok_r)
3749 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3750 _SAVE_LDFLAGS=$LDFLAGS
3751 LDFLAGS="$LDFLAGS -lrt"
3752 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3753                ac_cv_have_clock_monotonic,
3754                [AC_TRY_LINK([#include <time.h>],
3755                             [ struct timespec ts;
3756                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3757                             ac_cv_have_clock_monotonic=yes,
3758                             ac_cv_have_clock_monotonic=no)])
3759 LDFLAGS=$_SAVE_LDFLAGS
3760 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3761     HAVE_CLOCK_MONOTONIC=1
3762     REALTIME_LIBS=-lrt
3763     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3764     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3765     AC_SUBST(REALTIME_LIBS)
3768 dnl check for wcrtomb/mbrtowc
3769 dnl =======================================================================
3770 if test -z "$MACOS_DEPLOYMENT_TARGET" -o "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3771 AC_LANG_SAVE
3772 AC_LANG_CPLUSPLUS
3773 AC_CACHE_CHECK(for wcrtomb,
3774     ac_cv_have_wcrtomb,
3775     [AC_TRY_LINK([#include <wchar.h>],
3776                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3777                  ac_cv_have_wcrtomb="yes",
3778                  ac_cv_have_wcrtomb="no")])
3779 if test "$ac_cv_have_wcrtomb" = "yes"; then
3780     AC_DEFINE(HAVE_WCRTOMB)
3782 AC_CACHE_CHECK(for mbrtowc,
3783     ac_cv_have_mbrtowc,
3784     [AC_TRY_LINK([#include <wchar.h>],
3785                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3786                  ac_cv_have_mbrtowc="yes",
3787                  ac_cv_have_mbrtowc="no")])
3788 if test "$ac_cv_have_mbrtowc" = "yes"; then
3789     AC_DEFINE(HAVE_MBRTOWC)
3791 AC_LANG_RESTORE
3794 AC_CACHE_CHECK(
3795     [for res_ninit()],
3796     ac_cv_func_res_ninit,
3797     [AC_TRY_LINK([
3798         #ifdef linux
3799         #define _BSD_SOURCE 1
3800         #endif
3801         #include <resolv.h>
3802         ],
3803         [int foo = res_ninit(&_res);],
3804         [ac_cv_func_res_ninit=yes],
3805         [ac_cv_func_res_ninit=no])
3806     ])
3808 if test "$ac_cv_func_res_ninit" = "yes"; then
3809     AC_DEFINE(HAVE_RES_NINIT)
3810 dnl must add the link line we do something as foolish as this... dougt
3811 dnl else
3812 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3813 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3816 AC_LANG_CPLUSPLUS
3817 AC_CACHE_CHECK(
3818     [for gnu_get_libc_version()],
3819     ac_cv_func_gnu_get_libc_version,
3820     [AC_TRY_LINK([
3821         #ifdef HAVE_GNU_LIBC_VERSION_H
3822         #include <gnu/libc-version.h>
3823         #endif
3824         ],
3825         [const char *glibc_version = gnu_get_libc_version();],
3826         [ac_cv_func_gnu_get_libc_version=yes],
3827         [ac_cv_func_gnu_get_libc_version=no] 
3828         )]
3829     )
3831 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3832     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3835 case $target_os in
3836     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3837         ;;
3838     *)
3839     
3840 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3841     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3842         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3843 _SAVE_LIBS=$LIBS
3844 LIBS="$LIBS $_ICONV_LIBS"
3845 AC_CACHE_CHECK(
3846     [for iconv()],
3847     ac_cv_func_iconv,
3848     [AC_TRY_LINK([
3849         #include <stdlib.h>
3850         #include <iconv.h>
3851         ],
3852         [
3853             iconv_t h = iconv_open("", "");
3854             iconv(h, NULL, NULL, NULL, NULL);
3855             iconv_close(h);
3856         ],
3857         [ac_cv_func_iconv=yes],
3858         [ac_cv_func_iconv=no] 
3859         )]
3860     )
3861 if test "$ac_cv_func_iconv" = "yes"; then
3862     AC_DEFINE(HAVE_ICONV)
3863     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3864     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3865     LIBICONV="$_ICONV_LIBS"
3866     AC_CACHE_CHECK(
3867         [for iconv() with const input],
3868         ac_cv_func_const_iconv,
3869         [AC_TRY_COMPILE([
3870             #include <stdlib.h>
3871             #include <iconv.h>
3872             ],
3873             [
3874                 const char *input = "testing";
3875                 iconv_t h = iconv_open("", "");
3876                 iconv(h, &input, NULL, NULL, NULL);
3877                 iconv_close(h);
3878             ],
3879             [ac_cv_func_const_iconv=yes],
3880             [ac_cv_func_const_iconv=no] 
3881             )]
3882         )
3883     if test "$ac_cv_func_const_iconv" = "yes"; then
3884         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3885     fi
3887 LIBS=$_SAVE_LIBS
3889     ;;
3890 esac
3892 AM_LANGINFO_CODESET
3894 AC_LANG_C
3896 dnl **********************
3897 dnl *** va_copy checks ***
3898 dnl **********************
3899 dnl we currently check for all three va_copy possibilities, so we get
3900 dnl all results in config.log for bug reports.
3901 AC_MSG_CHECKING(for an implementation of va_copy())
3902 AC_CACHE_VAL(ac_cv_va_copy,[
3903     AC_TRY_RUN([
3904         #include <stdarg.h>
3905         void f (int i, ...) {
3906             va_list args1, args2;
3907             va_start (args1, i);
3908             va_copy (args2, args1);
3909             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3910                 exit (1);
3911             va_end (args1); va_end (args2);
3912         }
3913         int main() { f (0, 42); return 0; }],
3914         ac_cv_va_copy=yes,
3915         ac_cv_va_copy=no,
3916         ac_cv_va_copy=no
3917     )
3919 AC_MSG_RESULT($ac_cv_va_copy)
3920 AC_MSG_CHECKING(for an implementation of __va_copy())
3921 AC_CACHE_VAL(ac_cv___va_copy,[
3922     AC_TRY_RUN([
3923         #include <stdarg.h>
3924         void f (int i, ...) {
3925             va_list args1, args2;
3926             va_start (args1, i);
3927             __va_copy (args2, args1);
3928             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3929                 exit (1);
3930             va_end (args1); va_end (args2);
3931         }
3932         int main() { f (0, 42); return 0; }],
3933         ac_cv___va_copy=yes,
3934         ac_cv___va_copy=no,
3935         ac_cv___va_copy=no
3936     )
3938 AC_MSG_RESULT($ac_cv___va_copy)
3939 AC_MSG_CHECKING(whether va_lists can be copied by value)
3940 AC_CACHE_VAL(ac_cv_va_val_copy,[
3941     AC_TRY_RUN([
3942         #include <stdarg.h>
3943         void f (int i, ...) {
3944             va_list args1, args2;
3945             va_start (args1, i);
3946             args2 = args1;
3947             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3948                 exit (1);
3949             va_end (args1); va_end (args2);
3950         }
3951         int main() { f (0, 42); return 0; }],
3952         ac_cv_va_val_copy=yes,
3953         ac_cv_va_val_copy=no,
3954         ac_cv_va_val_copy=yes
3955     )
3957 if test "x$ac_cv_va_copy" = "xyes"; then
3958     AC_DEFINE(VA_COPY, va_copy)
3959     AC_DEFINE(HAVE_VA_COPY)
3960 elif test "x$ac_cv___va_copy" = "xyes"; then
3961     AC_DEFINE(VA_COPY, __va_copy)
3962     AC_DEFINE(HAVE_VA_COPY)
3965 if test "x$ac_cv_va_val_copy" = "xno"; then
3966    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3968 AC_MSG_RESULT($ac_cv_va_val_copy)
3970 dnl Check for dll-challenged libc's.
3971 dnl This check is apparently only needed for Linux.
3972 case "$target" in
3973         *-linux*)
3974             dnl ===================================================================
3975             _curdir=`pwd`
3976             export _curdir
3977             rm -rf conftest* _conftest
3978             mkdir _conftest
3979             cat >> conftest.C <<\EOF
3980 #include <stdio.h>
3981 #include <link.h>
3982 #include <dlfcn.h>
3983 #ifdef _dl_loaded
3984 void __dump_link_map(void) {
3985   struct link_map *map = _dl_loaded;
3986   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3988 int main() {
3989   dlopen("./conftest1.so",RTLD_LAZY);
3990   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3991   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3992   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3993   __dump_link_map();
3995 #else
3996 /* _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).*/
3997 int main() { printf("./conftest1.so\n"); }
3998 #endif
4001             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4003             cat >> conftest1.C <<\EOF
4004 #include <stdio.h>
4005 void foo(void) {printf("foo in dll called\n");}
4007             ${CXX-g++} -fPIC -c -g conftest1.C
4008             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4009             ${CXX-g++} -g conftest.C -o conftest -ldl
4010             cp -f conftest1.so conftest _conftest
4011             cd _conftest
4012             if test `./conftest | grep conftest1.so | wc -l` -gt 1
4013             then
4014                 echo
4015                 echo "*** Your libc has a bug that can result in loading the same dynamic"
4016                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
4017                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
4018                 echo "*** will be excessive memory usage at runtime."
4019                 echo
4020             fi
4021             cd ${_curdir}
4022             rm -rf conftest* _conftest
4023             dnl ===================================================================
4024             ;;
4025 esac
4027 dnl ===================================================================
4028 dnl ========================================================
4029 dnl Put your C++ language/feature checks below
4030 dnl ========================================================
4031 AC_LANG_CPLUSPLUS
4033 ARM_ABI_PREFIX=
4034 HAVE_GCC3_ABI=
4035 if test "$GNU_CC"; then
4036   if test "$CPU_ARCH" = "arm" ; then
4037     AC_CACHE_CHECK(for ARM EABI,
4038         ac_cv_gcc_arm_eabi,
4039         [AC_TRY_COMPILE([],
4040                         [
4041 #if defined(__ARM_EABI__)
4042   return 0;
4043 #else
4044 #error Not ARM EABI.
4045 #endif
4046                         ],
4047                         ac_cv_gcc_arm_eabi="yes",
4048                         ac_cv_gcc_arm_eabi="no")])
4049     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4050         HAVE_ARM_EABI=1
4051         ARM_ABI_PREFIX=eabi-
4052     else
4053         ARM_ABI_PREFIX=oabi-
4054     fi
4055   fi
4057   AC_CACHE_CHECK(for gcc 3.0 ABI,
4058       ac_cv_gcc_three_abi,
4059       [AC_TRY_COMPILE([],
4060                       [
4061 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4062   return 0;
4063 #else
4064 #error Not gcc3.
4065 #endif
4066                       ],
4067                       ac_cv_gcc_three_abi="yes",
4068                       ac_cv_gcc_three_abi="no")])
4069   if test "$ac_cv_gcc_three_abi" = "yes"; then
4070       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4071       HAVE_GCC3_ABI=1
4072   else
4073       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4074   fi
4076 AC_SUBST(HAVE_GCC3_ABI)
4079 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4080                ac_cv_cpp_explicit,
4081                [AC_TRY_COMPILE(class X {
4082                                public: explicit X(int i) : i_(i) {}
4083                                private: int i_;
4084                                };,
4085                                X x(3);,
4086                                ac_cv_cpp_explicit=yes,
4087                                ac_cv_cpp_explicit=no)])
4088 if test "$ac_cv_cpp_explicit" = yes ; then
4089    AC_DEFINE(HAVE_CPP_EXPLICIT)
4092 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4093                ac_cv_cpp_typename,
4094                [AC_TRY_COMPILE(class param {
4095                                public:
4096                                    typedef unsigned long num_type;
4097                                };
4099                                template <class T> class tplt {
4100                                public:
4101                                    typedef typename T::num_type t_num_type;
4102                                    t_num_type foo(typename T::num_type num) {
4103                                        return num;
4104                                    }
4105                                };,
4106                                tplt<param> A;
4107                                A.foo(0);,
4108                                ac_cv_cpp_typename=yes,
4109                                ac_cv_cpp_typename=no)])
4110 if test "$ac_cv_cpp_typename" = yes ; then
4111    AC_DEFINE(HAVE_CPP_TYPENAME)
4114 dnl Check for support of modern template specialization syntax
4115 dnl Test code and requirement from scc@netscape.com.
4116 dnl Autoconf cut-and-paste job by waterson@netscape.com
4117 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4118                ac_cv_cpp_modern_specialize_template_syntax,
4119                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4120                                class Y {};
4121                                template <> struct X<Y> { double a; };,
4122                                X<int> int_x;
4123                                X<Y> y_x;,
4124                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4125                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4126 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4127   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4131 dnl Some compilers support only full specialization, and some don't.
4132 AC_CACHE_CHECK(whether partial template specialization works,
4133                ac_cv_cpp_partial_specialization,
4134                [AC_TRY_COMPILE(template <class T> class Foo {};
4135                                template <class T> class Foo<T*> {};,
4136                                return 0;,
4137                                ac_cv_cpp_partial_specialization=yes,
4138                                ac_cv_cpp_partial_specialization=no)])
4139 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4140   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4143 dnl Some compilers have limited support for operators with templates;
4144 dnl specifically, it is necessary to define derived operators when a base
4145 dnl class's operator declaration should suffice.
4146 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4147                ac_cv_need_derived_template_operators,
4148                [AC_TRY_COMPILE([template <class T> class Base { };
4149                                 template <class T>
4150                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4151                                 template <class T> class Derived : public Base<T> { };],
4152                                [Derived<char> a, b;
4153                                 Base<char> c = a + b;
4154                                 return 0;],
4155                                ac_cv_need_derived_template_operators=no,
4156                                ac_cv_need_derived_template_operators=yes)])
4157 if test "$ac_cv_need_derived_template_operators" = yes ; then
4158   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4162 dnl Some compilers have trouble detecting that a template class
4163 dnl that derives from another template is actually an instance
4164 dnl of the base class. This test checks for that.
4165 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4166                ac_cv_need_cpp_template_cast_to_base,
4167                [AC_TRY_COMPILE([template <class T> class Base { };
4168                                 template <class T> class Derived : public Base<T> { };
4169                                 template <class T> int foo(const Base<T>&) { return 0; }],
4170                                [Derived<char> bar; return foo(bar);],
4171                                ac_cv_need_cpp_template_cast_to_base=no,
4172                                ac_cv_need_cpp_template_cast_to_base=yes)])
4173 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4174   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4177 dnl Some compilers have trouble resolving the ambiguity between two
4178 dnl functions whose arguments differ only by cv-qualifications.
4179 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4180                ac_cv_can_resolve_const_ambiguity,
4181                [AC_TRY_COMPILE([
4182                                 template <class T> class ptrClass {
4183                                   public: T* ptr;
4184                                 };
4186                                 template <class T> T* a(ptrClass<T> *arg) {
4187                                   return arg->ptr;
4188                                 }
4190                                 template <class T>
4191                                 const T* a(const ptrClass<T> *arg) {
4192                                   return arg->ptr;
4193                                 }
4194                                ],
4195                                [ ptrClass<int> i;
4196                                  a(&i); ],
4197                                ac_cv_can_resolve_const_ambiguity=yes,
4198                                ac_cv_can_resolve_const_ambiguity=no)])
4199 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4200   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4204 dnl We don't do exceptions on unix.  The only reason this used to be here
4205 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4206 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4207 dnl So im commenting this out until someone writes some artificial 
4208 dnl intelligence to detect not only if the compiler has exceptions, but if 
4209 dnl they are enabled as well.
4210 dnl 
4211 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4212 dnl                ac_cv_cpp_exceptions,
4213 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4214 dnl                                static void F() { throw X(); },
4215 dnl                                try { F(); } catch(X & e) { },
4216 dnl                                ac_cv_cpp_exceptions=yes,
4217 dnl                                ac_cv_cpp_exceptions=no)])
4218 dnl if test $ac_cv_cpp_exceptions = yes ; then
4219 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4220 dnl fi
4222 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4223 dnl supports it well enough to allow us to use it to change access, but not
4224 dnl to resolve ambiguity. The next two tests determine how well the |using|
4225 dnl keyword is supported.
4227 dnl Check to see if we can change access with |using|.  Test both a
4228 dnl legal and an illegal example.
4229 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4230                ac_cv_cpp_access_changing_using2,
4231                [AC_TRY_COMPILE(
4232                    class A { protected: int foo() { return 0; } };
4233                    class B : public A { public: using A::foo; };,
4234                    B b; return b.foo();,
4235                    [AC_TRY_COMPILE(
4236                        class A { public: int foo() { return 1; } };
4237                        class B : public A { private: using A::foo; };,
4238                        B b; return b.foo();,
4239                        ac_cv_cpp_access_changing_using2=no,
4240                        ac_cv_cpp_access_changing_using2=yes)],
4241                    ac_cv_cpp_access_changing_using2=no)])
4242 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4243    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4246 dnl Check to see if we can resolve ambiguity with |using|.
4247 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4248                ac_cv_cpp_ambiguity_resolving_using,
4249                [AC_TRY_COMPILE(class X { 
4250                                  public: int go(const X&) {return 3;}
4251                                          int jo(const X&) {return 3;}
4252                                };
4253                                class Y : public X {
4254                                  public:  int go(int) {return 2;}
4255                                           int jo(int) {return 2;}
4256                                           using X::jo;
4257                                  private: using X::go;
4258                                };,
4259                                X x; Y y; y.jo(x);,
4260                                ac_cv_cpp_ambiguity_resolving_using=yes,
4261                                ac_cv_cpp_ambiguity_resolving_using=no)])
4262 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4263    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4266 dnl Check to see if the |std| namespace is supported. If so, we'll want
4267 dnl to qualify any standard library calls with "std::" to ensure that
4268 dnl those functions can be resolved.
4269 AC_CACHE_CHECK(for \"std::\" namespace,
4270                ac_cv_cpp_namespace_std,
4271                [AC_TRY_COMPILE([#include <algorithm>],
4272                                [return std::min(0, 1);],
4273                                ac_cv_cpp_namespace_std=yes,
4274                                ac_cv_cpp_namespace_std=no)])
4275 if test "$ac_cv_cpp_namespace_std" = yes ; then
4276    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4279 dnl Older compilers are overly ambitious with respect to using the standard
4280 dnl template library's |operator!=()| when |operator==()| is defined. In
4281 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4282 dnl ambiguity at compile-time. This test checks for that case.
4283 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4284                ac_cv_cpp_unambiguous_std_notequal,
4285                [AC_TRY_COMPILE([#include <algorithm>
4286                                 struct T1 {};
4287                                 int operator==(const T1&, const T1&) { return 0; }
4288                                 int operator!=(const T1&, const T1&) { return 0; }],
4289                                [T1 a,b; return a != b;],
4290                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4291                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4292 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4293   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4297 AC_CACHE_CHECK(for C++ reinterpret_cast,
4298                ac_cv_cpp_reinterpret_cast,
4299                [AC_TRY_COMPILE(struct X { int i; };
4300                                struct Y { int i; };,
4301                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4302                                ac_cv_cpp_reinterpret_cast=yes,
4303                                ac_cv_cpp_reinterpret_cast=no)])
4304 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4305    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4308 dnl See if a dynamic_cast to void* gives the most derived object.
4309 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4310                ac_cv_cpp_dynamic_cast_void_ptr,
4311                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4312                             class Y { int j; public: virtual ~Y() { } };
4313                             class Z : public X, public Y { int k; };
4315                             int main() {
4316                                  Z mdo;
4317                                  X *subx = (X*)&mdo;
4318                                  Y *suby = (Y*)&mdo;
4319                                  return !((((void*)&mdo != (void*)subx) &&
4320                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4321                                           (((void*)&mdo != (void*)suby) &&
4322                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4323                             }],
4324                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4325                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4326                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4327 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4328    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4332 dnl note that this one is reversed - if the test fails, then
4333 dnl we require implementations of unused virtual methods. Which
4334 dnl really blows because it means we'll have useless vtable
4335 dnl bloat.
4336 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4337                ac_cv_cpp_unused_required,
4338                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4339                                X x;,
4340                                ac_cv_cpp_unused_required=no,
4341                                ac_cv_cpp_unused_required=yes)])
4342 if test "$ac_cv_cpp_unused_required" = yes ; then
4343    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4347 dnl Some compilers have trouble comparing a constant reference to a templatized
4348 dnl class to zero, and require an explicit operator==() to be defined that takes
4349 dnl an int. This test separates the strong from the weak.
4351 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4352                ac_cv_trouble_comparing_to_zero,
4353                [AC_TRY_COMPILE([#include <algorithm>
4354                                 template <class T> class Foo {};
4355                                 class T2;
4356                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4357                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4358                                [Foo<int> f; return (0 != f);],
4359                                ac_cv_trouble_comparing_to_zero=no,
4360                                ac_cv_trouble_comparing_to_zero=yes)])
4361 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4362   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4365 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4366 _SAVE_LDFLAGS=$LDFLAGS
4367 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4368 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4369                ac_cv_thread_keyword,
4370                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4371                             [return tlsIsMainThread;],
4372                             ac_cv_thread_keyword=yes,
4373                             ac_cv_thread_keyword=no)])
4374 LDFLAGS=$_SAVE_LDFLAGS
4375 if test "$ac_cv_thread_keyword" = yes; then
4376   # mips builds fail with TLS variables because of a binutils bug.
4377   # See bug 528687
4378   case "${target}" in
4379     mips*-*)
4380       :
4381       ;;
4382     *-android*)
4383       :
4384       ;;
4385     *)
4386       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4387       ;;
4388   esac
4391 dnl Check for the existence of various allocation headers/functions
4393 MALLOC_H=
4394 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4395 if test "$MALLOC_H" = ""; then
4396   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4397   if test "$MALLOC_H" = ""; then
4398     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4399   fi
4401 if test "$MALLOC_H" != ""; then
4402    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4405 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4406 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4408 dnl See if compiler supports some gcc-style attributes
4410 AC_CACHE_CHECK(for __attribute__((always_inline)),
4411                ac_cv_attribute_always_inline,
4412                [AC_TRY_COMPILE([],
4413                                [inline void f(void) __attribute__((always_inline));],
4414                                ac_cv_attribute_always_inline=yes,
4415                                ac_cv_attribute_always_inline=no)])
4417 AC_CACHE_CHECK(for __attribute__((malloc)),
4418                ac_cv_attribute_malloc,
4419                [AC_TRY_COMPILE([],
4420                                [void* f(int) __attribute__((malloc));],
4421                                ac_cv_attribute_malloc=yes,
4422                                ac_cv_attribute_malloc=no)])
4424 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4425                ac_cv_attribute_warn_unused,
4426                [AC_TRY_COMPILE([],
4427                                [int f(void) __attribute__((warn_unused_result));],
4428                                ac_cv_attribute_warn_unused=yes,
4429                                ac_cv_attribute_warn_unused=no)])
4431 AC_CACHE_CHECK(for __attribute__((noreturn)),
4432                ac_cv_attribute_noreturn,
4433                [AC_TRY_COMPILE([],
4434                                [void f(void) __attribute__((noreturn));],
4435                                ac_cv_attribute_noreturn=yes,
4436                                ac_cv_attribute_noreturn=no)])
4438 dnl End of C++ language/feature checks
4439 AC_LANG_C
4441 dnl ========================================================
4442 dnl =  Internationalization checks
4443 dnl ========================================================
4445 dnl Internationalization and Locale support is different
4446 dnl on various UNIX platforms.  Checks for specific i18n
4447 dnl features go here.
4449 dnl check for LC_MESSAGES
4450 AC_CACHE_CHECK(for LC_MESSAGES,
4451                 ac_cv_i18n_lc_messages,
4452                 [AC_TRY_COMPILE([#include <locale.h>],
4453                                 [int category = LC_MESSAGES;],
4454                                 ac_cv_i18n_lc_messages=yes,
4455                                 ac_cv_i18n_lc_messages=no)])
4456 if test "$ac_cv_i18n_lc_messages" = yes; then
4457    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4460 AC_HAVE_FUNCS(localeconv)
4462 fi # SKIP_COMPILER_CHECKS
4464 TARGET_XPCOM_ABI=
4465 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4466     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4469 dnl Mozilla specific options
4470 dnl ========================================================
4471 dnl The macros used for command line options
4472 dnl are defined in build/autoconf/altoptions.m4.
4474 dnl If the compiler supports these attributes, define them as
4475 dnl convenience macros.
4476 if test "$ac_cv_attribute_always_inline" = yes ; then
4477   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4478 else
4479   AC_DEFINE(NS_ALWAYS_INLINE,)
4482 if test "$ac_cv_attribute_malloc" = yes ; then
4483   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4484 else
4485   AC_DEFINE(NS_ATTR_MALLOC,)
4488 if test "$ac_cv_attribute_warn_unused" = yes ; then
4489   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4490 else
4491   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4494 if test "$ac_cv_attribute_noreturn" = yes ; then
4495   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4496 else
4497   AC_DEFINE(NS_NORETURN,)
4500 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4501 dnl features that Windows actually does support.
4503 if test -n "$SKIP_COMPILER_CHECKS"; then
4504    dnl Windows has malloc.h
4505    AC_DEFINE(MALLOC_H, [<malloc.h>])
4506    AC_DEFINE(HAVE_FORCEINLINE)
4507    AC_DEFINE(HAVE_LOCALECONV)
4508 fi # SKIP_COMPILER_CHECKS
4510 dnl ========================================================
4511 dnl =
4512 dnl = Check for external package dependencies
4513 dnl =
4514 dnl ========================================================
4515 MOZ_ARG_HEADER(External Packages)
4517 MOZ_ENABLE_LIBXUL=1
4519 MOZ_ARG_WITH_STRING(libxul-sdk,
4520 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4521   LIBXUL_SDK_DIR=$withval)
4523 if test "$LIBXUL_SDK_DIR" = "yes"; then
4524     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4525 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4526     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4528     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4529         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4530     fi
4532     MOZ_ENABLE_LIBXUL=1
4534 AC_SUBST(LIBXUL_SDK)
4536 if test -n "$LIBXUL_SDK"; then
4537     LIBXUL_DIST="$LIBXUL_SDK"
4538 else
4539     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4541 AC_SUBST(LIBXUL_DIST)
4543 SYSTEM_LIBXUL=
4545 MOZ_ARG_WITH_BOOL(system-libxul,
4546 [  --with-system-libxul    Use system installed libxul SDK],
4547     SYSTEM_LIBXUL=1)
4549 if test -n "$SYSTEM_LIBXUL" -a -z "$MOZ_ENABLE_LIBXUL"; then
4550     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4553 dnl ========================================================
4554 dnl = If NSPR was not detected in the system, 
4555 dnl = use the one in the source tree (mozilla/nsprpub)
4556 dnl ========================================================
4557 MOZ_ARG_WITH_BOOL(system-nspr,
4558 [  --with-system-nspr      Use system installed NSPR],
4559     _USE_SYSTEM_NSPR=1 )
4561 if test -n "$_USE_SYSTEM_NSPR"; then
4562     AM_PATH_NSPR(4.8.6, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4565 if test -n "$MOZ_NATIVE_NSPR"; then
4566     _SAVE_CFLAGS=$CFLAGS
4567     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4568     AC_TRY_COMPILE([#include "prtypes.h"],
4569                 [#ifndef PR_STATIC_ASSERT
4570                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4571                  #endif],
4572                 [MOZ_NATIVE_NSPR=1],
4573                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4574     CFLAGS=$_SAVE_CFLAGS
4575 else
4576     if test "$OS_ARCH" = "WINCE"; then
4577         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4578         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4579     elif test "$OS_ARCH" = "WINNT"; then
4580         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4581         if test -n "$GNU_CC"; then
4582             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4583         else
4584             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4585         fi
4586     else
4587         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4588         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4589     fi
4592 dnl system libevent Support
4593 dnl ========================================================
4594 MOZ_ARG_WITH_STRING(system-libevent,
4595 [  --with-system-libevent=[PFX]
4596                           Use system libevent [installed at prefix PFX]],
4597     LIBEVENT_DIR=$withval)
4599 _SAVE_CFLAGS=$CFLAGS
4600 _SAVE_LDFLAGS=$LDFLAGS
4601 _SAVE_LIBS=$LIBS
4602 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4603     MOZ_NATIVE_LIBEVENT=
4604 else
4605     if test "${LIBEVENT_DIR}" = "yes"; then
4606         LIBEVENT_DIR=/usr
4607     fi
4608     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4609     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4610     AC_CHECK_HEADER(event.h,
4611                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4612                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4613                      fi],
4614                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4615     AC_CHECK_LIB(event, event_init,
4616                  [MOZ_NATIVE_LIBEVENT=1
4617                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4618                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4619                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4621 CFLAGS=$_SAVE_CFLAGS
4622 LDFLAGS=$_SAVE_LDFLAGS
4623 LIBS=$_SAVE_LIBS
4625 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4626 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4627 AC_SUBST(MOZ_LIBEVENT_LIBS)
4629 dnl ========================================================
4630 dnl = If NSS was not detected in the system, 
4631 dnl = use the one in the source tree (mozilla/security/nss)
4632 dnl ========================================================
4634 MOZ_ARG_WITH_BOOL(system-nss,
4635 [  --with-system-nss       Use system installed NSS],
4636     _USE_SYSTEM_NSS=1 )
4638 if test -n "$_USE_SYSTEM_NSS"; then
4639     AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4642 if test -n "$MOZ_NATIVE_NSS"; then
4643    NSS_LIBS="$NSS_LIBS -lcrmf"
4644 else
4645    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4646    NSS_DEP_LIBS="\
4647         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4648         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4649         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4650         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4651         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4653    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4654        NSS_LIBS="\
4655         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4656         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4657         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4658         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4659         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4660    else
4661        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4662    fi
4665 if test -z "$SKIP_LIBRARY_CHECKS"; then
4666 dnl system JPEG support
4667 dnl ========================================================
4668 MOZ_ARG_WITH_STRING(system-jpeg,
4669 [  --with-system-jpeg[=PFX]
4670                           Use system libjpeg [installed at prefix PFX]],
4671     JPEG_DIR=$withval)
4673 _SAVE_CFLAGS=$CFLAGS
4674 _SAVE_LDFLAGS=$LDFLAGS
4675 _SAVE_LIBS=$LIBS
4676 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4677     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4678     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4680 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4681     SYSTEM_JPEG=
4682 else
4683     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4686 if test "$SYSTEM_JPEG" = 1; then
4687     LIBS="$JPEG_LIBS $LIBS"
4688     AC_TRY_COMPILE([ #include <stdio.h>
4689                      #include <sys/types.h>
4690                      #include <jpeglib.h> ],
4691                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4692                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4693                      #endif ],
4694                    SYSTEM_JPEG=1,
4695                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4696 fi 
4697 CFLAGS=$_SAVE_CFLAGS
4698 LDFLAGS=$_SAVE_LDFLAGS
4699 LIBS=$_SAVE_LIBS
4701 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4702     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4703     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4706 dnl system ZLIB support
4707 dnl ========================================================
4708 MOZ_ARG_WITH_STRING(system-zlib,
4709 [  --with-system-zlib[=PFX]
4710                           Use system libz [installed at prefix PFX]],
4711     ZLIB_DIR=$withval)
4713 _SAVE_CFLAGS=$CFLAGS
4714 _SAVE_LDFLAGS=$LDFLAGS
4715 _SAVE_LIBS=$LIBS
4716 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4717     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4718     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4720 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4721     SYSTEM_ZLIB=
4722 else
4723     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4724         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4726 if test "$SYSTEM_ZLIB" = 1; then
4727     LIBS="$ZLIB_LIBS $LIBS"
4728     AC_TRY_COMPILE([ #include <stdio.h>
4729                      #include <string.h>
4730                      #include <zlib.h> ],
4731                    [ #if ZLIB_VERNUM < $MOZZLIB 
4732                      #error "Insufficient zlib version ($MOZZLIB required)."
4733                      #endif ],
4734                    SYSTEM_ZLIB=1,
4735                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4737 CFLAGS=$_SAVE_CFLAGS
4738 LDFLAGS=$_SAVE_LDFLAGS
4739 LIBS=$_SAVE_LIBS
4741 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4742     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4743     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4746 dnl system BZIP2 Support
4747 dnl ========================================================
4748 MOZ_ARG_WITH_STRING(system-bz2,
4749 [  --with-system-bz2[=PFX]
4750                           Use system libbz2 [installed at prefix PFX]],
4751     BZ2_DIR=$withval)
4753 _SAVE_CFLAGS=$CFLAGS
4754 _SAVE_LDFLAGS=$LDFLAGS
4755 _SAVE_LIBS=$LIBS
4756 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4757     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4758     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4760 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4761     SYSTEM_BZ2=
4762 else
4763     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4764         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4766 CFLAGS=$_SAVE_CFLAGS
4767 LDFLAGS=$_SAVE_LDFLAGS
4768 LIBS=$_SAVE_LIBS
4770 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4771     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4772     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4775 dnl system PNG Support
4776 dnl ========================================================
4777 MOZ_ARG_WITH_STRING(system-png, 
4778 [  --with-system-png[=PFX]
4779                           Use system libpng [installed at prefix PFX]],
4780     PNG_DIR=$withval)
4782 _SAVE_CFLAGS=$CFLAGS
4783 _SAVE_LDFLAGS=$LDFLAGS
4784 _SAVE_LIBS=$LIBS
4785 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4786 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4787 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4788     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4789     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4791 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4792     SYSTEM_PNG=
4793 else
4794     _SAVE_PNG_LIBS=$PNG_LIBS
4795     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4796                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4797                  $PNG_LIBS)
4798     AC_CHECK_LIB(png, png_get_acTL, ,
4799                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4800                  $_SAVE_PNG_LIBS)
4802 if test "$SYSTEM_PNG" = 1; then
4803     LIBS="$PNG_LIBS $LIBS"
4804     AC_TRY_COMPILE([ #include <stdio.h>
4805                      #include <sys/types.h>
4806                      #include <png.h> ],
4807                    [ #if PNG_LIBPNG_VER < $MOZPNG
4808                      #error "Insufficient libpng version ($MOZPNG required)."
4809                      #endif
4810                      #ifndef PNG_UINT_31_MAX
4811                      #error "Insufficient libpng version."
4812                      #endif ],
4813                    SYSTEM_PNG=1,
4814                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4816 CFLAGS=$_SAVE_CFLAGS
4817 LDFLAGS=$_SAVE_LDFLAGS
4818 LIBS=$_SAVE_LIBS
4820 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4821     PNG_CFLAGS="-I${PNG_DIR}/include"
4822     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4825 fi # SKIP_LIBRARY_CHECKS
4827 dnl system HunSpell Support
4828 dnl ========================================================
4829 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4830 [  --enable-system-hunspell
4831                           Use system hunspell (located with pkgconfig)],
4832     SYSTEM_HUNSPELL=1 )
4834 if test -n "$SYSTEM_HUNSPELL"; then
4835     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4838 AC_SUBST(SYSTEM_HUNSPELL)
4840 dnl ========================================================
4841 dnl Java SDK support
4842 dnl ========================================================
4843 JAVA_INCLUDE_PATH=
4844 MOZ_ARG_WITH_STRING(java-include-path,
4845 [  --with-java-include-path=dir
4846                           Location of Java SDK headers],
4847     JAVA_INCLUDE_PATH=$withval)
4849 JAVA_BIN_PATH=
4850 MOZ_ARG_WITH_STRING(java-bin-path,
4851 [  --with-java-bin-path=dir
4852                           Location of Java binaries (java, javac, jar)],
4853     JAVA_BIN_PATH=$withval)
4855 dnl ========================================================
4856 dnl =
4857 dnl = Application
4858 dnl =
4859 dnl ========================================================
4861 MOZ_ARG_HEADER(Application)
4863 BUILD_STATIC_LIBS=
4864 ENABLE_TESTS=1
4865 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4866 MOZ_BRANDING_DIRECTORY=
4867 MOZ_OFFICIAL_BRANDING=
4868 MOZ_FEEDS=1
4869 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4870 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4871 MOZ_INSTALLER=1
4872 MOZ_IPC=1
4873 MOZ_JAVAXPCOM=
4874 MOZ_JSDEBUGGER=1
4875 MOZ_JSLOADER=1
4876 MOZ_MATHML=1
4877 MOZ_MORK=
4878 MOZ_MORKREADER=1
4879 MOZ_AUTH_EXTENSION=1
4880 MOZ_NO_ACTIVEX_SUPPORT=1
4881 MOZ_NO_FAST_LOAD=
4882 MOZ_OGG=1
4883 MOZ_RAW=1
4884 MOZ_SYDNEYAUDIO=
4885 MOZ_VORBIS=
4886 MOZ_WAVE=1
4887 MOZ_MEDIA=
4888 MOZ_WEBM=1
4889 VPX_AS=
4890 VPX_ASFLAGS=
4891 VPX_X86_ASM=
4892 MOZ_PANGO=1
4893 MOZ_PERMISSIONS=1
4894 MOZ_PLACES=1
4895 MOZ_PLAINTEXT_EDITOR_ONLY=
4896 MOZ_PLUGINS=1
4897 MOZ_PREF_EXTENSIONS=1
4898 MOZ_PROFILELOCKING=1
4899 MOZ_PSM=1
4900 MOZ_RDF=1
4901 MOZ_REFLOW_PERF=
4902 MOZ_SAFE_BROWSING=
4903 MOZ_FASTSTART=
4904 MOZ_HELP_VIEWER=
4905 MOZ_SPELLCHECK=1
4906 MOZ_SPLASHSCREEN=
4907 MOZ_STORAGE=1
4908 MOZ_SVG=1
4909 MOZ_THUMB2=
4910 MOZ_TIMELINE=
4911 MOZ_TOOLKIT_SEARCH=1
4912 MOZ_UI_LOCALE=en-US
4913 MOZ_UNIVERSALCHARDET=1
4914 MOZ_URL_CLASSIFIER=
4915 MOZ_USE_NATIVE_UCONV=
4916 MOZ_VIEW_SOURCE=1
4917 MOZ_XSLT_STANDALONE=
4918 MOZ_XTF=1
4919 MOZ_XUL=1
4920 MOZ_ZIPWRITER=1
4921 NS_PRINTING=1
4922 NSS_DISABLE_DBM=
4923 NECKO_WIFI=1
4924 NECKO_COOKIES=1
4925 NECKO_DISK_CACHE=1
4926 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource"
4927 USE_ARM_KUSER=
4928 BUILD_CTYPES=1
4929 XPC_IDISPATCH_SUPPORT=
4932 case "$target_os" in
4933 darwin*|*wince*|*winmo*)
4934     ACCESSIBILITY=
4935     ;;
4937     ACCESSIBILITY=1
4938     ;;
4939 esac
4941 case "$target_os" in
4942     msvc*|mks*|cygwin*|mingw*)
4943         NS_ENABLE_TSF=1
4944         if test -z "$GNU_CC"; then 
4945             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4946                 NS_ENABLE_TSF=
4947             fi
4948         fi
4949         if test -n "$NS_ENABLE_TSF"; then
4950             AC_DEFINE(NS_ENABLE_TSF)
4951         fi
4952         ;;
4953 esac
4955 case "${target}" in
4956     arm-android-eabi)
4957         NSS_DISABLE_DBM=1
4958         USE_ARM_KUSER=1
4959         MOZ_INSTALLER=
4960         MOZ_CRASHREPORTER=
4961         NS_PRINTING=
4962         NECKO_WIFI=
4963         MOZ_THUMB2=1
4964         MOZ_THEME_FASTSTRIPE=1
4965         MOZ_TREE_FREETYPE=1
4966         MOZ_MEMORY=1
4967         ;;
4968 esac
4970 MOZ_ARG_ENABLE_STRING(application,
4971 [  --enable-application=APP
4972                           Options include:
4973                             browser (Firefox)
4974                             xulrunner
4975                             content/xslt (Standalone Transformiix XSLT)
4976                             netwerk (Standalone Necko)
4977                             tools/update-packaging (AUS-related packaging tools)
4978                             standalone (use this for standalone
4979                               xpcom/xpconnect or to manually drive a build)],
4980 [ MOZ_BUILD_APP=$enableval ] )
4982 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4983 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4984   XULRUNNER_STUB_NAME=$withval)
4986 if test -z "$XULRUNNER_STUB_NAME"; then
4987   case "$target_os" in
4988   darwin*)
4989     XULRUNNER_STUB_NAME=xulrunner
4990     ;;
4991   *)
4992     XULRUNNER_STUB_NAME=xulrunner-stub
4993   esac
4995 AC_SUBST(XULRUNNER_STUB_NAME)
4997 if test -z "$MOZ_BUILD_APP"; then
4998   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4999 else
5000   # We have a valid application only if it has a build.mk file in its top
5001   # directory.
5002   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5003     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5004   fi
5007 # Allow the application to influence configure with a confvars.sh script.
5009 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5010 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5011   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5012   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5013 else
5014   AC_MSG_RESULT([no])
5017 # Now is a good time to test for logic errors, define mismatches, etc.
5018 case "$MOZ_BUILD_APP" in
5019 xulrunner)
5020   if test "$LIBXUL_SDK"; then
5021     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5022   fi
5023   ;;
5024 esac
5026 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5027 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5028 # MOZ_BUILD_APP.
5029 case "$MOZ_BUILD_APP" in
5030 browser)
5031   AC_DEFINE(MOZ_PHOENIX)
5032   ;;
5034 xulrunner)
5035   AC_DEFINE(MOZ_XULRUNNER)
5036   ;;
5038 content/xslt)
5039   AC_DEFINE(TX_EXE)
5040   ;;
5042 standalone) 
5043   MOZ_APP_NAME=mozilla
5044   MOZ_APP_DISPLAYNAME=Mozilla
5045   MOZ_APP_VERSION=$MOZILLA_VERSION
5046   ;;
5048 esac
5050 AC_SUBST(MOZ_BUILD_APP)
5051 AC_SUBST(MOZ_PHOENIX)
5052 AC_SUBST(MOZ_XULRUNNER)
5054 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5056 dnl ========================================================
5057 dnl = 
5058 dnl = Toolkit Options
5059 dnl = 
5060 dnl ========================================================
5061 MOZ_ARG_HEADER(Toolkit Options)
5063     dnl ========================================================
5064     dnl = Select the default toolkit
5065     dnl ========================================================
5066         MOZ_ARG_ENABLE_STRING(default-toolkit,
5067         [  --enable-default-toolkit=TK
5068                           Select default toolkit
5069                           Platform specific defaults:
5070                             BeOS - cairo-beos
5071                             Mac OS X - cairo-cocoa
5072                             Neutrino/QNX - photon
5073                             OS/2 - cairo-os2
5074                             Win32/WinCE - cairo-windows
5075                             Gtk2 with DirectFB - cairo-gtk2-dfb
5076                             * - cairo-gtk2
5077                             * - cairo-qt],
5078     [ _DEFAULT_TOOLKIT=$enableval ],
5079     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5081     if test "$_DEFAULT_TOOLKIT" = "photon" \
5082         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5083         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5084         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5085         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5086         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5087         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5088         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5089         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5090         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5091     then
5092         dnl nglayout only supports building with one toolkit,
5093         dnl so ignore everything after the first comma (",").
5094         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5095     else
5096         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5097     fi
5099 dnl ========================================================
5100 dnl = Enable the toolkit as needed                         =
5101 dnl ========================================================
5103 case "$MOZ_WIDGET_TOOLKIT" in
5104 photon)
5105         MOZ_ENABLE_PHOTON=1
5106         AC_DEFINE(MOZ_WIDGET_PHOTON)
5107     ;;
5109 cairo-windows)
5110     MOZ_WIDGET_TOOLKIT=windows
5111     MOZ_WEBGL=1
5112     case "${target}" in
5113     *-wince*)
5114         NS_PRINTING=
5115         ;;
5116     esac
5117     ;;
5119 cairo-gtk2|cairo-gtk2-x11)
5120     MOZ_WIDGET_TOOLKIT=gtk2
5121     MOZ_ENABLE_GTK2=1
5122     MOZ_ENABLE_XREMOTE=1
5123     MOZ_WEBGL=1
5124     MOZ_WEBGL_GLX=1
5126     AC_DEFINE(MOZ_X11)
5127     MOZ_X11=1
5128     USE_FC_FREETYPE=1
5130     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5131     TK_LIBS='$(MOZ_GTK2_LIBS)'
5132     AC_DEFINE(MOZ_WIDGET_GTK2)
5133     ;;
5135 cairo-gtk2-dfb)
5136     MOZ_WIDGET_TOOLKIT=gtk2
5137     MOZ_ENABLE_GTK2=1
5138     MOZ_WEBGL=
5140     AC_DEFINE(MOZ_DFB)
5141     MOZ_DFB=1
5143     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5144     TK_LIBS='$(MOZ_GTK2_LIBS)'
5145     AC_DEFINE(MOZ_WIDGET_GTK2)
5146     if test "$no_x" != "yes"; then
5147         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5148         no_x=yes
5149     fi
5150     ;;
5152 cairo-qt)
5153     MOZ_WIDGET_TOOLKIT=qt
5154     MOZ_ENABLE_QT=1
5155     MOZ_ENABLE_XREMOTE=1
5156     MOZ_WEBGL=1
5157     MOZ_WEBGL_GLX=1
5158     USE_ELF_DYNSTR_GC=
5159     NS_PRINTING=
5161     AC_DEFINE(MOZ_X11)
5162     MOZ_X11=1
5163     USE_FC_FREETYPE=1
5165     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5166     TK_LIBS='$(MOZ_QT_LIBS)'
5167     AC_DEFINE(MOZ_WIDGET_QT)
5168     ;;
5170 cairo-beos)
5171     MOZ_WIDGET_TOOLKIT=beos
5172     USE_FC_FREETYPE=1
5173     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5174     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5175     ;;
5177 cairo-os2)
5178     MOZ_WIDGET_TOOLKIT=os2
5179     USE_FC_FREETYPE=1
5180     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5181     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5182     ;;
5184 cairo-cocoa)
5185     MOZ_WIDGET_TOOLKIT=cocoa
5186     AC_DEFINE(MOZ_WIDGET_COCOA)
5187     MOZ_USER_DIR="Mozilla"
5188     AC_DEFINE(XP_MACOSX)
5189     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5190     TK_CFLAGS="-DNO_X11"
5191     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5192     CFLAGS="$CFLAGS $TK_CFLAGS"
5193     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5194     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5195     MOZ_FS_LAYOUT=bundle
5196     MOZ_WEBGL=1
5197     ;;
5199 cairo-android)
5200     AC_DEFINE(MOZ_WIDGET_ANDROID)
5201     MOZ_WIDGET_TOOLKIT=android
5202     MOZ_WEBGL=
5203     ;;
5205 esac
5207 if test "$MOZ_ENABLE_XREMOTE"; then
5208     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5211 if test "$COMPILE_ENVIRONMENT"; then
5212   if test "$MOZ_ENABLE_GTK2"; then
5213     if test "$MOZ_X11"; then
5214       GDK_PACKAGES=gdk-x11-2.0
5215     elif test "$MOZ_DFB"; then
5216       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5217       GDK_PACKAGES=directfb
5218     fi
5220     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5221   fi
5223 fi # COMPILE_ENVIRONMENT
5225 AC_SUBST(MOZ_FS_LAYOUT)
5227 dnl ========================================================
5228 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5229 dnl their usage and use them in spidermonkey.
5230 dnl ========================================================
5231 MOZ_ARG_WITH_BOOL(arm-kuser,
5232 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5233     USE_ARM_KUSER=1,)
5234 if test -n "$USE_ARM_KUSER"; then
5235    AC_DEFINE(USE_ARM_KUSER)
5238 dnl ========================================================
5239 dnl = startup-notification support module
5240 dnl ========================================================
5242 if test "$MOZ_ENABLE_GTK2"
5243 then
5244     MOZ_ENABLE_STARTUP_NOTIFICATION=
5246     MOZ_ARG_ENABLE_BOOL(startup-notification,
5247     [  --enable-startup-notification
5248                           Enable startup-notification support (default: disabled) ],
5249         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5250         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5251     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5252     then
5253         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5254                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5255         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5256             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5257             then
5258                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5259             fi
5260             MOZ_ENABLE_STARTUP_NOTIFICATION=
5261         ])
5262     fi
5264     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5265         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5266     fi
5268     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5270 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5271 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5272 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5274 dnl ========================================================
5275 dnl = QT support
5276 dnl ========================================================
5277 if test "$MOZ_ENABLE_QT"
5278 then
5279     MOZ_ARG_WITH_STRING(qtdir,
5280     [  --with-qtdir=\$dir       Specify Qt directory ],
5281     [ QTDIR=$withval])
5283     if test -z "$QTDIR"; then
5284         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5285         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5286     else
5287         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5289         MOZ_QT_CFLAGS="-DQT_SHARED"
5290         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5291         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5292         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5293         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5294         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5295         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5296         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5297         HOST_MOC="$QTDIR/bin/moc"
5298     fi
5299     if test -z "$HOST_MOC"; then
5300         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5301 incorrect])
5302     fi
5303     MOC=$HOST_MOC
5306 AC_SUBST(GTK_CONFIG)
5307 AC_SUBST(TK_CFLAGS)
5308 AC_SUBST(TK_LIBS)
5310 AC_SUBST(MOZ_ENABLE_GTK2)
5311 AC_SUBST(MOZ_ENABLE_PHOTON)
5312 AC_SUBST(MOZ_ENABLE_QT)
5313 AC_SUBST(MOZ_ENABLE_XREMOTE)
5314 AC_SUBST(MOZ_GTK2_CFLAGS)
5315 AC_SUBST(MOZ_GTK2_LIBS)
5316 AC_SUBST(MOZ_QT_CFLAGS)
5317 AC_SUBST(MOZ_QT_LIBS)
5318 AC_SUBST(MOZ_ENABLE_MEEGOTOUCH)
5320 AC_SUBST(MOC)
5322 AC_SUBST(MOZ_DFB)
5323 AC_SUBST(MOZ_X11)
5325 dnl ========================================================
5326 dnl =
5327 dnl = Components & Features
5328 dnl = 
5329 dnl ========================================================
5330 MOZ_ARG_HEADER(Components and Features)
5332 dnl ========================================================
5333 dnl = Localization
5334 dnl ========================================================
5335 MOZ_ARG_ENABLE_STRING(ui-locale,
5336 [  --enable-ui-locale=ab-CD
5337                           Select the user interface locale (default: en-US)],
5338     MOZ_UI_LOCALE=$enableval )
5339 AC_SUBST(MOZ_UI_LOCALE)
5341 dnl ========================================================
5342 dnl = Trademarked Branding 
5343 dnl ========================================================
5344 MOZ_ARG_ENABLE_BOOL(official-branding,
5345 [  --enable-official-branding
5346                           Enable Official mozilla.org Branding
5347                           Do not distribute builds with
5348                           --enable-official-branding unless you have
5349                           permission to use trademarks per
5350                           http://www.mozilla.org/foundation/trademarks/ .],
5352   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5353     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5354   else
5355     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5356     MOZ_OFFICIAL_BRANDING=1
5357   fi
5358 ], MOZ_OFFICIAL_BRANDING=)
5360 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5361 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5362   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5365 MOZ_ARG_WITH_STRING(branding,
5366 [  --with-branding=dir     Use branding from the specified directory.],
5367     MOZ_BRANDING_DIRECTORY=$withval)
5369 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5370 if test -z "$REAL_BRANDING_DIRECTORY"; then
5371   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5374 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5375   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5378 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5380 dnl ========================================================
5381 dnl = Distribution ID
5382 dnl ========================================================
5383 MOZ_ARG_WITH_STRING(distribution-id,
5384 [  --with-distribution-id=ID
5385                           Set distribution-specific id (default=org.mozilla)],
5386 [ val=`echo $withval`
5387     MOZ_DISTRIBUTION_ID="$val"])
5389 if test -z "$MOZ_DISTRIBUTION_ID"; then
5390    MOZ_DISTRIBUTION_ID="org.mozilla"
5393 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5394 AC_SUBST(MOZ_DISTRIBUTION_ID)
5397 dnl ========================================================
5398 dnl complex text support off by default
5399 dnl ========================================================
5400 MOZ_ARG_DISABLE_BOOL(pango,
5401 [  --disable-pango         Disable usage of Pango ],
5402     MOZ_PANGO=,
5403     MOZ_PANGO=1)
5405 dnl ========================================================
5406 dnl = Pango
5407 dnl ========================================================
5408 if test "$MOZ_ENABLE_GTK2"
5409 then
5410     AC_SUBST(MOZ_PANGO)
5412     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5414     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5415     AC_SUBST(MOZ_PANGO_CFLAGS)
5416     AC_SUBST(MOZ_PANGO_LIBS)
5417     if test "$MOZ_PANGO"
5418     then
5419         AC_DEFINE(MOZ_PANGO)
5420     else
5421         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5422         AC_SUBST(FT2_CFLAGS)
5423         AC_SUBST(FT2_LIBS)
5424     fi
5427 if test "$MOZ_ENABLE_QT"
5428 then
5429     if test "$MOZ_PANGO"
5430     then
5431         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5432         [
5433             AC_SUBST(MOZ_PANGO_CFLAGS)
5434             AC_SUBST(MOZ_PANGO_LIBS)
5435             AC_DEFINE(MOZ_PANGO)
5436         ],
5437         [
5438             echo "Pango library not found, will use FT2 font engine"
5439             MOZ_PANGO=
5440         ])
5441     fi
5442     AC_SUBST(MOZ_PANGO)
5445 dnl ========================================================
5446 dnl = GnomeVFS, GIO and GConf support module
5447 dnl ========================================================
5449 if test "$MOZ_X11"
5450 then
5451     dnl build the gnomevfs extension by default only when the
5452     dnl GTK2 toolkit is in use.
5453     if test "$MOZ_ENABLE_GTK2"
5454     then
5455         MOZ_ENABLE_GNOMEVFS=1
5456         MOZ_ENABLE_GCONF=1
5457     fi
5459     dnl ========================================================
5460     dnl = GnomeVFS support module
5461     dnl ========================================================
5462     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5463     [  --disable-gnomevfs      Disable GnomeVFS support ],
5464         MOZ_ENABLE_GNOMEVFS=,
5465         MOZ_ENABLE_GNOMEVFS=force)
5467     if test "$MOZ_ENABLE_GNOMEVFS"
5468     then
5469         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5470             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5471             MOZ_ENABLE_GNOMEVFS=1
5472             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5473         ],[
5474             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5475             then
5476                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5477             fi
5478             MOZ_ENABLE_GNOMEVFS=
5479         ])
5480     else
5481         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5482             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5483               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5484             ])
5485         fi
5486     fi
5488     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5489     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5490     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5492     dnl ========================================================
5493     dnl = GIO support module
5494     dnl ========================================================
5495     MOZ_ARG_ENABLE_BOOL(gio,
5496     [  --enable-gio            Enable GIO support (default: disabled)],
5497         MOZ_ENABLE_GIO=force,
5498         MOZ_ENABLE_GIO=)
5500     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5501     then
5502         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5503             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5504             MOZ_ENABLE_GIO=1
5505             AC_DEFINE(MOZ_ENABLE_GIO)
5506         ],[
5507             if test "$MOZ_ENABLE_GIO" = "force"
5508             then
5509                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5510             fi
5511             MOZ_ENABLE_GIO=
5512         ])
5513     fi
5515     AC_SUBST(MOZ_ENABLE_GIO)
5516     AC_SUBST(MOZ_GIO_CFLAGS)
5517     AC_SUBST(MOZ_GIO_LIBS)
5518    
5519     dnl ========================================================
5520     dnl = GConf support module
5521     dnl ========================================================
5522     if test "$MOZ_ENABLE_GCONF"
5523     then
5524         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5525             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5526             MOZ_ENABLE_GCONF=1
5527         ],[
5528             if test "$MOZ_ENABLE_GCONF" = "force"
5529             then
5530                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5531             fi
5532             MOZ_ENABLE_GCONF=
5533         ])
5534     fi
5536     if test "$MOZ_ENABLE_GCONF"; then
5537         AC_DEFINE(MOZ_ENABLE_GCONF)
5538     fi
5540     AC_SUBST(MOZ_ENABLE_GCONF)
5541     AC_SUBST(MOZ_GCONF_CFLAGS)
5542     AC_SUBST(MOZ_GCONF_LIBS)
5545 dnl ========================================================
5546 dnl = libproxy support
5547 dnl ========================================================
5549 if test "$MOZ_ENABLE_GTK2"
5550 then
5551     MOZ_ENABLE_LIBPROXY=
5553     MOZ_ARG_ENABLE_BOOL(libproxy,
5554     [  --enable-libproxy         Enable libproxy support ],
5555     MOZ_ENABLE_LIBPROXY=1,
5556     MOZ_ENABLE_LIBPROXY=)
5558     if test "$MOZ_ENABLE_LIBPROXY"
5559     then
5560         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5561         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5562     fi
5564 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5565 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5566 AC_SUBST(MOZ_LIBPROXY_LIBS)
5568 dnl ========================================================
5569 dnl = libnotify support
5570 dnl ========================================================
5572 if test "$MOZ_ENABLE_GTK2"
5573 then
5574     MOZ_ENABLE_LIBNOTIFY=1
5576     MOZ_ARG_DISABLE_BOOL(libnotify,
5577     [  --disable-libnotify     Disable libnotify support ],
5578     MOZ_ENABLE_LIBNOTIFY=,
5579     MOZ_ENABLE_LIBNOTIFY=1)
5581     if test "$MOZ_ENABLE_LIBNOTIFY"
5582     then
5583         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5584     fi
5587 if test -z "$SKIP_LIBRARY_CHECKS"
5588 then
5589     if test "$MOZ_ENABLE_GTK2"
5590     then
5591         if test "$MOZ_ENABLE_LIBNOTIFY"
5592         then
5593             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5594         fi
5595     fi
5597 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5598 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5599 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5601 dnl ========================================================
5602 dnl = GNOME component (mozgnome)
5603 dnl ========================================================
5605 # The GNOME component is built if one of 
5606 # gnome-vfs, gio, gconf or libnotify is available.
5607 if test "$MOZ_ENABLE_GCONF" -o \
5608    "$MOZ_ENABLE_GNOMEVFS" -o \
5609    "$MOZ_ENABLE_GIO" -o \
5610    "$MOZ_ENABLE_LIBNOTIFY"; then
5611     MOZ_ENABLE_GNOME_COMPONENT=1
5612 else
5613     MOZ_ENABLE_GNOME_COMPONENT=
5615 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5617 dnl ========================================================
5618 dnl = libgnomeui support module
5619 dnl ========================================================
5621 if test "$MOZ_ENABLE_GTK2"
5622 then
5623     MOZ_ENABLE_GNOMEUI=1
5625     MOZ_ARG_DISABLE_BOOL(gnomeui,
5626     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5627         MOZ_ENABLE_GNOMEUI=,
5628         MOZ_ENABLE_GNOMEUI=force)
5630     if test "$MOZ_ENABLE_GNOMEUI"
5631     then
5632         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5633         [
5634             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5635             MOZ_ENABLE_GNOMEUI=1
5636         ],[
5637             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5638             then
5639                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5640             fi
5641             MOZ_ENABLE_GNOMEUI=
5642         ])
5643     fi
5645     if test "$MOZ_ENABLE_GNOMEUI"; then
5646         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5647     fi
5650 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5651 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5652 AC_SUBST(MOZ_GNOMEUI_LIBS)
5654 dnl ========================================================
5655 dnl = dbus support
5656 dnl ========================================================
5658 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5659 then
5660     MOZ_ENABLE_DBUS=1
5662     MOZ_ARG_DISABLE_BOOL(dbus,
5663     [  --disable-dbus          Disable dbus support ],
5664         MOZ_ENABLE_DBUS=,
5665         MOZ_ENABLE_DBUS=1)
5667     if test "$MOZ_ENABLE_DBUS"
5668     then
5669         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5670         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5671         AC_DEFINE(MOZ_ENABLE_DBUS)
5672     fi
5674 AC_SUBST(MOZ_ENABLE_DBUS)
5675 AC_SUBST(MOZ_DBUS_CFLAGS)
5676 AC_SUBST(MOZ_DBUS_LIBS)
5677 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5678 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5680 dnl ========================================================
5681 dnl = Build Personal Security Manager
5682 dnl ========================================================
5683 MOZ_ARG_DISABLE_BOOL(crypto,
5684 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5685     MOZ_PSM=,
5686     MOZ_PSM=1 )
5688 dnl ========================================================
5689 dnl = JS Debugger XPCOM component (js/jsd)
5690 dnl ========================================================
5691 MOZ_ARG_DISABLE_BOOL(jsd,
5692 [  --disable-jsd           Disable JavaScript debug library],
5693     MOZ_JSDEBUGGER=,
5694     MOZ_JSDEBUGGER=1)
5697 dnl ========================================================
5698 dnl = Disable IPC support for tabs and plugins
5699 dnl ========================================================
5700 MOZ_ARG_DISABLE_BOOL(ipc,
5701 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5702     MOZ_IPC=,
5703     MOZ_IPC=1)
5705 if test -n "$MOZ_IPC"; then
5706     AC_DEFINE(MOZ_IPC)
5709 AC_SUBST(MOZ_IPC)
5711 dnl ========================================================
5712 dnl = Enable IPDL's "expensive" unit tests
5713 dnl ========================================================
5714 MOZ_IPDL_TESTS=
5716 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5717 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5718     MOZ_IPDL_TESTS=1,
5719     MOZ_IPDL_TESTS=)
5721 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5722     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5725 if test -n "$MOZ_IPDL_TESTS"; then
5726     AC_DEFINE(MOZ_IPDL_TESTS)
5729 AC_SUBST(MOZ_IPDL_TESTS)
5731 dnl ========================================================
5732 dnl = Disable plugin support
5733 dnl ========================================================
5734 MOZ_ARG_DISABLE_BOOL(plugins,
5735 [  --disable-plugins       Disable plugins support],
5736     MOZ_PLUGINS=,
5737     MOZ_PLUGINS=1)
5739 dnl ========================================================
5740 dnl = Disable building dbm
5741 dnl ========================================================
5742 MOZ_ARG_DISABLE_BOOL(dbm,
5743 [  --disable-dbm           Disable building dbm],
5744     NSS_DISABLE_DBM=1,
5745     NSS_DISABLE_DBM=)
5747 dnl bi-directional support always on
5748 IBMBIDI=1
5749 AC_DEFINE(IBMBIDI)
5751 dnl ========================================================
5752 dnl view source support on by default
5753 dnl ========================================================
5754 if test "$MOZ_VIEW_SOURCE"; then
5755     AC_DEFINE(MOZ_VIEW_SOURCE)
5758 dnl ========================================================
5759 dnl accessibility support on by default on all platforms 
5760 dnl except OS X.
5761 dnl ========================================================
5762 MOZ_ARG_DISABLE_BOOL(accessibility,
5763 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5764     ACCESSIBILITY=,
5765     ACCESSIBILITY=1 )
5766 if test "$ACCESSIBILITY"; then
5767     AC_DEFINE(ACCESSIBILITY)
5770 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5771 case "$target" in
5772 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5773     if test "$ac_cv_header_atlbase_h" = "no"; then
5774         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.])
5775     fi
5776     if test "$ac_cv_header_oleacc_idl" = "no"; then
5777         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.])
5778     fi
5779     ;;
5780 esac
5783 dnl ========================================================
5784 dnl xpcom js loader support on by default
5785 dnl ========================================================
5786 if test "$MOZ_JSLOADER"; then
5787     AC_DEFINE(MOZ_JSLOADER)
5790 dnl ========================================================
5791 dnl Disable printing
5792 dnl ========================================================
5793 MOZ_ARG_DISABLE_BOOL(printing,
5794 [  --disable-printing      Disable printing support],
5795     NS_PRINTING=,
5796     NS_PRINTING=1)
5798 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5799     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5800     NS_PRINTING=
5803 if test "$NS_PRINTING"; then
5804     AC_DEFINE(NS_PRINTING)
5805     AC_DEFINE(NS_PRINT_PREVIEW)
5807 dnl ========================================================
5808 dnl use native unicode converters
5809 dnl ========================================================
5810 MOZ_ARG_ENABLE_BOOL(native-uconv,
5811 [  --enable-native-uconv   Enable iconv support],
5812     MOZ_USE_NATIVE_UCONV=1,
5813     MOZ_USE_NATIVE_UCONV= )
5814 if test "$MOZ_USE_NATIVE_UCONV"; then
5815     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5817 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5818     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5822 dnl ========================================================
5823 dnl Libeditor can be build as plaintext-only,
5824 dnl or as a full html and text editing component.
5825 dnl We build both by default.
5826 dnl ========================================================
5827 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5828 [  --enable-plaintext-editor-only
5829                           Allow only plaintext editing],
5830     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5831     MOZ_PLAINTEXT_EDITOR_ONLY= )
5832 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5833 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5835 dnl ========================================================
5836 dnl = Disable Fast Load
5837 dnl ========================================================
5838 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5839 [  --disable-xpcom-fastload
5840                           Disable XPCOM fastload support],
5841     MOZ_NO_FAST_LOAD=1,
5842     MOZ_NO_FAST_LOAD=)
5844 AC_SUBST(MOZ_NO_FAST_LOAD)
5846 if test -n "$MOZ_NO_FAST_LOAD"; then
5847     AC_DEFINE(MOZ_NO_FAST_LOAD)
5850 AC_SUBST(MOZ_RAW)
5851 AC_DEFINE(MOZ_RAW)
5853 dnl ========================================================
5854 dnl = Disable Ogg Codecs
5855 dnl ========================================================
5856 MOZ_ARG_DISABLE_BOOL(ogg,
5857 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5858     MOZ_OGG=,
5859     MOZ_OGG=1)
5861 if test -n "$MOZ_OGG"; then
5862     AC_DEFINE(MOZ_OGG)
5863     MOZ_SYDNEYAUDIO=1
5864     MOZ_MEDIA=1
5865     MOZ_VORBIS=1
5867     dnl Checks for __attribute__(aligned()) directive
5868     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5869         [ac_cv_c_attribute_aligned],
5870         [ac_cv_c_attribute_aligned=0
5871          CFLAGS_save="${CFLAGS}"
5872          CFLAGS="${CFLAGS} -Werror"
5873          for ac_cv_c_attr_align_try in 64 32 16 8; do
5874            echo "trying $ac_cv_c_attr_align_try"
5875            AC_TRY_COMPILE([],
5876                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5877                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5878            if test "$ac_cv_c_attribute_aligned" != 0; then
5879              break;
5880            fi
5881          done
5882            CFLAGS="${CFLAGS_save}"])
5883     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5884       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5885                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5886     fi
5889 dnl ========================================================
5890 dnl = Disable VP8 decoder support
5891 dnl ========================================================
5892 MOZ_ARG_DISABLE_BOOL(webm,
5893 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5894     MOZ_WEBM=,
5895     MOZ_WEBM=1)
5897 if test -n "$MOZ_WEBM"; then
5898     AC_DEFINE(MOZ_WEBM)
5899     MOZ_SYDNEYAUDIO=1
5900     MOZ_MEDIA=1
5901     MOZ_VORBIS=1
5903     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5904     dnl For Win32 (MSVC) we must use MASM.
5905     if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" = "x86" -a -z "$GNU_CC"; then
5906         AC_MSG_CHECKING([for MASM assembler])
5907         AC_CHECK_PROGS(VPX_AS, ml, "")
5908         if test -n "$VPX_AS"; then
5909           VPX_X86_ASM=1
5910           VPX_AS='sh $(topsrcdir)/media/libvpx/yasm2masm-as.sh'
5911         else
5912             AC_MSG_ERROR([Need MASM (ml.exe) in order to assemble libvpx optimized assembly. Either disable webm (reconfigure with --disable-webm) or install MASM. MASM is included in the Windows 7 SDK, or you can download MASM directly from http://www.microsoft.com/downloads/details.aspx?familyid=7a1c9da0-0510-44a2-b042-7ef370530c64&displaylang=en])
5913         fi
5914     else 
5916       dnl For Darwin x86, Darwin x86_64, Linux x86, and WINNT x86_64
5917       dnl we can use YASM.
5918       AC_MSG_CHECKING([for YASM assembler])
5919       AC_CHECK_PROGS(VPX_AS, $YASM yasm, "")
5920       dnl We have YASM, see if we have assembly on this platform.  
5921       case "$OS_ARCH:$OS_TEST" in
5922       Linux:x86|Linux:i?86)
5923         VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5924         VPX_X86_ASM=1
5925       ;;
5926       Linux:x86_64)
5927         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5928         VPX_X86_ASM=1
5929       ;;
5930       SunOS:i?86)
5931         VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5932         VPX_X86_ASM=1
5933       ;;
5934       SunOS:x86_64)
5935         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5936         VPX_X86_ASM=1
5937       ;;
5938       Darwin:i?86)
5939         VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5940         VPX_X86_ASM=1
5941       ;;
5942       Darwin:x86_64)
5943         VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5944         VPX_X86_ASM=1
5945       ;;
5946       WINNT:x86_64)
5947         if test -z "$GNU_CC"; then
5948           VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5949           VPX_X86_ASM=1
5950         fi
5951       ;;
5952       esac
5953       if test "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5954         AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
5955       fi
5956     fi # end !WINNT_x86_MSVC
5958     if test -n "$VPX_X86_ASM"; then
5959       AC_DEFINE(VPX_X86_ASM)
5960     else
5961       AC_MSG_WARN([No assembler or assembly support for libvpx, using unoptimized C routines.])
5962     fi
5965 dnl ========================================================
5966 dnl = Disable Wave decoder support
5967 dnl ========================================================
5968 MOZ_ARG_DISABLE_BOOL(wave,
5969 [  --disable-wave          Disable Wave decoder support],
5970     MOZ_WAVE=,
5971     MOZ_WAVE=1)
5973 if test -n "$MOZ_WAVE"; then
5974     AC_DEFINE(MOZ_WAVE)
5975     MOZ_SYDNEYAUDIO=1
5976     MOZ_MEDIA=1
5979 dnl ========================================================
5980 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5981 dnl ========================================================
5983 if test -n "$MOZ_SYDNEYAUDIO"; then
5984     AC_DEFINE(MOZ_SYDNEYAUDIO)
5987 if test -n "$MOZ_MEDIA"; then
5988     AC_DEFINE(MOZ_MEDIA)
5991 if test -n "$MOZ_VORBIS"; then
5992     AC_DEFINE(MOZ_VORBIS)
5995 dnl ========================================================
5996 dnl = Check alsa availability on Linux if using sydneyaudio
5997 dnl ========================================================
5999 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6000 if test -n "$MOZ_SYDNEYAUDIO"; then
6001    case "$target_os" in
6002 linux*)
6003       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6004          [echo "$MOZ_ALSA_PKG_ERRORS"
6005           AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux.  Disable with --disable-ogg --disable-wave --disable-webm.  (On Ubuntu, you might try installing the package libasound2-dev.)])])
6006       ;;
6007    esac
6010 dnl ========================================================
6011 dnl Splashscreen
6012 dnl ========================================================
6013 AC_ARG_ENABLE(splashscreen,
6014               [  --enable-splashscreen   display splashscreen while loading (default=no)],
6015               [enable_splash="yes"],[enable_splash=""])
6016 if test "x$enable_splash" = "xyes"; then
6017   MOZ_SPLASHSCREEN=1
6018   AC_DEFINE(MOZ_SPLASHSCREEN)
6020 AC_SUBST(MOZ_SPLASHSCREEN)
6022 dnl ========================================================
6023 dnl Permissions System
6024 dnl ========================================================
6025 MOZ_ARG_DISABLE_BOOL(permissions,
6026 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
6027     MOZ_PERMISSIONS=,
6028     MOZ_PERMISSIONS=1
6031 dnl ========================================================
6032 dnl NegotiateAuth
6033 dnl ========================================================
6034 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6035 [  --disable-negotiateauth Disable GSS-API negotiation ],
6036     MOZ_AUTH_EXTENSION=,
6037     MOZ_AUTH_EXTENSION=1 )
6039 dnl ========================================================
6040 dnl XTF
6041 dnl ========================================================
6042 MOZ_ARG_DISABLE_BOOL(xtf,
6043 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
6044     MOZ_XTF=,
6045     MOZ_XTF=1 )
6046 if test "$MOZ_XTF"; then
6047   AC_DEFINE(MOZ_XTF)
6050 dnl ========================================================
6051 dnl Pref extensions (autoconfig and system-pref)
6052 dnl ========================================================
6053 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6054 [  --disable-pref-extensions
6055                           Disable pref extensions such as autoconfig and
6056                           system-pref],
6057   MOZ_PREF_EXTENSIONS=,
6058   MOZ_PREF_EXTENSIONS=1 )
6060 dnl ========================================================
6061 dnl = Universalchardet
6062 dnl ========================================================
6063 MOZ_ARG_DISABLE_BOOL(universalchardet,
6064 [  --disable-universalchardet
6065                           Disable universal encoding detection],
6066   MOZ_UNIVERSALCHARDET=,
6067   MOZ_UNIVERSALCHARDET=1 )
6069 dnl ========================================================
6070 dnl JavaXPCOM
6071 dnl ========================================================
6072 case "${target}" in
6073 *-wince*)
6074     MOZ_JAVAXPCOM=
6075     ;;
6076 esac
6078 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6079 [  --enable-javaxpcom
6080                           Enable Java-XPCOM bridge],
6081     MOZ_JAVAXPCOM=1,
6082     MOZ_JAVAXPCOM=)
6084 case "$host_os" in
6085   cygwin*|msvc*|mks*)
6086     if test -n "$JAVA_HOME"; then
6087       JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6088     fi
6089     ;;
6090   *mingw*)
6091     if test -n "$JAVA_HOME"; then
6092       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6093     fi
6094     ;;
6095 esac
6097 if test -n "${JAVA_BIN_PATH}"; then
6098   dnl Look for javac and jar in the specified path.
6099   JAVA_PATH="$JAVA_BIN_PATH"
6100 else
6101   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6102   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6105 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6106 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6107 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6109 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6110   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6111     AC_MSG_ERROR([The programs java, javac and jar were not found.  Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
6112   fi
6115 if test -n "${MOZ_JAVAXPCOM}"; then
6116   if test -n "${JAVA_INCLUDE_PATH}"; then
6117     dnl Make sure jni.h exists in the given include path.
6118     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6119       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6120     fi
6121   else
6122     case "$target_os" in
6123       darwin*)
6124         dnl Default to java system location
6125         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6126         ;;
6127       *)
6128         dnl Try $JAVA_HOME
6129         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6130         ;;
6131     esac
6132     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6133       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.])
6134     fi
6135   fi
6138 dnl ========================================================
6139 dnl = Breakpad crash reporting (on by default on supported platforms)
6140 dnl ========================================================
6142 case $target in
6143 i?86-*-mingw*)
6144   MOZ_CRASHREPORTER=1
6145   ;;
6146 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6147   MOZ_CRASHREPORTER=1
6148   ;;
6149 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6150   MOZ_CRASHREPORTER=1
6151   ;;
6152 *solaris*)
6153   MOZ_CRASHREPORTER=1
6154   ;;
6155 esac
6157 MOZ_ARG_DISABLE_BOOL(crashreporter,
6158 [  --disable-crashreporter Disable breakpad crash reporting],
6159     MOZ_CRASHREPORTER=,
6160     MOZ_CRASHREPORTER=1)
6162 if test -n "$MOZ_CRASHREPORTER"; then
6163    AC_DEFINE(MOZ_CRASHREPORTER)
6165   if (test "$OS_ARCH" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6166     test -z "$SKIP_LIBRARY_CHECKS"; then
6167     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6168     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6169     AC_SUBST(MOZ_GTHREAD_LIBS)
6171     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.])])
6172   fi
6175 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6176 [  --with-crashreporter-enable-percent=NN
6177                           Enable sending crash reports by default on NN% of users. (default=100)],
6178 [ val=`echo $withval | sed 's/[^0-9]//g'`
6179     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6181 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6182    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6184 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6186 dnl ========================================================
6187 dnl = Enable compilation of specific extension modules
6188 dnl ========================================================
6190 MOZ_ARG_ENABLE_STRING(extensions,
6191 [  --enable-extensions     Enable extensions],
6192 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6193     if test "$option" = "yes" -o "$option" = "all"; then
6194         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6195     elif test "$option" = "no" -o "$option" = "none"; then
6196         MOZ_EXTENSIONS=""
6197     elif test "$option" = "default"; then
6198         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6199     elif test `echo "$option" | grep -c \^-` != 0; then
6200         option=`echo $option | sed 's/^-//'`
6201         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6202     else
6203         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6204     fi
6205 done],
6206     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6208 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6209     # Suppress warning on non-X11 platforms
6210     if test -n "$MOZ_X11"; then
6211         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6212     fi
6213     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6216 dnl Do not build gnomevfs with libxul based apps
6217 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6218     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6221 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6222     # Suppress warning on non-X11 platforms
6223     if test -n "$MOZ_X11"; then
6224         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6225     fi
6226     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6229 dnl Do not build gio with libxul based apps
6230 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6231     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6234 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6235     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6236     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6239 dnl This might be temporary: build tridentprofile only on Windows
6240 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6241     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6242     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6245 dnl cookie must be built before tridentprofile. put it at list's end.
6246 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6247   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6248   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6251 dnl xforms requires xtf and schema-validation
6252 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6253     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6254     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6256 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
6257     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
6258     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6261 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6262     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6263     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6266 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6267     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6268     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6271 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6272     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6273     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6276 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6277     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6278     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6281 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6282     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6283     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6286 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6287     AC_MSG_WARN([spellcheck is no longer an extension.])
6288     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6291 dnl Remove dupes
6292 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6294 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6295 dnl when trying to build a nonexistent extension.
6296 for extension in $MOZ_EXTENSIONS; do
6297     if test ! -d "${srcdir}/extensions/${extension}"; then
6298         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6299     fi
6300 done
6303 dnl ========================================================
6304 dnl Image decoders
6305 dnl ========================================================
6306 case "$MOZ_WIDGET_TOOLKIT" in
6307 beos|windows|os2|mac|cocoa)
6308     ;;
6310     if test -z "$MOZ_ENABLE_GTK2" -a -z "$MOZ_ENABLE_QT"; then
6311        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6312     fi
6313     ;;
6314 esac
6316 MOZ_ARG_ENABLE_STRING(image-decoders,
6317 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
6318                           Enable specific image decoders],
6319 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6320     if test "$option" = "yes" -o "$option" = "all"; then
6321         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6322     elif test "$option" = "no" -o "$option" = "none"; then
6323         MOZ_IMG_DECODERS=""
6324     elif test "$option" = "default"; then
6325         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6326     elif test `echo "$option" | grep -c \^-` != 0; then
6327         option=`echo $option | sed 's/^-//'`
6328         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6329     else
6330         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6331     fi
6332 done],
6333     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6335 dnl Dupes are removed in the encoder section because it will also add decoders
6337 dnl ========================================================
6338 dnl Image encoders
6339 dnl ========================================================
6340 MOZ_ARG_ENABLE_STRING(image-encoders,
6341 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
6342                           Enable specific image encoders],
6343 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6344     if test "$option" = "yes" -o "$option" = "all"; then
6345         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6346     elif test "$option" = "no" -o "$option" = "none"; then
6347         MOZ_IMG_ENCODERS=""
6348         addencoder=""
6349     elif test "$option" = "default"; then
6350         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6351     elif test `echo "$option" | grep -c \^-` != 0; then
6352         option=`echo $option | sed 's/^-//'`
6353         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6354     else
6355         addencoder="$option"
6356     fi
6357     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6358 done],
6359     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6361 dnl Remove dupes
6362 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6363 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6365 dnl ========================================================
6366 dnl MathML on by default
6367 dnl ========================================================
6368 MOZ_ARG_DISABLE_BOOL(mathml,
6369 [  --disable-mathml        Disable MathML support],
6370     MOZ_MATHML=,
6371     MOZ_MATHML=1 )
6372 if test "$MOZ_MATHML"; then
6373   AC_DEFINE(MOZ_MATHML)
6376 dnl ========================================================
6377 dnl SVG
6378 dnl ========================================================
6379 MOZ_ARG_DISABLE_BOOL(svg,
6380 [  --disable-svg           Disable SVG support],
6381     MOZ_SVG=,
6382     MOZ_SVG=1 )
6383 if test -n "$MOZ_SVG"; then
6384   AC_DEFINE(MOZ_SVG)
6387 dnl ========================================================
6388 dnl SMIL
6389 dnl ========================================================
6390 MOZ_SMIL=1
6391 MOZ_ARG_DISABLE_BOOL(smil,
6392 [  --disable-smil          Disable SMIL animation support],
6393     MOZ_SMIL=,
6394     MOZ_SMIL=1 )
6395 # Automatically disable SMIL if SVG is disabled
6396 if test -z "$MOZ_SVG"; then
6397   MOZ_SMIL=
6399 if test -n "$MOZ_SMIL"; then
6400   AC_DEFINE(MOZ_SMIL)
6403 dnl ========================================================
6404 dnl Build Freetype in the tree
6405 dnl ========================================================
6406 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6407 [  --enable-tree-freetype  Enable Tree FreeType],
6408     MOZ_TREE_FREETYPE=1,
6409     MOZ_TREE_FREETYPE= )
6410 if test -n "$MOZ_TREE_FREETYPE"; then
6411    AC_DEFINE(MOZ_TREE_FREETYPE)
6412    AC_SUBST(MOZ_TREE_FREETYPE)
6413    MOZ_ENABLE_CAIRO_FT=1       
6414    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6415    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6416    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6417    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6418    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6419    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6420    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6421    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6422    AC_SUBST(CAIRO_FT_CFLAGS)
6426 dnl ========================================================
6427 dnl Installer
6428 dnl ========================================================
6429 case "$target_os" in
6430     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6431         MOZ_INSTALLER=1
6432         ;;
6433 esac
6435 MOZ_ARG_DISABLE_BOOL(installer,
6436 [  --disable-installer     Disable building of installer],
6437     MOZ_INSTALLER=,
6438     MOZ_INSTALLER=1)
6439 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6440     # Disable installer for Windows builds that use the new toolkit if the
6441     # required major version and minimum minor version of Unicode NSIS isn't in
6442     # the path.
6443     REQ_NSIS_MAJOR_VER=2
6444     MIN_NSIS_MINOR_VER=33
6445     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6446     if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6447         AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path. To build without the installer reconfigure using --disable-installer.])
6448     fi
6449     changequote(,)
6450     MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6451     changequote([,])
6452     if test ! "$MAKENSISU_VER" == ""; then
6453         MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6454         MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6455     fi
6456     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6457     if test "$MAKENSISU_VER" == "" -o \
6458        ! "$MAKENSISU_MAJOR_VER" == "$REQ_NSIS_MAJOR_VER" -o \
6459        ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6460         AC_MSG_RESULT([no])
6461         AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path. To build without the installer reconfigure using --disable-installer.])
6462     fi
6463     AC_MSG_RESULT([yes])
6464     MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6467 AC_SUBST(MOZ_INSTALLER)
6469 AC_MSG_CHECKING([for tar archiver])
6470 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6471 if test -z "$TAR"; then
6472     AC_MSG_ERROR([no tar archiver found in \$PATH])
6474 AC_MSG_RESULT([$TAR])
6475 AC_SUBST(TAR)
6477 AC_MSG_CHECKING([for wget])
6478 AC_CHECK_PROGS(WGET, wget, "")
6479 AC_MSG_RESULT([$WGET])
6480 AC_SUBST(WGET)
6482 dnl ========================================================
6483 dnl Updater
6484 dnl ========================================================
6486 MOZ_ARG_DISABLE_BOOL(updater,
6487 [  --disable-updater       Disable building of updater],
6488     MOZ_UPDATER=,
6489     MOZ_UPDATER=1 )
6491 if test -n "$MOZ_UPDATER"; then
6492     AC_DEFINE(MOZ_UPDATER)
6495 # app update channel is 'default' when not supplied.
6496 MOZ_ARG_ENABLE_STRING([update-channel],
6497 [  --enable-update-channel=CHANNEL
6498                           Select application update channel (default=default)],
6499     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6501 if test -z "$MOZ_UPDATE_CHANNEL"; then
6502     MOZ_UPDATE_CHANNEL=default
6504 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6505 AC_SUBST(MOZ_UPDATE_CHANNEL)
6507 # tools/update-packaging is not checked out by default.
6508 MOZ_ARG_ENABLE_BOOL(update-packaging,
6509 [  --enable-update-packaging
6510                           Enable tools/update-packaging],
6511     MOZ_UPDATE_PACKAGING=1,
6512     MOZ_UPDATE_PACKAGING= )
6513 AC_SUBST(MOZ_UPDATE_PACKAGING)
6515 dnl ========================================================
6516 dnl ActiveX
6517 dnl ========================================================
6519 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6520 [  --disable-xpconnect-idispatch
6521                           Disable building of xpconnect support for IDispatch
6522                           (win32 only)],
6523     XPC_IDISPATCH_SUPPORT=,
6524     XPC_IDISPATCH_SUPPORT=1)
6525 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6527 MOZ_ARG_DISABLE_BOOL(activex,
6528 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6529     MOZ_NO_ACTIVEX_SUPPORT=1,
6530     MOZ_NO_ACTIVEX_SUPPORT= )
6531 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6533 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6534 [  --enable-activex-scripting
6535                           Enable building of ActiveX scripting support (win32)],
6536     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6537     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6538 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6540 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6541 then
6542     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6545 if test "$COMPILE_ENVIRONMENT" = "1"; then
6546 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6547 case "$target" in
6548 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6549     if test "$ac_cv_header_atlbase_h" = "no"; then
6550         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.])
6551     fi
6552     ;;
6553 esac
6557 dnl ========================================================
6558 dnl leaky
6559 dnl ========================================================
6560 MOZ_ARG_ENABLE_BOOL(leaky,
6561 [  --enable-leaky          Build leaky memory tool],
6562     MOZ_LEAKY=1,
6563     MOZ_LEAKY=)
6566 dnl ========================================================
6567 dnl build the tests by default
6568 dnl ========================================================
6569 MOZ_ARG_DISABLE_BOOL(tests,
6570 [  --disable-tests         Do not build test libraries & programs],
6571     ENABLE_TESTS=,
6572     ENABLE_TESTS=1 )
6574 dnl ========================================================
6575 dnl parental controls (for Windows Vista)
6576 dnl ========================================================
6577 MOZ_ARG_DISABLE_BOOL(parental-controls,
6578 [  --disable-parental-controls
6579                           Do not build parental controls],
6580    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6581    MOZ_DISABLE_PARENTAL_CONTROLS=)
6582 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6583     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6586 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6588 dnl ========================================================
6589 dnl =
6590 dnl = Module specific options
6591 dnl =
6592 dnl ========================================================
6593 MOZ_ARG_HEADER(Individual module options)
6595 dnl ========================================================
6596 dnl = Disable feed handling components
6597 dnl ========================================================
6598 MOZ_ARG_DISABLE_BOOL(feeds,
6599 [  --disable-feeds         Disable feed handling and processing components],
6600     MOZ_FEEDS=,
6601     MOZ_FEEDS=1 )
6602 if test -n "$MOZ_FEEDS"; then
6603     AC_DEFINE(MOZ_FEEDS)
6604 else
6605     if test "$MOZ_BUILD_APP" = "browser"; then
6606         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6607     fi
6610 dnl ========================================================
6611 dnl = Enable mozStorage
6612 dnl ========================================================
6613 dnl Implicitly enabled by default if building calendar or places
6614 MOZ_ARG_ENABLE_BOOL(storage,
6615 [  --enable-storage        Enable mozStorage module and related components],
6616     MOZ_STORAGE=1,
6617     MOZ_STORAGE= )
6618 if test -n "$MOZ_STORAGE"; then
6619     AC_DEFINE(MOZ_STORAGE)
6622 dnl ========================================================
6623 dnl Check for sqlite
6624 dnl ========================================================
6626 MOZ_NATIVE_SQLITE=
6627 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6628 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6629 MOZ_NATIVE_SQLITE=1,
6630 MOZ_NATIVE_SQLITE= )
6632 if test -z "$MOZ_NATIVE_SQLITE"
6633 then
6634     SQLITE_CFLAGS=
6635     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6636 else
6637     dnl ============================
6638     dnl === SQLite Version check ===
6639     dnl ============================
6640     dnl Check to see if the system SQLite package is new enough.
6641     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6643     dnl ==================================
6644     dnl === SQLITE_SECURE_DELETE check ===
6645     dnl ==================================
6646     dnl Check to see if the system SQLite package is compiled with
6647     dnl SQLITE_SECURE_DELETE enabled.
6648     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6649     _SAVE_CFLAGS="$CFLAGS"
6650     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6651     _SAVE_LIBS="$LIBS"
6652     LIBS="$LIBS $SQLITE_LIBS"
6653     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6654         AC_TRY_RUN([
6655             #include "sqlite3.h"
6657             int main(int argc, char **argv){
6658               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6659             }],
6660             ac_cv_sqlite_secure_delete=yes,
6661             ac_cv_sqlite_secure_delete=no,
6662             ac_cv_sqlite_secure_delete=no
6663         )
6664     ])
6665     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6666     CFLAGS="$_SAVE_CFLAGS"
6667     LIBS="$_SAVE_LIBS"
6668     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6669         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6670     fi
6672     dnl ===============================
6673     dnl === SQLITE_THREADSAFE check ===
6674     dnl ===============================
6675     dnl Check to see if the system SQLite package is compiled with
6676     dnl SQLITE_THREADSAFE enabled.
6677     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6678     _SAVE_CFLAGS="$CFLAGS"
6679     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6680     _SAVE_LIBS="$LIBS"
6681     LIBS="$LIBS $SQLITE_LIBS"
6682     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6683         AC_TRY_RUN([
6684             #include "sqlite3.h"
6686             int main(int argc, char **argv){
6687               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6688             }],
6689             ac_cv_sqlite_threadsafe=yes,
6690             ac_cv_sqlite_threadsafe=no,
6691             ac_cv_sqlite_threadsafe=no
6692         )
6693     ])
6694     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6695     CFLAGS="$_SAVE_CFLAGS"
6696     LIBS="$_SAVE_LIBS"
6697     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6698         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6699     fi
6701     dnl ================================
6702     dnl === SQLITE_ENABLE_FTS3 check ===
6703     dnl ================================
6704     dnl check to see if the system SQLite package is compiled with
6705     dnl SQLITE_ENABLE_FTS3 enabled.
6706     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6707     _SAVE_CFLAGS="$CFLAGS"
6708     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6709     _SAVE_LIBS="$LIBS"
6710     LIBS="$LIBS $SQLITE_LIBS"
6711     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6712         AC_TRY_RUN([
6713             #include "sqlite3.h"
6715             int main(int argc, char **argv){
6716               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6717             }],
6718             ac_cv_sqlite_enable_fts3=yes,
6719             ac_cv_sqlite_enable_fts3=no,
6720             ac_cv_sqlite_enable_fts3=no
6721         )
6722     ])
6723     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6724     CFLAGS="$_SAVE_CFLAGS"
6725     LIBS="$_SAVE_LIBS"
6726     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6727         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6728     fi
6730     dnl =========================================
6731     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6732     dnl =========================================
6733     dnl check to see if the system SQLite package is compiled with
6734     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6735     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6736     _SAVE_CFLAGS="$CFLAGS"
6737     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6738     _SAVE_LIBS="$LIBS"
6739     LIBS="$LIBS $SQLITE_LIBS"
6740     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6741         AC_TRY_RUN([
6742             #include "sqlite3.h"
6744             int main(int argc, char **argv){
6745               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6746             }],
6747             ac_cv_sqlite_enable_unlock_notify=yes,
6748             ac_cv_sqlite_enable_unlock_notify=no,
6749             ac_cv_sqlite_enable_unlock_notify=no
6750         )
6751     ])
6752     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6753     CFLAGS="$_SAVE_CFLAGS"
6754     LIBS="$_SAVE_LIBS"
6755     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6756         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6757     fi
6760 AC_SUBST(MOZ_NATIVE_SQLITE)
6762 dnl ========================================================
6763 dnl = Enable help viewer (off by default)
6764 dnl ========================================================
6765 if test -n "$MOZ_HELP_VIEWER"; then
6766      dnl Do this if defined in confvars.sh
6767      AC_DEFINE(MOZ_HELP_VIEWER)
6770 dnl ========================================================
6771 dnl = Enable safe browsing (anti-phishing)
6772 dnl ========================================================
6773 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6774 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6775     MOZ_SAFE_BROWSING=1,
6776     MOZ_SAFE_BROWSING= )
6777 if test -n "$MOZ_SAFE_BROWSING"; then
6778     AC_DEFINE(MOZ_SAFE_BROWSING)
6780 AC_SUBST(MOZ_SAFE_BROWSING)
6782 dnl ========================================================
6783 dnl = Enable faststart component
6784 dnl ========================================================
6785 MOZ_ARG_ENABLE_BOOL(faststart,
6786 [  --enable-faststart      Enable the faststart component],
6787     MOZ_FASTSTART=1,
6788     MOZ_FASTSTART= )
6789 if test -n "$MOZ_FASTSTART"; then
6790     AC_DEFINE(MOZ_FASTSTART)
6792 AC_SUBST(MOZ_FASTSTART)
6794 dnl ========================================================
6795 dnl = Enable url-classifier
6796 dnl ========================================================
6797 dnl Implicitly enabled by default if building with safe-browsing
6798 if test -n "$MOZ_SAFE_BROWSING"; then
6799     MOZ_URL_CLASSIFIER=1
6801 MOZ_ARG_ENABLE_BOOL(url-classifier,
6802 [  --enable-url-classifier Enable url classifier module],
6803     MOZ_URL_CLASSIFIER=1,
6804     MOZ_URL_CLASSIFIER= )
6805 if test -n "$MOZ_URL_CLASSIFIER"; then
6806     AC_DEFINE(MOZ_URL_CLASSIFIER)
6808 AC_SUBST(MOZ_URL_CLASSIFIER)
6810 dnl ========================================================
6811 dnl = Disable zipwriter
6812 dnl ========================================================
6813 MOZ_ARG_DISABLE_BOOL(zipwriter,
6814 [  --disable-zipwriter     Disable zipwriter component],
6815     MOZ_ZIPWRITER=,
6816     MOZ_ZIPWRITER=1 )
6817 AC_SUBST(MOZ_ZIPWRITER)
6819 dnl ========================================================
6820 dnl = Disable libconic
6821 dnl ========================================================
6822 MOZ_ENABLE_LIBCONIC=1
6823 MOZ_ARG_DISABLE_BOOL(libconic,
6824 [  --disable-libconic      Disable libconic],
6825     MOZ_ENABLE_LIBCONIC=,
6826     MOZ_ENABLE_LIBCONIC=1 )
6828 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6829     PKG_CHECK_MODULES(LIBCONIC, conic,
6830                       MOZ_ENABLE_LIBCONIC=1,
6831                       MOZ_ENABLE_LIBCONIC=)
6833 if test "$MOZ_ENABLE_LIBCONIC"; then
6834     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6837 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6838 AC_SUBST(LIBCONIC_CFLAGS)
6839 AC_SUBST(LIBCONIC_LIBS)
6841 dnl ========================================================
6842 dnl = Maemo checks
6843 dnl ========================================================
6845 MAEMO_SDK_TARGET_VER=-1
6847 MOZ_ARG_WITH_STRING(maemo-version,
6848 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6849                           Maemo SDK Version],
6850   MAEMO_SDK_TARGET_VER=$withval)
6852 case "$MAEMO_SDK_TARGET_VER" in
6854     MOZ_PLATFORM_MAEMO=5
6855     ;;
6858     MOZ_PLATFORM_MAEMO=6
6859     ;;
6862     dnl We aren't compiling for Maemo, move on.
6863     ;;
6865     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6866     ;;
6867 esac
6869 if test $MOZ_PLATFORM_MAEMO; then
6870    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6872    if test -z "$MOZ_ENABLE_DBUS"; then
6873        AC_MSG_ERROR([DBus is required when building for Maemo])
6874    fi
6876    MOZ_GFX_OPTIMIZE_MOBILE=1
6877    MOZ_WEBGL_GLX=
6878    MOZ_MAEMO_LIBLOCATION=
6880    if test $MOZ_PLATFORM_MAEMO = 5; then
6881       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6882       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6883                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6884       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6885                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6887       AC_SUBST(XCOMPOSITE_LIBS)
6889       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6890       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6891       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6892       if test -z "$_LIB_FOUND"; then
6893          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6894       fi
6897       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6898       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6899       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6900       if test -z "$_LIB_FOUND"; then
6901          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6902       fi
6904       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6905       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6906       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6907       if test -z "$_LIB_FOUND"; then
6908          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6909       fi
6911    fi
6912    if test $MOZ_PLATFORM_MAEMO = 6; then
6913       PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6914       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6915       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6916       if test -z "$_LIB_FOUND"; then
6917          AC_MSG_ERROR([libcontentaction is required when build for Maemo])
6918       fi
6919    fi
6921    if test "$MOZ_PLATFORM_MAEMO" -gt 5; then
6922      MOZ_THUMB2=1
6923      PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore)
6924      MOZ_ENABLE_MEEGOTOUCH=1
6925      AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6926      MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6927      MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6928    fi
6930    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6931    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6932    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6933    if test "$_LIB_FOUND"; then
6934       MOZ_MAEMO_LIBLOCATION=1
6935       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6936    else
6937       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6938    fi
6939    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6941    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6942    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6945 dnl ========================================================
6946 dnl = Enable building the Thumb2 instruction set
6947 dnl ========================================================
6948 MOZ_ARG_ENABLE_BOOL(thumb2,
6949  [  --enable-thumb2         Enable Thumb2 instruction set],
6950     MOZ_THUMB2=1,
6951     MOZ_THUMB2=)
6953 if test -n "$MOZ_THUMB2"; then
6954   case "$target_cpu" in
6955     arm*)
6956       if test "$GNU_CC"; then
6957         CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6958         CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6959         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
6960       else
6961         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
6962       fi
6963     ;;
6964     *)
6965       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
6966     ;;
6967   esac
6970 dnl ========================================================
6971 dnl = faststripe theme
6972 dnl ========================================================
6973 MOZ_ARG_ENABLE_BOOL(faststripe,
6974 [  --enable-faststripe     Use faststripe theme],
6975     MOZ_THEME_FASTSTRIPE=1,
6976     MOZ_THEME_FASTSTRIPE= )
6977 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6979 dnl ========================================================
6980 dnl =
6981 dnl = Feature options that require extra sources to be pulled
6982 dnl =
6983 dnl ========================================================
6984 dnl MOZ_ARG_HEADER(Features that require extra sources)
6986 dnl ========================================================
6987 dnl =
6988 dnl = Debugging Options
6989 dnl = 
6990 dnl ========================================================
6991 MOZ_ARG_HEADER(Debugging and Optimizations)
6993 dnl ========================================================
6994 dnl = Disable building with debug info.
6995 dnl = Debugging is OFF by default
6996 dnl ========================================================
6997 if test -z "$MOZ_DEBUG_FLAGS"; then
6998   MOZ_DEBUG_FLAGS="-g"
7001 MOZ_ARG_ENABLE_STRING(debug,
7002 [  --enable-debug[=DBG]    Enable building with developer debug info
7003                            (using compiler flags DBG)],
7004 [ if test "$enableval" != "no"; then
7005     MOZ_DEBUG=1
7006     if test -n "$enableval" -a "$enableval" != "yes"; then
7007         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7008         _MOZ_DEBUG_FLAGS_SET=1
7009     fi
7010   else
7011     MOZ_DEBUG=
7012   fi ],
7013   MOZ_DEBUG=)
7015 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7016 MOZ_ARG_WITH_STRING(debug-label,
7017 [  --with-debug-label=LABELS
7018                           Define DEBUG_<value> for each comma-separated
7019                           value given.],
7020 [ for option in `echo $withval | sed 's/,/ /g'`; do
7021     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7022 done])
7024 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7026 if test -n "$MOZ_DEBUG"; then
7027     AC_MSG_CHECKING([for valid debug flags])
7028     _SAVE_CFLAGS=$CFLAGS
7029     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7030     AC_TRY_COMPILE([#include <stdio.h>], 
7031         [printf("Hello World\n");],
7032         _results=yes,
7033         _results=no)
7034     AC_MSG_RESULT([$_results])
7035     if test "$_results" = "no"; then
7036         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7037     fi
7038     CFLAGS=$_SAVE_CFLAGS
7041 dnl ========================================================
7042 dnl enable mobile optimizations
7043 dnl ========================================================
7044 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7045 [  --enable-mobile-optimize
7046                           Enable mobile optimizations],
7047     MOZ_GFX_OPTIMIZE_MOBILE=1)
7049 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7051 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7052     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7055 dnl ========================================================
7056 dnl = Enable code optimization. ON by default.
7057 dnl ========================================================
7058 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7059         MOZ_OPTIMIZE_FLAGS="-O"
7062 MOZ_ARG_ENABLE_STRING(optimize,
7063 [  --disable-optimize      Disable compiler optimization
7064   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7065 [ if test "$enableval" != "no"; then
7066     MOZ_OPTIMIZE=1
7067     if test -n "$enableval" -a "$enableval" != "yes"; then
7068         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7069         MOZ_OPTIMIZE=2
7070     fi
7071 else
7072     MOZ_OPTIMIZE=
7073 fi ], MOZ_OPTIMIZE=1)
7075 if test "$COMPILE_ENVIRONMENT"; then
7076 if test -n "$MOZ_OPTIMIZE"; then
7077     AC_MSG_CHECKING([for valid optimization flags])
7078     _SAVE_CFLAGS=$CFLAGS
7079     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7080     AC_TRY_COMPILE([#include <stdio.h>], 
7081         [printf("Hello World\n");],
7082         _results=yes,
7083         _results=no)
7084     AC_MSG_RESULT([$_results])
7085     if test "$_results" = "no"; then
7086         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7087     fi
7088     CFLAGS=$_SAVE_CFLAGS
7090 fi # COMPILE_ENVIRONMENT
7092 AC_SUBST(MOZ_OPTIMIZE)
7093 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7094 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7095 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7097 dnl ========================================================
7098 dnl = (Deprecated) generation of debugger info for specific modules
7099 dnl ========================================================
7100 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7101 [  --enable-debugger-info-modules
7102                           Enable/disable debugger info for specific modules],
7103 [ if test "$enableval" != "no"; then
7104     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7105     MOZ_DEBUG_SYMBOLS=1
7106   fi ])
7108 dnl ========================================================
7109 dnl = Enable generation of debug symbols
7110 dnl ========================================================
7111 MOZ_ARG_ENABLE_STRING(debug-symbols,
7112 [  --enable-debug-symbols[=DBG]
7113                           Enable debugging symbols (using compiler flags DBG)],
7114 [ if test "$enableval" != "no"; then
7115       MOZ_DEBUG_SYMBOLS=1
7116       if test -n "$enableval" -a "$enableval" != "yes"; then
7117           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7118               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7119           else
7120               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7121           fi
7122       fi
7123   fi ])
7125 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7126     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7127     export MOZ_DEBUG_SYMBOLS
7130 dnl ========================================================
7131 dnl = Disable any treating of compile warnings as errors
7132 dnl ========================================================
7133 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7134 [  --disable-warnings-as-errors
7135                           Disable treating of warnings as errors],
7136     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7137     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7138 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7139    WARNINGS_AS_ERRORS=''
7142 dnl ========================================================
7143 dnl = Disable runtime logging checks
7144 dnl ========================================================
7145 MOZ_ARG_DISABLE_BOOL(logging,
7146 [  --disable-logging       Disable logging facilities],
7147     NS_DISABLE_LOGGING=1,
7148     NS_DISABLE_LOGGING= )
7149 if test "$NS_DISABLE_LOGGING"; then
7150     AC_DEFINE(NS_DISABLE_LOGGING)
7151 else
7152     AC_DEFINE(MOZ_LOGGING)
7155 dnl ========================================================
7156 dnl = This will enable logging of addref, release, ctor, dtor.
7157 dnl ========================================================
7158 _ENABLE_LOGREFCNT=42
7159 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7160 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7161     _ENABLE_LOGREFCNT=1,
7162     _ENABLE_LOGREFCNT= )
7163 if test "$_ENABLE_LOGREFCNT" = "1"; then
7164     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7165 elif test -z "$_ENABLE_LOGREFCNT"; then
7166     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7169 dnl ========================================================
7170 dnl = Enable trace malloc
7171 dnl ========================================================
7172 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7173 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7174 [  --enable-trace-malloc   Enable malloc tracing],
7175     NS_TRACE_MALLOC=1,
7176     NS_TRACE_MALLOC= )
7177 if test "$NS_TRACE_MALLOC"; then
7178   # Please, Mr. Linker Man, don't take away our symbol names
7179   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7180   USE_ELF_DYNSTR_GC=
7181   AC_DEFINE(NS_TRACE_MALLOC)
7183 AC_SUBST(NS_TRACE_MALLOC)
7185 dnl ========================================================
7186 dnl = Enable jemalloc
7187 dnl ========================================================
7188 MOZ_ARG_ENABLE_BOOL(jemalloc,
7189 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7190     MOZ_MEMORY=1,
7191     MOZ_MEMORY=)
7193 if test "$NS_TRACE_MALLOC"; then
7194     MOZ_MEMORY=
7197 if test "$MOZ_MEMORY"; then
7199   dnl Don't try to run compiler tests on Windows  
7200   if test "$OS_ARCH" = "WINNT"; then
7201     if test -z "$HAVE_64BIT_OS"; then
7202       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7203     else
7204       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7205     fi
7206   else
7207     AC_CHECK_SIZEOF([int *], [4])
7208     case "${ac_cv_sizeof_int_p}" in
7209     4)
7210       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7211       ;;
7212     8)
7213       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7214       ;;
7215     *)
7216       AC_MSG_ERROR([Unexpected pointer size])
7217       ;;
7218     esac
7219   fi
7221   AC_DEFINE(MOZ_MEMORY)
7222   if test "x$MOZ_DEBUG" = "x1"; then
7223     AC_DEFINE(MOZ_MEMORY_DEBUG)
7224   fi
7225   dnl The generic feature tests that determine how to compute ncpus are long and
7226   dnl complicated.  Therefore, simply define special cpp variables for the
7227   dnl platforms we have special knowledge of.
7228   case "${target}" in
7229   *-darwin*)
7230     AC_DEFINE(MOZ_MEMORY_DARWIN)
7231     ;;
7232   *-*freebsd*)
7233     AC_DEFINE(MOZ_MEMORY_BSD)
7234     ;;
7235   *-*linux*)
7236     AC_DEFINE(MOZ_MEMORY_LINUX)
7237     ;;
7238   *-netbsd*)
7239     AC_DEFINE(MOZ_MEMORY_BSD)
7240     ;;
7241   *-solaris*)
7242     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7243     ;;
7244   *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7245     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7246     dnl This is sort of awful. Will revisit if we add support for more versions
7247     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7248         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7249     fi
7250     if test -z "$WIN32_CRT_SRC_DIR"; then
7251       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7252         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).])
7253       else
7254         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7255       fi
7256     fi
7257     dnl cpu check
7258     case "${target_cpu}" in
7259     i*86)
7260       MOZ_CRT_CPU_ARCH=intel
7261       ;;
7262     x86_64)
7263       MOZ_CRT_CPU_ARCH=amd64
7264       ;;
7265     *)
7266       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7267       ;;
7268     esac
7270     AC_SUBST(MOZ_CRT_CPU_ARCH)
7272     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7273       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7274     fi
7275     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7276     _objdir_win=`pwd -W`
7277     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7278     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7279     dnl Also pass this to NSPR/NSS
7280     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7281     export DLLFLAGS
7282     ;;
7283   *-*wince)
7284     AC_DEFINE(MOZ_MEMORY_WINCE)
7285     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7286     if test -z "$WINCE_WINDOWS_MOBILE"; then
7287       AC_DEFINE(MOZ_MEMORY_WINCE6)
7288     fi
7289     ;;
7290   *-*winmo)
7291     AC_DEFINE(MOZ_MEMORY_WINCE)
7292     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7293     ;;
7294   *-android*)
7295     AC_DEFINE(MOZ_MEMORY_LINUX)
7296     AC_DEFINE(MOZ_MEMORY_ANDROID)
7297     _WRAP_MALLOC=1
7298     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc"
7299     ;;
7300   *)
7301     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7302     ;;
7303   esac
7305   if test "$OS_ARCH" != "Darwin"; then
7306     dnl NB: this must be kept in sync with jemalloc.h
7307     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7308     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7309     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7310   fi
7312 AC_SUBST(MOZ_MEMORY)
7313 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7314 AC_SUBST(WIN32_CRT_SRC_DIR)
7315 dnl Need to set this for make because NSS doesn't have configure
7316 AC_SUBST(DLLFLAGS)
7318 dnl ========================================================
7319 dnl = Use malloc wrapper lib
7320 dnl ========================================================
7321 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7322 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7323     _WRAP_MALLOC=1,
7324     _WRAP_MALLOC= )
7326 if test -n "$_WRAP_MALLOC"; then
7327     if test "$GNU_CC"; then
7328     WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -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 -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign"
7329     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7330     fi
7333 dnl ========================================================
7334 dnl = Location of malloc wrapper lib
7335 dnl ========================================================
7336 MOZ_ARG_WITH_STRING(wrap-malloc,
7337 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7338     WRAP_MALLOC_LIB=$withval)
7340 dnl ========================================================
7341 dnl = Use JS Call tracing
7342 dnl ========================================================
7343 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7344 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7345     MOZ_TRACE_JSCALLS=1,
7346     MOZ_TRACE_JSCALLS= )
7347 if test -n "$MOZ_TRACE_JSCALLS"; then
7348     AC_DEFINE(MOZ_TRACE_JSCALLS)
7351 dnl ========================================================
7352 dnl = Use TraceVis
7353 dnl ========================================================
7354 MOZ_ARG_ENABLE_BOOL(tracevis,
7355 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7356     MOZ_TRACEVIS=1,
7357     MOZ_TRACEVIS= )
7358 if test -n "$MOZ_TRACEVIS"; then
7359     AC_DEFINE(MOZ_TRACEVIS)
7362 dnl ========================================================
7363 dnl = Use GCTimer
7364 dnl ========================================================
7365 MOZ_ARG_ENABLE_BOOL(gctimer,
7366 [  --enable-gctimer        Enable GC timer (default=no)],
7367     MOZ_GCTIMER=1,
7368     MOZ_GCTIMER= )
7369 if test -n "$MOZ_GCTIMER"; then
7370     AC_DEFINE(MOZ_GCTIMER)
7373 dnl ========================================================
7374 dnl = Use Valgrind
7375 dnl ========================================================
7376 MOZ_ARG_ENABLE_BOOL(valgrind,
7377 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7378     MOZ_VALGRIND=1,
7379     MOZ_VALGRIND= )
7380 if test -n "$MOZ_VALGRIND"; then
7381     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7382         AC_MSG_ERROR(
7383             [--enable-valgrind specified but Valgrind is not installed]))
7384     AC_DEFINE(MOZ_VALGRIND)
7387 dnl ========================================================
7388 dnl jprof
7389 dnl ========================================================
7390 MOZ_ARG_ENABLE_BOOL(jprof,
7391 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
7392     MOZ_JPROF=1,
7393     MOZ_JPROF= )
7394 if test -n "$MOZ_JPROF"; then
7395     AC_DEFINE(MOZ_JPROF)
7398 dnl ========================================================
7399 dnl shark
7400 dnl ========================================================
7401 MOZ_ARG_ENABLE_BOOL(shark,
7402 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
7403     MOZ_SHARK=1,
7404     MOZ_SHARK= )
7405 if test -n "$MOZ_SHARK"; then
7406     AC_DEFINE(MOZ_SHARK)
7409 dnl ========================================================
7410 dnl callgrind
7411 dnl ========================================================
7412 MOZ_ARG_ENABLE_BOOL(callgrind,
7413 [  --enable-callgrind      Enable callgrind profiling],
7414     MOZ_CALLGRIND=1,
7415     MOZ_CALLGRIND= )
7416 if test -n "$MOZ_CALLGRIND"; then
7417     AC_DEFINE(MOZ_CALLGRIND)
7420 dnl ========================================================
7421 dnl vtune
7422 dnl ========================================================
7423 MOZ_ARG_ENABLE_BOOL(vtune,
7424 [  --enable-vtune          Enable vtune profiling],
7425     MOZ_VTUNE=1,
7426     MOZ_VTUNE= )
7427 if test -n "$MOZ_VTUNE"; then
7428     AC_DEFINE(MOZ_VTUNE)
7431 dnl ========================================================
7432 dnl Zealous JavaScript GC
7433 dnl ========================================================
7434 MOZ_ARG_ENABLE_BOOL(gczeal,
7435 [  --enable-gczeal         Enable zealous JavaScript GCing],
7436     JS_GC_ZEAL=1,
7437     JS_GC_ZEAL= )
7438 if test -n "$JS_GC_ZEAL"; then
7439     AC_DEFINE(JS_GC_ZEAL)
7442 dnl ======================================================
7443 dnl = Enable compiling with ccache
7444 dnl ======================================================
7445 MOZ_ARG_WITH_STRING(ccache,
7446 [  --with-ccache[=path/to/ccache]
7447                           Enable compiling with ccache],
7448     CCACHE=$withval, CCACHE="no")
7450 if test "$CCACHE" != "no"; then
7451     if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7452         CCACHE=
7453     else
7454         if test ! -e "$CCACHE"; then
7455             AC_MSG_ERROR([$CCACHE not found])
7456         fi
7457     fi
7458     MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7459     if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7460         AC_MSG_ERROR([ccache not found])
7461     elif test -x "$CCACHE"; then
7462         CC="$CCACHE $CC"
7463         CXX="$CCACHE $CXX"
7464     else
7465         AC_MSG_ERROR([$CCACHE is not executable])
7466     fi
7469 dnl ========================================================
7470 dnl = Enable static checking using gcc-dehydra
7471 dnl ========================================================
7473 MOZ_ARG_WITH_STRING(static-checking,
7474 [  --with-static-checking=path/to/gcc_dehydra.so
7475                           Enable static checking of code using GCC-dehydra],
7476     DEHYDRA_PATH=$withval,
7477     DEHYDRA_PATH= )
7479 if test -n "$DEHYDRA_PATH"; then
7480     if test ! -f "$DEHYDRA_PATH"; then
7481         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7482     fi
7483     AC_DEFINE(NS_STATIC_CHECKING)
7485 AC_SUBST(DEHYDRA_PATH)
7487 dnl ========================================================
7488 dnl = Enable stripping of libs & executables
7489 dnl ========================================================
7490 MOZ_ARG_ENABLE_BOOL(strip,
7491 [  --enable-strip          Enable stripping of libs & executables ],
7492     ENABLE_STRIP=1,
7493     ENABLE_STRIP= )
7495 dnl ========================================================
7496 dnl = Enable stripping of libs & executables when packaging
7497 dnl ========================================================
7498 MOZ_ARG_ENABLE_BOOL(install-strip,
7499 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7500     PKG_SKIP_STRIP= ,
7501     PKG_SKIP_STRIP=1)
7503 dnl ========================================================
7504 dnl = --enable-elf-dynstr-gc
7505 dnl ========================================================
7506 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7507 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7508     USE_ELF_DYNSTR_GC=1,
7509     USE_ELF_DYNSTR_GC= )
7511 dnl ========================================================
7512 dnl = 
7513 dnl = Profiling and Instrumenting
7514 dnl = 
7515 dnl ========================================================
7516 MOZ_ARG_HEADER(Profiling and Instrumenting)
7518 dnl ========================================================
7519 dnl = Enable timeline service, which provides lightweight
7520 dnl = instrumentation of mozilla for performance measurement.
7521 dnl = Timeline is off by default.
7522 dnl ========================================================
7523 MOZ_ARG_ENABLE_BOOL(timeline,
7524 [  --enable-timeline       Enable timeline services ],
7525     MOZ_TIMELINE=1,
7526     MOZ_TIMELINE= )
7527 if test -n "$MOZ_TIMELINE"; then
7528     AC_DEFINE(MOZ_TIMELINE)
7531 dnl ========================================================
7532 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7533 dnl = timing for identifying code bottlenecks 
7534 dnl = NS_FUNCTION_TIMER is off by default.
7535 dnl ========================================================
7536 MOZ_ARG_ENABLE_BOOL(functiontimer,
7537 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7538     NS_FUNCTION_TIMER=1,
7539     NS_FUNCTION_TIMER= )
7540 if test -n "$NS_FUNCTION_TIMER"; then
7541     AC_DEFINE(NS_FUNCTION_TIMER)
7544 dnl ========================================================
7545 dnl Turn on reflow counting
7546 dnl ========================================================
7547 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7548 [  --enable-reflow-perf    Enable reflow performance tracing],
7549     MOZ_REFLOW_PERF=1,
7550     MOZ_REFLOW_PERF= )
7551 if test -n "$MOZ_REFLOW_PERF"; then
7552     AC_DEFINE(MOZ_REFLOW_PERF)
7555 dnl ========================================================
7556 dnl Enable code size metrics.
7557 dnl ========================================================
7558 MOZ_ARG_ENABLE_BOOL(codesighs,
7559 [  --enable-codesighs      Enable code size analysis tools],
7560     _ENABLE_CODESIGHS=1,
7561     _ENABLE_CODESIGHS= )
7562 if test -n "$_ENABLE_CODESIGHS"; then
7563     if test -d $srcdir/tools/codesighs; then 
7564         MOZ_MAPINFO=1
7565     else
7566         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7567     fi
7570 dnl ========================================================
7571 dnl = Support for Quantify (Windows)
7572 dnl ========================================================
7573 MOZ_ARG_ENABLE_BOOL(quantify,
7574 [  --enable-quantify       Enable Quantify support (Windows only) ],
7575     MOZ_QUANTIFY=1,
7576     MOZ_QUANTIFY= )
7578 dnl ========================================================
7579 dnl = Support for demangling undefined symbols
7580 dnl ========================================================
7581 if test -z "$SKIP_LIBRARY_CHECKS"; then
7582     AC_LANG_SAVE
7583     AC_LANG_CPLUSPLUS
7584     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7585     AC_LANG_RESTORE
7588 # Demangle only for debug or trace-malloc builds
7589 MOZ_DEMANGLE_SYMBOLS=
7590 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7591     MOZ_DEMANGLE_SYMBOLS=1
7592     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7594 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7596 dnl ========================================================
7597 dnl = Support for gcc stack unwinding (from gcc 3.3)
7598 dnl ========================================================
7599 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7600     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7603 dnl ========================================================
7604 dnl =
7605 dnl = Misc. Options
7606 dnl = 
7607 dnl ========================================================
7608 MOZ_ARG_HEADER(Misc. Options)
7610 dnl ========================================================
7611 dnl update xterm title
7612 dnl ========================================================
7613 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7614 [  --enable-xterm-updates  Update XTERM titles with current command.],
7615     MOZ_UPDATE_XTERM=1,
7616     MOZ_UPDATE_XTERM= )
7618 dnl =========================================================
7619 dnl = Chrome format
7620 dnl =========================================================
7621 MOZ_ARG_ENABLE_STRING([chrome-format],
7622 [  --enable-chrome-format=jar|flat|both|symlink|omni
7623                           Select FORMAT of chrome files (default=jar)],
7624     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7626 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7627     MOZ_CHROME_FILE_FORMAT=jar
7630 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7631     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7632     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7633     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7634     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7635     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7638 dnl =========================================================
7639 dnl Omnijar packaging (bug 552121)
7640 dnl =========================================================
7641 dnl Omnijar packaging is compatible with flat packaging.
7642 dnl In unpackaged builds, omnijar looks for files as if
7643 dnl things were flat packaged. After packaging, all files
7644 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7645 dnl is set to flat since putting files into jars is only
7646 dnl done during packaging with omnijar.
7647 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7648     MOZ_OMNIJAR=1
7649     AC_DEFINE(MOZ_OMNIJAR)
7650     MOZ_CHROME_FILE_FORMAT=flat
7651 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7652     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7655 AC_SUBST(MOZ_OMNIJAR)
7657 dnl ========================================================
7658 dnl = Define default location for MOZILLA_FIVE_HOME
7659 dnl ========================================================
7660 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7661 [  --with-default-mozilla-five-home
7662                           Set the default value for MOZILLA_FIVE_HOME],
7663 [ val=`echo $withval`
7664   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7666 dnl ========================================================
7667 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7668 dnl ========================================================
7669 MOZ_ARG_WITH_STRING(user-appdir,
7670 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7671 [ val=`echo $withval`
7672 if echo "$val" | grep "\/" >/dev/null; then
7673     AC_MSG_ERROR("Homedir must be single relative path.")
7674 else 
7675     MOZ_USER_DIR="$val"
7676 fi])
7678 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7680 dnl ========================================================
7681 dnl = Doxygen configuration
7682 dnl ========================================================
7683 dnl Use commas to specify multiple dirs to this arg
7684 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7685 MOZ_ARG_WITH_STRING(doc-input-dirs,
7686 [  --with-doc-input-dirs=DIRS
7687                           Header/idl dirs to create docs from],
7688 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7689 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7691 dnl Use commas to specify multiple dirs to this arg
7692 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7693 MOZ_ARG_WITH_STRING(doc-include-dirs,
7694 [  --with-doc-include-dirs=DIRS  
7695                           Include dirs to preprocess doc headers],
7696 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7697 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7699 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7700 MOZ_ARG_WITH_STRING(doc-output-dir,
7701 [  --with-doc-output-dir=DIR
7702                           Dir to generate docs into],
7703 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7704 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7706 if test -z "$SKIP_COMPILER_CHECKS"; then
7707 dnl ========================================================
7708 dnl =
7709 dnl = Compiler Options
7710 dnl = 
7711 dnl ========================================================
7712 MOZ_ARG_HEADER(Compiler Options)
7714 dnl ========================================================
7715 dnl Check for gcc -pipe support
7716 dnl ========================================================
7717 AC_MSG_CHECKING([for gcc -pipe support])
7718 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
7719     echo '#include <stdio.h>' > dummy-hello.c
7720     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7721     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7722     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7723     if test $? = 0; then
7724         _res_as_stdin="yes"
7725     else
7726         _res_as_stdin="no"
7727     fi
7728     if test "$_res_as_stdin" = "yes"; then
7729         _SAVE_CFLAGS=$CFLAGS
7730         CFLAGS="$CFLAGS -pipe"
7731         AC_TRY_COMPILE( [ #include <stdio.h> ],
7732             [printf("Hello World\n");],
7733             [_res_gcc_pipe="yes"],
7734             [_res_gcc_pipe="no"] )
7735         CFLAGS=$_SAVE_CFLAGS
7736     fi
7737     if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
7738         _res="yes";
7739         CFLAGS="$CFLAGS -pipe"
7740         CXXFLAGS="$CXXFLAGS -pipe"
7741     else
7742         _res="no"
7743     fi
7744     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7745     AC_MSG_RESULT([$_res])
7746 else
7747     AC_MSG_RESULT([no])
7750 dnl ========================================================
7751 dnl Profile guided optimization
7752 dnl ========================================================
7753 dnl Test for profiling options
7754 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7756 dnl Provide a switch to disable PGO even when called via profiledbuild.
7757 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7758 [  --disable-profile-guided-optimization
7759                           Don't build with PGO even if called via make profiledbuild],
7760 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7761 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7763 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7765 _SAVE_CFLAGS="$CFLAGS"
7766 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7768 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7769 AC_TRY_COMPILE([], [return 0;],
7770                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7771                  result="yes" ], result="no")
7772 AC_MSG_RESULT([$result])
7774 if test $result = "yes"; then
7775   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7776   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7777   PROFILE_USE_LDFLAGS="-fprofile-use"
7780 CFLAGS="$_SAVE_CFLAGS"
7782 if test -n "$INTEL_CC"; then
7783   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7784   PROFILE_GEN_LDFLAGS=
7785   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7786   PROFILE_USE_LDFLAGS=
7789 dnl Sun Studio on Solaris
7790 if test "$SOLARIS_SUNPRO_CC"; then
7791   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7792   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7793   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7794   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7797 AC_SUBST(PROFILE_GEN_CFLAGS)
7798 AC_SUBST(PROFILE_GEN_LDFLAGS)
7799 AC_SUBST(PROFILE_USE_CFLAGS)
7800 AC_SUBST(PROFILE_USE_LDFLAGS)
7802 AC_LANG_CPLUSPLUS
7804 dnl ========================================================
7805 dnl Test for -pedantic bustage
7806 dnl ========================================================
7807 MOZ_ARG_DISABLE_BOOL(pedantic,
7808 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7809 _PEDANTIC= )
7810 if test "$_PEDANTIC"; then
7811     _SAVE_CXXFLAGS=$CXXFLAGS
7812     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7813     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7814     AC_TRY_COMPILE([$configure_static_assert_macros],
7815                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7816                    result="no", result="yes" )
7817     AC_MSG_RESULT([$result])
7818     CXXFLAGS="$_SAVE_CXXFLAGS"
7820     case "$result" in
7821     no)
7822         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7823         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7824         ;;
7825     yes)
7826         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7827         ;;
7828     esac
7831 dnl ========================================================
7832 dnl Test for correct temporary object destruction order
7833 dnl ========================================================
7834 dnl We want to make sure the compiler follows the C++ spec here as 
7835 dnl xpcom and the string classes depend on it (bug 235381).
7836 AC_MSG_CHECKING([for correct temporary object destruction order])
7837 AC_TRY_RUN([ class A {
7838              public:  A(int& x) : mValue(x) {}
7839                       ~A() { mValue--; }
7840                       operator char**() { return 0; }
7841              private:  int& mValue;
7842              };
7843              void func(char **arg) {}
7844              int m=2;
7845              void test() {
7846                   func(A(m));
7847                   if (m==1) m = 0;
7848              }
7849              int main() {
7850                  test();
7851                  return(m);
7852              }
7853              ],
7854      result="yes", result="no", result="maybe")
7855 AC_MSG_RESULT([$result])
7857 if test "$result" = "no"; then
7858     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7861 dnl ========================================================
7862 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7863 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7864 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7865 dnl ========================================================
7866 _SAVE_CXXFLAGS=$CXXFLAGS
7867 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7868 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7869     ac_nscap_nonconst_opeq_bug,
7870     [AC_TRY_COMPILE([
7871                       template <class T>
7872                       class Pointer
7873                         {
7874                         public:
7875                           T* myPtr;
7876                         };
7877                       
7878                       template <class T, class U>
7879                       int operator==(const Pointer<T>& rhs, U* lhs)
7880                         {
7881                           return rhs.myPtr == lhs;
7882                         }
7883                       
7884                       template <class T, class U>
7885                       int operator==(const Pointer<T>& rhs, const U* lhs)
7886                         {
7887                           return rhs.myPtr == lhs;
7888                         }
7889                     ],
7890                     [
7891                       Pointer<int> foo;
7892                       const int* bar;
7893                       return foo == bar;
7894                     ],
7895                     ac_nscap_nonconst_opeq_bug="no",
7896                     ac_nscap_nonconst_opeq_bug="yes")])
7897 CXXFLAGS="$_SAVE_CXXFLAGS"
7899 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7900     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7902 fi # SKIP_COMPILER_CHECKS
7904 dnl ========================================================
7905 dnl C++ rtti
7906 dnl Should be smarter and check that the compiler does indeed have rtti
7907 dnl ========================================================
7909 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7910 [  --enable-cpp-rtti       Enable C++ RTTI ],
7911 [ _MOZ_USE_RTTI=1 ],
7912 [ _MOZ_USE_RTTI= ])
7914 if test "$_MOZ_USE_RTTI"; then
7915    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7916 else
7917    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7920 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7922 dnl ========================================================
7923 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
7924 dnl Should be smarter and check that the compiler does indeed have exceptions
7925 dnl ========================================================
7926 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7927 [  --enable-cpp-exceptions Enable C++ exceptions ],
7928 [ _MOZ_CPP_EXCEPTIONS=1 ],
7929 [ _MOZ_CPP_EXCEPTIONS= ])
7931 if test "$_MOZ_CPP_EXCEPTIONS"; then
7932     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7933     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
7934 else
7935     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7938 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7940 # Irix & OSF native compilers do not like exception declarations 
7941 # when exceptions are disabled
7942 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7943     AC_DEFINE(CPP_THROW_NEW, [])
7944 else
7945     AC_DEFINE(CPP_THROW_NEW, [throw()])
7947 AC_LANG_C
7949 dnl ========================================================
7950 dnl =
7951 dnl = Build depencency options
7952 dnl =
7953 dnl ========================================================
7954 MOZ_ARG_HEADER(Build dependencies)
7956 dnl ========================================================
7957 dnl = Do not auto generate dependency info
7958 dnl ========================================================
7959 MOZ_AUTO_DEPS=1
7960 MOZ_ARG_DISABLE_BOOL(auto-deps,
7961 [  --disable-auto-deps     Do not automatically generate dependency info],
7962     MOZ_AUTO_DEPS=,
7963     MOZ_AUTO_DEPS=1)
7965 if test -n "$MOZ_AUTO_DEPS"; then
7966 dnl ========================================================
7967 dnl = Use mkdepend instead of $CC -MD for dependency generation
7968 dnl ========================================================
7969 _cpp_md_flag=
7970 MOZ_ARG_DISABLE_BOOL(md,
7971 [  --disable-md            Do not use compiler-based dependencies ],
7972   [_cpp_md_flag=],
7973   [_cpp_md_flag=1],
7974   [dnl Default is to turn on -MD if using GNU-compatible compilers
7975    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7976      _cpp_md_flag=1
7977    fi
7978   dnl Default is to use -xM if using Sun Studio on Solaris
7979    if test "$SOLARIS_SUNPRO_CC"; then
7980      _cpp_md_flag=1
7981    fi])
7982 if test "$_cpp_md_flag"; then
7983   COMPILER_DEPEND=1
7984   if test "$OS_ARCH" = "OpenVMS"; then
7985     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7986   else
7987     _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
7988   fi
7989   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7990   if test "$SOLARIS_SUNPRO_CC"; then
7991     _DEPEND_CFLAGS=
7992   fi
7993 else
7994   COMPILER_DEPEND=
7995   dnl Don't override this for MSVC
7996   if test -z "$_WIN32_MSVC"; then
7997     _USE_CPP_INCLUDE_FLAG=
7998     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7999     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8000   else
8001     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8002     dnl cl.py provides dependency generation for MSVC
8003     CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8004     CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8005     COMPILER_DEPEND=1
8006   fi
8008 fi # MOZ_AUTO_DEPS
8009 MDDEPDIR='.deps'
8010 AC_SUBST(MOZ_AUTO_DEPS)
8011 AC_SUBST(COMPILER_DEPEND)
8012 AC_SUBST(MDDEPDIR)
8013 AC_SUBST(CC_WRAPPER)
8014 AC_SUBST(CXX_WRAPPER)
8017 dnl ========================================================
8018 dnl =
8019 dnl = Static Build Options
8020 dnl =
8021 dnl ========================================================
8022 MOZ_ARG_HEADER(Static build options)
8024 MOZ_ARG_ENABLE_BOOL(static,
8025 [  --enable-static         Enable building of internal static libs],
8026     BUILD_STATIC_LIBS=1,
8027     BUILD_STATIC_LIBS=)
8029 MOZ_ARG_ENABLE_BOOL(libxul,
8030 [  --enable-libxul         Enable building of libxul],
8031     MOZ_ENABLE_LIBXUL=1,
8032     MOZ_ENABLE_LIBXUL=)
8034 MOZ_ARG_ENABLE_BOOL(shared-js,
8035 [  --enable-shared-js
8036                           Create a shared JavaScript library.],
8037     ENABLE_SHARED_JS=1,
8038     ENABLE_SHARED_JS=)
8040 if test -z "$MOZ_ENABLE_LIBXUL"; then
8041   dnl --disable-libxul implies shared js
8042   ENABLE_SHARED_JS=1
8045 if test -n "$ENABLE_SHARED_JS"; then
8046   JS_SHARED_LIBRARY=1
8047   MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
8048 else
8049   MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
8050   AC_DEFINE(MOZ_STATIC_JS)
8052 AC_SUBST(JS_SHARED_LIBRARY)
8054 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8055         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
8058 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8059         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8062 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
8063     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
8066 if test -z "$MOZ_ENABLE_LIBXUL" -a -n "$MOZ_OMNIJAR"; then
8067     AC_MSG_ERROR([Omnijar packaging is incompatible with --disable-libxul. Please either --enable-libxul or --enable-chrome-format=jar|flat|symlink]);
8070 AC_SUBST(LIBXUL_LIBS)
8072 if test -n "$MOZ_ENABLE_LIBXUL"; then
8073     XPCOM_LIBS="$LIBXUL_LIBS"
8074     AC_DEFINE(MOZ_ENABLE_LIBXUL)
8075 else
8076     if test -n "$BUILD_STATIC_LIBS"; then
8077         AC_DEFINE(MOZ_STATIC_BUILD)
8078     fi
8079     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
8082 dnl ========================================================
8083 dnl =
8084 dnl = Standalone module options
8085 dnl = 
8086 dnl ========================================================
8087 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8089 dnl Check for GLib and libIDL.
8090 dnl ========================================================
8091 SKIP_IDL_CHECK="no"
8093 if test -z "$COMPILE_ENVIRONMENT"; then
8094     SKIP_IDL_CHECK="yes"
8097 dnl = Allow users to disable libIDL checking for standalone modules
8098 MOZ_ARG_WITHOUT_BOOL(libIDL,
8099 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
8100         SKIP_IDL_CHECK="yes")
8102 if test -z "$CROSS_COMPILE"; then
8103     if test -z "$HOST_LIBIDL_CONFIG"; then
8104         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8105     fi
8106     if test -z "$HOST_LIBIDL_PREFIX"; then
8107         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8108     fi
8111 if test "$SKIP_IDL_CHECK" = "no"
8112 then
8113     _LIBIDL_FOUND=
8114     case "$host" in
8115     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8116         if test -n "$GLIB_PREFIX"; then
8117             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8118             if test "$?" = "0"; then
8119                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8120                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8121                 fi
8122                 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8123             else
8124                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8125             fi
8126         else
8127             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8128         fi
8129         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8130             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8131         fi
8132         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8133         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8134             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8135         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8136             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8137         else
8138             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8139         fi
8141         if test -n "$HOST_LIBIDL_PREFIX"; then
8142             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8143             if test "$?" = "0"; then
8144                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8145                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8146                 fi
8147                 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8148             else
8149                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8150             fi
8151         else
8152             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8153         fi        
8154         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8155             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8156         fi
8157         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8158         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8159             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8160             STATIC_LIBIDL=1
8161         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8162             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8163         else
8164             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8165         fi
8166         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8167         _LIBIDL_FOUND=1
8168         ;;
8169     esac
8171     if test -z "$_LIBIDL_FOUND"; then
8172         if test "$MACOS_SDK_DIR"; then 
8173             dnl xpidl, and therefore libIDL, is only needed on the build host.
8174             dnl Don't build it against the SDK, as that causes problems.
8175             _MACSAVE_CFLAGS="$CFLAGS"
8176             _MACSAVE_LIBS="$LIBS"
8177             _MACSAVE_LDFLAGS="$LDFLAGS"
8178             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8179           changequote(,)
8180           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"`
8181           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8182           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8183           changequote([,])
8184           unset NEXT_ROOT
8185         fi
8187         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8188     fi
8190     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8191     dnl to either libIDL1 or libIDL2.
8192     if test -z "$_LIBIDL_FOUND"; then
8193         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8194         if test -z "$_LIBIDL_FOUND"; then
8195             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8196         fi
8197     fi
8198     dnl
8199     dnl If we don't have a libIDL config program & not cross-compiling, 
8200     dnl     look for orbit-config instead.
8201     dnl
8202     if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8203         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8204         if test -n "$ORBIT_CONFIG"; then
8205             AC_MSG_CHECKING([for ORBit libIDL usability])
8206                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8207             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8208             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8209             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8210             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8211             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8212             HOST_LIBIDL_CONFIG=
8213             _SAVE_CFLAGS="$CFLAGS"
8214             _SAVE_LIBS="$LIBS"
8215             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8216             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8217             AC_TRY_RUN([
8218 #include <stdlib.h>
8219 #include <libIDL/IDL.h>
8220 int main() {
8221   char *s;
8222   s=strdup(IDL_get_libver_string());
8223   if(s==NULL) {
8224     exit(1);
8225   }
8226   exit(0);
8228             ], [_LIBIDL_FOUND=1
8229                 result="yes"],
8230                [HOST_LIBIDL_CFLAGS=
8231                 HOST_LIBIDL_LIBS=
8232                 result="no"],
8233                [_LIBIDL_FOUND=1
8234                 result="maybe"] )
8235             AC_MSG_RESULT($result)
8236             CFLAGS="$_SAVE_CFLAGS"
8237             LIBS="$_SAVE_LIBS"
8238         fi
8239     fi
8240     if test -z "$_LIBIDL_FOUND"; then
8241         AC_MSG_ERROR([libIDL not found.
8242         libIDL $LIBIDL_VERSION or higher is required.])
8243     fi
8244     if test "$MACOS_SDK_DIR"; then
8245       CFLAGS="$_MACSAVE_CFLAGS"
8246       LIBS="$_MACSAVE_LIBS"
8247       LDFLAGS="$_MACSAVE_LDFLAGS"
8248       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8249         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8250       fi
8251     fi
8254 if test -n "$CROSS_COMPILE"; then
8255     case "$target" in
8256     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8257         if test -n "$GLIB_PREFIX"; then
8258             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8259             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8260                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8261             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8262                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8263             else
8264                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8265             fi
8266         fi
8268         if test -n "$LIBIDL_PREFIX"; then
8269             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8270             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8271                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8272                 STATIC_LIBIDL=1
8273             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8274                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8275             else
8276                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8277             fi
8278         fi
8279         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8280         ;;
8281     *)
8282         if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8283             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8284             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8285         fi
8286         ;;
8287     esac
8288 else
8289     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8290     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8293 if test -z "$SKIP_PATH_CHECKS"; then
8294 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8295     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8296         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8297     else
8298         AM_PATH_GLIB(${GLIB_VERSION})
8299     fi
8303 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8304     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8307 AC_SUBST(LIBIDL_CFLAGS)
8308 AC_SUBST(LIBIDL_LIBS)
8309 AC_SUBST(STATIC_LIBIDL)
8310 AC_SUBST(GLIB_CFLAGS)
8311 AC_SUBST(GLIB_LIBS)
8312 AC_SUBST(GLIB_GMODULE_LIBS)
8313 AC_SUBST(HOST_LIBIDL_CONFIG)
8314 AC_SUBST(HOST_LIBIDL_CFLAGS)
8315 AC_SUBST(HOST_LIBIDL_LIBS)
8317 dnl ========================================================
8318 dnl Check for cairo
8319 dnl ========================================================
8320 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8322 MOZ_TREE_CAIRO=1
8323 MOZ_ARG_ENABLE_BOOL(system-cairo,
8324 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8325 MOZ_TREE_CAIRO=,
8326 MOZ_TREE_CAIRO=1 )
8328 # Check for headers defining standard int types.
8329 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8331 if test "$MOZ_TREE_CAIRO"; then
8332     AC_DEFINE(MOZ_TREE_CAIRO)
8334     # For now we assume that we will have a uint64_t available through
8335     # one of the above headers or mozstdint.h.
8336     AC_DEFINE(HAVE_UINT64_T)
8338     # Define macros for cairo-features.h
8339     if test "$MOZ_X11"; then
8340         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8341         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8342         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8343         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8344         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8345         MOZ_ENABLE_CAIRO_FT=1
8346         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8347     fi
8348     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8349         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8350     fi
8351     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8352         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8353         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8354         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8355     fi
8356     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8357         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8358         if test -z "$WINCE"; then
8359             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8360             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8361                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8362                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8363                 MOZ_ENABLE_D2D_SURFACE=1
8364                 MOZ_ENABLE_DWRITE_FONT=1
8365             else
8366                 WIN32_DWRITE_FONT_FEATURE=
8367                 WIN32_D2D_SURFACE_FEATURE=
8368             fi
8369         else
8370             WIN32_FONT_FEATURE=
8371             WIN32_DWRITE_FONT_FEATURE=
8372             WIN32_D2D_SURFACE_FEATURE=
8373         fi
8375         AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8377         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
8378         if test -z "$HAS_DDRAW"; then
8379             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.])
8380             DDRAW_SURFACE_FEATURE=
8381         else
8382             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
8383         fi
8385         if test -z "$OGLES_SDK_DIR"; then
8386             OGLES_SURFACE_FEATURE=
8387         else
8388             AC_TRY_COMPILE([
8389               #include <EGL/egl.h>
8390               #include <EGL/eglext.h>
8391               #include <GLES2/gl2.h>
8392               #include <GLES2/gl2ext.h>
8393             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
8394             if test -z "$HAS_OGLES"; then
8395               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
8396               OGLES_SURFACE_FEATURE=
8397             else
8398               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
8399             fi
8400         fi
8402         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8403     fi
8404     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8405         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8406         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8407         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8408         MOZ_ENABLE_CAIRO_FT=1
8409         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8410         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8411     fi
8412     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8413         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8414         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8415         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8416         MOZ_ENABLE_CAIRO_FT=1
8417     fi
8418     if test "$USE_FC_FREETYPE"; then
8419         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8420     fi
8421     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8422     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8423     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8424     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8425     AC_SUBST(CAIRO_FT_CFLAGS)
8426     AC_SUBST(HAS_OGLES)
8428     if test "$MOZ_DEBUG"; then
8429       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8430     else
8431       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8432     fi
8434     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8436     AC_SUBST(PS_SURFACE_FEATURE)
8437     AC_SUBST(PDF_SURFACE_FEATURE)
8438     AC_SUBST(SVG_SURFACE_FEATURE)
8439     AC_SUBST(XLIB_SURFACE_FEATURE)
8440     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8441     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8442     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8443     AC_SUBST(XCB_SURFACE_FEATURE)
8444     AC_SUBST(WIN32_SURFACE_FEATURE)
8445     AC_SUBST(DDRAW_SURFACE_FEATURE)
8446     AC_SUBST(OGLES_SURFACE_FEATURE)    
8447     AC_SUBST(OS2_SURFACE_FEATURE)
8448     AC_SUBST(BEOS_SURFACE_FEATURE)
8449     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8450     AC_SUBST(FT_FONT_FEATURE)
8451     AC_SUBST(FC_FONT_FEATURE)
8452     AC_SUBST(WIN32_FONT_FEATURE)
8453     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8454     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8455     AC_SUBST(QUARTZ_FONT_FEATURE)
8456     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8457     AC_SUBST(QT_SURFACE_FEATURE)
8459     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src) $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'" $CAIRO_FT_LIBS"
8460     if test "$MOZ_X11"; then
8461         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8462     fi
8464     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8465     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8467 else
8468    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8469    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8470    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8471    if test "$MOZ_X11"; then
8472         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8473         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8474         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8475    fi
8478 AC_SUBST(MOZ_TREE_CAIRO)
8479 AC_SUBST(MOZ_CAIRO_CFLAGS)
8480 AC_SUBST(MOZ_CAIRO_LIBS)
8482 dnl ========================================================
8483 dnl qcms
8484 dnl ========================================================
8486 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8487 AC_SUBST(QCMS_LIBS)
8489 dnl ========================================================
8490 dnl HarfBuzz
8491 dnl ========================================================
8492 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8493 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8495 dnl ========================================================
8496 dnl disable xul
8497 dnl ========================================================
8498 MOZ_ARG_DISABLE_BOOL(xul,
8499 [  --disable-xul           Disable XUL],
8500     MOZ_XUL= )
8501 if test "$MOZ_XUL"; then
8502   AC_DEFINE(MOZ_XUL)
8503 else
8504   dnl remove extensions that require XUL
8505   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8508 AC_SUBST(MOZ_XUL)
8510 dnl ========================================================
8511 dnl disable profile locking
8512 dnl   do no use this in applications that can have more than
8513 dnl   one process accessing the profile directory.
8514 dnl ========================================================
8515 MOZ_ARG_DISABLE_BOOL(profilelocking,
8516 [  --disable-profilelocking
8517                           Disable profile locking],
8518     MOZ_PROFILELOCKING=,
8519     MOZ_PROFILELOCKING=1 )
8520 if test "$MOZ_PROFILELOCKING"; then
8521   AC_DEFINE(MOZ_PROFILELOCKING)
8524 dnl ========================================================
8525 dnl disable rdf services
8526 dnl ========================================================
8527 MOZ_ARG_DISABLE_BOOL(rdf,
8528 [  --disable-rdf           Disable RDF],
8529     MOZ_RDF= )
8530 if test "$MOZ_RDF"; then
8531   AC_DEFINE(MOZ_RDF)
8534 AC_SUBST(MOZ_RDF)
8536 dnl ========================================================
8537 dnl necko configuration options
8538 dnl ========================================================
8541 dnl option to disable various necko protocols
8543 MOZ_ARG_ENABLE_STRING(necko-protocols,
8544 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8545                           Enable/disable specific protocol handlers],
8546 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8547     if test "$option" = "yes" -o "$option" = "all"; then
8548         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8549     elif test "$option" = "no" -o "$option" = "none"; then
8550         NECKO_PROTOCOLS=""
8551     elif test "$option" = "default"; then
8552         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8553     elif test `echo "$option" | grep -c \^-` != 0; then
8554         option=`echo $option | sed 's/^-//'`
8555         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8556     else
8557         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8558     fi
8559 done],
8560     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8561 dnl Remove dupes
8562 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8563 AC_SUBST(NECKO_PROTOCOLS)
8564 for p in $NECKO_PROTOCOLS; do
8565     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8566 done
8569 dnl option to disable necko's disk cache
8571 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8572 [  --disable-necko-disk-cache
8573                           Disable necko disk cache],
8574     NECKO_DISK_CACHE=,
8575     NECKO_DISK_CACHE=1)
8576 AC_SUBST(NECKO_DISK_CACHE)
8577 if test "$NECKO_DISK_CACHE"; then
8578     AC_DEFINE(NECKO_DISK_CACHE)
8582 dnl option to disable necko's wifi scanner
8584 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8585 [  --disable-necko-wifi    Disable necko wifi scanner],
8586     NECKO_WIFI=,
8587     NECKO_WIFI=1)
8589 if test "$OS_ARCH" = "OS2"; then
8590   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8591   NECKO_WIFI=
8593 if test "$NECKO_WIFI" -a \
8594         "$OS_ARCH" != "Linux" -a \
8595         "$OS_ARCH" != "Darwin" -a \
8596         "$OS_ARCH" != "SunOS" -a \
8597         "$OS_ARCH" != "WINNT" -a \
8598         "$OS_ARCH" != "WINCE"; then
8599   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8602 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8603 then
8604   AC_CHECK_HEADER([iwlib.h])
8605   if test "$ac_cv_header_iwlib_h" != "yes"; then
8606     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])
8607   fi
8610 if test "$NECKO_WIFI"; then
8611   AC_DEFINE(NECKO_WIFI)
8613 AC_SUBST(NECKO_WIFI)
8616 dnl option to disable cookies
8618 MOZ_ARG_DISABLE_BOOL(cookies,
8619 [  --disable-cookies       Disable cookie support],
8620     NECKO_COOKIES=,
8621     NECKO_COOKIES=1)
8622 AC_SUBST(NECKO_COOKIES)
8623 if test "$NECKO_COOKIES"; then
8624     AC_DEFINE(NECKO_COOKIES)
8628 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8630 MOZ_ARG_DISABLE_BOOL(ctypes,
8631 [  --disable-ctypes        Disable js-ctypes],
8632     BUILD_CTYPES=,
8633     BUILD_CTYPES=1)
8634 AC_SUBST(BUILD_CTYPES)
8635 if test "$BUILD_CTYPES"; then
8636   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8637     # Disable ctypes for arm/wince.
8638     BUILD_CTYPES=
8639   else
8640     AC_DEFINE(BUILD_CTYPES)
8641   fi
8644 dnl NECKO_ configuration options are not global
8645 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8647 dnl Only build Mork if it's required
8648 AC_SUBST(MOZ_MORK)
8649 if test "$MOZ_MORK"; then
8650   AC_DEFINE(MOZ_MORK)
8653 dnl Build the lightweight Mork reader if required
8654 AC_SUBST(MOZ_MORKREADER)
8655 if test "$MOZ_MORKREADER"; then
8656   AC_DEFINE(MOZ_MORKREADER)
8659 dnl Build Places if required
8660 if test "$MOZ_PLACES"; then
8661   AC_DEFINE(MOZ_PLACES)
8664 dnl Build Sync Services if required
8665 AC_SUBST(MOZ_SERVICES_SYNC)
8666 if test -n "$MOZ_SERVICES_SYNC"; then
8667   AC_DEFINE(MOZ_SERVICES_SYNC)
8670 dnl ========================================================
8671 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8672     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8675 dnl ========================================================
8676 dnl =
8677 dnl = Maintainer debug option (no --enable equivalent)
8678 dnl =
8679 dnl ========================================================
8681 AC_SUBST(AR)
8682 AC_SUBST(AR_FLAGS)
8683 AC_SUBST(AR_LIST)
8684 AC_SUBST(AR_EXTRACT)
8685 AC_SUBST(AR_DELETE)
8686 AC_SUBST(AS)
8687 AC_SUBST(ASFLAGS)
8688 AC_SUBST(AS_DASH_C_FLAG)
8689 AC_SUBST(LD)
8690 AC_SUBST(RC)
8691 AC_SUBST(RCFLAGS)
8692 AC_SUBST(WINDRES)
8693 AC_SUBST(IMPLIB)
8694 AC_SUBST(FILTER)
8695 AC_SUBST(BIN_FLAGS)
8696 AC_SUBST(NS_USE_NATIVE)
8697 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8698 AC_SUBST(MOZ_UPDATE_XTERM)
8699 AC_SUBST(MINIMO)
8700 AC_SUBST(MOZ_PLATFORM_MAEMO)
8701 AC_SUBST(MOZ_AUTH_EXTENSION)
8702 AC_SUBST(MOZ_MATHML)
8703 AC_SUBST(MOZ_PERMISSIONS)
8704 AC_SUBST(MOZ_XTF)
8705 AC_SUBST(MOZ_PREF_EXTENSIONS)
8706 AC_SUBST(MOZ_SVG)
8707 AC_SUBST(MOZ_SMIL)
8708 AC_SUBST(MOZ_XSLT_STANDALONE)
8709 AC_SUBST(MOZ_JS_LIBS)
8710 AC_SUBST(MOZ_PSM)
8711 AC_SUBST(MOZ_DEBUG)
8712 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8713 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8714 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8715 AC_SUBST(MOZ_DEBUG_FLAGS)
8716 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8717 AC_SUBST(WARNINGS_AS_ERRORS)
8718 AC_SUBST(MOZ_EXTENSIONS)
8719 AC_SUBST(MOZ_IMG_DECODERS)
8720 AC_SUBST(MOZ_IMG_ENCODERS)
8721 AC_SUBST(MOZ_JSDEBUGGER)
8722 AC_SUBST(MOZ_PLUGINS)
8723 AC_SUBST(MOZ_LOG_REFCNT)
8724 AC_SUBST(MOZ_LEAKY)
8725 AC_SUBST(MOZ_JPROF)
8726 AC_SUBST(MOZ_SHARK)
8727 AC_SUBST(MOZ_CALLGRIND)
8728 AC_SUBST(MOZ_VTUNE)
8729 AC_SUBST(MOZ_JSLOADER)
8730 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8731 AC_SUBST(MOZ_QUANTIFY)
8732 AC_SUBST(LIBICONV)
8733 AC_SUBST(MOZ_PLACES)
8734 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8735 AC_SUBST(MOZ_STORAGE)
8736 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8737 AC_SUBST(MOZ_FEEDS)
8738 AC_SUBST(NS_PRINTING)
8739 AC_SUBST(MOZ_WEBGL)
8740 AC_SUBST(MOZ_HELP_VIEWER)
8742 AC_SUBST(MOZ_JAVAXPCOM)
8743 AC_SUBST(JAVA_INCLUDE_PATH)
8744 AC_SUBST(JAVA)
8745 AC_SUBST(JAVAC)
8746 AC_SUBST(JAR)
8748 AC_SUBST(MOZ_PROFILELOCKING)
8750 AC_SUBST(HAVE_XIE)
8751 AC_SUBST(MOZ_XIE_LIBS)
8753 AC_SUBST(BUILD_STATIC_LIBS)
8754 AC_SUBST(MOZ_ENABLE_LIBXUL)
8755 AC_SUBST(ENABLE_TESTS)
8756 AC_SUBST(IBMBIDI)
8757 AC_SUBST(MOZ_UNIVERSALCHARDET)
8758 AC_SUBST(ACCESSIBILITY)
8759 AC_SUBST(MOZ_VIEW_SOURCE)
8760 AC_SUBST(MOZ_SPELLCHECK)
8761 AC_SUBST(MOZ_USER_DIR)
8762 AC_SUBST(MOZ_CRASHREPORTER)
8763 AC_SUBST(MOZ_UPDATER)
8765 AC_SUBST(ENABLE_STRIP)
8766 AC_SUBST(PKG_SKIP_STRIP)
8767 AC_SUBST(USE_ELF_DYNSTR_GC)
8768 AC_SUBST(INCREMENTAL_LINKER)
8769 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8770 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8772 AC_SUBST(MOZ_FIX_LINK_PATHS)
8773 AC_SUBST(XPCOM_LIBS)
8774 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8775 AC_SUBST(XPCOM_GLUE_LDOPTS)
8776 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8778 AC_SUBST(USE_DEPENDENT_LIBS)
8780 AC_SUBST(MOZ_BUILD_ROOT)
8781 AC_SUBST(MOZ_OS2_TOOLS)
8782 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8784 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8785 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8786 AC_SUBST(MOZ_TIMELINE)
8787 AC_SUBST(OGLES_SDK_DIR)
8789 AC_SUBST(MOZ_APP_NAME)
8790 AC_SUBST(MOZ_APP_DISPLAYNAME)
8791 AC_SUBST(MOZ_APP_VERSION)
8792 AC_SUBST(MOZ_APP_UA_EXTRA)
8793 AC_SUBST(FIREFOX_VERSION)
8795 AC_SUBST(MOZ_PKG_SPECIAL)
8797 AC_SUBST(MOZILLA_OFFICIAL)
8799 dnl win32 options
8800 AC_SUBST(MOZ_MAPINFO)
8801 AC_SUBST(MOZ_BROWSE_INFO)
8802 AC_SUBST(MOZ_TOOLS_DIR)
8803 AC_SUBST(CYGWIN_WRAPPER)
8804 AC_SUBST(AS_PERL)
8805 AC_SUBST(WIN32_REDIST_DIR)
8806 AC_SUBST(PYTHON)
8807 AC_SUBST(MAKENSISU)
8809 AC_SUBST(WINCE)
8810 AC_SUBST(WINCE_SDK_DIR)
8811 AC_SUBST(WINCE_WINDOWS_MOBILE)
8813 dnl Echo the CFLAGS to remove extra whitespace.
8814 CFLAGS=`echo \
8815         $_WARNINGS_CFLAGS \
8816         $CFLAGS`
8818 CXXFLAGS=`echo \
8819         $_MOZ_RTTI_FLAGS \
8820         $_MOZ_EXCEPTIONS_FLAGS \
8821         $_WARNINGS_CXXFLAGS \
8822         $CXXFLAGS`
8824 COMPILE_CFLAGS=`echo \
8825     $_DEFINES_CFLAGS \
8826         $_DEPEND_CFLAGS \
8827     $COMPILE_CFLAGS`
8829 COMPILE_CXXFLAGS=`echo \
8830     $_DEFINES_CXXFLAGS \
8831         $_DEPEND_CFLAGS \
8832     $COMPILE_CXXFLAGS`
8834 AC_SUBST(SYSTEM_MAKEDEPEND)
8835 AC_SUBST(SYSTEM_LIBXUL)
8836 AC_SUBST(SYSTEM_JPEG)
8837 AC_SUBST(SYSTEM_PNG)
8838 AC_SUBST(SYSTEM_ZLIB)
8839 AC_SUBST(SYSTEM_BZ2)
8841 AC_SUBST(JPEG_CFLAGS)
8842 AC_SUBST(JPEG_LIBS)
8843 AC_SUBST(ZLIB_CFLAGS)
8844 AC_SUBST(ZLIB_LIBS)
8845 AC_SUBST(BZ2_CFLAGS)
8846 AC_SUBST(BZ2_LIBS)
8847 AC_SUBST(PNG_CFLAGS)
8848 AC_SUBST(PNG_LIBS)
8850 AC_SUBST(MOZ_JPEG_CFLAGS)
8851 AC_SUBST(MOZ_JPEG_LIBS)
8852 AC_SUBST(MOZ_ZLIB_CFLAGS)
8853 AC_SUBST(MOZ_ZLIB_LIBS)
8854 AC_SUBST(MOZ_BZ2_CFLAGS)
8855 AC_SUBST(MOZ_BZ2_LIBS)
8856 AC_SUBST(MOZ_PNG_CFLAGS)
8857 AC_SUBST(MOZ_PNG_LIBS)
8859 AC_SUBST(NSPR_CFLAGS)
8860 AC_SUBST(NSPR_LIBS)
8861 AC_SUBST(MOZ_NATIVE_NSPR)
8863 AC_SUBST(NSS_CFLAGS)
8864 AC_SUBST(NSS_LIBS)
8865 AC_SUBST(NSS_DEP_LIBS)
8866 AC_SUBST(MOZ_NATIVE_NSS)
8867 AC_SUBST(NSS_DISABLE_DBM)
8869 AC_SUBST(CFLAGS)
8870 AC_SUBST(CXXFLAGS)
8871 AC_SUBST(CPPFLAGS)
8872 AC_SUBST(COMPILE_CFLAGS)
8873 AC_SUBST(COMPILE_CXXFLAGS)
8874 AC_SUBST(LDFLAGS)
8875 AC_SUBST(LIBS)
8876 AC_SUBST(CROSS_COMPILE)
8877 AC_SUBST(WCHAR_CFLAGS)
8879 AC_SUBST(HOST_CC)
8880 AC_SUBST(HOST_CXX)
8881 AC_SUBST(HOST_CFLAGS)
8882 AC_SUBST(HOST_CXXFLAGS)
8883 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8884 AC_SUBST(HOST_AR)
8885 AC_SUBST(HOST_AR_FLAGS)
8886 AC_SUBST(HOST_LD)
8887 AC_SUBST(HOST_RANLIB)
8888 AC_SUBST(HOST_NSPR_MDCPUCFG)
8889 AC_SUBST(HOST_BIN_SUFFIX)
8890 AC_SUBST(HOST_OS_ARCH)
8892 AC_SUBST(TARGET_CPU)
8893 AC_SUBST(TARGET_VENDOR)
8894 AC_SUBST(TARGET_OS)
8895 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8896 AC_SUBST(TARGET_MD_ARCH)
8897 AC_SUBST(TARGET_XPCOM_ABI)
8898 AC_SUBST(OS_TARGET)
8899 AC_SUBST(OS_ARCH)
8900 AC_SUBST(OS_RELEASE)
8901 AC_SUBST(OS_TEST)
8903 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8904 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8906 AC_SUBST(WRAP_MALLOC_CFLAGS)
8907 AC_SUBST(WRAP_MALLOC_LIB)
8908 AC_SUBST(MKSHLIB)
8909 AC_SUBST(MKCSHLIB)
8910 AC_SUBST(MKSHLIB_FORCE_ALL)
8911 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8912 AC_SUBST(DSO_CFLAGS)
8913 AC_SUBST(DSO_PIC_CFLAGS)
8914 AC_SUBST(DSO_LDOPTS)
8915 AC_SUBST(LIB_PREFIX)
8916 AC_SUBST(DLL_PREFIX)
8917 AC_SUBST(DLL_SUFFIX)
8918 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8919 AC_SUBST(LIB_SUFFIX)
8920 AC_SUBST(OBJ_SUFFIX)
8921 AC_SUBST(BIN_SUFFIX)
8922 AC_SUBST(ASM_SUFFIX)
8923 AC_SUBST(IMPORT_LIB_SUFFIX)
8924 AC_SUBST(USE_N32)
8925 AC_SUBST(CC_VERSION)
8926 AC_SUBST(CXX_VERSION)
8927 AC_SUBST(MSMANIFEST_TOOL)
8928 AC_SUBST(NS_ENABLE_TSF)
8929 AC_SUBST(MOZ_NSS_PATCH)
8931 AC_SUBST(MOZ_MEDIA)
8932 AC_SUBST(MOZ_SYDNEYAUDIO)
8933 AC_SUBST(MOZ_WAVE)
8934 AC_SUBST(MOZ_VORBIS)
8935 AC_SUBST(MOZ_WEBM)
8936 AC_SUBST(MOZ_OGG)
8937 AC_SUBST(MOZ_ALSA_LIBS)
8938 AC_SUBST(VPX_AS)
8939 AC_SUBST(VPX_ASFLAGS)
8940 AC_SUBST(VPX_X86_ASM)
8942 if test "$USING_HCC"; then
8943    CC='${topsrcdir}/build/hcc'
8944    CC="$CC '$_OLDCC'"
8945    CXX='${topsrcdir}/build/hcpp'
8946    CXX="$CXX '$_OLDCXX'"
8947    AC_SUBST(CC)
8948    AC_SUBST(CXX)
8951 dnl Check for missing components
8952 if test "$COMPILE_ENVIRONMENT"; then
8953 if test "$MOZ_X11"; then
8954     dnl ====================================================
8955     dnl = Check if X headers exist
8956     dnl ====================================================
8957     _SAVE_CFLAGS=$CFLAGS
8958     CFLAGS="$CFLAGS $XCFLAGS"
8959     AC_TRY_COMPILE([
8960         #include <stdio.h>
8961         #include <stdlib.h>
8962         #include <X11/Xlib.h>
8963         #include <X11/Intrinsic.h>
8964     ],
8965     [
8966         Display *dpy = 0;
8967         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8968             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8969             exit(1);
8970         }
8971     ], [], 
8972     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8973     CFLAGS="$_SAVE_CFLAGS"
8975     if test ! -z "$MISSING_X"; then
8976         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8977     fi
8979 fi # MOZ_X11
8981 dnl Check for headers, etc. needed by WebGL.
8982 if test -n "$MOZ_WEBGL_GLX"; then
8983     AC_CHECK_HEADER(GL/glx.h)
8984     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8985         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8986     fi
8987 fi # MOZ_WEBGL_GLX
8988 fi # COMPILE_ENVIRONMENT
8990 if test "$USE_FC_FREETYPE"; then
8991     if test "$COMPILE_ENVIRONMENT"; then
8992         _SAVE_CPPFLAGS="$CPPFLAGS"
8993         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8994         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
8995             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8996         CPPFLAGS="$_SAVE_CPPFLAGS"
8997     else
8998         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8999     fi
9002 dnl Set various defines and substitutions
9003 dnl ========================================================
9005 if test "$OS_ARCH" = "BeOS"; then
9006   AC_DEFINE(XP_BEOS)
9007 elif test "$OS_ARCH" = "Darwin"; then
9008   AC_DEFINE(XP_UNIX)
9009   AC_DEFINE(UNIX_ASYNC_DNS)
9010 elif test "$OS_ARCH" = "OpenVMS"; then
9011   AC_DEFINE(XP_UNIX)
9012 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
9013   AC_DEFINE(XP_UNIX)
9014   AC_DEFINE(UNIX_ASYNC_DNS)
9017 if test "$MOZ_DEBUG"; then
9018     AC_DEFINE(MOZ_REFLOW_PERF)
9019     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9022 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9023     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9024     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9025     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9026     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9027     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9028     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9029     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9030     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9033 dnl ========================================================
9034 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
9035 dnl ========================================================
9036 case "$host_os" in
9037 mingw*)
9038     WIN_TOP_SRC=`cd $srcdir; pwd -W`
9039     ;;
9040 cygwin*|msvc*|mks*)
9041     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
9042     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
9043     CC="\$(CYGWIN_WRAPPER) $CC"
9044     CXX="\$(CYGWIN_WRAPPER) $CXX"
9045     CPP="\$(CYGWIN_WRAPPER) $CPP"
9046     LD="\$(CYGWIN_WRAPPER) $LD"
9047     AS="\$(CYGWIN_WRAPPER) $AS"
9048     RC="\$(CYGWIN_WRAPPER) $RC"
9049     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
9050     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
9051     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
9052     ;;
9053 esac
9055 AC_SUBST(CYGDRIVE_MOUNT)
9056 AC_SUBST(WIN_TOP_SRC)
9058 AC_SUBST(MOZILLA_VERSION)
9060 AC_SUBST(ac_configure_args)
9062 dnl Spit out some output
9063 dnl ========================================================
9065 dnl The following defines are used by xpcom
9066 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9067 CPP_THROW_NEW
9068 HAVE_CPP_2BYTE_WCHAR_T
9069 HAVE_CPP_ACCESS_CHANGING_USING
9070 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9071 HAVE_CPP_BOOL
9072 HAVE_CPP_CHAR16_T
9073 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9074 HAVE_CPP_EXPLICIT
9075 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9076 HAVE_CPP_NAMESPACE_STD
9077 HAVE_CPP_NEW_CASTS
9078 HAVE_CPP_PARTIAL_SPECIALIZATION
9079 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9080 HAVE_CPP_TYPENAME
9081 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9082 HAVE_STATVFS
9083 NEED_CPP_UNUSED_IMPLEMENTATIONS
9084 NEW_H
9085 HAVE_GETPAGESIZE
9086 HAVE_ICONV
9087 HAVE_ICONV_WITH_CONST_INPUT
9088 HAVE_MBRTOWC
9089 HAVE_SYS_MOUNT_H
9090 HAVE_SYS_VFS_H
9091 HAVE_WCRTOMB
9094 AC_CONFIG_HEADER(
9095 netwerk/necko-config.h
9096 xpcom/xpcom-config.h
9097 xpcom/xpcom-private.h
9100 # Save the defines header file before autoconf removes it.
9101 # (Do not add AC_DEFINE calls after this line.)
9102   _CONFIG_TMP=confdefs-tmp.h
9103   _CONFIG_DEFS_H=mozilla-config.h
9105   cat > $_CONFIG_TMP <<\EOF
9106 /* List of defines generated by configure. Included with preprocessor flag,
9107  * -include, to avoid long list of -D defines on the compile command-line.
9108  * Do not edit.
9109  */
9111 #ifndef _MOZILLA_CONFIG_H_
9112 #define _MOZILLA_CONFIG_H_
9115 _EGREP_PATTERN='^#define ('
9116 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9117     for f in $_NON_GLOBAL_ACDEFINES; do
9118         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9119     done
9121 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9123   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9125   cat >> $_CONFIG_TMP <<\EOF
9127 #endif /* _MOZILLA_CONFIG_H_ */
9131   # Only write mozilla-config.h when something changes (or it doesn't exist)
9132   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9133     rm $_CONFIG_TMP
9134   else
9135     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9136     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9138     echo ==== $_CONFIG_DEFS_H =================================
9139     cat $_CONFIG_DEFS_H
9140   fi
9142 dnl Probably shouldn't call this manually but we always want the output of DEFS
9143 rm -f confdefs.h.save
9144 mv confdefs.h confdefs.h.save
9145 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9146 AC_OUTPUT_MAKE_DEFS()
9147 MOZ_DEFINES=$DEFS
9148 AC_SUBST(MOZ_DEFINES)
9149 rm -f confdefs.h
9150 mv confdefs.h.save confdefs.h
9152 dnl Load the list of Makefiles to generate.
9153 dnl   To add new Makefiles, edit allmakefiles.sh.
9154 dnl   allmakefiles.sh sets the variable, MAKEFILES.
9155 . ${srcdir}/allmakefiles.sh
9156 dnl 
9157 dnl Run a perl script to quickly create the makefiles.
9158 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9159 dnl   for the files it cannot handle correctly. This way, config.status
9160 dnl   will handle these files.
9161 dnl If it fails, nothing is set and config.status will run as usual.
9163 dnl This does not change the $MAKEFILES variable.
9165 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9167 if test -z "${AS_PERL}"; then
9168 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9169 else
9170 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9172 . ./conftest.sh
9173 rm conftest.sh
9175 echo $MAKEFILES > unallmakefiles
9177 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9179 AC_OUTPUT($MAKEFILES)
9181 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9182 if test "$CAIRO_FEATURES_H"; then
9183   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9184     echo "$CAIRO_FEATURES_H is unchanged"
9185     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9186   else
9187     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9188   fi
9191 dnl ========================================================
9192 dnl = Setup a nice relatively clean build environment for
9193 dnl = sub-configures.
9194 dnl ========================================================
9195 CC="$_SUBDIR_CC" 
9196 CXX="$_SUBDIR_CXX" 
9197 CFLAGS="$_SUBDIR_CFLAGS" 
9198 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9199 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9200 LDFLAGS="$_SUBDIR_LDFLAGS"
9201 HOST_CC="$_SUBDIR_HOST_CC" 
9202 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9203 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9206 unset MAKEFILES
9207 unset CONFIG_FILES
9209 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9210 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9212 if test -n "$MOZ_THUMB2"; then
9213   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9215 if test -n "$_WRAP_MALLOC"; then
9216   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9219 if test -z "$MOZ_NATIVE_NSPR"; then
9220     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9221     if test -z "$MOZ_DEBUG"; then
9222         ac_configure_args="$ac_configure_args --disable-debug"
9223     fi
9224     if test "$MOZ_OPTIMIZE" = "1"; then
9225         ac_configure_args="$ac_configure_args --enable-optimize"
9226     fi
9227     if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9228        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9229     fi
9230     if test -n "$HAVE_64BIT_OS"; then
9231         ac_configure_args="$ac_configure_args --enable-64bit"
9232     fi
9233     if test -n "$USE_ARM_KUSER"; then
9234         ac_configure_args="$ac_configure_args --with-arm-kuser"
9235     fi
9236     AC_OUTPUT_SUBDIRS(nsprpub)
9237     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9240 if test -z "$MOZ_NATIVE_NSPR"; then
9241     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9242     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9243     if test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
9244        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9245        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9246        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9247        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9248     fi
9249     rm -f config/autoconf.mk.bak
9252 # Run the SpiderMonkey 'configure' script.
9253 dist=$MOZ_BUILD_ROOT/dist
9254 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9255 ac_configure_args="$ac_configure_args --enable-threadsafe"
9256 if test "$BUILD_CTYPES"; then
9257     # Build js-ctypes on the platforms we can.
9258     ac_configure_args="$ac_configure_args --enable-ctypes"
9260 if test -z "$JS_SHARED_LIBRARY" ; then
9261     ac_configure_args="$ac_configure_args --disable-shared-js"
9263 if test -z "$MOZ_NATIVE_NSPR"; then
9264     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9265     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9267 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9268 ac_configure_args="$ac_configure_args --prefix=$dist"
9269 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9270 if test "$MOZ_MEMORY"; then
9271    ac_configure_args="$ac_configure_args --enable-jemalloc"
9272    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9273      export MOZ_MEMORY_LDFLAGS
9274    fi
9276 AC_OUTPUT_SUBDIRS(js/src)
9277 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9279 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9281 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9282 dnl Needs to be at the end to respect possible changes from NSPR configure
9283 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9284   echo "config/autoconf.mk is unchanged"
9285   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9286 else
9287   rm -f config/autoconf.mk.orig 2> /dev/null