Back out changeset fecc8ed9e813.
[mozilla-central.git] / configure.in
blobfbcc5e5c84b4c033acfed30e3487ccde9d4ca14c
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 dnl
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
10 dnl
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
14 dnl License.
15 dnl
16 dnl The Original Code is this file as it was released upon August 6, 1998.
17 dnl
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
22 dnl
23 dnl Contributor(s):
24 dnl   Jamie Zawinski <jwz@jwz.org>
25 dnl   gettimeofday args check
26 dnl   Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl   gnomefe update & enable-pthreads
28 dnl   Ramiro Estrugo <ramiro@netscape.com>
29 dnl   X11 makedepend support
30 dnl   Insure support.
31 dnl   Henry Sobotka <sobotka@axess.com>
32 dnl   OS/2 support
33 dnl   Dan Mosedale <dmose@mozilla.org>
34 dnl   LDAP support
35 dnl   Seth Spitzer <sspitzer@netscape.com>
36 dnl   xpctools support
37 dnl   Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl   Howard Chu <hyc@symas.com>
39 dnl   MSYS support
40 dnl   Mark Mentovai <mark@moxienet.com>:
41 dnl   Mac OS X 10.4 support
42 dnl   Giorgio Maone <g.maone@informaction.com>
43 dnl   MSVC l10n compatible version check
44 dnl   Ben Turner <mozilla@songbirdnest.com>
45 dnl   Windows x64 support
46 dnl   Makoto Kato <m_kato@ga2.so-net.ne.jp>
47 dnl
48 dnl Alternatively, the contents of this file may be used under the terms of
49 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
50 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
51 dnl in which case the provisions of the GPL or the LGPL are applicable instead
52 dnl of those above. If you wish to allow use of your version of this file only
53 dnl under the terms of either the GPL or the LGPL, and not to allow others to
54 dnl use your version of this file under the terms of the MPL, indicate your
55 dnl decision by deleting the provisions above and replace them with the notice
56 dnl and other provisions required by the GPL or the LGPL. If you do not delete
57 dnl the provisions above, a recipient may use your version of this file under
58 dnl the terms of any one of the MPL, the GPL or the LGPL.
59 dnl
60 dnl ***** END LICENSE BLOCK *****
62 dnl Process this file with autoconf to produce a configure script.
63 dnl ========================================================
65 AC_PREREQ(2.13)
66 AC_INIT(config/config.mk)
67 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
68 AC_CANONICAL_SYSTEM
69 TARGET_CPU="${target_cpu}"
70 TARGET_VENDOR="${target_vendor}"
71 TARGET_OS="${target_os}"
74 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1` 
75 AC_SUBST(MOZ_DEB_TIMESTAMP)
78 dnl ========================================================
79 dnl =
80 dnl = Don't change the following two lines.  Doing so breaks:
81 dnl =
82 dnl = CFLAGS="-foo" ./configure
83 dnl =
84 dnl ========================================================
85 CFLAGS="${CFLAGS=}"
86 CPPFLAGS="${CPPFLAGS=}"
87 CXXFLAGS="${CXXFLAGS=}"
88 LDFLAGS="${LDFLAGS=}"
89 HOST_CFLAGS="${HOST_CFLAGS=}"
90 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
91 HOST_LDFLAGS="${HOST_LDFLAGS=}"
93 dnl ========================================================
94 dnl = Preserve certain environment flags passed to configure
95 dnl = We want sub projects to receive the same flags
96 dnl = untainted by this configure script
97 dnl ========================================================
98 _SUBDIR_CC="$CC"
99 _SUBDIR_CXX="$CXX"
100 _SUBDIR_CFLAGS="$CFLAGS"
101 _SUBDIR_CPPFLAGS="$CPPFLAGS"
102 _SUBDIR_CXXFLAGS="$CXXFLAGS"
103 _SUBDIR_LDFLAGS="$LDFLAGS"
104 _SUBDIR_HOST_CC="$HOST_CC"
105 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
106 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
107 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
108 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
110 dnl Set the version number of the libs included with mozilla
111 dnl ========================================================
112 MOZJPEG=62
113 MOZPNG=10401
114 MOZZLIB=0x1230
115 NSPR_VERSION=4
116 NSS_VERSION=3
118 dnl Set the minimum version of toolkit libs used by mozilla
119 dnl ========================================================
120 GLIB_VERSION=1.2.0
121 LIBIDL_VERSION=0.6.3
122 PERL_VERSION=5.006
123 PYTHON_VERSION=2.4
124 CAIRO_VERSION=1.8.8
125 PANGO_VERSION=1.14.0
126 GTK2_VERSION=2.10.0
127 WINDRES_VERSION=2.14.90
128 W32API_VERSION=3.8
129 GNOMEVFS_VERSION=2.0
130 GNOMEUI_VERSION=2.2.0
131 GCONF_VERSION=1.2.1
132 GIO_VERSION=2.0
133 STARTUP_NOTIFICATION_VERSION=0.8
134 DBUS_VERSION=0.60
135 SQLITE_VERSION=3.6.23.1
136 LIBNOTIFY_VERSION=0.4
138 MSMANIFEST_TOOL=
140 dnl Set various checks
141 dnl ========================================================
142 MISSING_X=
143 AC_PROG_AWK
145 dnl Initialize the Pthread test variables early so they can be
146 dnl  overridden by each platform.
147 dnl ========================================================
148 USE_PTHREADS=
149 _PTHREAD_LDFLAGS=""
151 dnl Do not allow a separate objdir build if a srcdir build exists.
152 dnl ==============================================================
153 _topsrcdir=`cd \`dirname $0\`; pwd`
154 _objdir=`pwd`
156 if test "$_topsrcdir" != "$_objdir"
157 then
158   # Check for a couple representative files in the source tree
159   _conflict_files=
160   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
161     if test -f $file; then
162       _conflict_files="$_conflict_files $file"
163     fi
164   done
165   if test "$_conflict_files"; then
166     echo "***"
167     echo "*   Your source tree contains these files:"
168     for file in $_conflict_files; do
169       echo "*         $file"
170     done
171     cat 1>&2 <<-EOF
172         *   This indicates that you previously built in the source tree.
173         *   A source tree build can confuse the separate objdir build.
174         *
175         *   To clean up the source tree:
176         *     1. cd $_topsrcdir
177         *     2. gmake distclean
178         ***
179         EOF
180     exit 1
181     break
182   fi
184 MOZ_BUILD_ROOT=`pwd`
186 dnl Default to MSVC for win32 and gcc-4.2 for darwin
187 dnl ==============================================================
188 if test -z "$CROSS_COMPILE"; then
189 case "$target" in
190 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
191     if test -z "$CC"; then CC=cl; fi
192     if test -z "$CXX"; then CXX=cl; fi
193     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
194     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
195     if test -z "$LD"; then LD=link; fi
196     if test -z "$AS"; then
197         case "${target_cpu}" in
198         i*86)
199             AS=ml;
200             ;;
201         x86_64)
202             AS=ml64;
203             ;;
204         esac
205     fi
206     if test -z "$MIDL"; then MIDL=midl; fi
207     ;;
208 *-darwin*)
209     if test -z "$CC"; then CC=gcc-4.2; fi
210     if test -z "$CXX"; then CXX=g++-4.2; fi
211     ;;
212 esac
215 COMPILE_ENVIRONMENT=1
216 MOZ_ARG_DISABLE_BOOL(compile-environment,
217 [  --disable-compile-environment
218                           Disable compiler/library checks.],
219     COMPILE_ENVIRONMENT= )
220 AC_SUBST(COMPILE_ENVIRONMENT)
222 MOZ_ARG_WITH_STRING(l10n-base,
223 [  --with-l10n-base=DIR    path to l10n repositories],
224     L10NBASEDIR=$withval)
225 if test ! -z "$L10NBASEDIR"; then
226     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
227         AC_MSG_ERROR([--with-l10n-base must specify a path])
228     elif test -d "$L10NBASEDIR"; then
229         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
230     else
231         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
232     fi
234 AC_SUBST(L10NBASEDIR)
236 dnl Check for Perl first -- needed for win32 SDK checks
237 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
238 if test -z "$PERL" || test "$PERL" = ":"; then
239     AC_MSG_ERROR([perl not found in \$PATH])
242 dnl ========================================================
243 dnl = Android uses a very custom (hacky) toolchain; we need to do this
244 dnl = here, so that the compiler checks can succeed
245 dnl ========================================================
247 MOZ_ARG_WITH_STRING(android-ndk,
248 [  --with-android-ndk=DIR
249                           location where the Android NDK can be found],
250     android_ndk=$withval)
252 MOZ_ARG_WITH_STRING(android-toolchain,
253 [  --with-android-toolchain=DIR
254                           location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
255     android_toolchain=$withval)
257 MOZ_ARG_WITH_STRING(android-platform,
258 [  --with-android-platform=DIR
259                           location of NDK platform dir, default NDK/build/platforms/android-5/arch-arm],
260     android_platform=$withval)
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-5/arch-arm
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}"
333     AC_DEFINE(ANDROID)
334     CROSS_COMPILE=1
335     MOZ_CHROME_FILE_FORMAT=omni
338 AC_SUBST(ANDROID_NDK)
339 AC_SUBST(ANDROID_TOOLCHAIN)
340 AC_SUBST(ANDROID_PLATFORM)
341 AC_SUBST(ANDROID_SDK)
342 AC_SUBST(ANDROID_TOOLS)
344 dnl ========================================================
345 dnl Checks for compilers.
346 dnl ========================================================
347 dnl Set CROSS_COMPILE in the environment when running configure
348 dnl to use the cross-compile setup for now
349 dnl ========================================================
351 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
352 AR_FLAGS='cr $@'
354 if test "$COMPILE_ENVIRONMENT"; then
356 dnl Do some special WinCE toolchain stuff
357 case "$target" in
358 *wince|*winmo)
360     MOZ_ARG_WITH_STRING(wince-sdk,
361     [  --with-wince-sdk=WINCE_SDK_DIR
362                           The path to the Windows CE SDK],
363     WINCE_SDK_DIR=$withval)
365     MOZ_ARG_WITH_STRING(ogles-sdk,
366     [  --with-ogles-sdk=OGLES_SDK_DIR
367                           The path to the OGLES SDK],
368     OGLES_SDK_DIR=$withval)
370     AC_DEFINE(WINCE)
371     
372     export WINCE=1
374     echo -----------------------------------------------------------------------------
375     echo Building Windows CE Shunt Library and Tool Chain
376     echo Using SDK in:
377     echo $WINCE_SDK_DIR
379     ac_exeext=.exe
381     _pwd=`pwd -W`
382     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
383     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
384     TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
385     -C $srcdir/build/wince/tools
387     CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
388     CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
389     CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
390     CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
391     LD="$_pwd/dist/sdk/bin/$target-link.exe"
392     AR="$_pwd/dist/sdk/bin/$target-lib.exe"
393     AS="$_pwd/dist/sdk/bin/$target-as.exe"
394     RC="$_pwd/dist/sdk/bin/$target-res.exe"
397     echo -----------------------------------------------------------------------------
399     ;;
400 esac
402 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
403     echo "cross compiling from $host to $target"
404     cross_compiling=yes
406     _SAVE_CC="$CC"
407     _SAVE_CFLAGS="$CFLAGS"
408     _SAVE_LDFLAGS="$LDFLAGS"
410     AC_MSG_CHECKING([for host c compiler])
411     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
412     if test -z "$HOST_CC"; then
413         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
414     fi
415     AC_MSG_RESULT([$HOST_CC])
416     AC_MSG_CHECKING([for host c++ compiler])
417     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
418     if test -z "$HOST_CXX"; then
419         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
420     fi
421     AC_MSG_RESULT([$HOST_CXX])
423     if test -z "$HOST_CFLAGS"; then
424         HOST_CFLAGS="$CFLAGS"
425     fi
426     if test -z "$HOST_CXXFLAGS"; then
427         HOST_CXXFLAGS="$CXXFLAGS"
428     fi
429     if test -z "$HOST_LDFLAGS"; then
430         HOST_LDFLAGS="$LDFLAGS"
431     fi
432     if test -z "$HOST_AR_FLAGS"; then
433         HOST_AR_FLAGS="$AR_FLAGS"
434     fi
435     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
436     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
437     CC="$HOST_CC"
438     CFLAGS="$HOST_CFLAGS"
439     LDFLAGS="$HOST_LDFLAGS"
441     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
442     AC_TRY_COMPILE([], [return(0);], 
443         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
444         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
446     CC="$HOST_CXX"
447     CFLAGS="$HOST_CXXFLAGS"
449     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
450     AC_TRY_COMPILE([], [return(0);], 
451         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
452         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
453     
454     CC=$_SAVE_CC
455     CFLAGS=$_SAVE_CFLAGS
456     LDFLAGS=$_SAVE_LDFLAGS
458     case "$build:$target" in
459       powerpc-apple-darwin8*:i?86-apple-darwin*)
460         dnl The Darwin cross compiler doesn't necessarily point itself at a
461         dnl root that has libraries for the proper architecture, it defaults
462         dnl to the system root.  The libraries in the system root on current
463         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
464         dnl checks will fail.  Fake a working SDK in that case.
465         _SAVE_CFLAGS=$CFLAGS
466         _SAVE_CXXFLAGS=$CXXLAGS
467         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
468         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
469         ;;
470     esac
472     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
473     unset ac_cv_prog_CC
474     AC_PROG_CC
475     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
476     unset ac_cv_prog_CXX
477     AC_PROG_CXX
479     case "$build:$target" in
480       powerpc-apple-darwin8*:i?86-apple-darwin*)
481         dnl Revert the changes made above.  From this point on, the target
482         dnl compiler will never be used without applying the SDK to CFLAGS
483         dnl (see --with-macos-sdk below).
484         CFLAGS=$_SAVE_CFLAGS
485         CXXFLAGS=$_SAVE_CXXFLAGS
486         ;;
487     esac
489     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
490     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
491     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
492     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
493     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
494     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
495     AC_DEFINE(CROSS_COMPILE)
496 else
497     AC_PROG_CC
498     AC_PROG_CXX
499     AC_PROG_RANLIB
500     MOZ_PATH_PROGS(AS, $AS as, $CC)
501     AC_CHECK_PROGS(AR, ar, :)
502     AC_CHECK_PROGS(LD, ld, :)
503     AC_CHECK_PROGS(STRIP, strip, :)
504     AC_CHECK_PROGS(WINDRES, windres, :)
505     if test -z "$HOST_CC"; then
506         HOST_CC='$(CC)'
507     fi
508     if test -z "$HOST_CFLAGS"; then
509         HOST_CFLAGS='$(CFLAGS)'
510     fi
511     if test -z "$HOST_CXX"; then
512         HOST_CXX='$(CXX)'
513     fi
514     if test -z "$HOST_CXXFLAGS"; then
515         HOST_CXXFLAGS='$(CXXFLAGS)'
516     fi
517     if test -z "$HOST_LDFLAGS"; then
518         HOST_LDFLAGS='$(LDFLAGS)'
519     fi
520     if test -z "$HOST_RANLIB"; then
521         HOST_RANLIB='$(RANLIB)'
522     fi
523     if test -z "$HOST_AR"; then
524         HOST_AR='$(AR)'
525     fi
526     if test -z "$HOST_AR_FLAGS"; then
527         HOST_AR_FLAGS='$(AR_FLAGS)'
528     fi
531 GNU_AS=
532 GNU_LD=
533 GNU_CC=
534 GNU_CXX=
535 CC_VERSION='N/A'
536 CXX_VERSION='N/A'
537 if test "$GCC" = "yes"; then
538     GNU_CC=1
539     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
541 if test "$GXX" = "yes"; then
542     GNU_CXX=1
543     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
545 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
546     GNU_AS=1
548 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
549     GNU_LD=1
551 if test "$GNU_CC"; then
552     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
553         GCC_USE_GNU_LD=1
554     fi
557 INTEL_CC=
558 INTEL_CXX=
559 if test "$GCC" = yes; then
560    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
561      INTEL_CC=1
562    fi
565 if test "$GXX" = yes; then
566    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
567      INTEL_CXX=1
568    fi
571 dnl Special win32 checks
572 dnl ========================================================
573 case "$target" in
574 *-wince|*-winmo)
575     WINVER=500
576     WINSDK_TARGETVER=502
577     ;;
579     WINVER=502
580     dnl Target the Windows 7 SDK by default
581     WINSDK_TARGETVER=601
582     ;;
583 esac
585 MOZ_ARG_WITH_STRING(windows-version,
586 [  --with-windows-version=WINSDK_TARGETVER
587                           Highest Windows version to target using this SDK
588                               502: Windows Server 2003
589                               600: Windows Vista
590                               601: Windows 7],
591   WINSDK_TARGETVER=$withval)
593 case "$WINSDK_TARGETVER" in
594 502|600|601)
595     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
596     ;;
599     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
600     ;;
602 esac
604 if test -n "$COMPILE_ENVIRONMENT"; then
605 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
606     # We can't build parental controls either
607     MOZ_DISABLE_PARENTAL_CONTROLS=1
611 case "$target" in
612 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
613     if test "$GCC" != "yes"; then
614         # Check to see if we are really running in a msvc environemnt
615         _WIN32_MSVC=1
616         AC_CHECK_PROGS(MIDL, midl)
618         # Make sure compilers are valid
619         CFLAGS="$CFLAGS -TC -nologo"
620         CXXFLAGS="$CXXFLAGS -TP -nologo"
621         AC_LANG_SAVE
622         AC_LANG_C
623         AC_TRY_COMPILE([#include <stdio.h>],
624             [ printf("Hello World\n"); ],,
625             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
627         AC_LANG_CPLUSPLUS
628         AC_TRY_COMPILE([#include <new.h>],
629             [ unsigned *test = new unsigned(42); ],,
630             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
631         AC_LANG_RESTORE
632         
633         changequote(,)
634         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
635         changequote([,])
636         
637         # Determine compiler version
638         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
639         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
640         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
641         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
642         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
643         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
645         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
646         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
648         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
649             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
650         fi
651         if test "$_CC_MAJOR_VERSION" = "13"; then
652             _CC_SUITE=7
653         elif test "$_CC_MAJOR_VERSION" = "14"; then
654             _CC_SUITE=8
655             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
656             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
657             dnl so be very specific here!
658             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
659             if test $_CC_RELEASE -gt 50727; then
660                _USE_DYNAMICBASE=1
661             elif test $_CC_BUILD -ge 762; then
662                _USE_DYNAMICBASE=1
663             fi
664             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
665             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
666         elif test "$_CC_MAJOR_VERSION" = "15"; then
667             _CC_SUITE=9
668             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
669             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
670             _USE_DYNAMICBASE=1
671             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
672             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
673         elif test "$_CC_MAJOR_VERSION" = "16"; then
674             _CC_SUITE=10
675             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
676             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
677             _USE_DYNAMICBASE=1
678             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
679             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
680         else
681             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
682         fi
684         _MOZ_RTTI_FLAGS_ON='-GR'
685         _MOZ_RTTI_FLAGS_OFF='-GR-'
686         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
687         _MOZ_EXCEPTIONS_FLAGS_OFF=''
689         if test -n "$WIN32_REDIST_DIR"; then
690             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
691         fi
692         
693         # bug #249782
694         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
695         if test "$_CC_SUITE" -ge "8"; then
696                 changequote(,)
697                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
698                 changequote([,])
700                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
701                 if test -n "$MSMT_TOOL"; then
702                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
703                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
704                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
705                         fi
706                         MSMANIFEST_TOOL=1
707                         unset MSMT_TOOL
708                 else
709                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
710                 fi
711         fi
713         # Check linker version
714         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
715         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
716         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
717             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
718         fi
719         INCREMENTAL_LINKER=1
721         # Check midl version
722         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
723         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
724         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
725         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
726         # Add flags if necessary
727         AC_MSG_CHECKING([for midl flags])
728         case "$target" in
729         i*86-*)
730             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
731                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
732                 # MIDL version 7.00.0500 or later has no problem.
733                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
734                 AC_MSG_RESULT([need -env win32])
735             else
736                 AC_MSG_RESULT([none needed])
737             fi
738             ;;
739         x86_64-*)
740             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
741             ;;
742         *)
743             AC_MSG_RESULT([none needed])
744             ;;
745         esac
747         # Identify which version of the SDK we're building with
748         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
749         # from there
750         AC_CHECK_HEADERS([winsdkver.h])
751         if test "$ac_cv_header_winsdkver_h" = "yes"; then
752             # Get the highest _WIN32_WINNT and NTDDI versions supported
753             # Take the higher of the two
754             # This is done because the Windows 7 beta SDK reports its
755             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
756             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
757                            ac_cv_winsdk_maxver,
758                            [cat > conftest.h <<EOF
759 #include <winsdkver.h>
760 #include <sdkddkver.h>
762 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
763 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
764 #else
765 #define WINSDK_MAXVER NTDDI_MAXVER
766 #endif
768 WINSDK_MAXVER
770                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
771                             rm -f conftest.h
772                            ])
773             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
774         else
775             # The Vista SDK is the only one to have sdkddkver.h but not
776             # WinSDKVer.h
777             AC_CHECK_HEADERS([sdkddkver.h])
778             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
779                 MOZ_WINSDK_MAXVER=0x06000000
780             else
781                 # Assume the Server 2003 Platform SDK
782                 MOZ_WINSDK_MAXVER=0x05020000
783             fi
784         fi
786         unset _MSVC_VER_FILTER
788         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
789             [
790                 AC_LANG_SAVE
791                 AC_LANG_CPLUSPLUS
792                 _SAVE_CXXFLAGS="$CXXFLAGS"
793                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
794                 AC_TRY_COMPILE([#include <exception>],
795                             [std::_Throw(std::exception()); return 0;],
796                             ac_cv_have_std__Throw="yes",
797                             ac_cv_have_std__Throw="no")
798                 CXXFLAGS="$_SAVE_CXXFLAGS"
799                 AC_LANG_RESTORE
800             ])
802         if test "$ac_cv_have_std__Throw" == "yes"; then
803             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
804                            ac_cv_have_dllimport_exception_bug,
805                 [
806                     AC_LANG_SAVE
807                     AC_LANG_CPLUSPLUS
808                     _SAVE_CXXFLAGS="$CXXFLAGS"
809                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
810                     AC_TRY_LINK([#include <vector>],
811                                 [std::vector<int> v; return v.at(1);],
812                                 ac_cv_have_dllimport_exception_bug="no",
813                                 ac_cv_have_dllimport_exception_bug="yes")
814                     CXXFLAGS="$_SAVE_CXXFLAGS"
815                     AC_LANG_RESTORE
816                 ])
817             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
818                 WRAP_STL_INCLUDES=1
819                 MOZ_MSVC_STL_WRAP__Throw=1
820                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
821             fi
822         else
823             AC_CACHE_CHECK(for overridable _RAISE,
824                            ac_cv_have__RAISE,
825                 [
826                     AC_LANG_SAVE
827                     AC_LANG_CPLUSPLUS
828                     _SAVE_CXXFLAGS="$CXXFLAGS"
829                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
830                     AC_TRY_COMPILE([#include <xstddef>
831                                     #undef _RAISE
832                                     #define _RAISE(x) externallyDefinedFunction((x).what())
833                                     #include <vector>
834                                    ],
835                                    [std::vector<int> v; return v.at(1);],
836                                    ac_cv_have__RAISE="no",
837                                    ac_cv_have__RAISE="yes")
838                     CXXFLAGS="$_SAVE_CXXFLAGS"
839                     AC_LANG_RESTORE
840                 ])
841             if test "$ac_cv_have__RAISE" = "yes"; then
842                 WRAP_STL_INCLUDES=1
843                 MOZ_MSVC_STL_WRAP__RAISE=1
844                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
845             else
846                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
847             fi
848         fi
850         if test "$WRAP_STL_INCLUDES" = "1"; then
851             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
852         fi
853     else
854         # Check w32api version
855         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
856         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
857         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
858         AC_TRY_COMPILE([#include <w32api.h>],
859             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
860                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
861                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
862                 #error "test failed."
863             #endif
864             , [ res=yes ], [ res=no ])
865         AC_MSG_RESULT([$res])
866         if test "$res" != "yes"; then
867             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
868         fi
869         # Check windres version
870         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
871         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
872         AC_MSG_RESULT([$_WINDRES_VERSION])
873         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
874         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
875         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
876         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
877         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
878         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
879         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
880                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
881                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
882                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
883                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
884                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
885         then
886             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
887         fi
889         # Server 2003 is the highest version supported
890         MOZ_WINSDK_MAXVER=0x05020000
891     fi # !GNU_CC
893     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
894     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
895     # Require OS features provided by IE 5.0
896     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
898     # If the maximum version supported by this SDK is lower than the target
899     # version, error out
900     AC_MSG_CHECKING([for Windows SDK being recent enough])
901     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
902         AC_MSG_RESULT("yes")
903     else
904         AC_MSG_RESULT("no")
905         AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
906     fi
908     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
909     # Definitions matching sdkddkver.h
910     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
911     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
912     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
913     ;;
914 esac
916 dnl Test breaks icc on OS/2 && MSVC
917 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
918     AC_PROG_CC_C_O
919     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
920         USING_HCC=1
921         _OLDCC=$CC
922         _OLDCXX=$CXX
923         CC="${srcdir}/build/hcc '$CC'"
924         CXX="${srcdir}/build/hcpp '$CXX'"
925     fi
928 AC_PROG_CPP
929 AC_PROG_CXXCPP
931 if test -n "$_WIN32_MSVC"; then
932     SKIP_PATH_CHECKS=1
933     SKIP_COMPILER_CHECKS=1
934     SKIP_LIBRARY_CHECKS=1
936     # Since we're skipping compiler and library checks, hard-code
937     # some facts here.
938     case "$target" in
939     *-wince|*-winmo)
940         ;;
941     *)
942         AC_DEFINE(HAVE_IO_H)
943         AC_DEFINE(HAVE_SETBUF)
944         AC_DEFINE(HAVE_ISATTY)
945         ;;
946     esac
949 fi # COMPILE_ENVIRONMENT
951 AC_SUBST(MIDL_FLAGS)
952 AC_SUBST(_MSC_VER)
954 AC_SUBST(GNU_AS)
955 AC_SUBST(GNU_LD)
956 AC_SUBST(GNU_CC)
957 AC_SUBST(GNU_CXX)
958 AC_SUBST(INTEL_CC)
959 AC_SUBST(INTEL_CXX)
961 AC_SUBST(STL_FLAGS)
962 AC_SUBST(WRAP_STL_INCLUDES)
963 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
964 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
966 dnl ========================================================
967 dnl Checks for programs.
968 dnl ========================================================
969 AC_PROG_INSTALL
970 AC_PROG_LN_S
972 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
973 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
974 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
975 _perl_res=$?
976 AC_MSG_RESULT([$_perl_version])
978 if test "$_perl_res" != 0; then
979     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
983 AC_MSG_CHECKING([for full perl installation])
984 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
985 _perl_res=$?
986 if test "$_perl_res" != 0; then
987     AC_MSG_RESULT([no])
988     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
989 else
990     AC_MSG_RESULT([yes])    
993 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.6 python2.5 python2.4 python)
994 if test -z "$PYTHON"; then
995     AC_MSG_ERROR([python was not found in \$PATH])
998 if test -z "$COMPILE_ENVIRONMENT"; then
999     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1001 AC_SUBST(NSINSTALL_BIN)
1003 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1004 MOZ_PATH_PROG(WHOAMI, whoami, :)
1005 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1006 MOZ_PATH_PROG(UNZIP, unzip, :)
1007 MOZ_PATH_PROGS(ZIP, zip)
1008 if test -z "$ZIP" || test "$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" || test "$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" && test "$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_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1223 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1224 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1225 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1226 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1227 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1228 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1230 MOZ_FS_LAYOUT=unix
1232 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1234 USE_DEPENDENT_LIBS=1
1236 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1238 MOZ_ENABLE_POSTSCRIPT=1 
1240 if test -n "$CROSS_COMPILE"; then
1241     OS_TARGET="${target_os}"
1242     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1243     OS_RELEASE=
1244     case "${target_os}" in
1245         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1246         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1247         gnu*)         OS_ARCH=GNU ;;
1248         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1249         mingw*)       OS_ARCH=WINNT ;;
1250         wince*)       OS_ARCH=WINCE ;;
1251         winmo*)       OS_ARCH=WINCE ;;
1252         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1253     esac
1254     case "${target}" in
1255         arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1256     esac
1257 else
1258     OS_TARGET=`uname -s`
1259     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1260     OS_RELEASE=`uname -r`
1263 # Before this used `uname -m` when not cross compiling
1264 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1265 OS_TEST="${target_cpu}"
1267 _COMPILER_PREFIX=
1269 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1271 #######################################################################
1272 # Master "Core Components" macros for getting the OS target           #
1273 #######################################################################
1276 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1277 # cross-compilation.
1281 # Define and override various archtecture-specific variables, including
1282 # HOST_OS_ARCH
1283 # OS_ARCH
1284 # OS_TEST
1285 # OS_TARGET
1286 # OS_RELEASE
1287 # OS_MINOR_RELEASE
1290 case "$HOST_OS_ARCH" in
1291 cygwin*|mingw*|mks*|msvc*)
1292     HOST_OS_ARCH=WINNT
1293     ;;
1294 darwin*)
1295     HOST_OS_ARCH=Darwin
1296     ;;
1297 linux*)
1298     HOST_OS_ARCH=Linux
1299     ;;
1300 solaris*)
1301     HOST_OS_ARCH=SunOS
1302     SOLARIS_SUNPRO_CC=
1303     SOLARIS_SUNPRO_CXX=
1304     if test -z "$GNU_CC"; then
1305         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1306             SOLARIS_SUNPRO_CC=1
1307        fi
1308     fi
1310     if test -z "$GNU_CXX"; then
1311        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1312            SOLARIS_SUNPRO_CXX=1
1313        fi
1314     fi
1315     AC_SUBST(SOLARIS_SUNPRO_CC)
1316     AC_SUBST(SOLARIS_SUNPRO_CXX)
1317     ;;
1318 BSD_386)
1319     HOST_OS_ARCH=BSD
1320     ;;
1321 dgux)
1322     HOST_OS_ARCH=DGUX
1323     ;;
1324 IRIX64)
1325     HOST_OS_ARCH=IRIX
1326     ;;
1327 UNIX_SV)
1328     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1329         HOST_OS_ARCH=NCR
1330     else
1331         HOST_OS_ARCH=UNIXWARE
1332     fi
1333     ;;
1334 ncr)
1335     HOST_OS_ARCH=NCR
1336     ;;
1337 UNIX_SYSTEM_V)
1338     HOST_OS_ARCH=NEC
1339     ;;
1340 OSF1)
1341     ;;
1342 *OpenVMS*)
1343     HOST_OS_ARCH=OpenVMS
1344     ;;
1345 OS_2)
1346     HOST_OS_ARCH=OS2
1347     ;;
1348 QNX)
1349     ;;
1350 SCO_SV)
1351     HOST_OS_ARCH=SCOOS
1352     ;;
1353 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1354     HOST_OS_ARCH=SINIX
1355     ;;
1356 UnixWare)
1357     HOST_OS_ARCH=UNIXWARE
1358     ;;
1359 esac
1361 case "$OS_ARCH" in
1362 WINNT)
1363     if test -z "$CROSS_COMPILE" ; then
1364         OS_TEST=`uname -p`
1365     fi
1366     ;;
1367 Windows_NT)
1369 # If uname -s returns "Windows_NT", we assume that we are using
1370 # the uname.exe in MKS toolkit.
1372 # The -r option of MKS uname only returns the major version number.
1373 # So we need to use its -v option to get the minor version number.
1374 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1376     OS_ARCH=WINNT
1377     OS_TARGET=WINNT
1378     OS_MINOR_RELEASE=`uname -v`
1379     if test "$OS_MINOR_RELEASE" = "00"; then
1380         OS_MINOR_RELEASE=0
1381     fi
1382     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1383     ;;
1384 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1386 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1387 # the uname.exe in the Cygwin tools.
1388 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1389 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1390 # the uname.exe in the GNU-Win32 tools.
1391 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1392 # the uname.exe in the MSYS tools.
1394     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1395     OS_ARCH=WINNT
1396     OS_TARGET=WINNT
1397     ;;
1398 AIX)
1399     OS_RELEASE=`uname -v`.`uname -r`
1400     OS_TEST=${target_cpu}
1401     ;;
1402 BSD_386)
1403     OS_ARCH=BSD
1404     ;;
1405 dgux)
1406     OS_ARCH=DGUX
1407     ;;
1408 IRIX64)
1409     OS_ARCH=IRIX
1410     ;;
1411 UNIX_SV)
1412     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1413         OS_ARCH=NCR
1414     else
1415         OS_ARCH=UNIXWARE
1416         OS_RELEASE=`uname -v`
1417     fi
1418     ;;
1419 ncr)
1420     OS_ARCH=NCR
1421     ;;
1422 UNIX_SYSTEM_V)
1423     OS_ARCH=NEC
1424     ;;
1425 OSF1)
1426     case `uname -v` in
1427     148)
1428         OS_RELEASE=V3.2C
1429         ;;
1430     564)
1431         OS_RELEASE=V4.0B
1432         ;;
1433     878)
1434         OS_RELEASE=V4.0D
1435         ;;
1436     esac
1437     ;;
1438 *OpenVMS*)
1439     OS_ARCH=OpenVMS
1440     OS_RELEASE=`uname -v`
1441     OS_TEST=`uname -p`
1442     ;;
1443 OS_2)
1444     OS_ARCH=OS2
1445     OS_TARGET=OS2
1446     OS_RELEASE=`uname -v`
1447     ;;
1448 QNX)
1449     if test "$OS_TARGET" != "NTO"; then
1450         changequote(,)
1451         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1452         changequote([,])
1453     fi
1454     OS_TEST=x86
1455     ;;
1456 SCO_SV)
1457     OS_ARCH=SCOOS
1458     OS_RELEASE=5.0
1459     ;;
1460 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1461     OS_ARCH=SINIX
1462     OS_TEST=`uname -p`
1463     ;;
1464 UnixWare)
1465     OS_ARCH=UNIXWARE
1466     OS_RELEASE=`uname -v`
1467     ;;
1468 WINCE)
1469     OS_ARCH=WINCE
1470     case "${target_os}" in
1471     *winmo)
1472         OS_TARGET=WINMO
1473         WINCE_WINDOWS_MOBILE=1
1474         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1475         ;;
1476     *)
1477         OS_TARGET=WINCE
1478         ;;
1479     esac
1480     ;;
1481 Darwin)
1482     case "${target_cpu}" in
1483     powerpc*)
1484         OS_TEST=ppc
1485         ;;
1486     i*86*)
1487         OS_TEST=i386 
1488         ;;
1489     x86_64)
1490         OS_TEST=x86_64
1491         ;;
1492     *)
1493         if test -z "$CROSS_COMPILE" ; then
1494             OS_TEST=`uname -p`
1495         fi
1496         ;;
1497     esac
1498     ;;
1499 esac
1501 if test "$OS_ARCH" = "NCR"; then
1502     changequote(,)
1503     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1504     changequote([,])
1507 # Only set CPU_ARCH if we recognize the value of OS_TEST
1509 case "$OS_TEST" in
1510 *86 | i86pc)
1511     CPU_ARCH=x86
1512     ;;
1514 powerpc64 | ppc64)
1515     CPU_ARCH=ppc64
1516     ;;
1518 powerpc | ppc | rs6000)
1519     CPU_ARCH=ppc
1520     ;;
1522 Alpha | alpha | ALPHA)
1523     CPU_ARCH=Alpha
1524     ;;
1526 s390)
1527     CPU_ARCH=s390
1528     ;;
1530 s390x)
1531     CPU_ARCH=s390x
1532     ;;
1534 hppa* | parisc)
1535     CPU_ARCH=hppa
1536     ;;
1538 sun4u | sparc*)
1539     CPU_ARCH=sparc
1540     ;;
1542 x86_64 | ia64)
1543     CPU_ARCH="$OS_TEST"
1544     ;;
1546 arm)
1547     CPU_ARCH=arm
1548     ;;
1549 esac
1551 if test -z "$OS_TARGET"; then
1552     OS_TARGET=$OS_ARCH
1554 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1556 dnl ========================================================
1557 dnl GNU specific defaults
1558 dnl ========================================================
1559 if test "$GNU_CC"; then
1560     # FIXME: Let us build with strict aliasing. bug 414641.
1561     CFLAGS="$CFLAGS -fno-strict-aliasing"
1562     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1563     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1564     DSO_LDOPTS='-shared'
1565     if test "$GCC_USE_GNU_LD"; then
1566         # Don't allow undefined symbols in libraries
1567         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1568     fi
1569     WARNINGS_AS_ERRORS='-Werror'
1570     DSO_CFLAGS=''
1571     DSO_PIC_CFLAGS='-fPIC'
1572     ASFLAGS="$ASFLAGS -fPIC"
1573     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1574     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1575     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1576     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1578     # Turn on GNU specific features
1579     # -Wall - turn on all warnings
1580     # -pedantic - make compiler warn about non-ANSI stuff, and
1581     #             be a little bit stricter
1582     # Warnings slamm took out for now (these were giving more noise than help):
1583     # -Wbad-function-cast - warns when casting a function to a new return type
1584     # -Wshadow - removed because it generates more noise than help --pete
1585     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1586     if test -z "$INTEL_CC"; then
1587        # Don't use -Wcast-align with ICC
1588        case "$CPU_ARCH" in
1589            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1590            hppa | ia64 | sparc | arm)
1591            ;;
1592            *)
1593         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1594            ;;
1595        esac
1596     fi
1598     dnl Turn pedantic on but disable the warnings for long long
1599     _PEDANTIC=1
1601     if test -z "$INTEL_CC"; then
1602       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1603     fi
1605     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1606     _USE_CPP_INCLUDE_FLAG=1
1607 elif test "$SOLARIS_SUNPRO_CC"; then
1608     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1609     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1611     DSO_LDOPTS='-shared'
1612     if test "$GNU_LD"; then
1613         # Don't allow undefined symbols in libraries
1614         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1615     fi
1617     DSO_CFLAGS=''
1618     if test "$CPU_ARCH" = "sparc"; then
1619         # for Sun Studio on Solaris/SPARC
1620         DSO_PIC_CFLAGS='-xcode=pic32'
1621     else
1622         DSO_PIC_CFLAGS='-KPIC'
1623     fi
1624     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1625 else
1626     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1627     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1629     DSO_LDOPTS='-shared'
1630     if test "$GNU_LD"; then
1631         # Don't allow undefined symbols in libraries
1632         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1633     fi
1635     DSO_CFLAGS=''
1636     DSO_PIC_CFLAGS='-KPIC'
1637     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1640 if test "$GNU_CXX"; then
1641     # FIXME: Let us build with strict aliasing. bug 414641.
1642     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1643     # Turn on GNU specific features
1644     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1645     if test -z "$INTEL_CC"; then
1646        # Don't use -Wcast-align with ICC
1647        case "$CPU_ARCH" in
1648            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1649            hppa | ia64 | sparc | arm)
1650            ;;
1651            *)
1652         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1653            ;;
1654        esac
1655     fi
1657     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1658     _USE_CPP_INCLUDE_FLAG=1
1660     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1661                    ac_has_wno_invalid_offsetof,
1662         [
1663             AC_LANG_SAVE
1664             AC_LANG_CPLUSPLUS
1665             _SAVE_CXXFLAGS="$CXXFLAGS"
1666             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1667             AC_TRY_COMPILE([],
1668                            [return(0);],
1669                            ac_has_wno_invalid_offsetof="yes",
1670                            ac_has_wno_invalid_offsetof="no")
1671             CXXFLAGS="$_SAVE_CXXFLAGS"
1672             AC_LANG_RESTORE
1673         ])
1674     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1675         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1676     fi
1678     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1679                    ac_has_wno_variadic_macros,
1680         [
1681             AC_LANG_SAVE
1682             AC_LANG_CPLUSPLUS
1683             _SAVE_CXXFLAGS="$CXXFLAGS"
1684             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1685             AC_TRY_COMPILE([],
1686                            [return(0);],
1687                            ac_has_wno_variadic_macros="yes",
1688                            ac_has_wno_variadic_macros="no")
1689             CXXFLAGS="$_SAVE_CXXFLAGS"
1690             AC_LANG_RESTORE
1691         ])
1692     if test "$ac_has_wno_variadic_macros" = "yes"; then
1693         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1694     fi
1696     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1697                    ac_has_werror_return_type,
1698         [
1699             AC_LANG_SAVE
1700             AC_LANG_CPLUSPLUS
1701             _SAVE_CXXFLAGS="$CXXFLAGS"
1702             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1703             AC_TRY_COMPILE([],
1704                            [return(0);],
1705                            ac_has_werror_return_type="yes",
1706                            ac_has_werror_return_type="no")
1707             CXXFLAGS="$_SAVE_CXXFLAGS"
1708             AC_LANG_RESTORE
1709         ])
1710     if test "$ac_has_werror_return_type" = "yes"; then
1711         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1712     fi
1714 else
1715     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1718 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1719 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1720 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1721 dnl normal behavior.
1722 dnl ========================================================
1723 MKSHLIB_FORCE_ALL=
1724 MKSHLIB_UNFORCE_ALL=
1726 if test "$COMPILE_ENVIRONMENT"; then
1727 if test "$GNU_CC"; then
1728   AC_MSG_CHECKING(whether ld has archive extraction flags)
1729   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1730    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1731     ac_cv_mkshlib_force_and_unforce="no"
1732     exec 3<&0 <<LOOP_INPUT
1733         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1734         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1735         force="-Wl,-all";              unforce="-Wl,-none"
1736 LOOP_INPUT
1737     while read line
1738     do
1739       eval $line
1740       LDFLAGS=$force
1741       LIBS=$unforce
1742       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1743     done
1744     exec 0<&3 3<&-
1745     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1746    ])
1747   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1748     AC_MSG_RESULT(no)
1749   else
1750     AC_MSG_RESULT(yes)
1751     eval $ac_cv_mkshlib_force_and_unforce
1752     MKSHLIB_FORCE_ALL=$force
1753     MKSHLIB_UNFORCE_ALL=$unforce
1754   fi
1755 fi # GNU_CC
1756 fi # COMPILE_ENVIRONMENT
1758 dnl =================================================================
1759 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1760 dnl which is bad when cross compiling.
1761 dnl =================================================================
1762 if test "$COMPILE_ENVIRONMENT"; then
1763 configure_static_assert_macros='
1764 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1765 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1766 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1769 dnl test that the macros actually work:
1770 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1771 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1772  [AC_LANG_SAVE
1773   AC_LANG_C
1774   ac_cv_static_assertion_macros_work="yes"
1775   AC_TRY_COMPILE([$configure_static_assert_macros],
1776                  [CONFIGURE_STATIC_ASSERT(1)],
1777                  ,
1778                  ac_cv_static_assertion_macros_work="no")
1779   AC_TRY_COMPILE([$configure_static_assert_macros],
1780                  [CONFIGURE_STATIC_ASSERT(0)],
1781                  ac_cv_static_assertion_macros_work="no",
1782                  )
1783   AC_LANG_CPLUSPLUS
1784   AC_TRY_COMPILE([$configure_static_assert_macros],
1785                  [CONFIGURE_STATIC_ASSERT(1)],
1786                  ,
1787                  ac_cv_static_assertion_macros_work="no")
1788   AC_TRY_COMPILE([$configure_static_assert_macros],
1789                  [CONFIGURE_STATIC_ASSERT(0)],
1790                  ac_cv_static_assertion_macros_work="no",
1791                  )
1792   AC_LANG_RESTORE
1793  ])
1794 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1795 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1796     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1798 fi # COMPILE_ENVIRONMENT
1800 dnl ========================================================
1801 dnl Checking for 64-bit OS
1802 dnl ========================================================
1803 if test "$COMPILE_ENVIRONMENT"; then
1804 AC_LANG_SAVE
1805 AC_LANG_C
1806 AC_MSG_CHECKING(for 64-bit OS)
1807 AC_TRY_COMPILE([$configure_static_assert_macros],
1808                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1809                result="yes", result="no")
1810 AC_MSG_RESULT("$result")
1811 if test "$result" = "yes"; then
1812     AC_DEFINE(HAVE_64BIT_OS)
1813     HAVE_64BIT_OS=1
1815 AC_SUBST(HAVE_64BIT_OS)
1816 AC_LANG_RESTORE
1817 fi # COMPILE_ENVIRONMENT
1819 dnl ========================================================
1820 dnl Enable high-memory support on OS/2 by default.
1821 dnl ========================================================
1822 MOZ_OS2_HIGH_MEMORY=1
1823 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1824 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1825     MOZ_OS2_HIGH_MEMORY=,
1826     MOZ_OS2_HIGH_MEMORY=1 )
1827 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1829 dnl ========================================================
1830 dnl System overrides of the defaults for host
1831 dnl ========================================================
1832 case "$host" in
1833 *-beos*)
1834     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1835     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1836     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1837     ;;
1839 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1840     # we need Python 2.5 on Windows
1841     PYTHON_VERSION=2.5
1842     if test -n "$_WIN32_MSVC"; then
1843         HOST_AR=lib
1844         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1845         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1846         HOST_RANLIB='echo ranlib'
1847     else
1848         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1849     fi
1850     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1851     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1852     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1853     HOST_BIN_SUFFIX=.exe
1854     case "$host" in
1855     *mingw*)
1856     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1857         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1858         ;;
1859     *)
1860         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1861         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1862             _pwd=`pwd`
1863             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1864         fi
1865         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1866             AS_PERL=1
1867             PERL="${CYGWIN_WRAPPER} $PERL"
1868         fi
1870         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1871             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1872         fi
1873         ;;
1874     esac
1876     case "${host_cpu}" in
1877     x86_64)
1878         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1879         ;;
1880     esac
1881     ;;
1883 *-darwin*)
1884     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1885     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1886     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1887     ;;
1889 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1890     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1891     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1892     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1893     ;;
1895 *os2*)
1896     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1897     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1898     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1899     HOST_BIN_SUFFIX=.exe
1900     MOZ_FIX_LINK_PATHS=
1901     ;;
1903 *-osf*)
1904     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1905     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1906     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1907     ;;
1910     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1911     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1912     ;;
1913 esac
1915 dnl We require version 2.4 or newer of Python to build,
1916 dnl and 2.5 or newer on Windows.
1917 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1918 changequote(,)
1919 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1920 _python_res=$?
1921 changequote([,])
1922 if test "$_python_res" != 0; then
1923     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1925 AC_MSG_RESULT([yes])
1927 dnl Get mozilla version from central milestone file
1928 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1930 dnl Get version of various core apps from the version files.
1931 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1933 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1934 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1936 dnl ========================================================
1937 dnl System overrides of the defaults for target
1938 dnl ========================================================
1940 case "$target" in
1941 *-aix*)
1942     AC_DEFINE(AIX)
1943     if test ! "$GNU_CC"; then
1944         if test ! "$HAVE_64BIT_OS"; then
1945             # Compiling with Visual Age C++ object model compat is the
1946             # default. To compile with object model ibm, add 
1947             # AIX_OBJMODEL=ibm to .mozconfig.
1948             if test "$AIX_OBJMODEL" = "ibm"; then
1949                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1950             else
1951                 AIX_OBJMODEL=compat
1952             fi
1953         else
1954             AIX_OBJMODEL=compat
1955         fi
1956         AC_SUBST(AIX_OBJMODEL)
1957         DSO_LDOPTS='-qmkshrobj=1'
1958         DSO_CFLAGS='-qflag=w:w'
1959         DSO_PIC_CFLAGS=
1960         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1961         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1962         MOZ_FIX_LINK_PATHS=
1963         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1964         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1965         if test "$COMPILE_ENVIRONMENT"; then
1966             AC_LANG_SAVE
1967             AC_LANG_CPLUSPLUS
1968             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1969             AC_TRY_COMPILE([],
1970                 [#if (__IBMCPP__ < 600)
1971                  #error "Bad compiler"
1972                  #endif],
1973                 _BAD_COMPILER=,_BAD_COMPILER=1)
1974             if test -n "$_BAD_COMPILER"; then
1975                 AC_MSG_RESULT([no])    
1976                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1977             else
1978                 AC_MSG_RESULT([yes])    
1979             fi
1980             AC_LANG_RESTORE
1981             TARGET_COMPILER_ABI="ibmc"
1982             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1983             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1984         fi
1985     fi
1986     case "${target_os}" in
1987     aix4.1*)
1988         DLL_SUFFIX='_shr.a'
1989         ;;
1990     esac
1991     if test "$COMPILE_ENVIRONMENT"; then
1992         AC_CHECK_HEADERS(sys/inttypes.h)
1993     fi
1994     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1995     ;;
1997 *-beos*)
1998     no_x=yes
1999     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
2000     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
2001     DSO_LDOPTS='-nostart'
2002     TK_LIBS='-lbe -lroot'
2003     LIBS="$LIBS -lbe"
2004     if test "$COMPILE_ENVIRONMENT"; then
2005         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
2006         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
2007     fi
2008     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
2009     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
2010     _MOZ_USE_RTTI=1
2011     USE_DEPENDENT_LIBS=
2012     MOZ_USER_DIR="Mozilla"
2013     ;;
2015 *-bsdi*)
2016     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2017     _PEDANTIC=
2018     case $OS_RELEASE in
2019         4.*|5.*)
2020             STRIP="$STRIP -d"
2021             ;;
2022         *)
2023             DSO_CFLAGS=''
2024             DSO_LDOPTS='-r'
2025             _WARNINGS_CFLAGS="-Wall"
2026             _WARNINGS_CXXFLAGS="-Wall"
2027             # The test above doesn't work properly, at least on 3.1.
2028             MKSHLIB_FORCE_ALL=''
2029             MKSHLIB_UNFORCE_ALL=''
2030         ;;
2031     esac
2032     ;;
2034 *-darwin*) 
2035     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2036     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2037     MOZ_OPTIMIZE_FLAGS="-O3"
2038     _PEDANTIC=
2039     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2040     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2041     DLL_SUFFIX=".dylib"
2042     DSO_LDOPTS=''
2043     STRIP="$STRIP -x -S"
2044     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2045     MOZ_ENABLE_POSTSCRIPT=
2046     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2047     # The ExceptionHandling framework is needed for Objective-C exception
2048     # logging code in nsObjCExceptions.h. Currently we only use that in debug
2049     # builds.
2050     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2052     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2053     dnl ===================================================================
2054     if test "x$enable_dtrace" = "xyes"; then
2055         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2056     else
2057         dnl check for the presence of the -dead_strip linker flag
2058         AC_MSG_CHECKING([for -dead_strip option to ld])
2059         _SAVE_LDFLAGS=$LDFLAGS
2060         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2061         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2062         if test -n "$_HAVE_DEAD_STRIP" ; then
2063             AC_MSG_RESULT([yes])
2064             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2065         else
2066             AC_MSG_RESULT([no])
2067         fi
2068         
2069         LDFLAGS=$_SAVE_LDFLAGS
2070     fi
2071     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2072     ;;
2074 *-freebsd*)
2075     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2076         DLL_SUFFIX=".so.1.0"
2077         DSO_LDOPTS="-shared"
2078     fi
2079     if test ! "$GNU_CC"; then
2080         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2081     fi
2082 # Can't have force w/o an unforce.
2083 #    # Hack for FreeBSD 2.2
2084 #    if test -z "$MKSHLIB_FORCE_ALL"; then
2085 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
2086 #       MKSHLIB_UNFORCE_ALL=''
2087 #    fi
2088     ;; 
2090 ia64*-hpux*)
2091     DLL_SUFFIX=".so"
2092     if test ! "$GNU_CC"; then
2093        DSO_LDOPTS='-b'
2094        DSO_CFLAGS=""
2095        DSO_PIC_CFLAGS=
2096        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2097        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2098        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2099     else
2100        DSO_LDOPTS='-b -E'
2101        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2102        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2103     fi
2104     MOZ_FIX_LINK_PATHS=
2105     SYSTEM_MAKEDEPEND=
2106     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2107     AC_DEFINE(_LARGEFILE64_SOURCE)
2108     ;;
2110 *-hpux*)
2111     DLL_SUFFIX=".sl"
2112     if test ! "$GNU_CC"; then
2113         DSO_LDOPTS='-b -Wl,+s'
2114         DSO_CFLAGS=""
2115         DSO_PIC_CFLAGS="+Z"
2116         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2117         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2118         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2119     else
2120         DSO_LDOPTS='-b -E +s'
2121         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2122         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2123     fi
2124     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2125     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2126     ;;
2128 *-irix5*)
2129     AC_DEFINE(IRIX)
2130     DSO_LDOPTS='-elf -shared'
2132     if test "$GNU_CC"; then
2133        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2134        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2135        MKSHLIB_FORCE_ALL='-Wl,-all'
2136        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2137        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2138     else
2139        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2140        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2141        MKSHLIB_FORCE_ALL='-all'
2142        MKSHLIB_UNFORCE_ALL='-none'
2143     fi
2144     ;;
2146 *-irix6*)
2147     AC_DEFINE(IRIX)
2148     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2149     dnl compile and link using -n32
2150     USE_N32=1
2151     TARGET_COMPILER_ABI=n32
2152     DSO_LDOPTS='-elf -shared'
2153     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2154     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2155     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2156     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2157     if test "$GNU_CC"; then
2158        MKSHLIB_FORCE_ALL='-Wl,-all'
2159        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2160        _WARNINGS_CFLAGS="-Wall"
2161        _WARNINGS_CXXFLAGS="-Wall"
2162        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2163     else
2164        MKSHLIB_FORCE_ALL='-all'
2165        MKSHLIB_UNFORCE_ALL='-none'
2166            AR_LIST="$AR t"
2167            AR_EXTRACT="$AR x"
2168            AR_DELETE="$AR d"
2169            AR='$(CXX) -ar'
2170            AR_FLAGS='-o $@'
2171        CFLAGS="$CFLAGS -woff 3262 -G 4"
2172        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2173        if test -n "$USE_N32"; then
2174            ASFLAGS="$ASFLAGS -n32"
2175            CFLAGS="$CFLAGS -n32"
2176            CXXFLAGS="$CXXFLAGS -n32"
2177            LDFLAGS="$LDFLAGS -n32"
2178        fi
2179        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2180        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2181        MOZ_FIX_LINK_PATHS=
2182     fi
2183     if test -z "$GNU_CXX"; then
2184       MIPSPRO_CXX=1
2185     fi
2186     ;;
2188 *-*linux*)
2189     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2190     # Similarly for GNU_CXX and INTEL_CXX.
2191     if test "$INTEL_CC" || test "$INTEL_CXX"; then
2192         # -Os has been broken on Intel's C/C++ compilers for quite a
2193         # while; Intel recommends against using it.
2194         MOZ_OPTIMIZE_FLAGS="-O2"
2195         MOZ_DEBUG_FLAGS="-g"
2196     elif test "$GNU_CC" || test "$GNU_CXX"; then
2197         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2198         case $GCC_VERSION in
2199         4.1.*|4.2.*)
2200             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
2201             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2202         esac
2203         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2204         MOZ_DEBUG_FLAGS="-g"
2205     fi
2207     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2209     MOZ_MEMORY=1
2211     case "${target_cpu}" in
2212     alpha*)
2213         CFLAGS="$CFLAGS -mieee"
2214         CXXFLAGS="$CXXFLAGS -mieee"
2215     ;;
2216     i*86)
2217         USE_ELF_DYNSTR_GC=1
2218     ;;
2219     mips*)
2220         MOZ_DEBUG_FLAGS="-g" # We want inlining
2221     ;;
2222     esac
2223     ;;
2225 *-wince*|*-winmo*)
2226     TARGET_COMPILER_ABI=msvc
2227     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2228     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2229     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2230     AR_LIST="$AR -list"
2231     AR_EXTRACT="$AR -extract"
2232     AR_DELETE="$AR d"
2233     AR_FLAGS='-OUT:"$@"'
2234     MOZ_MEMORY=1
2235     NSS_DISABLE_DBM=1
2236     MOZ_OGG=
2237     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2239     if test "$AS_BIN"; then
2240         AS="$AS_BIN"
2241     fi
2242     DSO_CFLAGS=
2243     DSO_PIC_CFLAGS=
2244     DLL_SUFFIX=.dll
2245     BIN_SUFFIX='.exe'
2246     if test -z "$RC"; then 
2247         RC=rc.exe  
2248     fi
2249     # certain versions of cygwin's makedepend barf on the 
2250     # #include <string> vs -I./dist/include/string issue so don't use it
2251     SYSTEM_MAKEDEPEND=
2253     HOST_CC=cl
2254     HOST_CXX=cl
2255     HOST_LD=link
2256     HOST_AR='lib -OUT:$@'
2257     HOST_RANLIB='echo ranlib'
2258     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2259         
2260         
2261     WARNINGS_AS_ERRORS='-WX'
2262     MOZ_OPTIMIZE_FLAGS='-Ox'
2263     AR_FLAGS='-NOLOGO -OUT:"$@"'
2264     ASM_SUFFIX=asm
2265     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2266     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2267     DLL_PREFIX=
2268     DOXYGEN=:
2269     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2270     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2271     GARBAGE=
2272     IMPORT_LIB_SUFFIX=lib
2273     dnl Need to force-link against mozalloc because it's used in the shunt
2274     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2275     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2276     LIB_PREFIX=
2277     LIB_SUFFIX=lib 
2278     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2279     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2280     MKSHLIB_FORCE_ALL=
2281     MKSHLIB_UNFORCE_ALL=
2282     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2283     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2284     MOZ_DEBUG_FLAGS='-Zi'
2285     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2286     MOZ_FIX_LINK_PATHS=
2287     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2288     OBJ_SUFFIX=obj
2289     RANLIB='echo not_ranlib'
2290     STRIP='echo not_strip'
2291     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2292     UNZIP=unzip
2293     XARGS=xargs
2294     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2295     ZIP=zip
2296     MOZ_TREE_FREETYPE=1
2298     AC_DEFINE(HAVE_SNPRINTF)
2299     AC_DEFINE(_WINDOWS)
2300     AC_DEFINE(WIN32)
2301     AC_DEFINE(XP_WIN)
2302     AC_DEFINE(XP_WIN32)
2303     AC_DEFINE(HW_THREADS)
2304     AC_DEFINE(STDC_HEADERS)
2305     AC_DEFINE(NEW_H, <new>)
2306     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2307     AC_DEFINE(HAVE_LOCALTIME_R)
2309     TARGET_MD_ARCH=win32
2310     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2311     BIN_SUFFIX='.exe'
2312     MOZ_ENABLE_POSTSCRIPT=
2313     MOZ_USER_DIR="Mozilla"
2315     MOZ_GFX_OPTIMIZE_MOBILE=1
2317     # Sanity check for WINCE_WINDOWS_MOBILE
2318     # XXX disabled until we can fix the mobile tinderbox
2319     ##if test "$WINCE_WINDOWS_MOBILE"; then
2320     ##   AC_CHECK_HEADER(tpcshell.h, [],
2321     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2322     ##fi
2326 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2327     DSO_CFLAGS=
2328     DSO_PIC_CFLAGS=
2329     DLL_SUFFIX=.dll
2330     RC=rc.exe
2331     # certain versions of cygwin's makedepend barf on the 
2332     # #include <string> vs -I./dist/include/string issue so don't use it
2333     SYSTEM_MAKEDEPEND=
2334     if test -n "$GNU_CC"; then
2335         CC="$CC -mno-cygwin"
2336         CXX="$CXX -mno-cygwin"
2337         CPP="$CPP -mno-cygwin"
2338         CFLAGS="$CFLAGS -mms-bitfields"
2339         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2340         DSO_LDOPTS='-shared'
2341         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2342         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2343         RC='$(WINDRES)'
2344         # Use temp file for windres (bug 213281)
2345         RCFLAGS='-O coff --use-temp-file'
2346         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2347         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2348         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2349         MOZ_FIX_LINK_PATHS=
2350         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2351         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2352         DLL_PREFIX=
2353         IMPORT_LIB_SUFFIX=dll.a
2354         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2355     else
2356         TARGET_COMPILER_ABI=msvc
2357         HOST_CC='$(CC)'
2358         HOST_CXX='$(CXX)'
2359         HOST_LD='$(LD)'
2360         if test "$AS_BIN"; then
2361             AS="$(basename "$AS_BIN")"
2362         fi
2363         AR='lib -NOLOGO -OUT:"$@"'
2364         AR_FLAGS=
2365         RANLIB='echo not_ranlib'
2366         STRIP='echo not_strip'
2367         XARGS=xargs
2368         ZIP=zip
2369         UNZIP=unzip
2370         DOXYGEN=:
2371         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2372         ASM_SUFFIX=asm
2373         OBJ_SUFFIX=obj
2374         LIB_SUFFIX=lib
2375         DLL_PREFIX=
2376         LIB_PREFIX=
2377         IMPORT_LIB_SUFFIX=lib
2378         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2379         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2380         MKSHLIB_FORCE_ALL=
2381         MKSHLIB_UNFORCE_ALL=
2382         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2383         _USE_CPP_INCLUDE_FLAG=1
2384         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2385         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2386         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2387         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2388         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2389         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2390         MOZ_DEBUG_FLAGS='-Zi'
2391         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2392         WARNINGS_AS_ERRORS='-WX'
2393         MOZ_OPTIMIZE_FLAGS='-O1'
2394         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2395         MOZ_FIX_LINK_PATHS=
2396         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2397         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2398         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2399         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2400         if test $_MSC_VER -ge 1400; then
2401             LDFLAGS="$LDFLAGS -NXCOMPAT"
2402             dnl For profile-guided optimization
2403             PROFILE_GEN_CFLAGS="-GL"
2404             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2405             dnl XXX: PGO builds can fail with warnings treated as errors,
2406             dnl specifically "no profile data available" appears to be
2407             dnl treated as an error sometimes. This might be a consequence
2408             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2409             dnl with the linker doing most of the work in the whole-program
2410             dnl optimization/PGO case. I think it's probably a compiler bug,
2411             dnl but we work around it here.
2412             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2413             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2414             dnl Probably also a compiler bug, but what can you do?
2415             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2416             if test -n "$_USE_DYNAMICBASE"; then
2417                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2418             fi
2419         fi
2420     fi
2421     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2422     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2423     AC_DEFINE(HAVE_SNPRINTF)
2424     AC_DEFINE(_WINDOWS)
2425     AC_DEFINE(WIN32)
2426     AC_DEFINE(XP_WIN)
2427     AC_DEFINE(XP_WIN32)
2428     AC_DEFINE(HW_THREADS)
2429     AC_DEFINE(STDC_HEADERS)
2430     AC_DEFINE(NEW_H, <new>)
2431     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2432     TARGET_MD_ARCH=win32
2433     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2434     BIN_SUFFIX='.exe'
2435     MOZ_ENABLE_POSTSCRIPT=
2436     MOZ_USER_DIR="Mozilla"
2438     dnl Hardcode to win95 for now - cls
2439     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2441     dnl set NO_X11 defines here as the general check is skipped on win32
2442     no_x=yes
2443     AC_DEFINE(NO_X11)
2445     dnl MinGW/MSYS doesn't provide or need cygpath
2446     case "$host" in
2447     *-mingw*)
2448         CYGPATH_W=echo
2449         CYGPATH_S=cat
2450         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2451         ;;
2452     *-cygwin*|*-msvc*|*-mks*)
2453         CYGPATH_W="cygpath -a -w"
2454         CYGPATH_S="sed -e s|\\\\|/|g"
2455         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2456         ;;
2457     esac
2458     case "$host" in
2459     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2461     if test -z "$MOZ_TOOLS"; then
2462         AC_MSG_ERROR([MOZ_TOOLS is not set])
2463     fi
2465     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2466     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2467         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2468     fi
2469     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2470     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2471         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2472     fi
2473     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2474     ;;
2475     esac 
2478     case "$host_os" in
2479     cygwin*|msvc*|mks*)
2480         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])
2481         ;;
2483     *)
2484         AC_CHECK_HEADERS(oleacc.idl)
2486         AC_LANG_SAVE
2487         AC_LANG_CPLUSPLUS
2488         AC_CHECK_HEADERS(atlbase.h)
2489         AC_LANG_RESTORE
2490         ;;
2491     esac
2493     case "$target" in
2494     i*86-*)
2495         if test "$HAVE_64BIT_OS"; then
2496             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2497         fi
2499         if test $_MSC_VER -ge 1400; then
2500             LDFLAGS="$LDFLAGS -SAFESEH"
2501         fi
2502         AC_CHECK_HEADERS(mmintrin.h)
2503         AC_DEFINE(_X86_)
2504         ;;
2505     alpha-*)
2506         AC_DEFINE(_ALPHA_)
2507         ;;
2508     mips-*)
2509         AC_DEFINE(_MIPS_)
2510         ;;
2511     x86_64-*)
2512         AC_DEFINE(_AMD64_)
2513         ;;
2514     *)
2515         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2516         ;;
2517     esac
2519     if test "$HAVE_64BIT_OS"; then
2520         AC_DEFINE(_WIN64)
2521     fi
2522     ;;
2524 *-netbsd*)
2525     DSO_CFLAGS=''
2526     CFLAGS="$CFLAGS -Dunix"
2527     CXXFLAGS="$CXXFLAGS -Dunix"
2528     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2529         DLL_SUFFIX=".so"
2530         DSO_PIC_CFLAGS='-fPIC -DPIC'
2531         DSO_LDOPTS='-shared'
2532         BIN_FLAGS='-Wl,--export-dynamic'
2533     else
2534         DSO_PIC_CFLAGS='-fPIC -DPIC'
2535         DLL_SUFFIX=".so.1.0"
2536         DSO_LDOPTS='-shared'
2537     fi
2538     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2539     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2540     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2541     if test "$LIBRUNPATH"; then
2542         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2543     fi
2544     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2545     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2546     ;;
2548 *-nto*) 
2549         AC_DEFINE(NTO)  
2550         AC_DEFINE(_QNX_SOURCE)
2551         AC_DEFINE(_i386)
2552         OS_TARGET=NTO
2553         WARNINGS_AS_ERRORS=''
2554         MOZ_OPTIMIZE_FLAGS="-O"
2555         MOZ_DEBUG_FLAGS="-gstabs"
2556         USE_PTHREADS=1
2557         _PEDANTIC=
2558         LIBS="$LIBS -lsocket -lstdc++"
2559         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2560         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2561         if test "$with_x" != "yes"
2562         then
2563                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2564             TK_CFLAGS='-I/usr/include/photon'
2565                 TK_LIBS='-lph'
2566         fi
2567         case "${target_cpu}" in
2568         ppc*)
2569         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2570         ;;
2571         esac
2572         case "${host_cpu}" in
2573         i*86)
2574         USE_ELF_DYNSTR_GC=1
2575         ;;
2576         esac
2577         ;;
2579 *-openbsd*)
2580     DLL_SUFFIX=".so.1.0"
2581     DSO_CFLAGS=''
2582     DSO_PIC_CFLAGS='-fPIC'
2583     DSO_LDOPTS='-shared -fPIC'
2584     if test "$LIBRUNPATH"; then
2585         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2586     fi
2587     ;;
2589 *-openvms*) 
2590     AC_DEFINE(NO_PW_GECOS)
2591     AC_DEFINE(NO_UDSOCK)
2592     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2593     USE_PTHREADS=1
2594     MKSHLIB_FORCE_ALL='-all'
2595     MKSHLIB_UNFORCE_ALL='-none'
2596     AS='as'
2597     AS_DASH_C_FLAG='-Wc/names=as_is'
2598     AR_FLAGS='c $@'
2599     DSO_LDOPTS='-shared -auto_symvec'
2600     DSO_PIC_CFLAGS=
2601     MOZ_DEBUG_LDFLAGS='-g'
2602     COMPAQ_CXX=1
2603     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2604     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2605     ;;
2608 *-os2*)
2609     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2610     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2611     AC_DEFINE(OS2)
2612     AC_DEFINE(XP_OS2)
2613     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2614     AC_DEFINE(TCPV40HDRS)
2615     DLL_PREFIX=
2616     LIB_PREFIX=
2617     LIB_SUFFIX=lib
2618     BIN_SUFFIX=".exe"
2619     DLL_SUFFIX=".dll"
2620     IMPORT_LIB_SUFFIX=lib
2621     DSO_PIC_CFLAGS=
2622     AR=emxomfar
2623     AR_FLAGS='r $@'
2624     CFLAGS="$CFLAGS -Zomf"
2625     CXXFLAGS="$CXXFLAGS -Zomf"
2626     DSO_LDOPTS='-Zdll'
2627     BIN_FLAGS='-Zlinker /ST:0x100000'
2628     IMPLIB='emximp -o'
2629     FILTER='emxexp -o'
2630     LDFLAGS='-Zmap'
2631     WARNINGS_AS_ERRORS='-Werror'
2632     MOZ_DEBUG_FLAGS="-g -fno-inline"
2633     MOZ_OPTIMIZE_FLAGS="-O2"
2634     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2635     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2636     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2637     TARGET_MD_ARCH=os2
2638     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2639     MOZ_ENABLE_POSTSCRIPT=
2640     RC=rc.exe
2641     RCFLAGS='-n'
2642     MOZ_USER_DIR="Mozilla"
2644     if test "$MOZTOOLS"; then
2645         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2646     else
2647         AC_MSG_ERROR([MOZTOOLS is not set])
2648     fi
2649     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2650         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2651         LDFLAGS="$LDFLAGS -Zhigh-mem"
2652         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2653         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2654     fi
2656     # GCC for OS/2 currently predefines these, but we don't want them
2657     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2658     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2660     AC_CACHE_CHECK(for __declspec(dllexport),
2661         ac_os2_declspec,
2662         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2663                         [return 0;],
2664                         ac_os2_declspec="yes",
2665                         ac_os2_declspec="no")])
2666     if test "$ac_os2_declspec" = "yes"; then
2667         FILTER='true'
2668         MOZ_OS2_USE_DECLSPEC='1'
2669     fi
2670     ;;
2672 alpha*-*-osf*)
2673     if test "$GNU_CC"; then
2674       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2675       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2677     else
2678         MOZ_DEBUG_FLAGS='-g'
2679         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2680         CFLAGS="$CFLAGS -ieee"
2681         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2682         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2683         DSO_CFLAGS=
2684         DSO_PIC_CFLAGS=
2685         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2686         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2687         MKSHLIB_FORCE_ALL='-all'
2688         MKSHLIB_UNFORCE_ALL='-none'
2689         dnl Might fix the libxpcom.so breakage on this platform as well....
2690         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2691         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2692     fi
2693     if test -z "$GNU_CXX"; then
2694       COMPAQ_CXX=1
2695     fi
2696     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2697     ;;
2699 *-qnx*) 
2700     DIRENT_INO=d_stat.st_ino
2701     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2702     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2703     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2704     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2705     AC_DEFINE(STDC_HEADERS)
2706     if test "$no_x" = "yes"; then
2707             _PLATFORM_DEFAULT_TOOLKIT='photon'
2708             TK_CFLAGS='-I/usr/nto/include/photon'
2709             TK_LIBS='-lphoton -lphrender'
2710     fi
2711     ;;
2713 *-sco*) 
2714     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2715     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2716     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2717     if test ! "$GNU_CC"; then
2718        DSO_LDOPTS='-G'
2719     fi
2720     ;;
2722 *-solaris*) 
2723     AC_DEFINE(SOLARIS)
2724     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2725     SYSTEM_MAKEDEPEND=
2726     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2727     # libraries one level up (e.g. libnspr4.so)
2728     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2729     if test "$SOLARIS_SUNPRO_CC"; then
2730        LIBS="-lCrun -lCstd $LIBS"
2731        NS_USE_NATIVE=1
2732        MOZ_FIX_LINK_PATHS=
2733        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2734        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2735        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath"
2736        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2737        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2738        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2739        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2740            _SAVE_LDFLAGS=$LDFLAGS
2741            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2742            AC_TRY_LINK([#include <stdio.h>],
2743                        [printf("Hello World\n");],
2744                        ,
2745                        [LDFLAGS=$_SAVE_LDFLAGS])
2746        fi
2747        WARNINGS_AS_ERRORS='-Werror'
2748        MOZ_OPTIMIZE_FLAGS="-xO4"
2749        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2750        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2751        MKSHLIB_FORCE_ALL='-z allextract'
2752        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2753        DSO_LDOPTS='-G -z muldefs'
2754        AR_LIST="$AR t"
2755        AR_EXTRACT="$AR x"
2756        AR_DELETE="$AR d"
2757        AR='$(CXX) -xar'
2758        AR_FLAGS='-o $@'
2759        AS='/usr/ccs/bin/as'
2760        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2761        AS_DASH_C_FLAG=''
2762        TARGET_COMPILER_ABI="sunc"
2763        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2764        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2765        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2766        AC_LANG_SAVE
2767        AC_LANG_CPLUSPLUS
2768        AC_TRY_COMPILE([],
2769            [#if (__SUNPRO_CC < 0x590)
2770            #error "Denied"
2771            #endif],
2772            _BAD_COMPILER=,_BAD_COMPILER=1)
2773         if test -n "$_BAD_COMPILER"; then
2774             _res="no"
2775             AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2776         else
2777             _res="yes"
2778         fi
2779         AC_MSG_RESULT([$_res])
2780         AC_LANG_RESTORE
2781     else
2782        ASFLAGS="$ASFLAGS -fPIC"
2783        DSO_LDOPTS='-G'
2784        _WARNINGS_CFLAGS=''
2785        _WARNINGS_CXXFLAGS=''
2786        if test "$OS_RELEASE" = "5.3"; then
2787           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2788        fi
2789     fi
2790     if test "$OS_RELEASE" = "5.5.1"; then
2791        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2792     fi
2793     ;;
2795 *-sunos*) 
2796     DSO_LDOPTS='-Bdynamic'
2797     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2798     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2799     AC_DEFINE(SUNOS4)
2800     AC_DEFINE(SPRINTF_RETURNS_STRING)
2801     case "$(target_os)" in
2802     sunos4.1*)
2803         DLL_SUFFIX='.so.1.0'
2804         ;;
2805     esac
2806     ;;
2808 *-sysv4.2uw7*) 
2809         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2810     ;;
2812 *-os2*)
2813     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2814     ;;
2816 *-android*)
2817     AC_DEFINE(NO_PW_GECOS)
2818     no_x=yes
2819     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2820     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2822     MOZ_GFX_OPTIMIZE_MOBILE=1
2823     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2824     ;;
2826 esac
2828 dnl Only one oddball right now (QNX), but this gives us flexibility
2829 dnl if any other platforms need to override this in the future.
2830 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2832 dnl ========================================================
2833 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2834 dnl by now will not have any way to link most binaries (tests
2835 dnl as well as viewer, apprunner, etc.), because some symbols
2836 dnl will be left out of the "composite" .so's by ld as unneeded.
2837 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2838 dnl they can link in the static libs that provide the missing
2839 dnl symbols.
2840 dnl ========================================================
2841 NO_LD_ARCHIVE_FLAGS=
2842 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2843     NO_LD_ARCHIVE_FLAGS=1
2845 case "$target" in
2846 *-os2*)
2847     NO_LD_ARCHIVE_FLAGS=
2848     ;;
2849 *-aix4.3*|*-aix5*)
2850     NO_LD_ARCHIVE_FLAGS=
2851     ;;
2852 *-openvms*)
2853     NO_LD_ARCHIVE_FLAGS=
2854     ;;
2855 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2856     if test -z "$GNU_CC"; then
2857         NO_LD_ARCHIVE_FLAGS=
2858     fi
2859     ;;
2860 esac
2861 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2863 dnl ========================================================
2864 dnl = Flags to strip unused symbols from .so components
2865 dnl ========================================================
2866 case "$target" in
2867     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2868         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2869         ;;
2870     *-solaris*)
2871         if test -z "$GNU_CC"; then
2872          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2873         else
2874          if test -z "$GCC_USE_GNU_LD"; then
2875           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2876          else
2877           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2878          fi
2879         fi
2880         ;;
2881     *-nto*) 
2882         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2883         ;;
2884     *-darwin*)
2885         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2886         ;;
2887     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2888         if test -n "$GNU_CC"; then
2889            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2890         fi
2891         ;;
2892 esac
2894 if test -z "$COMPILE_ENVIRONMENT"; then
2895     SKIP_COMPILER_CHECKS=1
2896     SKIP_LIBRARY_CHECKS=1
2899 if test -z "$SKIP_COMPILER_CHECKS"; then
2900 dnl Checks for typedefs, structures, and compiler characteristics.
2901 dnl ========================================================
2902 AC_LANG_C
2903 AC_HEADER_STDC
2904 AC_C_CONST
2905 AC_TYPE_MODE_T
2906 AC_TYPE_OFF_T
2907 AC_TYPE_PID_T
2908 AC_TYPE_SIZE_T
2909 AC_MSG_CHECKING(for __stdcall)
2910 AC_CACHE_VAL(ac_cv___stdcall,
2911  [AC_TRY_COMPILE([],
2912                  [void foo(); void __stdcall foo();],
2913                  [ac_cv___stdcall=true],
2914                  [ac_cv___stdcall=false])])
2915 if test "$ac_cv___stdcall" = true ; then
2916   AC_DEFINE(HAVE_STDCALL)
2917   AC_MSG_RESULT(yes)
2918 else
2919   AC_MSG_RESULT(no)
2921 AC_MSG_CHECKING(for ssize_t)
2922 AC_CACHE_VAL(ac_cv_type_ssize_t,
2923  [AC_TRY_COMPILE([#include <stdio.h>
2924                   #include <sys/types.h>],
2925                  [ssize_t foo = 0;],
2926                  [ac_cv_type_ssize_t=true],
2927                  [ac_cv_type_ssize_t=false])])
2928 if test "$ac_cv_type_ssize_t" = true ; then
2929   AC_DEFINE(HAVE_SSIZE_T)
2930   AC_MSG_RESULT(yes)
2931 else
2932   AC_MSG_RESULT(no)
2934 AC_STRUCT_ST_BLKSIZE
2935 AC_MSG_CHECKING(for siginfo_t)
2936 AC_CACHE_VAL(ac_cv_siginfo_t,
2937  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2938                   #include <signal.h>],
2939                  [siginfo_t* info;],
2940                  [ac_cv_siginfo_t=true],
2941                  [ac_cv_siginfo_t=false])])
2942 if test "$ac_cv_siginfo_t" = true ; then
2943   AC_DEFINE(HAVE_SIGINFO_T)
2944   AC_MSG_RESULT(yes)
2945 else
2946   AC_MSG_RESULT(no)
2949 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2950 dnl ========================================================
2951 AC_MSG_CHECKING(for int16_t)
2952 AC_CACHE_VAL(ac_cv_int16_t,
2953  [AC_TRY_COMPILE([#include <stdio.h>
2954                   #include <sys/types.h>],
2955                  [int16_t foo = 0;],
2956                  [ac_cv_int16_t=true],
2957                  [ac_cv_int16_t=false])])
2958 if test "$ac_cv_int16_t" = true ; then
2959   AC_DEFINE(HAVE_INT16_T)
2960   AC_MSG_RESULT(yes)
2961 else
2962   AC_MSG_RESULT(no)
2964 AC_MSG_CHECKING(for int32_t)
2965 AC_CACHE_VAL(ac_cv_int32_t,
2966  [AC_TRY_COMPILE([#include <stdio.h>
2967                   #include <sys/types.h>],
2968                  [int32_t foo = 0;],
2969                  [ac_cv_int32_t=true],
2970                  [ac_cv_int32_t=false])])
2971 if test "$ac_cv_int32_t" = true ; then
2972   AC_DEFINE(HAVE_INT32_T)
2973   AC_MSG_RESULT(yes)
2974 else
2975   AC_MSG_RESULT(no)
2977 AC_MSG_CHECKING(for int64_t)
2978 AC_CACHE_VAL(ac_cv_int64_t,
2979  [AC_TRY_COMPILE([#include <stdio.h>
2980                   #include <sys/types.h>],
2981                  [int64_t foo = 0;],
2982                  [ac_cv_int64_t=true],
2983                  [ac_cv_int64_t=false])])
2984 if test "$ac_cv_int64_t" = true ; then
2985   AC_DEFINE(HAVE_INT64_T)
2986   AC_MSG_RESULT(yes)
2987 else
2988   AC_MSG_RESULT(no)
2990 AC_MSG_CHECKING(for int64)
2991 AC_CACHE_VAL(ac_cv_int64,
2992  [AC_TRY_COMPILE([#include <stdio.h>
2993                   #include <sys/types.h>],
2994                  [int64 foo = 0;],
2995                  [ac_cv_int64=true],
2996                  [ac_cv_int64=false])])
2997 if test "$ac_cv_int64" = true ; then
2998   AC_DEFINE(HAVE_INT64)
2999   AC_MSG_RESULT(yes)
3000 else
3001   AC_MSG_RESULT(no)
3003 AC_MSG_CHECKING(for uint)
3004 AC_CACHE_VAL(ac_cv_uint,
3005  [AC_TRY_COMPILE([#include <stdio.h>
3006                   #include <sys/types.h>],
3007                  [uint foo = 0;],
3008                  [ac_cv_uint=true],
3009                  [ac_cv_uint=false])])
3010 if test "$ac_cv_uint" = true ; then
3011   AC_DEFINE(HAVE_UINT)
3012   AC_MSG_RESULT(yes)
3013 else
3014   AC_MSG_RESULT(no)
3016 AC_MSG_CHECKING(for uint_t)
3017 AC_CACHE_VAL(ac_cv_uint_t,
3018  [AC_TRY_COMPILE([#include <stdio.h>
3019                   #include <sys/types.h>],
3020                  [uint_t foo = 0;],
3021                  [ac_cv_uint_t=true],
3022                  [ac_cv_uint_t=false])])
3023 if test "$ac_cv_uint_t" = true ; then
3024   AC_DEFINE(HAVE_UINT_T)
3025   AC_MSG_RESULT(yes)
3026 else
3027   AC_MSG_RESULT(no)
3029 AC_MSG_CHECKING(for uint16_t)
3030 AC_CACHE_VAL(ac_cv_uint16_t,
3031  [AC_TRY_COMPILE([#include <stdio.h>
3032                   #include <sys/types.h>],
3033                  [uint16_t foo = 0;],
3034                  [ac_cv_uint16_t=true],
3035                  [ac_cv_uint16_t=false])])
3036 if test "$ac_cv_uint16_t" = true ; then
3037   AC_DEFINE(HAVE_UINT16_T)
3038   AC_MSG_RESULT(yes)
3039 else
3040   AC_MSG_RESULT(no)
3043 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3044 dnl are defined when compiling C++ but not C.  Since the result of this
3045 dnl test is used only in C++, do it in C++.
3046 AC_LANG_CPLUSPLUS
3048 AC_MSG_CHECKING(for uname.domainname)
3049 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3050     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3051         [ struct utsname *res; char *domain; 
3052             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3053         [ac_cv_have_uname_domainname_field=true],
3054         [ac_cv_have_uname_domainname_field=false])])
3056 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3057     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3058     AC_MSG_RESULT(yes)
3059 else
3060     AC_MSG_RESULT(no)
3063 AC_MSG_CHECKING(for uname.__domainname)
3064 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3065     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3066         [ struct utsname *res; char *domain; 
3067             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3068         [ac_cv_have_uname_us_domainname_field=true],
3069         [ac_cv_have_uname_us_domainname_field=false])])
3071 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3072     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3073     AC_MSG_RESULT(yes)
3074 else
3075     AC_MSG_RESULT(no)
3078 AC_LANG_CPLUSPLUS
3080 dnl Check for usable char16_t (2 bytes, unsigned)
3081 dnl (we might not need the unsignedness check anymore)
3082 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3083     ac_cv_have_usable_char16_t,
3084     [AC_TRY_COMPILE([$configure_static_assert_macros],
3085                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3086                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3087                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3088                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3089                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3090                     ac_cv_have_usable_char16_t="yes",
3091                     ac_cv_have_usable_char16_t="no")])
3092 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3093     AC_DEFINE(HAVE_CPP_CHAR16_T)
3094     HAVE_CPP_CHAR16_T=1
3097 dnl Check for usable wchar_t (2 bytes, unsigned)
3098 dnl (we really don't need the unsignedness check anymore)
3099 dnl ========================================================
3101 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3102     ac_cv_have_usable_wchar_v2,
3103     [AC_TRY_COMPILE([#include <stddef.h>
3104                      $configure_static_assert_macros],
3105                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3106                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3107                     ac_cv_have_usable_wchar_v2="yes",
3108                     ac_cv_have_usable_wchar_v2="no")])
3109 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3110     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3111     HAVE_CPP_2BYTE_WCHAR_T=1
3112 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3113 dnl This is really gcc-only
3114 dnl Do this test using CXX only since some versions of gcc
3115 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3116 dnl only have short-wchar support for c++.
3117 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3119     _SAVE_CXXFLAGS=$CXXFLAGS
3120     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3122     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3123         ac_cv_have_usable_wchar_option_v2,
3124         [AC_TRY_LINK([#include <stddef.h>
3125                       $configure_static_assert_macros],
3126                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3127                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3128                      ac_cv_have_usable_wchar_option_v2="yes",
3129                      ac_cv_have_usable_wchar_option_v2="no")])
3131     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3132         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3133         HAVE_CPP_2BYTE_WCHAR_T=1
3134         WCHAR_CFLAGS="-fshort-wchar"
3135     else    
3136         CXXFLAGS=$_SAVE_CXXFLAGS
3137     fi
3140 AC_LANG_C
3142 dnl Check for .hidden assembler directive and visibility attribute.
3143 dnl Borrowed from glibc configure.in
3144 dnl ===============================================================
3145 if test "$GNU_CC"; then
3146   AC_CACHE_CHECK(for visibility(hidden) attribute,
3147                  ac_cv_visibility_hidden,
3148                  [cat > conftest.c <<EOF
3149                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3151                   ac_cv_visibility_hidden=no
3152                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3153                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3154                       ac_cv_visibility_hidden=yes
3155                     fi
3156                   fi
3157                   rm -f conftest.[cs]
3158                  ])
3159   if test "$ac_cv_visibility_hidden" = "yes"; then
3160     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3162     AC_CACHE_CHECK(for visibility(default) attribute,
3163                    ac_cv_visibility_default,
3164                    [cat > conftest.c <<EOF
3165                     int foo __attribute__ ((visibility ("default"))) = 1;
3167                     ac_cv_visibility_default=no
3168                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3169                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3170                         ac_cv_visibility_default=yes
3171                       fi
3172                     fi
3173                     rm -f conftest.[cs]
3174                    ])
3175     if test "$ac_cv_visibility_default" = "yes"; then
3176       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3178       AC_CACHE_CHECK(for visibility pragma support,
3179                      ac_cv_visibility_pragma,
3180                      [cat > conftest.c <<EOF
3181 #pragma GCC visibility push(hidden)
3182                       int foo_hidden = 1;
3183 #pragma GCC visibility push(default)
3184                       int foo_default = 1;
3186                       ac_cv_visibility_pragma=no
3187                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3188                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3189                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3190                             ac_cv_visibility_pragma=yes
3191                           fi
3192                         fi
3193                       fi
3194                       rm -f conftest.[cs]
3195                     ])
3196       if test "$ac_cv_visibility_pragma" = "yes"; then
3197         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3198                        ac_cv_have_visibility_class_bug,
3199                        [cat > conftest.c <<EOF
3200 #pragma GCC visibility push(hidden)
3201 struct __attribute__ ((visibility ("default"))) TestStruct {
3202   static void Init();
3204 __attribute__ ((visibility ("default"))) void TestFunc() {
3205   TestStruct::Init();
3208                        ac_cv_have_visibility_class_bug=no
3209                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3210                          ac_cv_have_visibility_class_bug=yes
3211                        else
3212                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3213                            ac_cv_have_visibility_class_bug=yes
3214                          fi
3215                        fi
3216                        rm -rf conftest.{c,S}
3217                        ])
3219         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3220                        ac_cv_have_visibility_builtin_bug,
3221                        [cat > conftest.c <<EOF
3222 #pragma GCC visibility push(hidden)
3223 #pragma GCC visibility push(default)
3224 #include <string.h>
3225 #pragma GCC visibility pop
3227 __attribute__ ((visibility ("default"))) void Func() {
3228   char c[[100]];
3229   memset(c, 0, sizeof(c));
3232                        ac_cv_have_visibility_builtin_bug=no
3233                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3234                          ac_cv_have_visibility_builtin_bug=yes
3235                        else
3236                          if test `grep -c "@PLT" conftest.S` = 0; then
3237                            ac_cv_visibility_builtin_bug=yes
3238                          fi
3239                        fi
3240                        rm -f conftest.{c,S}
3241                        ])
3242         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3243                 "$ac_cv_have_visibility_class_bug" = "no"; then
3244           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3245           WRAP_SYSTEM_INCLUDES=1
3246           STL_FLAGS='-I$(DIST)/stl_wrappers'
3247           WRAP_STL_INCLUDES=1
3248         else
3249           VISIBILITY_FLAGS='-fvisibility=hidden'
3250         fi # have visibility pragma bug
3251       fi   # have visibility pragma
3252     fi     # have visibility(default) attribute
3253   fi       # have visibility(hidden) attribute
3254 fi         # GNU_CC
3256 # visibility hidden flag for Sun Studio on Solaris
3257 if test "$SOLARIS_SUNPRO_CC"; then
3258 VISIBILITY_FLAGS='-xldscope=hidden'
3259 fi         # Sun Studio on Solaris
3261 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3262 AC_SUBST(VISIBILITY_FLAGS)
3264 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3265 dnl ========================================================
3266 if test "$GNU_CC"; then
3267   CFLAGS_save="${CFLAGS}"
3268   CFLAGS="${CFLAGS} -Werror"
3269   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3270                  ac_cv_force_align_arg_pointer,
3271                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3272                                  [],
3273                                  ac_cv_force_align_arg_pointer="yes",
3274                                  ac_cv_force_align_arg_pointer="no")])
3275   CFLAGS="${CFLAGS_save}"
3276   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3277     HAVE_GCC_ALIGN_ARG_POINTER=1
3278   else
3279     HAVE_GCC_ALIGN_ARG_POINTER=
3280   fi
3282 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3284 dnl Checks for header files.
3285 dnl ========================================================
3286 AC_HEADER_DIRENT
3287 case "$target_os" in
3288 freebsd*)
3289 # for stuff like -lXshm
3290     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3291     ;;
3292 esac
3293 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3294 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3295 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3296 AC_CHECK_HEADERS(malloc.h)
3297 AC_CHECK_HEADERS(X11/XKBlib.h)
3298 AC_CHECK_HEADERS(io.h)
3300 dnl These are all the places some variant of statfs can be hiding.
3301 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3303 dnl Quota support
3304 AC_CHECK_HEADERS(sys/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`" && test -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`" && test -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" || test "$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 By default, turn rtti and exceptions off on g++/egcs
4030 dnl ========================================================
4031 if test "$GNU_CXX"; then
4033   AC_MSG_CHECKING(for C++ exceptions flag)
4035   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
4036   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
4037   [echo "int main() { return 0; }" | cat > conftest.C
4039   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
4041   if egrep "warning.*renamed" conftest.out >/dev/null; then
4042     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
4043   else
4044     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
4045   fi
4047   rm -f conftest*])
4049   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
4050   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
4051   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
4054 dnl ========================================================
4055 dnl Put your C++ language/feature checks below
4056 dnl ========================================================
4057 AC_LANG_CPLUSPLUS
4059 ARM_ABI_PREFIX=
4060 HAVE_GCC3_ABI=
4061 if test "$GNU_CC"; then
4062   if test "$CPU_ARCH" = "arm" ; then
4063     AC_CACHE_CHECK(for ARM EABI,
4064         ac_cv_gcc_arm_eabi,
4065         [AC_TRY_COMPILE([],
4066                         [
4067 #if defined(__ARM_EABI__)
4068   return 0;
4069 #else
4070 #error Not ARM EABI.
4071 #endif
4072                         ],
4073                         ac_cv_gcc_arm_eabi="yes",
4074                         ac_cv_gcc_arm_eabi="no")])
4075     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4076         HAVE_ARM_EABI=1
4077         ARM_ABI_PREFIX=eabi-
4078     else
4079         ARM_ABI_PREFIX=oabi-
4080     fi
4081   fi
4083   AC_CACHE_CHECK(for gcc 3.0 ABI,
4084       ac_cv_gcc_three_abi,
4085       [AC_TRY_COMPILE([],
4086                       [
4087 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4088   return 0;
4089 #else
4090 #error Not gcc3.
4091 #endif
4092                       ],
4093                       ac_cv_gcc_three_abi="yes",
4094                       ac_cv_gcc_three_abi="no")])
4095   if test "$ac_cv_gcc_three_abi" = "yes"; then
4096       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4097       HAVE_GCC3_ABI=1
4098   else
4099       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4100   fi
4102 AC_SUBST(HAVE_GCC3_ABI)
4105 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4106                ac_cv_cpp_explicit,
4107                [AC_TRY_COMPILE(class X {
4108                                public: explicit X(int i) : i_(i) {}
4109                                private: int i_;
4110                                };,
4111                                X x(3);,
4112                                ac_cv_cpp_explicit=yes,
4113                                ac_cv_cpp_explicit=no)])
4114 if test "$ac_cv_cpp_explicit" = yes ; then
4115    AC_DEFINE(HAVE_CPP_EXPLICIT)
4118 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4119                ac_cv_cpp_typename,
4120                [AC_TRY_COMPILE(class param {
4121                                public:
4122                                    typedef unsigned long num_type;
4123                                };
4125                                template <class T> class tplt {
4126                                public:
4127                                    typedef typename T::num_type t_num_type;
4128                                    t_num_type foo(typename T::num_type num) {
4129                                        return num;
4130                                    }
4131                                };,
4132                                tplt<param> A;
4133                                A.foo(0);,
4134                                ac_cv_cpp_typename=yes,
4135                                ac_cv_cpp_typename=no)])
4136 if test "$ac_cv_cpp_typename" = yes ; then
4137    AC_DEFINE(HAVE_CPP_TYPENAME)
4140 dnl Check for support of modern template specialization syntax
4141 dnl Test code and requirement from scc@netscape.com.
4142 dnl Autoconf cut-and-paste job by waterson@netscape.com
4143 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4144                ac_cv_cpp_modern_specialize_template_syntax,
4145                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4146                                class Y {};
4147                                template <> struct X<Y> { double a; };,
4148                                X<int> int_x;
4149                                X<Y> y_x;,
4150                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4151                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4152 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4153   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4157 dnl Some compilers support only full specialization, and some don't.
4158 AC_CACHE_CHECK(whether partial template specialization works,
4159                ac_cv_cpp_partial_specialization,
4160                [AC_TRY_COMPILE(template <class T> class Foo {};
4161                                template <class T> class Foo<T*> {};,
4162                                return 0;,
4163                                ac_cv_cpp_partial_specialization=yes,
4164                                ac_cv_cpp_partial_specialization=no)])
4165 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4166   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4169 dnl Some compilers have limited support for operators with templates;
4170 dnl specifically, it is necessary to define derived operators when a base
4171 dnl class's operator declaration should suffice.
4172 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4173                ac_cv_need_derived_template_operators,
4174                [AC_TRY_COMPILE([template <class T> class Base { };
4175                                 template <class T>
4176                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4177                                 template <class T> class Derived : public Base<T> { };],
4178                                [Derived<char> a, b;
4179                                 Base<char> c = a + b;
4180                                 return 0;],
4181                                ac_cv_need_derived_template_operators=no,
4182                                ac_cv_need_derived_template_operators=yes)])
4183 if test "$ac_cv_need_derived_template_operators" = yes ; then
4184   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4188 dnl Some compilers have trouble detecting that a template class
4189 dnl that derives from another template is actually an instance
4190 dnl of the base class. This test checks for that.
4191 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4192                ac_cv_need_cpp_template_cast_to_base,
4193                [AC_TRY_COMPILE([template <class T> class Base { };
4194                                 template <class T> class Derived : public Base<T> { };
4195                                 template <class T> int foo(const Base<T>&) { return 0; }],
4196                                [Derived<char> bar; return foo(bar);],
4197                                ac_cv_need_cpp_template_cast_to_base=no,
4198                                ac_cv_need_cpp_template_cast_to_base=yes)])
4199 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4200   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4203 dnl Some compilers have trouble resolving the ambiguity between two
4204 dnl functions whose arguments differ only by cv-qualifications.
4205 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4206                ac_cv_can_resolve_const_ambiguity,
4207                [AC_TRY_COMPILE([
4208                                 template <class T> class ptrClass {
4209                                   public: T* ptr;
4210                                 };
4212                                 template <class T> T* a(ptrClass<T> *arg) {
4213                                   return arg->ptr;
4214                                 }
4216                                 template <class T>
4217                                 const T* a(const ptrClass<T> *arg) {
4218                                   return arg->ptr;
4219                                 }
4220                                ],
4221                                [ ptrClass<int> i;
4222                                  a(&i); ],
4223                                ac_cv_can_resolve_const_ambiguity=yes,
4224                                ac_cv_can_resolve_const_ambiguity=no)])
4225 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4226   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4230 dnl We don't do exceptions on unix.  The only reason this used to be here
4231 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4232 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4233 dnl So im commenting this out until someone writes some artificial 
4234 dnl intelligence to detect not only if the compiler has exceptions, but if 
4235 dnl they are enabled as well.
4236 dnl 
4237 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4238 dnl                ac_cv_cpp_exceptions,
4239 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4240 dnl                                static void F() { throw X(); },
4241 dnl                                try { F(); } catch(X & e) { },
4242 dnl                                ac_cv_cpp_exceptions=yes,
4243 dnl                                ac_cv_cpp_exceptions=no)])
4244 dnl if test $ac_cv_cpp_exceptions = yes ; then
4245 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4246 dnl fi
4248 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4249 dnl supports it well enough to allow us to use it to change access, but not
4250 dnl to resolve ambiguity. The next two tests determine how well the |using|
4251 dnl keyword is supported.
4253 dnl Check to see if we can change access with |using|.  Test both a
4254 dnl legal and an illegal example.
4255 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4256                ac_cv_cpp_access_changing_using2,
4257                [AC_TRY_COMPILE(
4258                    class A { protected: int foo() { return 0; } };
4259                    class B : public A { public: using A::foo; };,
4260                    B b; return b.foo();,
4261                    [AC_TRY_COMPILE(
4262                        class A { public: int foo() { return 1; } };
4263                        class B : public A { private: using A::foo; };,
4264                        B b; return b.foo();,
4265                        ac_cv_cpp_access_changing_using2=no,
4266                        ac_cv_cpp_access_changing_using2=yes)],
4267                    ac_cv_cpp_access_changing_using2=no)])
4268 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4269    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4272 dnl Check to see if we can resolve ambiguity with |using|.
4273 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4274                ac_cv_cpp_ambiguity_resolving_using,
4275                [AC_TRY_COMPILE(class X { 
4276                                  public: int go(const X&) {return 3;}
4277                                          int jo(const X&) {return 3;}
4278                                };
4279                                class Y : public X {
4280                                  public:  int go(int) {return 2;}
4281                                           int jo(int) {return 2;}
4282                                           using X::jo;
4283                                  private: using X::go;
4284                                };,
4285                                X x; Y y; y.jo(x);,
4286                                ac_cv_cpp_ambiguity_resolving_using=yes,
4287                                ac_cv_cpp_ambiguity_resolving_using=no)])
4288 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4289    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4292 dnl Check to see if the |std| namespace is supported. If so, we'll want
4293 dnl to qualify any standard library calls with "std::" to ensure that
4294 dnl those functions can be resolved.
4295 AC_CACHE_CHECK(for \"std::\" namespace,
4296                ac_cv_cpp_namespace_std,
4297                [AC_TRY_COMPILE([#include <algorithm>],
4298                                [return std::min(0, 1);],
4299                                ac_cv_cpp_namespace_std=yes,
4300                                ac_cv_cpp_namespace_std=no)])
4301 if test "$ac_cv_cpp_namespace_std" = yes ; then
4302    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4305 dnl Older compilers are overly ambitious with respect to using the standard
4306 dnl template library's |operator!=()| when |operator==()| is defined. In
4307 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4308 dnl ambiguity at compile-time. This test checks for that case.
4309 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4310                ac_cv_cpp_unambiguous_std_notequal,
4311                [AC_TRY_COMPILE([#include <algorithm>
4312                                 struct T1 {};
4313                                 int operator==(const T1&, const T1&) { return 0; }
4314                                 int operator!=(const T1&, const T1&) { return 0; }],
4315                                [T1 a,b; return a != b;],
4316                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4317                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4318 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4319   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4323 AC_CACHE_CHECK(for C++ reinterpret_cast,
4324                ac_cv_cpp_reinterpret_cast,
4325                [AC_TRY_COMPILE(struct X { int i; };
4326                                struct Y { int i; };,
4327                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4328                                ac_cv_cpp_reinterpret_cast=yes,
4329                                ac_cv_cpp_reinterpret_cast=no)])
4330 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4331    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4334 dnl See if a dynamic_cast to void* gives the most derived object.
4335 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4336                ac_cv_cpp_dynamic_cast_void_ptr,
4337                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4338                             class Y { int j; public: virtual ~Y() { } };
4339                             class Z : public X, public Y { int k; };
4341                             int main() {
4342                                  Z mdo;
4343                                  X *subx = (X*)&mdo;
4344                                  Y *suby = (Y*)&mdo;
4345                                  return !((((void*)&mdo != (void*)subx) &&
4346                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4347                                           (((void*)&mdo != (void*)suby) &&
4348                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4349                             }],
4350                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4351                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4352                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4353 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4354    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4358 dnl note that this one is reversed - if the test fails, then
4359 dnl we require implementations of unused virtual methods. Which
4360 dnl really blows because it means we'll have useless vtable
4361 dnl bloat.
4362 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4363                ac_cv_cpp_unused_required,
4364                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4365                                X x;,
4366                                ac_cv_cpp_unused_required=no,
4367                                ac_cv_cpp_unused_required=yes)])
4368 if test "$ac_cv_cpp_unused_required" = yes ; then
4369    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4373 dnl Some compilers have trouble comparing a constant reference to a templatized
4374 dnl class to zero, and require an explicit operator==() to be defined that takes
4375 dnl an int. This test separates the strong from the weak.
4377 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4378                ac_cv_trouble_comparing_to_zero,
4379                [AC_TRY_COMPILE([#include <algorithm>
4380                                 template <class T> class Foo {};
4381                                 class T2;
4382                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4383                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4384                                [Foo<int> f; return (0 != f);],
4385                                ac_cv_trouble_comparing_to_zero=no,
4386                                ac_cv_trouble_comparing_to_zero=yes)])
4387 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4388   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4391 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4392 _SAVE_LDFLAGS=$LDFLAGS
4393 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4394 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4395                ac_cv_thread_keyword,
4396                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4397                             [return tlsIsMainThread;],
4398                             ac_cv_thread_keyword=yes,
4399                             ac_cv_thread_keyword=no)])
4400 LDFLAGS=$_SAVE_LDFLAGS
4401 if test "$ac_cv_thread_keyword" = yes; then
4402   # mips builds fail with TLS variables because of a binutils bug.
4403   # See bug 528687
4404   case "${target}" in
4405     mips*-*)
4406       :
4407       ;;
4408     *-android*)
4409       :
4410       ;;
4411     *)
4412       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4413       ;;
4414   esac
4417 dnl Check for the existence of various allocation headers/functions
4419 MALLOC_H=
4420 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4421 if test "$MALLOC_H" = ""; then
4422   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4423   if test "$MALLOC_H" = ""; then
4424     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4425   fi
4427 if test "$MALLOC_H" != ""; then
4428    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4431 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4432 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4434 dnl See if compiler supports some gcc-style attributes
4436 AC_CACHE_CHECK(for __attribute__((always_inline)),
4437                ac_cv_attribute_always_inline,
4438                [AC_TRY_COMPILE([],
4439                                [inline void f(void) __attribute__((always_inline));],
4440                                ac_cv_attribute_always_inline=yes,
4441                                ac_cv_attribute_always_inline=no)])
4443 AC_CACHE_CHECK(for __attribute__((malloc)),
4444                ac_cv_attribute_malloc,
4445                [AC_TRY_COMPILE([],
4446                                [void* f(int) __attribute__((malloc));],
4447                                ac_cv_attribute_malloc=yes,
4448                                ac_cv_attribute_malloc=no)])
4450 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4451                ac_cv_attribute_warn_unused,
4452                [AC_TRY_COMPILE([],
4453                                [int f(void) __attribute__((warn_unused_result));],
4454                                ac_cv_attribute_warn_unused=yes,
4455                                ac_cv_attribute_warn_unused=no)])
4457 AC_CACHE_CHECK(for __attribute__((noreturn)),
4458                ac_cv_attribute_noreturn,
4459                [AC_TRY_COMPILE([],
4460                                [void f(void) __attribute__((noreturn));],
4461                                ac_cv_attribute_noreturn=yes,
4462                                ac_cv_attribute_noreturn=no)])
4464 dnl End of C++ language/feature checks
4465 AC_LANG_C
4467 dnl ========================================================
4468 dnl =  Internationalization checks
4469 dnl ========================================================
4471 dnl Internationalization and Locale support is different
4472 dnl on various UNIX platforms.  Checks for specific i18n
4473 dnl features go here.
4475 dnl check for LC_MESSAGES
4476 AC_CACHE_CHECK(for LC_MESSAGES,
4477                 ac_cv_i18n_lc_messages,
4478                 [AC_TRY_COMPILE([#include <locale.h>],
4479                                 [int category = LC_MESSAGES;],
4480                                 ac_cv_i18n_lc_messages=yes,
4481                                 ac_cv_i18n_lc_messages=no)])
4482 if test "$ac_cv_i18n_lc_messages" = yes; then
4483    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4486 AC_HAVE_FUNCS(localeconv)
4488 fi # SKIP_COMPILER_CHECKS
4490 TARGET_XPCOM_ABI=
4491 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4492     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4495 dnl Mozilla specific options
4496 dnl ========================================================
4497 dnl The macros used for command line options
4498 dnl are defined in build/autoconf/altoptions.m4.
4500 dnl If the compiler supports these attributes, define them as
4501 dnl convenience macros.
4502 if test "$ac_cv_attribute_always_inline" = yes ; then
4503   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4504 else
4505   AC_DEFINE(NS_ALWAYS_INLINE,)
4508 if test "$ac_cv_attribute_malloc" = yes ; then
4509   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4510 else
4511   AC_DEFINE(NS_ATTR_MALLOC,)
4514 if test "$ac_cv_attribute_warn_unused" = yes ; then
4515   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4516 else
4517   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4520 if test "$ac_cv_attribute_noreturn" = yes ; then
4521   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4522 else
4523   AC_DEFINE(NS_NORETURN,)
4526 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4527 dnl features that Windows actually does support.
4529 if test -n "$SKIP_COMPILER_CHECKS"; then
4530    dnl Windows has malloc.h
4531    AC_DEFINE(MALLOC_H, [<malloc.h>])
4532    AC_DEFINE(HAVE_FORCEINLINE)
4533    AC_DEFINE(HAVE_LOCALECONV)
4534 fi # SKIP_COMPILER_CHECKS
4536 dnl ========================================================
4537 dnl =
4538 dnl = Check for external package dependencies
4539 dnl =
4540 dnl ========================================================
4541 MOZ_ARG_HEADER(External Packages)
4543 MOZ_ENABLE_LIBXUL=1
4545 MOZ_ARG_WITH_STRING(libxul-sdk,
4546 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4547   LIBXUL_SDK_DIR=$withval)
4549 if test "$LIBXUL_SDK_DIR" = "yes"; then
4550     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4551 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4552     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4554     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4555         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4556     fi
4558     MOZ_ENABLE_LIBXUL=1
4560 AC_SUBST(LIBXUL_SDK)
4562 if test -n "$LIBXUL_SDK"; then
4563     LIBXUL_DIST="$LIBXUL_SDK"
4564 else
4565     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4567 AC_SUBST(LIBXUL_DIST)
4569 SYSTEM_LIBXUL=
4571 MOZ_ARG_WITH_BOOL(system-libxul,
4572 [  --with-system-libxul    Use system installed libxul SDK],
4573     SYSTEM_LIBXUL=1)
4575 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4576     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4579 dnl ========================================================
4580 dnl = If NSPR was not detected in the system, 
4581 dnl = use the one in the source tree (mozilla/nsprpub)
4582 dnl ========================================================
4583 MOZ_ARG_WITH_BOOL(system-nspr,
4584 [  --with-system-nspr      Use system installed NSPR],
4585     _USE_SYSTEM_NSPR=1 )
4587 if test -n "$_USE_SYSTEM_NSPR"; then
4588     AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4591 if test -n "$MOZ_NATIVE_NSPR"; then
4592     _SAVE_CFLAGS=$CFLAGS
4593     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4594     AC_TRY_COMPILE([#include "prtypes.h"],
4595                 [#ifndef PR_STATIC_ASSERT
4596                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4597                  #endif],
4598                 [MOZ_NATIVE_NSPR=1],
4599                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4600     CFLAGS=$_SAVE_CFLAGS
4601 else
4602     if test "$OS_ARCH" = "WINCE"; then
4603         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4604         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4605     elif test "$OS_ARCH" = "WINNT"; then
4606         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4607         if test -n "$GNU_CC"; then
4608             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4609         else
4610             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4611         fi
4612     else
4613         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4614         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4615     fi
4618 dnl system libevent Support
4619 dnl ========================================================
4620 MOZ_ARG_WITH_STRING(system-libevent,
4621 [  --with-system-libevent=[PFX]
4622                           Use system libevent [installed at prefix PFX]],
4623     LIBEVENT_DIR=$withval)
4625 _SAVE_CFLAGS=$CFLAGS
4626 _SAVE_LDFLAGS=$LDFLAGS
4627 _SAVE_LIBS=$LIBS
4628 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4629     MOZ_NATIVE_LIBEVENT=
4630 else
4631     if test "${LIBEVENT_DIR}" = "yes"; then
4632         LIBEVENT_DIR=/usr
4633     fi
4634     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4635     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4636     AC_CHECK_HEADER(event.h,
4637                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4638                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4639                      fi],
4640                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4641     AC_CHECK_LIB(event, event_init,
4642                  [MOZ_NATIVE_LIBEVENT=1
4643                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4644                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4645                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4647 CFLAGS=$_SAVE_CFLAGS
4648 LDFLAGS=$_SAVE_LDFLAGS
4649 LIBS=$_SAVE_LIBS
4651 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4652 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4653 AC_SUBST(MOZ_LIBEVENT_LIBS)
4655 dnl ========================================================
4656 dnl = If NSS was not detected in the system, 
4657 dnl = use the one in the source tree (mozilla/security/nss)
4658 dnl ========================================================
4660 MOZ_ARG_WITH_BOOL(system-nss,
4661 [  --with-system-nss       Use system installed NSS],
4662     _USE_SYSTEM_NSS=1 )
4664 if test -n "$_USE_SYSTEM_NSS"; then
4665     AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4668 if test -n "$MOZ_NATIVE_NSS"; then
4669    NSS_LIBS="$NSS_LIBS -lcrmf"
4670 else
4671    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4672    NSS_DEP_LIBS="\
4673         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4674         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4675         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4676         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4677         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4679    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4680        NSS_LIBS="\
4681         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4682         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4683         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4684         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4685         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4686    else
4687        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4688    fi
4691 if test -z "$SKIP_LIBRARY_CHECKS"; then
4692 dnl system JPEG support
4693 dnl ========================================================
4694 MOZ_ARG_WITH_STRING(system-jpeg,
4695 [  --with-system-jpeg[=PFX]
4696                           Use system libjpeg [installed at prefix PFX]],
4697     JPEG_DIR=$withval)
4699 _SAVE_CFLAGS=$CFLAGS
4700 _SAVE_LDFLAGS=$LDFLAGS
4701 _SAVE_LIBS=$LIBS
4702 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4703     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4704     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4706 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4707     SYSTEM_JPEG=
4708 else
4709     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4712 if test "$SYSTEM_JPEG" = 1; then
4713     LIBS="$JPEG_LIBS $LIBS"
4714     AC_TRY_COMPILE([ #include <stdio.h>
4715                      #include <sys/types.h>
4716                      #include <jpeglib.h> ],
4717                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4718                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4719                      #endif ],
4720                    SYSTEM_JPEG=1,
4721                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4722 fi 
4723 CFLAGS=$_SAVE_CFLAGS
4724 LDFLAGS=$_SAVE_LDFLAGS
4725 LIBS=$_SAVE_LIBS
4727 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4728     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4729     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4732 dnl system ZLIB support
4733 dnl ========================================================
4734 MOZ_ARG_WITH_STRING(system-zlib,
4735 [  --with-system-zlib[=PFX]
4736                           Use system libz [installed at prefix PFX]],
4737     ZLIB_DIR=$withval)
4739 _SAVE_CFLAGS=$CFLAGS
4740 _SAVE_LDFLAGS=$LDFLAGS
4741 _SAVE_LIBS=$LIBS
4742 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4743     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4744     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4746 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4747     SYSTEM_ZLIB=
4748 else
4749     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4750         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4752 if test "$SYSTEM_ZLIB" = 1; then
4753     LIBS="$ZLIB_LIBS $LIBS"
4754     AC_TRY_COMPILE([ #include <stdio.h>
4755                      #include <string.h>
4756                      #include <zlib.h> ],
4757                    [ #if ZLIB_VERNUM < $MOZZLIB 
4758                      #error "Insufficient zlib version ($MOZZLIB required)."
4759                      #endif ],
4760                    SYSTEM_ZLIB=1,
4761                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4763 CFLAGS=$_SAVE_CFLAGS
4764 LDFLAGS=$_SAVE_LDFLAGS
4765 LIBS=$_SAVE_LIBS
4767 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4768     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4769     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4772 dnl system BZIP2 Support
4773 dnl ========================================================
4774 MOZ_ARG_WITH_STRING(system-bz2,
4775 [  --with-system-bz2[=PFX]
4776                           Use system libbz2 [installed at prefix PFX]],
4777     BZ2_DIR=$withval)
4779 _SAVE_CFLAGS=$CFLAGS
4780 _SAVE_LDFLAGS=$LDFLAGS
4781 _SAVE_LIBS=$LIBS
4782 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4783     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4784     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4786 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4787     SYSTEM_BZ2=
4788 else
4789     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4790         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4792 CFLAGS=$_SAVE_CFLAGS
4793 LDFLAGS=$_SAVE_LDFLAGS
4794 LIBS=$_SAVE_LIBS
4796 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4797     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4798     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4801 dnl system PNG Support
4802 dnl ========================================================
4803 MOZ_ARG_WITH_STRING(system-png, 
4804 [  --with-system-png[=PFX]
4805                           Use system libpng [installed at prefix PFX]],
4806     PNG_DIR=$withval)
4808 _SAVE_CFLAGS=$CFLAGS
4809 _SAVE_LDFLAGS=$LDFLAGS
4810 _SAVE_LIBS=$LIBS
4811 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4812 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4813 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4814     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4815     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4817 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4818     SYSTEM_PNG=
4819 else
4820     _SAVE_PNG_LIBS=$PNG_LIBS
4821     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4822                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4823                  $PNG_LIBS)
4824     AC_CHECK_LIB(png, png_get_acTL, ,
4825                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4826                  $_SAVE_PNG_LIBS)
4828 if test "$SYSTEM_PNG" = 1; then
4829     LIBS="$PNG_LIBS $LIBS"
4830     AC_TRY_COMPILE([ #include <stdio.h>
4831                      #include <sys/types.h>
4832                      #include <png.h> ],
4833                    [ #if PNG_LIBPNG_VER < $MOZPNG
4834                      #error "Insufficient libpng version ($MOZPNG required)."
4835                      #endif
4836                      #ifndef PNG_UINT_31_MAX
4837                      #error "Insufficient libpng version."
4838                      #endif ],
4839                    SYSTEM_PNG=1,
4840                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4842 CFLAGS=$_SAVE_CFLAGS
4843 LDFLAGS=$_SAVE_LDFLAGS
4844 LIBS=$_SAVE_LIBS
4846 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4847     PNG_CFLAGS="-I${PNG_DIR}/include"
4848     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4851 fi # SKIP_LIBRARY_CHECKS
4853 dnl system HunSpell Support
4854 dnl ========================================================
4855 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4856 [  --enable-system-hunspell
4857                           Use system hunspell (located with pkgconfig)],
4858     SYSTEM_HUNSPELL=1 )
4860 if test -n "$SYSTEM_HUNSPELL"; then
4861     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4864 AC_SUBST(SYSTEM_HUNSPELL)
4866 dnl ========================================================
4867 dnl Java SDK support
4868 dnl ========================================================
4869 JAVA_INCLUDE_PATH=
4870 MOZ_ARG_WITH_STRING(java-include-path,
4871 [  --with-java-include-path=dir
4872                           Location of Java SDK headers],
4873     JAVA_INCLUDE_PATH=$withval)
4875 JAVA_BIN_PATH=
4876 MOZ_ARG_WITH_STRING(java-bin-path,
4877 [  --with-java-bin-path=dir
4878                           Location of Java binaries (java, javac, jar)],
4879     JAVA_BIN_PATH=$withval)
4881 dnl ========================================================
4882 dnl =
4883 dnl = Application
4884 dnl =
4885 dnl ========================================================
4887 MOZ_ARG_HEADER(Application)
4889 BUILD_STATIC_LIBS=
4890 ENABLE_TESTS=1
4891 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4892 MOZ_BRANDING_DIRECTORY=
4893 MOZ_OFFICIAL_BRANDING=
4894 MOZ_FEEDS=1
4895 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4896 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4897 MOZ_INSTALLER=1
4898 MOZ_IPC=1
4899 MOZ_JAVAXPCOM=
4900 MOZ_JSDEBUGGER=1
4901 MOZ_JSLOADER=1
4902 MOZ_MATHML=1
4903 MOZ_MORK=
4904 MOZ_MORKREADER=1
4905 MOZ_AUTH_EXTENSION=1
4906 MOZ_NO_ACTIVEX_SUPPORT=1
4907 MOZ_NO_INSPECTOR_APIS=
4908 MOZ_NO_FAST_LOAD=
4909 MOZ_OGG=1
4910 MOZ_SYDNEYAUDIO=
4911 MOZ_WAVE=1
4912 MOZ_MEDIA=
4913 MOZ_PANGO=1
4914 MOZ_PERMISSIONS=1
4915 MOZ_PLACES=1
4916 MOZ_PLAINTEXT_EDITOR_ONLY=
4917 MOZ_PLUGINS=1
4918 MOZ_PREF_EXTENSIONS=1
4919 MOZ_PROFILELOCKING=1
4920 MOZ_PSM=1
4921 MOZ_RDF=1
4922 MOZ_REFLOW_PERF=
4923 MOZ_SAFE_BROWSING=
4924 MOZ_FASTSTART=
4925 MOZ_HELP_VIEWER=
4926 MOZ_SPELLCHECK=1
4927 MOZ_SPLASHSCREEN=
4928 MOZ_STORAGE=1
4929 MOZ_SVG=1
4930 MOZ_THUMB2=
4931 MOZ_TIMELINE=
4932 MOZ_TOOLKIT_SEARCH=1
4933 MOZ_UI_LOCALE=en-US
4934 MOZ_UNIVERSALCHARDET=1
4935 MOZ_URL_CLASSIFIER=
4936 MOZ_USE_NATIVE_UCONV=
4937 MOZ_VIEW_SOURCE=1
4938 MOZ_XSLT_STANDALONE=
4939 MOZ_XTF=1
4940 MOZ_XUL=1
4941 MOZ_ZIPWRITER=1
4942 NS_PRINTING=1
4943 NSS_DISABLE_DBM=
4944 NECKO_WIFI=1
4945 NECKO_COOKIES=1
4946 NECKO_DISK_CACHE=1
4947 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4948 USE_ARM_KUSER=
4949 BUILD_CTYPES=1
4950 XPC_IDISPATCH_SUPPORT=
4953 case "$target_os" in
4954 darwin*|*wince*|*winmo*)
4955     ACCESSIBILITY=
4956     ;;
4958     ACCESSIBILITY=1
4959     ;;
4960 esac
4962 case "$target_os" in
4963     msvc*|mks*|cygwin*|mingw*)
4964         NS_ENABLE_TSF=1
4965         if test -z "$GNU_CC"; then 
4966             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4967                 NS_ENABLE_TSF=
4968             fi
4969             XPC_IDISPATCH_SUPPORT=1
4970             MOZ_NO_ACTIVEX_SUPPORT=
4971         fi
4972         if test -n "$NS_ENABLE_TSF"; then
4973             AC_DEFINE(NS_ENABLE_TSF)
4974         fi
4975         ;;
4976 esac
4978 case "${target}" in
4979     arm-android-eabi)
4980         NSS_DISABLE_DBM=1
4981         USE_ARM_KUSER=1
4982         MOZ_INSTALLER=
4983         MOZ_CRASHREPORTER=
4984         NS_PRINTING=
4985         NECKO_WIFI=
4986         MOZ_PLUGINS=
4987         MOZ_THUMB2=1
4988         MOZ_THEME_FASTSTRIPE=1
4989         MOZ_TREE_FREETYPE=1
4990         MOZ_MEMORY=1
4991         ;;
4992 esac
4994 MOZ_ARG_ENABLE_STRING(application,
4995 [  --enable-application=APP
4996                           Options include:
4997                             browser (Firefox)
4998                             xulrunner
4999                             content/xslt (Standalone Transformiix XSLT)
5000                             netwerk (Standalone Necko)
5001                             tools/update-packaging (AUS-related packaging tools)
5002                             standalone (use this for standalone
5003                               xpcom/xpconnect or to manually drive a build)],
5004 [ MOZ_BUILD_APP=$enableval ] )
5006 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5007 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
5008   XULRUNNER_STUB_NAME=$withval)
5010 if test -z "$XULRUNNER_STUB_NAME"; then
5011   case "$target_os" in
5012   darwin*)
5013     XULRUNNER_STUB_NAME=xulrunner
5014     ;;
5015   *)
5016     XULRUNNER_STUB_NAME=xulrunner-stub
5017   esac
5019 AC_SUBST(XULRUNNER_STUB_NAME)
5021 if test -z "$MOZ_BUILD_APP"; then
5022   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5023 else
5024   # We have a valid application only if it has a build.mk file in its top
5025   # directory.
5026   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5027     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5028   fi
5031 # Allow the application to influence configure with a confvars.sh script.
5033 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5034 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5035   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5036   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5037 else
5038   AC_MSG_RESULT([no])
5041 # Now is a good time to test for logic errors, define mismatches, etc.
5042 case "$MOZ_BUILD_APP" in
5043 xulrunner)
5044   if test "$LIBXUL_SDK"; then
5045     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5046   fi
5047   ;;
5048 esac
5050 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5051 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5052 # MOZ_BUILD_APP.
5053 case "$MOZ_BUILD_APP" in
5054 browser)
5055   AC_DEFINE(MOZ_PHOENIX)
5056   ;;
5058 xulrunner)
5059   AC_DEFINE(MOZ_XULRUNNER)
5060   ;;
5062 content/xslt)
5063   AC_DEFINE(TX_EXE)
5064   ;;
5066 standalone) 
5067   MOZ_APP_NAME=mozilla
5068   MOZ_APP_DISPLAYNAME=Mozilla
5069   MOZ_APP_VERSION=$MOZILLA_VERSION
5070   ;;
5072 esac
5074 AC_SUBST(MOZ_BUILD_APP)
5075 AC_SUBST(MOZ_PHOENIX)
5076 AC_SUBST(MOZ_XULRUNNER)
5078 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5080 dnl ========================================================
5081 dnl = 
5082 dnl = Toolkit Options
5083 dnl = 
5084 dnl ========================================================
5085 MOZ_ARG_HEADER(Toolkit Options)
5087     dnl ========================================================
5088     dnl = Select the default toolkit
5089     dnl ========================================================
5090         MOZ_ARG_ENABLE_STRING(default-toolkit,
5091         [  --enable-default-toolkit=TK
5092                           Select default toolkit
5093                           Platform specific defaults:
5094                             BeOS - cairo-beos
5095                             Mac OS X - cairo-cocoa
5096                             Neutrino/QNX - photon
5097                             OS/2 - cairo-os2
5098                             Win32/WinCE - cairo-windows
5099                             Gtk2 with DirectFB - cairo-gtk2-dfb
5100                             * - cairo-gtk2
5101                             * - cairo-qt],
5102     [ _DEFAULT_TOOLKIT=$enableval ],
5103     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5105     if test "$_DEFAULT_TOOLKIT" = "photon" \
5106         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5107         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5108         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5109         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5110         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5111         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5112         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5113         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5114         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5115     then
5116         dnl nglayout only supports building with one toolkit,
5117         dnl so ignore everything after the first comma (",").
5118         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5119     else
5120         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5121     fi
5123 dnl ========================================================
5124 dnl = Enable the toolkit as needed                         =
5125 dnl ========================================================
5127 case "$MOZ_WIDGET_TOOLKIT" in
5128 photon)
5129         MOZ_ENABLE_PHOTON=1
5130         AC_DEFINE(MOZ_WIDGET_PHOTON)
5131     ;;
5133 cairo-windows)
5134     MOZ_WIDGET_TOOLKIT=windows
5135     MOZ_WEBGL=1
5136     case "${target}" in
5137     *-wince*)
5138         NS_PRINTING=
5139         ;;
5140     esac
5141     ;;
5143 cairo-gtk2|cairo-gtk2-x11)
5144     MOZ_WIDGET_TOOLKIT=gtk2
5145     MOZ_ENABLE_GTK2=1
5146     MOZ_ENABLE_XREMOTE=1
5147     MOZ_WEBGL=1
5148     MOZ_WEBGL_GLX=1
5150     AC_DEFINE(MOZ_X11)
5151     MOZ_X11=1
5152     USE_FC_FREETYPE=1
5154     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5155     TK_LIBS='$(MOZ_GTK2_LIBS)'
5156     AC_DEFINE(MOZ_WIDGET_GTK2)
5157     ;;
5159 cairo-gtk2-dfb)
5160     MOZ_WIDGET_TOOLKIT=gtk2
5161     MOZ_ENABLE_GTK2=1
5162     MOZ_WEBGL=
5164     AC_DEFINE(MOZ_DFB)
5165     MOZ_DFB=1
5167     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5168     TK_LIBS='$(MOZ_GTK2_LIBS)'
5169     AC_DEFINE(MOZ_WIDGET_GTK2)
5170     if test "$no_x" != "yes"; then
5171         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5172         no_x=yes
5173     fi
5174     ;;
5176 cairo-qt)
5177     MOZ_WIDGET_TOOLKIT=qt
5178     MOZ_ENABLE_QT=1
5179     MOZ_ENABLE_XREMOTE=1
5180     MOZ_WEBGL=1
5181     MOZ_WEBGL_GLX=1
5182     USE_ELF_DYNSTR_GC=
5183     NS_PRINTING=
5185     AC_DEFINE(MOZ_X11)
5186     MOZ_X11=1
5187     USE_FC_FREETYPE=1
5189     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5190     TK_LIBS='$(MOZ_QT_LIBS)'
5191     AC_DEFINE(MOZ_WIDGET_QT)
5192     ;;
5194 cairo-beos)
5195     MOZ_WIDGET_TOOLKIT=beos
5196     USE_FC_FREETYPE=1
5197     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5198     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5199     ;;
5201 cairo-os2)
5202     MOZ_WIDGET_TOOLKIT=os2
5203     USE_FC_FREETYPE=1
5204     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5205     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5206     ;;
5208 cairo-cocoa)
5209     MOZ_WIDGET_TOOLKIT=cocoa
5210     AC_DEFINE(MOZ_WIDGET_COCOA)
5211     MOZ_USER_DIR="Mozilla"
5212     AC_DEFINE(XP_MACOSX)
5213     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5214     TK_CFLAGS="-DNO_X11"
5215     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5216     CFLAGS="$CFLAGS $TK_CFLAGS"
5217     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5218     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5219     MOZ_FS_LAYOUT=bundle
5220     MOZ_WEBGL=1
5221     ;;
5223 cairo-android)
5224     AC_DEFINE(MOZ_WIDGET_ANDROID)
5225     MOZ_WIDGET_TOOLKIT=android
5226     MOZ_WEBGL=
5227     ;;
5229 esac
5231 if test "$MOZ_ENABLE_XREMOTE"; then
5232     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5235 if test "$COMPILE_ENVIRONMENT"; then
5236   if test "$MOZ_ENABLE_GTK2"; then
5237     if test "$MOZ_X11"; then
5238       GDK_PACKAGES=gdk-x11-2.0
5239     elif test "$MOZ_DFB"; then
5240       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5241       GDK_PACKAGES=directfb
5242     fi
5244     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5245   fi
5247 fi # COMPILE_ENVIRONMENT
5249 AC_SUBST(MOZ_FS_LAYOUT)
5251 dnl ========================================================
5252 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5253 dnl their usage and use them in spidermonkey.
5254 dnl ========================================================
5255 MOZ_ARG_WITH_BOOL(arm-kuser,
5256 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5257     USE_ARM_KUSER=1,)
5258 if test -n "$USE_ARM_KUSER"; then
5259    AC_DEFINE(USE_ARM_KUSER)
5262 dnl ========================================================
5263 dnl = startup-notification support module
5264 dnl ========================================================
5266 if test "$MOZ_ENABLE_GTK2"
5267 then
5268     MOZ_ENABLE_STARTUP_NOTIFICATION=
5270     MOZ_ARG_ENABLE_BOOL(startup-notification,
5271     [  --enable-startup-notification
5272                           Enable startup-notification support (default: disabled) ],
5273         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5274         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5275     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5276     then
5277         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5278                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5279         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5280             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5281             then
5282                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5283             fi
5284             MOZ_ENABLE_STARTUP_NOTIFICATION=
5285         ])
5286     fi
5288     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5289         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5290     fi
5292     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5294 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5295 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5296 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5298 dnl ========================================================
5299 dnl = QT support
5300 dnl ========================================================
5301 if test "$MOZ_ENABLE_QT"
5302 then
5303     MOZ_ARG_WITH_STRING(qtdir,
5304     [  --with-qtdir=\$dir       Specify Qt directory ],
5305     [ QTDIR=$withval])
5307     if test -z "$QTDIR"; then
5308         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5309         AC_CHECK_PROGS(HOST_MOC, moc, "")
5310     else
5311         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5313         MOZ_QT_CFLAGS="-DQT_SHARED"
5314         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5315         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5316         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5317         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5318         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5319         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5320         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5321         HOST_MOC="$QTDIR/bin/moc"
5322     fi
5323     if test -z "$HOST_MOC"; then
5324         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5325 incorrect])
5326     fi
5327     MOC=$HOST_MOC
5330 AC_SUBST(GTK_CONFIG)
5331 AC_SUBST(TK_CFLAGS)
5332 AC_SUBST(TK_LIBS)
5334 AC_SUBST(MOZ_ENABLE_GTK2)
5335 AC_SUBST(MOZ_ENABLE_PHOTON)
5336 AC_SUBST(MOZ_ENABLE_QT)
5337 AC_SUBST(MOZ_ENABLE_XREMOTE)
5338 AC_SUBST(MOZ_GTK2_CFLAGS)
5339 AC_SUBST(MOZ_GTK2_LIBS)
5340 AC_SUBST(MOZ_QT_CFLAGS)
5341 AC_SUBST(MOZ_QT_LIBS)
5343 AC_SUBST(MOC)
5345 AC_SUBST(MOZ_DFB)
5346 AC_SUBST(MOZ_X11)
5348 dnl ========================================================
5349 dnl =
5350 dnl = Components & Features
5351 dnl = 
5352 dnl ========================================================
5353 MOZ_ARG_HEADER(Components and Features)
5355 dnl ========================================================
5356 dnl = Localization
5357 dnl ========================================================
5358 MOZ_ARG_ENABLE_STRING(ui-locale,
5359 [  --enable-ui-locale=ab-CD
5360                           Select the user interface locale (default: en-US)],
5361     MOZ_UI_LOCALE=$enableval )
5362 AC_SUBST(MOZ_UI_LOCALE)
5364 dnl ========================================================
5365 dnl = Trademarked Branding 
5366 dnl ========================================================
5367 MOZ_ARG_ENABLE_BOOL(official-branding,
5368 [  --enable-official-branding
5369                           Enable Official mozilla.org Branding
5370                           Do not distribute builds with
5371                           --enable-official-branding unless you have
5372                           permission to use trademarks per
5373                           http://www.mozilla.org/foundation/trademarks/ .],
5375   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5376     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5377   else
5378     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5379     MOZ_OFFICIAL_BRANDING=1
5380   fi
5381 ], MOZ_OFFICIAL_BRANDING=)
5383 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5384 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5385   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5388 MOZ_ARG_WITH_STRING(branding,
5389 [  --with-branding=dir     Use branding from the specified directory.],
5390     MOZ_BRANDING_DIRECTORY=$withval)
5392 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5393 if test -z "$REAL_BRANDING_DIRECTORY"; then
5394   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5397 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5398   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5401 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5403 dnl ========================================================
5404 dnl = Distribution ID
5405 dnl ========================================================
5406 MOZ_ARG_WITH_STRING(distribution-id,
5407 [  --with-distribution-id=ID
5408                           Set distribution-specific id (default=org.mozilla)],
5409 [ val=`echo $withval`
5410     MOZ_DISTRIBUTION_ID="$val"])
5412 if test -z "$MOZ_DISTRIBUTION_ID"; then
5413    MOZ_DISTRIBUTION_ID="org.mozilla"
5416 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5417 AC_SUBST(MOZ_DISTRIBUTION_ID)
5420 dnl ========================================================
5421 dnl complex text support off by default
5422 dnl ========================================================
5423 MOZ_ARG_DISABLE_BOOL(pango,
5424 [  --disable-pango         Disable usage of Pango ],
5425     MOZ_PANGO=,
5426     MOZ_PANGO=1)
5428 dnl ========================================================
5429 dnl = Pango
5430 dnl ========================================================
5431 if test "$MOZ_ENABLE_GTK2"
5432 then
5433     AC_SUBST(MOZ_PANGO)
5435     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5437     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5438     AC_SUBST(MOZ_PANGO_CFLAGS)
5439     AC_SUBST(MOZ_PANGO_LIBS)
5440     if test "$MOZ_PANGO"
5441     then
5442         AC_DEFINE(MOZ_PANGO)
5443     else
5444         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5445         AC_SUBST(FT2_CFLAGS)
5446         AC_SUBST(FT2_LIBS)
5447     fi
5450 if test "$MOZ_ENABLE_QT"
5451 then
5452     if test "$MOZ_PANGO"
5453     then
5454         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5455         [
5456             AC_SUBST(MOZ_PANGO_CFLAGS)
5457             AC_SUBST(MOZ_PANGO_LIBS)
5458             AC_DEFINE(MOZ_PANGO)
5459         ],
5460         [
5461             echo "Pango library not found, will use FT2 font engine"
5462             MOZ_PANGO=
5463         ])
5464     fi
5465     AC_SUBST(MOZ_PANGO)
5468 dnl ========================================================
5469 dnl = GnomeVFS, GIO and GConf support module
5470 dnl ========================================================
5472 if test "$MOZ_X11"
5473 then
5474     dnl build the gnomevfs extension by default only when the
5475     dnl GTK2 toolkit is in use.
5476     if test "$MOZ_ENABLE_GTK2"
5477     then
5478         MOZ_ENABLE_GNOMEVFS=1
5479         MOZ_ENABLE_GCONF=1
5480     fi
5482     dnl ========================================================
5483     dnl = GnomeVFS support module
5484     dnl ========================================================
5485     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5486     [  --disable-gnomevfs      Disable GnomeVFS support ],
5487         MOZ_ENABLE_GNOMEVFS=,
5488         MOZ_ENABLE_GNOMEVFS=force)
5490     if test "$MOZ_ENABLE_GNOMEVFS"
5491     then
5492         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5493             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5494             MOZ_ENABLE_GNOMEVFS=1
5495             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5496         ],[
5497             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5498             then
5499                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5500             fi
5501             MOZ_ENABLE_GNOMEVFS=
5502         ])
5503     else
5504         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5505             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5506               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5507             ])
5508         fi
5509     fi
5511     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5512     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5513     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5515     dnl ========================================================
5516     dnl = GIO support module
5517     dnl ========================================================
5518     MOZ_ARG_ENABLE_BOOL(gio,
5519     [  --enable-gio            Enable GIO support (default: disabled)],
5520         MOZ_ENABLE_GIO=force,
5521         MOZ_ENABLE_GIO=)
5523     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5524     then
5525         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5526             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5527             MOZ_ENABLE_GIO=1
5528             AC_DEFINE(MOZ_ENABLE_GIO)
5529         ],[
5530             if test "$MOZ_ENABLE_GIO" = "force"
5531             then
5532                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5533             fi
5534             MOZ_ENABLE_GIO=
5535         ])
5536     fi
5538     AC_SUBST(MOZ_ENABLE_GIO)
5539     AC_SUBST(MOZ_GIO_CFLAGS)
5540     AC_SUBST(MOZ_GIO_LIBS)
5541    
5542     dnl ========================================================
5543     dnl = GConf support module
5544     dnl ========================================================
5545     if test "$MOZ_ENABLE_GCONF"
5546     then
5547         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5548             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5549             MOZ_ENABLE_GCONF=1
5550         ],[
5551             if test "$MOZ_ENABLE_GCONF" = "force"
5552             then
5553                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5554             fi
5555             MOZ_ENABLE_GCONF=
5556         ])
5557     fi
5559     if test "$MOZ_ENABLE_GCONF"; then
5560         AC_DEFINE(MOZ_ENABLE_GCONF)
5561     fi
5563     AC_SUBST(MOZ_ENABLE_GCONF)
5564     AC_SUBST(MOZ_GCONF_CFLAGS)
5565     AC_SUBST(MOZ_GCONF_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" || \
5608    test "$MOZ_ENABLE_GNOMEVFS" || \
5609    test "$MOZ_ENABLE_GIO" || \
5610    test "$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" || test "$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 case "${target}" in
5701 *-wince*|*-android*)
5702     MOZ_IPC=
5703     ;;
5704 esac
5706 MOZ_ARG_DISABLE_BOOL(ipc,
5707 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5708     MOZ_IPC=,
5709     MOZ_IPC=1)
5711 if test -n "$MOZ_IPC"; then
5712     AC_DEFINE(MOZ_IPC)
5715 AC_SUBST(MOZ_IPC)
5717 dnl ========================================================
5718 dnl = Enable IPDL's "expensive" unit tests
5719 dnl ========================================================
5720 MOZ_IPDL_TESTS=
5722 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5723 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5724     MOZ_IPDL_TESTS=1,
5725     MOZ_IPDL_TESTS=)
5727 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5728     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5731 if test -n "$MOZ_IPDL_TESTS"; then
5732     AC_DEFINE(MOZ_IPDL_TESTS)
5735 AC_SUBST(MOZ_IPDL_TESTS)
5737 dnl ========================================================
5738 dnl = Disable plugin support
5739 dnl ========================================================
5740 MOZ_ARG_DISABLE_BOOL(plugins,
5741 [  --disable-plugins       Disable plugins support],
5742     MOZ_PLUGINS=,)
5744 dnl ========================================================
5745 dnl = Disable building dbm
5746 dnl ========================================================
5747 MOZ_ARG_DISABLE_BOOL(dbm,
5748 [  --disable-dbm       Disable building dbm],
5749     NSS_DISABLE_DBM=1,)
5751 dnl bi-directional support always on
5752 IBMBIDI=1
5753 AC_DEFINE(IBMBIDI)
5755 dnl ========================================================
5756 dnl view source support on by default
5757 dnl ========================================================
5758 if test "$MOZ_VIEW_SOURCE"; then
5759     AC_DEFINE(MOZ_VIEW_SOURCE)
5762 dnl ========================================================
5763 dnl accessibility support on by default on all platforms 
5764 dnl except OS X.
5765 dnl ========================================================
5766 MOZ_ARG_DISABLE_BOOL(accessibility,
5767 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5768     ACCESSIBILITY=,
5769     ACCESSIBILITY=1 )
5770 if test "$ACCESSIBILITY"; then
5771     AC_DEFINE(ACCESSIBILITY)
5774 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5775 case "$target" in
5776 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5777     if test "$ac_cv_header_atlbase_h" = "no"; then
5778         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.])
5779     fi
5780     if test "$ac_cv_header_oleacc_idl" = "no"; then
5781         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.])
5782     fi
5783     ;;
5784 esac
5787 dnl ========================================================
5788 dnl xpcom js loader support on by default
5789 dnl ========================================================
5790 if test "$MOZ_JSLOADER"; then
5791     AC_DEFINE(MOZ_JSLOADER)
5794 dnl ========================================================
5795 dnl Disable printing
5796 dnl ========================================================
5797 MOZ_ARG_DISABLE_BOOL(printing,
5798 [  --disable-printing      Disable printing support],
5799     NS_PRINTING=,)
5801 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5802     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5803     NS_PRINTING=
5806 if test "$NS_PRINTING"; then
5807     AC_DEFINE(NS_PRINTING)
5808     AC_DEFINE(NS_PRINT_PREVIEW)
5810 dnl ========================================================
5811 dnl use native unicode converters
5812 dnl ========================================================
5813 MOZ_ARG_ENABLE_BOOL(native-uconv,
5814 [  --enable-native-uconv   Enable iconv support],
5815     MOZ_USE_NATIVE_UCONV=1,
5816     MOZ_USE_NATIVE_UCONV= )
5817 if test "$MOZ_USE_NATIVE_UCONV"; then
5818     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5820 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5821     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5825 dnl ========================================================
5826 dnl Libeditor can be build as plaintext-only,
5827 dnl or as a full html and text editing component.
5828 dnl We build both by default.
5829 dnl ========================================================
5830 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5831 [  --enable-plaintext-editor-only
5832                           Allow only plaintext editing],
5833     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5834     MOZ_PLAINTEXT_EDITOR_ONLY= )
5835 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5836 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5838 dnl ========================================================
5839 dnl = Disable Fast Load
5840 dnl ========================================================
5841 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5842 [  --disable-xpcom-fastload
5843                           Disable XPCOM fastload support],
5844     MOZ_NO_FAST_LOAD=1,
5845     MOZ_NO_FAST_LOAD=)
5847 AC_SUBST(MOZ_NO_FAST_LOAD)
5849 if test -n "$MOZ_NO_FAST_LOAD"; then
5850     AC_DEFINE(MOZ_NO_FAST_LOAD)
5853 dnl ========================================================
5854 dnl = Disable Ogg Codecs
5855 dnl ========================================================
5856 MOZ_ARG_DISABLE_BOOL(ogg,
5857 [  --disable-ogg           Disable Ogg Codec support],
5858     MOZ_OGG=,)
5860 AC_SUBST(MOZ_OGG)
5862 if test -n "$MOZ_OGG"; then
5863     AC_DEFINE(MOZ_OGG)
5864     MOZ_SYDNEYAUDIO=1
5865     MOZ_MEDIA=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 Wave decoder support
5891 dnl ========================================================
5892 MOZ_ARG_DISABLE_BOOL(wave,
5893 [  --disable-wave          Disable Wave decoder support],
5894     MOZ_WAVE=,)
5896 AC_SUBST(MOZ_WAVE)
5898 if test -n "$MOZ_WAVE"; then
5899     AC_DEFINE(MOZ_WAVE)
5900     MOZ_SYDNEYAUDIO=1
5901     MOZ_MEDIA=1
5904 dnl ========================================================
5905 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5906 dnl ========================================================
5908 AC_SUBST(MOZ_SYDNEYAUDIO)
5910 if test -n "$MOZ_SYDNEYAUDIO"; then
5911     AC_DEFINE(MOZ_SYDNEYAUDIO)
5914 AC_SUBST(MOZ_MEDIA)
5916 if test -n "$MOZ_MEDIA"; then
5917     AC_DEFINE(MOZ_MEDIA)
5920 dnl ========================================================
5921 dnl = Check alsa availability on Linux if using sydneyaudio
5922 dnl ========================================================
5924 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5925 if test -n "$MOZ_SYDNEYAUDIO"; then
5926    case "$target_os" in
5927 linux*)
5928       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5929          [echo "$MOZ_ALSA_PKG_ERRORS"
5930           AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux.  Disable with --disable-ogg --disable-wave.])])
5931       ;;
5932    esac
5934 AC_SUBST(MOZ_ALSA_LIBS)
5936 dnl ========================================================
5937 dnl Splashscreen
5938 dnl ========================================================
5939 AC_ARG_ENABLE(splashscreen,
5940               [  --enable-splashscreen   display splashscreen while loading (default=no)],
5941               [enable_splash="yes"],[enable_splash=""])
5942 if test "x$enable_splash" = "xyes"; then
5943   MOZ_SPLASHSCREEN=1
5944   AC_DEFINE(MOZ_SPLASHSCREEN)
5946 AC_SUBST(MOZ_SPLASHSCREEN)
5948 dnl ========================================================
5949 dnl Permissions System
5950 dnl ========================================================
5951 MOZ_ARG_DISABLE_BOOL(permissions,
5952 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5953     MOZ_PERMISSIONS=,
5954     MOZ_PERMISSIONS=1
5957 dnl ========================================================
5958 dnl NegotiateAuth
5959 dnl ========================================================
5960 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5961 [  --disable-negotiateauth Disable GSS-API negotiation ],
5962     MOZ_AUTH_EXTENSION=,
5963     MOZ_AUTH_EXTENSION=1 )
5965 dnl ========================================================
5966 dnl XTF
5967 dnl ========================================================
5968 MOZ_ARG_DISABLE_BOOL(xtf,
5969 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5970     MOZ_XTF=,
5971     MOZ_XTF=1 )
5972 if test "$MOZ_XTF"; then
5973   AC_DEFINE(MOZ_XTF)
5976 dnl ========================================================
5977 dnl Pref extensions (autoconfig and system-pref)
5978 dnl ========================================================
5979 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5980 [  --disable-pref-extensions
5981                           Disable pref extensions such as autoconfig and
5982                           system-pref],
5983   MOZ_PREF_EXTENSIONS=,
5984   MOZ_PREF_EXTENSIONS=1 )
5986 dnl ========================================================
5987 dnl = Universalchardet
5988 dnl ========================================================
5989 MOZ_ARG_DISABLE_BOOL(universalchardet,
5990 [  --disable-universalchardet
5991                           Disable universal encoding detection],
5992   MOZ_UNIVERSALCHARDET=,
5993   MOZ_UNIVERSALCHARDET=1 )
5995 dnl ========================================================
5996 dnl JavaXPCOM
5997 dnl ========================================================
5998 case "${target}" in
5999 *-wince*)
6000     MOZ_JAVAXPCOM=
6001     ;;
6002 esac
6004 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6005 [  --enable-javaxpcom
6006                           Enable Java-XPCOM bridge],
6007     MOZ_JAVAXPCOM=1,)
6009 case "$host_os" in
6010   cygwin*|msvc*|mks*)
6011     if test -n "$JAVA_HOME"; then
6012       JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6013     fi
6014     ;;
6015   *mingw*)
6016     if test -n "$JAVA_HOME"; then
6017       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6018     fi
6019     ;;
6020 esac
6022 if test -n "${JAVA_BIN_PATH}"; then
6023   dnl Look for javac and jar in the specified path.
6024   JAVA_PATH="$JAVA_BIN_PATH"
6025 else
6026   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6027   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6030 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6031 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6032 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6034 if test -n "${JAVA_BIN_PATH}" || test "$OS_TARGET" = Android; then
6035   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
6036     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}])
6037   fi
6040 if test -n "${MOZ_JAVAXPCOM}"; then
6041   if test -n "${JAVA_INCLUDE_PATH}"; then
6042     dnl Make sure jni.h exists in the given include path.
6043     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6044       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6045     fi
6046   else
6047     case "$target_os" in
6048       darwin*)
6049         dnl Default to java system location
6050         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6051         ;;
6052       *)
6053         dnl Try $JAVA_HOME
6054         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6055         ;;
6056     esac
6057     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6058       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.])
6059     fi
6060   fi
6063 dnl ========================================================
6064 dnl = Breakpad crash reporting (on by default on supported platforms)
6065 dnl ========================================================
6067 case $target in
6068 i?86-*-mingw*)
6069   MOZ_CRASHREPORTER=1
6070   ;;
6071 i?86-apple-darwin*|powerpc-apple-darwin*)
6072   MOZ_CRASHREPORTER=1
6073   ;;
6074 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6075   MOZ_CRASHREPORTER=1
6076   ;;
6077 *solaris*)
6078   MOZ_CRASHREPORTER=1
6079   ;;
6080 esac
6082 MOZ_ARG_DISABLE_BOOL(crashreporter,
6083 [  --disable-crashreporter Disable breakpad crash reporting],
6084     MOZ_CRASHREPORTER=,)
6086 if test -n "$MOZ_CRASHREPORTER"; then
6087    AC_DEFINE(MOZ_CRASHREPORTER)
6089   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
6090     test -z "$SKIP_LIBRARY_CHECKS"; then
6091     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6092     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6093     AC_SUBST(MOZ_GTHREAD_LIBS)
6095     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.])])
6096   fi
6099 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6100 [  --with-crashreporter-enable-percent=NN
6101                           Enable sending crash reports by default on NN% of users. (default=100)],
6102 [ val=`echo $withval | sed 's/[^0-9]//g'`
6103     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6105 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6106    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6108 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6110 dnl ========================================================
6111 dnl = Enable compilation of specific extension modules
6112 dnl ========================================================
6114 MOZ_ARG_ENABLE_STRING(extensions,
6115 [  --enable-extensions     Enable extensions],
6116 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6117     if test "$option" = "yes" || test "$option" = "all"; then
6118         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6119     elif test "$option" = "no" || test "$option" = "none"; then
6120         MOZ_EXTENSIONS=""
6121     elif test "$option" = "default"; then
6122         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6123     elif test `echo "$option" | grep -c \^-` != 0; then
6124         option=`echo $option | sed 's/^-//'`
6125         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6126     else
6127         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6128     fi
6129 done],
6130     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6132 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6133     # Suppress warning on non-X11 platforms
6134     if test -n "$MOZ_X11"; then
6135         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6136     fi
6137     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6140 dnl Do not build gnomevfs with libxul based apps
6141 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6142     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6145 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6146     # Suppress warning on non-X11 platforms
6147     if test -n "$MOZ_X11"; then
6148         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6149     fi
6150     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6153 dnl Do not build gio with libxul based apps
6154 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6155     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6158 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6159     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6160     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6163 dnl This might be temporary: build tridentprofile only on Windows
6164 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6165     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6166     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6169 dnl cookie must be built before tridentprofile. put it at list's end.
6170 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6171   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6172   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6175 dnl xforms requires xtf and schema-validation
6176 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6177     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6178     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6180 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
6181     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
6182     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6185 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6186     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6187     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6190 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6191     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6192     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6195 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6196     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6197     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6200 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6201     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6202     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6205 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6206     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6207     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6210 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6211     AC_MSG_WARN([spellcheck is no longer an extension.])
6212     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6215 dnl Remove dupes
6216 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6218 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6219 dnl when trying to build a nonexistent extension.
6220 for extension in $MOZ_EXTENSIONS; do
6221     if test ! -d "${srcdir}/extensions/${extension}"; then
6222         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6223     fi
6224 done
6227 dnl ========================================================
6228 dnl Image decoders
6229 dnl ========================================================
6230 case "$MOZ_WIDGET_TOOLKIT" in
6231 beos|windows|os2|mac|cocoa)
6232     ;;
6234     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
6235        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6236     fi
6237     ;;
6238 esac
6240 MOZ_ARG_ENABLE_STRING(image-decoders,
6241 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
6242                           Enable specific image decoders],
6243 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6244     if test "$option" = "yes" || test "$option" = "all"; then
6245         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6246     elif test "$option" = "no" || test "$option" = "none"; then
6247         MOZ_IMG_DECODERS=""
6248     elif test "$option" = "default"; then
6249         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6250     elif test `echo "$option" | grep -c \^-` != 0; then
6251         option=`echo $option | sed 's/^-//'`
6252         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6253     else
6254         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6255     fi
6256 done],
6257     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6259 dnl Dupes are removed in the encoder section because it will also add decoders
6261 dnl ========================================================
6262 dnl Image encoders
6263 dnl ========================================================
6264 MOZ_ARG_ENABLE_STRING(image-encoders,
6265 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
6266                           Enable specific image encoders],
6267 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6268     if test "$option" = "yes" || test "$option" = "all"; then
6269         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6270     elif test "$option" = "no" || test "$option" = "none"; then
6271         MOZ_IMG_ENCODERS=""
6272         addencoder=""
6273     elif test "$option" = "default"; then
6274         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6275     elif test `echo "$option" | grep -c \^-` != 0; then
6276         option=`echo $option | sed 's/^-//'`
6277         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6278     else
6279         addencoder="$option"
6280     fi
6281     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6282 done],
6283     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6285 dnl Remove dupes
6286 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6287 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6289 dnl ========================================================
6290 dnl MathML on by default
6291 dnl ========================================================
6292 MOZ_ARG_DISABLE_BOOL(mathml,
6293 [  --disable-mathml        Disable MathML support],
6294     MOZ_MATHML=,
6295     MOZ_MATHML=1 )
6296 if test "$MOZ_MATHML"; then
6297   AC_DEFINE(MOZ_MATHML)
6300 dnl ========================================================
6301 dnl SVG
6302 dnl ========================================================
6303 MOZ_ARG_DISABLE_BOOL(svg,
6304 [  --disable-svg           Disable SVG support],
6305     MOZ_SVG=,
6306     MOZ_SVG=1 )
6307 if test -n "$MOZ_SVG"; then
6308   AC_DEFINE(MOZ_SVG)
6311 dnl ========================================================
6312 dnl SMIL
6313 dnl ========================================================
6314 MOZ_SMIL=1
6315 MOZ_ARG_DISABLE_BOOL(smil,
6316 [  --disable-smil          Disable SMIL animation support],
6317     MOZ_SMIL=,
6318     MOZ_SMIL=1 )
6319 # Automatically disable SMIL if SVG is disabled
6320 if test -z "$MOZ_SVG"; then
6321   MOZ_SMIL=
6323 if test -n "$MOZ_SMIL"; then
6324   AC_DEFINE(MOZ_SMIL)
6327 dnl ========================================================
6328 dnl Build Freetype in the tree
6329 dnl ========================================================
6330 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6331 [  --enable-tree-freetype  Enable Tree FreeType],
6332     MOZ_TREE_FREETYPE=1,
6333     MOZ_TREE_FREETYPE= )
6334 if test -n "$MOZ_TREE_FREETYPE"; then
6335    AC_DEFINE(MOZ_TREE_FREETYPE)
6336    AC_SUBST(MOZ_TREE_FREETYPE)
6337    MOZ_ENABLE_CAIRO_FT=1       
6338    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6339    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6340    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6341    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6342    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6343    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6344    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6345    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6346    AC_SUBST(CAIRO_FT_CFLAGS)
6350 dnl ========================================================
6351 dnl Installer
6352 dnl ========================================================
6353 case "$target_os" in
6354     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6355         MOZ_INSTALLER=1
6356         ;;
6357 esac
6359 MOZ_ARG_DISABLE_BOOL(installer,
6360 [  --disable-installer     Disable building of installer],
6361     MOZ_INSTALLER=,)
6362 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6363     # Disable installer for Windows builds that use the new toolkit if NSIS
6364     # isn't in the path.
6365     MOZ_PATH_PROGS(MAKENSIS, makensis)
6366     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
6367         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
6368     fi
6369     # The Windows build for NSIS requires the iconv command line utility to
6370     # convert the charset of the locale files.
6371     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6372     if test -z "$HOST_ICONV"; then
6373         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6374     fi
6377 AC_SUBST(MOZ_INSTALLER)
6379 AC_MSG_CHECKING([for tar archiver])
6380 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6381 if test -z "$TAR"; then
6382     AC_MSG_ERROR([no tar archiver found in \$PATH])
6384 AC_MSG_RESULT([$TAR])
6385 AC_SUBST(TAR)
6387 AC_MSG_CHECKING([for wget])
6388 AC_CHECK_PROGS(WGET, wget, "")
6389 AC_MSG_RESULT([$WGET])
6390 AC_SUBST(WGET)
6392 dnl ========================================================
6393 dnl Updater
6394 dnl ========================================================
6396 MOZ_ARG_DISABLE_BOOL(updater,
6397 [  --disable-updater       Disable building of updater],
6398     MOZ_UPDATER=,
6399     MOZ_UPDATER=1 )
6400 AC_SUBST(MOZ_UPDATER)
6402 # app update channel is 'default' when not supplied.
6403 MOZ_ARG_ENABLE_STRING([update-channel],
6404 [  --enable-update-channel=CHANNEL
6405                           Select application update channel (default=default)],
6406     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6408 if test -z "$MOZ_UPDATE_CHANNEL"; then
6409     MOZ_UPDATE_CHANNEL=default
6411 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6413 # tools/update-packaging is not checked out by default.
6414 MOZ_ARG_ENABLE_BOOL(update-packaging,
6415 [  --enable-update-packaging
6416                           Enable tools/update-packaging],
6417     MOZ_UPDATE_PACKAGING=1,
6418     MOZ_UPDATE_PACKAGING= )
6419 AC_SUBST(MOZ_UPDATE_PACKAGING)
6421 dnl ========================================================
6422 dnl ActiveX
6423 dnl ========================================================
6425 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6426 [  --disable-xpconnect-idispatch
6427                           Disable building of xpconnect support for IDispatch
6428                           (win32 only)],
6429     XPC_IDISPATCH_SUPPORT=,
6430     XPC_IDISPATCH_SUPPORT=1)
6431 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6433 MOZ_ARG_DISABLE_BOOL(activex,
6434 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6435     MOZ_NO_ACTIVEX_SUPPORT=1,
6436     MOZ_NO_ACTIVEX_SUPPORT= )
6437 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6439 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6440 [  --enable-activex-scripting
6441                           Enable building of ActiveX scripting support (win32)],
6442     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6443     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6444 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6446 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6447 then
6448     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6451 if test "$COMPILE_ENVIRONMENT" = "1"; then
6452 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6453 case "$target" in
6454 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6455     if test "$ac_cv_header_atlbase_h" = "no"; then
6456         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.])
6457     fi
6458     ;;
6459 esac
6463 dnl ========================================================
6464 dnl leaky
6465 dnl ========================================================
6466 MOZ_ARG_ENABLE_BOOL(leaky,
6467 [  --enable-leaky          Build leaky memory tool],
6468     MOZ_LEAKY=1,
6469     MOZ_LEAKY=)
6472 dnl ========================================================
6473 dnl build the tests by default
6474 dnl ========================================================
6475 MOZ_ARG_DISABLE_BOOL(tests,
6476 [  --disable-tests         Do not build test libraries & programs],
6477     ENABLE_TESTS=,
6478     ENABLE_TESTS=1 )
6480 dnl ========================================================
6481 dnl parental controls (for Windows Vista)
6482 dnl ========================================================
6483 MOZ_ARG_DISABLE_BOOL(parental-controls,
6484 [  --disable-parental-controls
6485                           Do not build parental controls],
6486    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6487    MOZ_DISABLE_PARENTAL_CONTROLS=)
6488 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6489     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6492 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6494 dnl ========================================================
6495 dnl =
6496 dnl = Module specific options
6497 dnl =
6498 dnl ========================================================
6499 MOZ_ARG_HEADER(Individual module options)
6501 dnl ========================================================
6502 dnl = Disable feed handling components
6503 dnl ========================================================
6504 MOZ_ARG_DISABLE_BOOL(feeds,
6505 [  --disable-feeds         Disable feed handling and processing components],
6506     MOZ_FEEDS=,
6507     MOZ_FEEDS=1 )
6508 if test -n "$MOZ_FEEDS"; then
6509     AC_DEFINE(MOZ_FEEDS)
6510 else
6511     if test "$MOZ_BUILD_APP" = "browser"; then
6512         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6513     fi
6516 dnl ========================================================
6517 dnl = Enable mozStorage
6518 dnl ========================================================
6519 dnl Implicitly enabled by default if building calendar or places
6520 MOZ_ARG_ENABLE_BOOL(storage,
6521 [  --enable-storage        Enable mozStorage module and related components],
6522     MOZ_STORAGE=1,
6523     MOZ_STORAGE= )
6524 if test -n "$MOZ_STORAGE"; then
6525     AC_DEFINE(MOZ_STORAGE)
6528 dnl ========================================================
6529 dnl Check for sqlite
6530 dnl ========================================================
6532 MOZ_NATIVE_SQLITE=
6533 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6534 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6535 MOZ_NATIVE_SQLITE=1,
6536 MOZ_NATIVE_SQLITE= )
6538 if test -z "$MOZ_NATIVE_SQLITE"
6539 then
6540     SQLITE_CFLAGS=
6541     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6542 else
6543     dnl ============================
6544     dnl === SQLite Version check ===
6545     dnl ============================
6546     dnl Check to see if the system SQLite package is new enough.
6547     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6549     dnl ==================================
6550     dnl === SQLITE_SECURE_DELETE check ===
6551     dnl ==================================
6552     dnl Check to see if the system SQLite package is compiled with
6553     dnl SQLITE_SECURE_DELETE enabled.
6554     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6555     _SAVE_CFLAGS="$CFLAGS"
6556     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6557     _SAVE_LIBS="$LIBS"
6558     LIBS="$LIBS $SQLITE_LIBS"
6559     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6560         AC_TRY_RUN([
6561             #include "sqlite3.h"
6563             int main(int argc, char **argv){
6564               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6565             }],
6566             ac_cv_sqlite_secure_delete=yes,
6567             ac_cv_sqlite_secure_delete=no,
6568             ac_cv_sqlite_secure_delete=no
6569         )
6570     ])
6571     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6572     CFLAGS="$_SAVE_CFLAGS"
6573     LIBS="$_SAVE_LIBS"
6574     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6575         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6576     fi
6578     dnl ===============================
6579     dnl === SQLITE_THREADSAFE check ===
6580     dnl ===============================
6581     dnl Check to see if the system SQLite package is compiled with
6582     dnl SQLITE_THREADSAFE enabled.
6583     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6584     _SAVE_CFLAGS="$CFLAGS"
6585     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6586     _SAVE_LIBS="$LIBS"
6587     LIBS="$LIBS $SQLITE_LIBS"
6588     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6589         AC_TRY_RUN([
6590             #include "sqlite3.h"
6592             int main(int argc, char **argv){
6593               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6594             }],
6595             ac_cv_sqlite_threadsafe=yes,
6596             ac_cv_sqlite_threadsafe=no,
6597             ac_cv_sqlite_threadsafe=no
6598         )
6599     ])
6600     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6601     CFLAGS="$_SAVE_CFLAGS"
6602     LIBS="$_SAVE_LIBS"
6603     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6604         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6605     fi
6607     dnl ================================
6608     dnl === SQLITE_ENABLE_FTS3 check ===
6609     dnl ================================
6610     dnl check to see if the system SQLite package is compiled with
6611     dnl SQLITE_THREADSAFE enabled.
6612     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6613     _SAVE_CFLAGS="$CFLAGS"
6614     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6615     _SAVE_LIBS="$LIBS"
6616     LIBS="$LIBS $SQLITE_LIBS"
6617     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6618         AC_TRY_RUN([
6619             #include "sqlite3.h"
6621             int main(int argc, char **argv){
6622               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6623             }],
6624             ac_cv_sqlite_enable_fts3=yes,
6625             ac_cv_sqlite_enable_fts3=no,
6626             ac_cv_sqlite_enable_fts3=no
6627         )
6628     ])
6629     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6630     CFLAGS="$_SAVE_CFLAGS"
6631     LIBS="$_SAVE_LIBS"
6632     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6633         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6634     fi
6637 AC_SUBST(MOZ_NATIVE_SQLITE)
6639 dnl ========================================================
6640 dnl = Enable help viewer (off by default)
6641 dnl ========================================================
6642 if test -n "$MOZ_HELP_VIEWER"; then
6643      dnl Do this if defined in confvars.sh
6644      AC_DEFINE(MOZ_HELP_VIEWER)
6647 dnl ========================================================
6648 dnl = Enable safe browsing (anti-phishing)
6649 dnl ========================================================
6650 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6651 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6652     MOZ_SAFE_BROWSING=1,
6653     MOZ_SAFE_BROWSING= )
6654 if test -n "$MOZ_SAFE_BROWSING"; then
6655     AC_DEFINE(MOZ_SAFE_BROWSING)
6657 AC_SUBST(MOZ_SAFE_BROWSING)
6659 dnl ========================================================
6660 dnl = Enable faststart component
6661 dnl ========================================================
6662 MOZ_ARG_ENABLE_BOOL(faststart,
6663 [  --enable-faststart      Enable the faststart component],
6664     MOZ_FASTSTART=1,
6665     MOZ_FASTSTART= )
6666 if test -n "$MOZ_FASTSTART"; then
6667     AC_DEFINE(MOZ_FASTSTART)
6669 AC_SUBST(MOZ_FASTSTART)
6671 dnl ========================================================
6672 dnl = Enable url-classifier
6673 dnl ========================================================
6674 dnl Implicitly enabled by default if building with safe-browsing
6675 if test -n "$MOZ_SAFE_BROWSING"; then
6676     MOZ_URL_CLASSIFIER=1
6678 MOZ_ARG_ENABLE_BOOL(url-classifier,
6679 [  --enable-url-classifier Enable url classifier module],
6680     MOZ_URL_CLASSIFIER=1,
6681     MOZ_URL_CLASSIFIER= )
6682 if test -n "$MOZ_URL_CLASSIFIER"; then
6683     AC_DEFINE(MOZ_URL_CLASSIFIER)
6685 AC_SUBST(MOZ_URL_CLASSIFIER)
6687 dnl ========================================================
6688 dnl = Disable zipwriter
6689 dnl ========================================================
6690 MOZ_ARG_DISABLE_BOOL(zipwriter,
6691 [  --disable-zipwriter     Disable zipwriter component],
6692     MOZ_ZIPWRITER=,
6693     MOZ_ZIPWRITER=1 )
6694 AC_SUBST(MOZ_ZIPWRITER)
6696 dnl ========================================================
6697 dnl = Disable libconic
6698 dnl ========================================================
6699 MOZ_ENABLE_LIBCONIC=1
6700 MOZ_ARG_DISABLE_BOOL(libconic,
6701 [  --disable-libconic      Disable libconic],
6702     MOZ_ENABLE_LIBCONIC=,
6703     MOZ_ENABLE_LIBCONIC=1 )
6705 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6706     PKG_CHECK_MODULES(LIBCONIC, conic,
6707                       MOZ_ENABLE_LIBCONIC=1,
6708                       MOZ_ENABLE_LIBCONIC=)
6710 if test "$MOZ_ENABLE_LIBCONIC"; then
6711     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6714 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6715 AC_SUBST(LIBCONIC_CFLAGS)
6716 AC_SUBST(LIBCONIC_LIBS)
6718 dnl ========================================================
6719 dnl = Maemo checks
6720 dnl ========================================================
6722 MAEMO_SDK_TARGET_VER=-1
6724 MOZ_ARG_WITH_STRING(maemo-version,
6725 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6726                           Maemo SDK Version],
6727   MAEMO_SDK_TARGET_VER=$withval)
6729 case "$MAEMO_SDK_TARGET_VER" in
6731     MOZ_PLATFORM_MAEMO=5
6732     ;;
6735     MOZ_PLATFORM_MAEMO=6
6736     ;;
6739     dnl We aren't compiling for Maemo, move on.
6740     ;;
6742     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6743     ;;
6744 esac
6746 if test $MOZ_PLATFORM_MAEMO; then
6747    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6749    if test -z "$MOZ_ENABLE_DBUS"; then
6750        AC_MSG_ERROR([DBus is required when building for Maemo])
6751    fi
6753    MOZ_GFX_OPTIMIZE_MOBILE=1
6754    MOZ_WEBGL_GLX=
6755    MOZ_MAEMO_LIBLOCATION=
6757    if test $MOZ_PLATFORM_MAEMO = 5; then
6758       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6759       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6760                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6761       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6762                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6764       AC_SUBST(XCOMPOSITE_LIBS)
6766       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6767       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6768       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6769       if test -z "$_LIB_FOUND"; then
6770          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6771       fi
6774       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6775       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6776       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6777       if test -z "$_LIB_FOUND"; then
6778          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6779       fi
6781       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6782       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6783       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6784       if test -z "$_LIB_FOUND"; then
6785          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6786       fi
6788    fi
6790    if test "$MOZ_PLATFORM_MAEMO" -gt 5; then
6791      MOZ_THUMB2=1
6792    fi
6794    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6795    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6796    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6797    if test "$_LIB_FOUND"; then
6798       MOZ_MAEMO_LIBLOCATION=1
6799       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6800    else
6801       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6802    fi
6803    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6805    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6806    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6809 dnl ========================================================
6810 dnl = Enable building the Thumb2 instruction set
6811 dnl ========================================================
6812 MOZ_ARG_ENABLE_BOOL(thumb2,
6813  [  --enable-thumb2         Enable Thumb2 instruction set],
6814     MOZ_THUMB2=1,
6815     MOZ_THUMB2=)
6817 if test -n "$MOZ_THUMB2"; then
6818   case "$target_cpu" in
6819     arm*)
6820       if test "$GNU_CC"; then
6821         CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6822         CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6823         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
6824       else
6825         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
6826       fi
6827     ;;
6828     *)
6829       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
6830     ;;
6831   esac
6834 dnl ========================================================
6835 dnl = faststripe theme
6836 dnl ========================================================
6837 MOZ_ARG_ENABLE_BOOL(faststripe,
6838 [  --enable-faststripe     Use faststripe theme],
6839     MOZ_THEME_FASTSTRIPE=1,
6840     MOZ_THEME_FASTSTRIPE= )
6841 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6843 dnl ========================================================
6844 dnl =
6845 dnl = Feature options that require extra sources to be pulled
6846 dnl =
6847 dnl ========================================================
6848 dnl MOZ_ARG_HEADER(Features that require extra sources)
6850 dnl ========================================================
6851 dnl =
6852 dnl = Debugging Options
6853 dnl = 
6854 dnl ========================================================
6855 MOZ_ARG_HEADER(Debugging and Optimizations)
6857 dnl ========================================================
6858 dnl = Disable building with debug info.
6859 dnl = Debugging is OFF by default
6860 dnl ========================================================
6861 if test -z "$MOZ_DEBUG_FLAGS"
6862 then
6863     case "$target" in
6864     *-irix*)
6865         if test "$GNU_CC"; then
6866             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6867             case "$GCC_VERSION" in
6868             2.95.*)
6869                 MOZ_DEBUG_FLAGS=""
6870                 ;;
6871             *)
6872                 MOZ_DEBUG_FLAGS="-g"
6873                 ;;
6874             esac
6875         else
6876             MOZ_DEBUG_FLAGS="-g"
6877         fi
6878         ;;
6879     *)
6880         MOZ_DEBUG_FLAGS="-g"
6881         ;;
6882     esac
6885 MOZ_ARG_ENABLE_STRING(debug,
6886 [  --enable-debug[=DBG]    Enable building with developer debug info
6887                            (using compiler flags DBG)],
6888 [ if test "$enableval" != "no"; then
6889     MOZ_DEBUG=1
6890     if test -n "$enableval" -a "$enableval" != "yes"; then
6891         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6892         _MOZ_DEBUG_FLAGS_SET=1
6893     fi
6894   else
6895     MOZ_DEBUG=
6896   fi ],
6897   MOZ_DEBUG=)
6899 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6900 MOZ_ARG_WITH_STRING(debug-label,
6901 [  --with-debug-label=LABELS
6902                           Define DEBUG_<value> for each comma-separated
6903                           value given.],
6904 [ for option in `echo $withval | sed 's/,/ /g'`; do
6905     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6906 done])
6908 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6910 if test -n "$MOZ_DEBUG"; then
6911     AC_MSG_CHECKING([for valid debug flags])
6912     _SAVE_CFLAGS=$CFLAGS
6913     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6914     AC_TRY_COMPILE([#include <stdio.h>], 
6915         [printf("Hello World\n");],
6916         _results=yes,
6917         _results=no)
6918     AC_MSG_RESULT([$_results])
6919     if test "$_results" = "no"; then
6920         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6921     fi
6922     CFLAGS=$_SAVE_CFLAGS
6925 dnl ========================================================
6926 dnl enable mobile optimizations
6927 dnl ========================================================
6928 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6929 [  --enable-mobile-optimize
6930                           Enable mobile optimizations],
6931     MOZ_GFX_OPTIMIZE_MOBILE=1)
6933 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6935 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6936     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6939 dnl ========================================================
6940 dnl = Enable code optimization. ON by default.
6941 dnl ========================================================
6942 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6943         MOZ_OPTIMIZE_FLAGS="-O"
6946 MOZ_ARG_ENABLE_STRING(optimize,
6947 [  --disable-optimize      Disable compiler optimization
6948   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6949 [ if test "$enableval" != "no"; then
6950     MOZ_OPTIMIZE=1
6951     if test -n "$enableval" && test "$enableval" != "yes"; then
6952         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6953         MOZ_OPTIMIZE=2
6954     fi
6955 else
6956     MOZ_OPTIMIZE=
6957 fi ], MOZ_OPTIMIZE=1)
6959 if test "$COMPILE_ENVIRONMENT"; then
6960 if test -n "$MOZ_OPTIMIZE"; then
6961     AC_MSG_CHECKING([for valid optimization flags])
6962     _SAVE_CFLAGS=$CFLAGS
6963     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6964     AC_TRY_COMPILE([#include <stdio.h>], 
6965         [printf("Hello World\n");],
6966         _results=yes,
6967         _results=no)
6968     AC_MSG_RESULT([$_results])
6969     if test "$_results" = "no"; then
6970         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6971     fi
6972     CFLAGS=$_SAVE_CFLAGS
6974 fi # COMPILE_ENVIRONMENT
6976 AC_SUBST(MOZ_OPTIMIZE)
6977 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6978 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6979 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6981 dnl ========================================================
6982 dnl = (Deprecated) generation of debugger info for specific modules
6983 dnl ========================================================
6984 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6985 [  --enable-debugger-info-modules
6986                           Enable/disable debugger info for specific modules],
6987 [ if test "$enableval" != "no"; then
6988     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
6989     MOZ_DEBUG_SYMBOLS=1
6990   fi ])
6992 dnl ========================================================
6993 dnl = Enable generation of debug symbols
6994 dnl ========================================================
6995 MOZ_ARG_ENABLE_STRING(debug-symbols,
6996 [  --enable-debug-symbols[=DBG]
6997                           Enable debugging symbols (using compiler flags DBG)],
6998 [ if test "$enableval" != "no"; then
6999       MOZ_DEBUG_SYMBOLS=1
7000       if test -n "$enableval" -a "$enableval" != "yes"; then
7001           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7002               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7003           else
7004               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7005           fi
7006       fi
7007   fi ])
7009 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7010     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7011     export MOZ_DEBUG_SYMBOLS
7014 dnl ========================================================
7015 dnl = Disable any treating of compile warnings as errors
7016 dnl ========================================================
7017 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7018 [  --disable-warnings-as-errors
7019                           Disable treating of warnings as errors],
7020     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7021     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7022 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7023    WARNINGS_AS_ERRORS=''
7026 dnl ========================================================
7027 dnl = Disable runtime logging checks
7028 dnl ========================================================
7029 MOZ_ARG_DISABLE_BOOL(logging,
7030 [  --disable-logging       Disable logging facilities],
7031     NS_DISABLE_LOGGING=1,
7032     NS_DISABLE_LOGGING= )
7033 if test "$NS_DISABLE_LOGGING"; then
7034     AC_DEFINE(NS_DISABLE_LOGGING)
7035 else
7036     AC_DEFINE(MOZ_LOGGING)
7039 dnl ========================================================
7040 dnl = This will enable logging of addref, release, ctor, dtor.
7041 dnl ========================================================
7042 _ENABLE_LOGREFCNT=42
7043 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7044 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7045     _ENABLE_LOGREFCNT=1,
7046     _ENABLE_LOGREFCNT= )
7047 if test "$_ENABLE_LOGREFCNT" = "1"; then
7048     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7049 elif test -z "$_ENABLE_LOGREFCNT"; then
7050     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7053 dnl ========================================================
7054 dnl = Enable trace malloc
7055 dnl ========================================================
7056 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7057 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7058 [  --enable-trace-malloc   Enable malloc tracing],
7059     NS_TRACE_MALLOC=1,
7060     NS_TRACE_MALLOC= )
7061 if test "$NS_TRACE_MALLOC"; then
7062   # Please, Mr. Linker Man, don't take away our symbol names
7063   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7064   USE_ELF_DYNSTR_GC=
7065   AC_DEFINE(NS_TRACE_MALLOC)
7067 AC_SUBST(NS_TRACE_MALLOC)
7069 dnl ========================================================
7070 dnl = Enable jemalloc
7071 dnl ========================================================
7072 MOZ_ARG_ENABLE_BOOL(jemalloc,
7073 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7074     MOZ_MEMORY=1,
7075     MOZ_MEMORY=)
7077 if test "$NS_TRACE_MALLOC"; then
7078     MOZ_MEMORY=
7081 if test "$MOZ_MEMORY"; then
7083   dnl Don't try to run compiler tests on Windows  
7084   if test "$OS_ARCH" = "WINNT"; then
7085     if test -z "$HAVE_64BIT_OS"; then
7086       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7087     else
7088       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7089     fi
7090   else
7091     AC_CHECK_SIZEOF([int *], [4])
7092     case "${ac_cv_sizeof_int_p}" in
7093     4)
7094       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7095       ;;
7096     8)
7097       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7098       ;;
7099     *)
7100       AC_MSG_ERROR([Unexpected pointer size])
7101       ;;
7102     esac
7103   fi
7105   AC_DEFINE(MOZ_MEMORY)
7106   if test "x$MOZ_DEBUG" = "x1"; then
7107     AC_DEFINE(MOZ_MEMORY_DEBUG)
7108   fi
7109   dnl The generic feature tests that determine how to compute ncpus are long and
7110   dnl complicated.  Therefore, simply define special cpp variables for the
7111   dnl platforms we have special knowledge of.
7112   case "${target}" in
7113   *-darwin*)
7114     AC_DEFINE(MOZ_MEMORY_DARWIN)
7115     ;;
7116   *-*freebsd*)
7117     AC_DEFINE(MOZ_MEMORY_BSD)
7118     ;;
7119   *-*linux*)
7120     AC_DEFINE(MOZ_MEMORY_LINUX)
7121     ;;
7122   *-netbsd*)
7123     AC_DEFINE(MOZ_MEMORY_BSD)
7124     ;;
7125   *-solaris*)
7126     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7127     ;;
7128   *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7129     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7130     dnl This is sort of awful. Will revisit if we add support for more versions
7131     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7132         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7133     fi
7134     if test -z "$WIN32_CRT_SRC_DIR"; then
7135       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7136         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).])
7137       else
7138         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7139       fi
7140     fi
7141     dnl cpu check
7142     case "${target_cpu}" in
7143     i*86)
7144       MOZ_CRT_CPU_ARCH=intel
7145       ;;
7146     x86_64)
7147       MOZ_CRT_CPU_ARCH=amd64
7148       ;;
7149     *)
7150       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7151       ;;
7152     esac
7154     AC_SUBST(MOZ_CRT_CPU_ARCH)
7156     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7157       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7158     fi
7159     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7160     _objdir_win=`pwd -W`
7161     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7162     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7163     dnl Also pass this to NSPR/NSS
7164     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7165     export DLLFLAGS
7166     ;;
7167   *-*wince)
7168     AC_DEFINE(MOZ_MEMORY_WINCE)
7169     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7170     if test -z "$WINCE_WINDOWS_MOBILE"; then
7171       AC_DEFINE(MOZ_MEMORY_WINCE6)
7172     fi
7173     ;;
7174   *-*winmo)
7175     AC_DEFINE(MOZ_MEMORY_WINCE)
7176     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7177     ;;
7178   *-android*)
7179     AC_DEFINE(MOZ_MEMORY_LINUX)
7180     AC_DEFINE(MOZ_MEMORY_ANDROID)
7181     _WRAP_MALLOC=1
7182     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc"
7183     ;;
7184   *)
7185     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7186     ;;
7187   esac
7189   if test "$OS_ARCH" != "Darwin"; then
7190     dnl NB: this must be kept in sync with jemalloc.h
7191     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7192     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7193     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7194   fi
7196 AC_SUBST(MOZ_MEMORY)
7197 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7198 AC_SUBST(WIN32_CRT_SRC_DIR)
7199 dnl Need to set this for make because NSS doesn't have configure
7200 AC_SUBST(DLLFLAGS)
7202 dnl ========================================================
7203 dnl = Use malloc wrapper lib
7204 dnl ========================================================
7205 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7206 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7207     _WRAP_MALLOC=1,
7208     _WRAP_MALLOC= )
7210 if test -n "$_WRAP_MALLOC"; then
7211     if test "$GNU_CC"; then
7212     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"
7213     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7214     fi
7217 dnl ========================================================
7218 dnl = Location of malloc wrapper lib
7219 dnl ========================================================
7220 MOZ_ARG_WITH_STRING(wrap-malloc,
7221 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7222     WRAP_MALLOC_LIB=$withval)
7224 dnl ========================================================
7225 dnl = Use TraceVis
7226 dnl ========================================================
7227 MOZ_ARG_ENABLE_BOOL(tracevis,
7228 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7229     MOZ_TRACEVIS=1,
7230     MOZ_TRACEVIS= )
7231 if test -n "$MOZ_TRACEVIS"; then
7232     AC_DEFINE(MOZ_TRACEVIS)
7235 dnl ========================================================
7236 dnl = Use GCTimer
7237 dnl ========================================================
7238 MOZ_ARG_ENABLE_BOOL(gctimer,
7239 [  --enable-gctimer        Enable GC timer (default=no)],
7240     MOZ_GCTIMER=1,
7241     MOZ_GCTIMER= )
7242 if test -n "$MOZ_GCTIMER"; then
7243     AC_DEFINE(MOZ_GCTIMER)
7246 dnl ========================================================
7247 dnl = Use Valgrind
7248 dnl ========================================================
7249 MOZ_ARG_ENABLE_BOOL(valgrind,
7250 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7251     MOZ_VALGRIND=1,
7252     MOZ_VALGRIND= )
7253 if test -n "$MOZ_VALGRIND"; then
7254     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7255         AC_MSG_ERROR(
7256             [--enable-valgrind specified but Valgrind is not installed]))
7257     AC_DEFINE(MOZ_VALGRIND)
7260 dnl ========================================================
7261 dnl jprof
7262 dnl ========================================================
7263 MOZ_ARG_ENABLE_BOOL(jprof,
7264 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
7265     MOZ_JPROF=1,
7266     MOZ_JPROF= )
7267 if test -n "$MOZ_JPROF"; then
7268     AC_DEFINE(MOZ_JPROF)
7271 dnl ========================================================
7272 dnl shark
7273 dnl ========================================================
7274 MOZ_ARG_ENABLE_BOOL(shark,
7275 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
7276     MOZ_SHARK=1,
7277     MOZ_SHARK= )
7278 if test -n "$MOZ_SHARK"; then
7279     AC_DEFINE(MOZ_SHARK)
7282 dnl ========================================================
7283 dnl callgrind
7284 dnl ========================================================
7285 MOZ_ARG_ENABLE_BOOL(callgrind,
7286 [  --enable-callgrind      Enable callgrind profiling],
7287     MOZ_CALLGRIND=1,
7288     MOZ_CALLGRIND= )
7289 if test -n "$MOZ_CALLGRIND"; then
7290     AC_DEFINE(MOZ_CALLGRIND)
7293 dnl ========================================================
7294 dnl vtune
7295 dnl ========================================================
7296 MOZ_ARG_ENABLE_BOOL(vtune,
7297 [  --enable-vtune          Enable vtune profiling],
7298     MOZ_VTUNE=1,
7299     MOZ_VTUNE= )
7300 if test -n "$MOZ_VTUNE"; then
7301     AC_DEFINE(MOZ_VTUNE)
7304 dnl ========================================================
7305 dnl Zealous JavaScript GC
7306 dnl ========================================================
7307 MOZ_ARG_ENABLE_BOOL(gczeal,
7308 [  --enable-gczeal         Enable zealous JavaScript GCing],
7309     JS_GC_ZEAL=1,
7310     JS_GC_ZEAL= )
7311 if test -n "$JS_GC_ZEAL"; then
7312     AC_DEFINE(JS_GC_ZEAL)
7315 dnl ========================================================
7316 dnl = Enable static checking using gcc-dehydra
7317 dnl ========================================================
7319 MOZ_ARG_WITH_STRING(static-checking,
7320 [  --with-static-checking=path/to/gcc_dehydra.so
7321                           Enable static checking of code using GCC-dehydra],
7322     DEHYDRA_PATH=$withval,
7323     DEHYDRA_PATH= )
7325 if test -n "$DEHYDRA_PATH"; then
7326     if test ! -f "$DEHYDRA_PATH"; then
7327         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7328     fi
7329     AC_DEFINE(NS_STATIC_CHECKING)
7331 AC_SUBST(DEHYDRA_PATH)
7333 dnl ========================================================
7334 dnl = Enable stripping of libs & executables
7335 dnl ========================================================
7336 MOZ_ARG_ENABLE_BOOL(strip,
7337 [  --enable-strip          Enable stripping of libs & executables ],
7338     ENABLE_STRIP=1,
7339     ENABLE_STRIP= )
7341 dnl ========================================================
7342 dnl = Enable stripping of libs & executables when packaging
7343 dnl ========================================================
7344 MOZ_ARG_ENABLE_BOOL(install-strip,
7345 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7346     PKG_SKIP_STRIP= ,
7347     PKG_SKIP_STRIP=1)
7349 dnl ========================================================
7350 dnl = --enable-elf-dynstr-gc
7351 dnl ========================================================
7352 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7353 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7354     USE_ELF_DYNSTR_GC=1,
7355     USE_ELF_DYNSTR_GC= )
7357 dnl ========================================================
7358 dnl = 
7359 dnl = Profiling and Instrumenting
7360 dnl = 
7361 dnl ========================================================
7362 MOZ_ARG_HEADER(Profiling and Instrumenting)
7364 dnl ========================================================
7365 dnl = Enable timeline service, which provides lightweight
7366 dnl = instrumentation of mozilla for performance measurement.
7367 dnl = Timeline is off by default.
7368 dnl ========================================================
7369 MOZ_ARG_ENABLE_BOOL(timeline,
7370 [  --enable-timeline       Enable timeline services ],
7371     MOZ_TIMELINE=1,
7372     MOZ_TIMELINE= )
7373 if test -n "$MOZ_TIMELINE"; then
7374     AC_DEFINE(MOZ_TIMELINE)
7377 dnl ========================================================
7378 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7379 dnl = timing for identifying code bottlenecks 
7380 dnl = NS_FUNCTION_TIMER is off by default.
7381 dnl ========================================================
7382 MOZ_ARG_ENABLE_BOOL(functiontimer,
7383 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7384     NS_FUNCTION_TIMER=1,
7385     NS_FUNCTION_TIMER= )
7386 if test -n "$NS_FUNCTION_TIMER"; then
7387     AC_DEFINE(NS_FUNCTION_TIMER)
7390 dnl ========================================================
7391 dnl Turn on reflow counting
7392 dnl ========================================================
7393 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7394 [  --enable-reflow-perf    Enable reflow performance tracing],
7395     MOZ_REFLOW_PERF=1,
7396     MOZ_REFLOW_PERF= )
7397 if test -n "$MOZ_REFLOW_PERF"; then
7398     AC_DEFINE(MOZ_REFLOW_PERF)
7401 dnl ========================================================
7402 dnl Enable code size metrics.
7403 dnl ========================================================
7404 MOZ_ARG_ENABLE_BOOL(codesighs,
7405 [  --enable-codesighs      Enable code size analysis tools],
7406     _ENABLE_CODESIGHS=1,
7407     _ENABLE_CODESIGHS= )
7408 if test -n "$_ENABLE_CODESIGHS"; then
7409     if test -d $srcdir/tools/codesighs; then 
7410         MOZ_MAPINFO=1
7411     else
7412         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7413     fi
7416 dnl ========================================================
7417 dnl = Support for Quantify (Windows)
7418 dnl ========================================================
7419 MOZ_ARG_ENABLE_BOOL(quantify,
7420 [  --enable-quantify       Enable Quantify support (Windows only) ],
7421     MOZ_QUANTIFY=1,
7422     MOZ_QUANTIFY= )
7424 dnl ========================================================
7425 dnl = Support for demangling undefined symbols
7426 dnl ========================================================
7427 if test -z "$SKIP_LIBRARY_CHECKS"; then
7428     AC_LANG_SAVE
7429     AC_LANG_CPLUSPLUS
7430     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7431     AC_LANG_RESTORE
7434 # Demangle only for debug or trace-malloc builds
7435 MOZ_DEMANGLE_SYMBOLS=
7436 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7437     MOZ_DEMANGLE_SYMBOLS=1
7438     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7440 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7442 dnl ========================================================
7443 dnl = Support for gcc stack unwinding (from gcc 3.3)
7444 dnl ========================================================
7445 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7446     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7449 dnl ========================================================
7450 dnl =
7451 dnl = Misc. Options
7452 dnl = 
7453 dnl ========================================================
7454 MOZ_ARG_HEADER(Misc. Options)
7456 dnl ========================================================
7457 dnl update xterm title
7458 dnl ========================================================
7459 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7460 [  --enable-xterm-updates  Update XTERM titles with current command.],
7461     MOZ_UPDATE_XTERM=1,
7462     MOZ_UPDATE_XTERM= )
7464 dnl =========================================================
7465 dnl = Chrome format
7466 dnl =========================================================
7467 MOZ_ARG_ENABLE_STRING([chrome-format],
7468 [  --enable-chrome-format=jar|flat|both|symlink|omni
7469                           Select FORMAT of chrome files (default=jar)],
7470     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7472 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7473     MOZ_CHROME_FILE_FORMAT=jar
7476 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7477     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7478     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7479     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7480     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7481     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7484 dnl =========================================================
7485 dnl Omnijar packaging (bug 552121)
7486 dnl =========================================================
7487 dnl Omnijar packaging is compatible with flat packaging.
7488 dnl In unpackaged builds, omnijar looks for files as if
7489 dnl things were flat packaged. After packaging, all files
7490 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7491 dnl is set to flat since putting files into jars is only
7492 dnl done during packaging with omnijar.
7493 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7494     MOZ_OMNIJAR=1
7495     AC_DEFINE(MOZ_OMNIJAR)
7496     MOZ_CHROME_FILE_FORMAT=flat
7497 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7498     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7501 AC_SUBST(MOZ_OMNIJAR)
7503 dnl ========================================================
7504 dnl = Define default location for MOZILLA_FIVE_HOME
7505 dnl ========================================================
7506 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7507 [  --with-default-mozilla-five-home
7508                           Set the default value for MOZILLA_FIVE_HOME],
7509 [ val=`echo $withval`
7510   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7512 dnl ========================================================
7513 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7514 dnl ========================================================
7515 MOZ_ARG_WITH_STRING(user-appdir,
7516 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7517 [ val=`echo $withval`
7518 if echo "$val" | grep "\/" >/dev/null; then
7519     AC_MSG_ERROR("Homedir must be single relative path.")
7520 else 
7521     MOZ_USER_DIR="$val"
7522 fi])
7524 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7526 dnl ========================================================
7527 dnl = Doxygen configuration
7528 dnl ========================================================
7529 dnl Use commas to specify multiple dirs to this arg
7530 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7531 MOZ_ARG_WITH_STRING(doc-input-dirs,
7532 [  --with-doc-input-dirs=DIRS
7533                           Header/idl dirs to create docs from],
7534 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7535 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7537 dnl Use commas to specify multiple dirs to this arg
7538 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7539 MOZ_ARG_WITH_STRING(doc-include-dirs,
7540 [  --with-doc-include-dirs=DIRS  
7541                           Include dirs to preprocess doc headers],
7542 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7543 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7545 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7546 MOZ_ARG_WITH_STRING(doc-output-dir,
7547 [  --with-doc-output-dir=DIR
7548                           Dir to generate docs into],
7549 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7550 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7552 if test -z "$SKIP_COMPILER_CHECKS"; then
7553 dnl ========================================================
7554 dnl =
7555 dnl = Compiler Options
7556 dnl = 
7557 dnl ========================================================
7558 MOZ_ARG_HEADER(Compiler Options)
7560 dnl ========================================================
7561 dnl Check for gcc -pipe support
7562 dnl ========================================================
7563 AC_MSG_CHECKING([for gcc -pipe support])
7564 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7565     echo '#include <stdio.h>' > dummy-hello.c
7566     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7567     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7568     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7569     if test $? = 0; then
7570         _res_as_stdin="yes"
7571     else
7572         _res_as_stdin="no"
7573     fi
7574     if test "$_res_as_stdin" = "yes"; then
7575         _SAVE_CFLAGS=$CFLAGS
7576         CFLAGS="$CFLAGS -pipe"
7577         AC_TRY_COMPILE( [ #include <stdio.h> ],
7578             [printf("Hello World\n");],
7579             [_res_gcc_pipe="yes"],
7580             [_res_gcc_pipe="no"] )
7581         CFLAGS=$_SAVE_CFLAGS
7582     fi
7583     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7584         _res="yes";
7585         CFLAGS="$CFLAGS -pipe"
7586         CXXFLAGS="$CXXFLAGS -pipe"
7587     else
7588         _res="no"
7589     fi
7590     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7591     AC_MSG_RESULT([$_res])
7592 else
7593     AC_MSG_RESULT([no])
7596 dnl ========================================================
7597 dnl Profile guided optimization
7598 dnl ========================================================
7599 dnl Test for profiling options
7600 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7601 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7603 dnl Provide a switch to disable PGO even when called via profiledbuild.
7604 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7605 [  --disable-profile-guided-optimization
7606                           Don't build with PGO even if called via make profiledbuild],
7607 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7608 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7610 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7612 _SAVE_CFLAGS="$CFLAGS"
7613 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7615 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7616 AC_TRY_COMPILE([], [return 0;],
7617                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7618                  result="yes" ], result="no")
7619 AC_MSG_RESULT([$result])
7621 if test $result = "yes"; then
7622   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7623   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7624   PROFILE_USE_LDFLAGS="-fprofile-use"
7625 else
7626   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7627   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7628   AC_TRY_COMPILE([], [return 0;],
7629                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7630                    result="yes" ], result="no")
7631   AC_MSG_RESULT([$result])
7632   if test $result = "yes"; then
7633     PROFILE_USE_CFLAGS="-fbranch-probabilities"
7634   fi
7635   # don't really care, this is an old GCC
7636   PROFILE_GEN_LDFLAGS=
7637   PROFILE_USE_LDFLAGS=
7640 CFLAGS="$_SAVE_CFLAGS"
7642 if test -n "$INTEL_CC"; then
7643   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7644   PROFILE_GEN_LDFLAGS=
7645   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7646   PROFILE_USE_LDFLAGS=
7649 dnl Sun Studio on Solaris
7650 if test "$SOLARIS_SUNPRO_CC"; then
7651   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7652   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7653   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7654   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7657 AC_SUBST(PROFILE_GEN_CFLAGS)
7658 AC_SUBST(PROFILE_GEN_LDFLAGS)
7659 AC_SUBST(PROFILE_USE_CFLAGS)
7660 AC_SUBST(PROFILE_USE_LDFLAGS)
7662 AC_LANG_CPLUSPLUS
7664 dnl ========================================================
7665 dnl Test for -pedantic bustage
7666 dnl ========================================================
7667 MOZ_ARG_DISABLE_BOOL(pedantic,
7668 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7669 _PEDANTIC= )
7670 if test "$_PEDANTIC"; then
7671     _SAVE_CXXFLAGS=$CXXFLAGS
7672     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7673     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7674     AC_TRY_COMPILE([$configure_static_assert_macros],
7675                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7676                    result="no", result="yes" )
7677     AC_MSG_RESULT([$result])
7678     CXXFLAGS="$_SAVE_CXXFLAGS"
7680     case "$result" in
7681     no)
7682         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7683         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7684         ;;
7685     yes)
7686         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7687         ;;
7688     esac
7691 dnl ========================================================
7692 dnl Test for correct temporary object destruction order
7693 dnl ========================================================
7694 dnl We want to make sure the compiler follows the C++ spec here as 
7695 dnl xpcom and the string classes depend on it (bug 235381).
7696 AC_MSG_CHECKING([for correct temporary object destruction order])
7697 AC_TRY_RUN([ class A {
7698              public:  A(int& x) : mValue(x) {}
7699                       ~A() { mValue--; }
7700                       operator char**() { return 0; }
7701              private:  int& mValue;
7702              };
7703              void func(char **arg) {}
7704              int m=2;
7705              void test() {
7706                   func(A(m));
7707                   if (m==1) m = 0;
7708              }
7709              int main() {
7710                  test();
7711                  return(m);
7712              }
7713              ],
7714      result="yes", result="no", result="maybe")
7715 AC_MSG_RESULT([$result])
7717 if test "$result" = "no"; then
7718     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7721 dnl ========================================================
7722 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7723 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7724 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7725 dnl ========================================================
7726 _SAVE_CXXFLAGS=$CXXFLAGS
7727 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7728 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7729     ac_nscap_nonconst_opeq_bug,
7730     [AC_TRY_COMPILE([
7731                       template <class T>
7732                       class Pointer
7733                         {
7734                         public:
7735                           T* myPtr;
7736                         };
7737                       
7738                       template <class T, class U>
7739                       int operator==(const Pointer<T>& rhs, U* lhs)
7740                         {
7741                           return rhs.myPtr == lhs;
7742                         }
7743                       
7744                       template <class T, class U>
7745                       int operator==(const Pointer<T>& rhs, const U* lhs)
7746                         {
7747                           return rhs.myPtr == lhs;
7748                         }
7749                     ],
7750                     [
7751                       Pointer<int> foo;
7752                       const int* bar;
7753                       return foo == bar;
7754                     ],
7755                     ac_nscap_nonconst_opeq_bug="no",
7756                     ac_nscap_nonconst_opeq_bug="yes")])
7757 CXXFLAGS="$_SAVE_CXXFLAGS"
7759 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7760     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7762 fi # SKIP_COMPILER_CHECKS
7764 dnl ========================================================
7765 dnl C++ rtti
7766 dnl Should be smarter and check that the compiler does indeed have rtti
7767 dnl ========================================================
7769 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7770 [  --enable-cpp-rtti       Enable C++ RTTI ],
7771 [ _MOZ_USE_RTTI=1 ],
7772 [ _MOZ_USE_RTTI= ])
7774 if test "$_MOZ_USE_RTTI"; then
7775    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7776 else
7777    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7780 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7782 dnl ========================================================
7783 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
7784 dnl Should be smarter and check that the compiler does indeed have exceptions
7785 dnl ========================================================
7786 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7787 [  --enable-cpp-exceptions Enable C++ exceptions ],
7788 [ _MOZ_CPP_EXCEPTIONS=1 ],
7789 [ _MOZ_CPP_EXCEPTIONS= ])
7791 if test "$_MOZ_CPP_EXCEPTIONS"; then
7792     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7793     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
7794 else
7795     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7798 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7800 # Irix & OSF native compilers do not like exception declarations 
7801 # when exceptions are disabled
7802 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7803     AC_DEFINE(CPP_THROW_NEW, [])
7804 else
7805     AC_DEFINE(CPP_THROW_NEW, [throw()])
7807 AC_LANG_C
7809 dnl ========================================================
7810 dnl =
7811 dnl = Build depencency options
7812 dnl =
7813 dnl ========================================================
7814 MOZ_ARG_HEADER(Build dependencies)
7816 dnl ========================================================
7817 dnl = Do not auto generate dependency info
7818 dnl ========================================================
7819 MOZ_AUTO_DEPS=1
7820 MOZ_ARG_DISABLE_BOOL(auto-deps,
7821 [  --disable-auto-deps     Do not automatically generate dependency info],
7822     MOZ_AUTO_DEPS=,
7823     MOZ_AUTO_DEPS=1)
7825 if test -n "$MOZ_AUTO_DEPS"; then
7826 dnl ========================================================
7827 dnl = Use mkdepend instead of $CC -MD for dependency generation
7828 dnl ========================================================
7829 _cpp_md_flag=
7830 MOZ_ARG_DISABLE_BOOL(md,
7831 [  --disable-md            Do not use compiler-based dependencies ],
7832   [_cpp_md_flag=],
7833   [_cpp_md_flag=1],
7834   [dnl Default is to turn on -MD if using GNU-compatible compilers
7835    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7836      _cpp_md_flag=1
7837    fi
7838   dnl Default is to use -xM if using Sun Studio on Solaris
7839    if test "$SOLARIS_SUNPRO_CC"; then
7840      _cpp_md_flag=1
7841    fi])
7842 if test "$_cpp_md_flag"; then
7843   COMPILER_DEPEND=1
7844   if test "$OS_ARCH" = "OpenVMS"; then
7845     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7846   else
7847     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7848   fi
7849   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7850   if test "$SOLARIS_SUNPRO_CC"; then
7851     _DEPEND_CFLAGS=
7852   fi
7853 else
7854   COMPILER_DEPEND=
7855   dnl Don't override this for MSVC
7856   if test -z "$_WIN32_MSVC"; then
7857     _USE_CPP_INCLUDE_FLAG=
7858     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7859     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7860   fi
7862 fi # MOZ_AUTO_DEPS
7863 MDDEPDIR='.deps'
7864 AC_SUBST(MOZ_AUTO_DEPS)
7865 AC_SUBST(COMPILER_DEPEND)
7866 AC_SUBST(MDDEPDIR)
7869 dnl ========================================================
7870 dnl =
7871 dnl = Static Build Options
7872 dnl =
7873 dnl ========================================================
7874 MOZ_ARG_HEADER(Static build options)
7876 MOZ_ARG_ENABLE_BOOL(static,
7877 [  --enable-static         Enable building of internal static libs],
7878     BUILD_STATIC_LIBS=1,
7879     BUILD_STATIC_LIBS=)
7881 MOZ_ARG_ENABLE_BOOL(libxul,
7882 [  --enable-libxul         Enable building of libxul],
7883     MOZ_ENABLE_LIBXUL=1,
7884     MOZ_ENABLE_LIBXUL=)
7886 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7887         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7890 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7891         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7894 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
7895     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
7898 AC_SUBST(LIBXUL_LIBS)
7900 if test -n "$MOZ_ENABLE_LIBXUL"; then
7901     XPCOM_LIBS="$LIBXUL_LIBS"
7902     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7903 else
7904     if test -n "$BUILD_STATIC_LIBS"; then
7905         AC_DEFINE(MOZ_STATIC_BUILD)
7906     fi
7907     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7910 dnl ========================================================
7911 dnl =
7912 dnl = Standalone module options
7913 dnl = 
7914 dnl ========================================================
7915 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7917 dnl Check for GLib and libIDL.
7918 dnl ========================================================
7919 SKIP_IDL_CHECK="no"
7921 if test -z "$COMPILE_ENVIRONMENT"; then
7922     SKIP_IDL_CHECK="yes"
7925 dnl = Allow users to disable libIDL checking for standalone modules
7926 MOZ_ARG_WITHOUT_BOOL(libIDL,
7927 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7928         SKIP_IDL_CHECK="yes")
7930 if test -z "$CROSS_COMPILE"; then
7931     if test -z "$HOST_LIBIDL_CONFIG"; then
7932         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7933     fi
7934     if test -z "$HOST_LIBIDL_PREFIX"; then
7935         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
7936     fi
7939 if test "$SKIP_IDL_CHECK" = "no"
7940 then
7941     _LIBIDL_FOUND=
7942     case "$host" in
7943     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
7944         if test -n "$GLIB_PREFIX"; then
7945             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
7946             if test "$?" = "0"; then
7947                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
7948                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
7949                 fi
7950                 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
7951             else
7952                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
7953             fi
7954         else
7955             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
7956         fi
7957         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
7958             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
7959         fi
7960         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
7961         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
7962             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
7963         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
7964             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
7965         else
7966             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
7967         fi
7969         if test -n "$HOST_LIBIDL_PREFIX"; then
7970             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
7971             if test "$?" = "0"; then
7972                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
7973                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
7974                 fi
7975                 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
7976             else
7977                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
7978             fi
7979         else
7980             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
7981         fi        
7982         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
7983             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
7984         fi
7985         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
7986         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
7987             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
7988             STATIC_LIBIDL=1
7989         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
7990             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
7991         else
7992             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
7993         fi
7994         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
7995         _LIBIDL_FOUND=1
7996         ;;
7997     esac
7999     if test -z "$_LIBIDL_FOUND"; then
8000         if test "$MACOS_SDK_DIR"; then 
8001             dnl xpidl, and therefore libIDL, is only needed on the build host.
8002             dnl Don't build it against the SDK, as that causes problems.
8003             _MACSAVE_CFLAGS="$CFLAGS"
8004             _MACSAVE_LIBS="$LIBS"
8005             _MACSAVE_LDFLAGS="$LDFLAGS"
8006             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8007           changequote(,)
8008           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"`
8009           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8010           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8011           changequote([,])
8012           unset NEXT_ROOT
8013         fi
8015         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8016     fi
8018     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8019     dnl to either libIDL1 or libIDL2.
8020     if test -z "$_LIBIDL_FOUND"; then
8021         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8022         if test -z "$_LIBIDL_FOUND"; then
8023             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8024         fi
8025     fi
8026     dnl
8027     dnl If we don't have a libIDL config program & not cross-compiling, 
8028     dnl     look for orbit-config instead.
8029     dnl
8030     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
8031         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8032         if test -n "$ORBIT_CONFIG"; then
8033             AC_MSG_CHECKING([for ORBit libIDL usability])
8034                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8035             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8036             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8037             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8038             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8039             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8040             HOST_LIBIDL_CONFIG=
8041             _SAVE_CFLAGS="$CFLAGS"
8042             _SAVE_LIBS="$LIBS"
8043             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8044             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8045             AC_TRY_RUN([
8046 #include <stdlib.h>
8047 #include <libIDL/IDL.h>
8048 int main() {
8049   char *s;
8050   s=strdup(IDL_get_libver_string());
8051   if(s==NULL) {
8052     exit(1);
8053   }
8054   exit(0);
8056             ], [_LIBIDL_FOUND=1
8057                 result="yes"],
8058                [HOST_LIBIDL_CFLAGS=
8059                 HOST_LIBIDL_LIBS=
8060                 result="no"],
8061                [_LIBIDL_FOUND=1
8062                 result="maybe"] )
8063             AC_MSG_RESULT($result)
8064             CFLAGS="$_SAVE_CFLAGS"
8065             LIBS="$_SAVE_LIBS"
8066         fi
8067     fi
8068     if test -z "$_LIBIDL_FOUND"; then
8069         AC_MSG_ERROR([libIDL not found.
8070         libIDL $LIBIDL_VERSION or higher is required.])
8071     fi
8072     if test "$MACOS_SDK_DIR"; then
8073       CFLAGS="$_MACSAVE_CFLAGS"
8074       LIBS="$_MACSAVE_LIBS"
8075       LDFLAGS="$_MACSAVE_LDFLAGS"
8076       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8077         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8078       fi
8079     fi
8082 if test -n "$CROSS_COMPILE"; then
8083     case "$target" in
8084     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8085         if test -n "$GLIB_PREFIX"; then
8086             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8087             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8088                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8089             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8090                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8091             else
8092                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8093             fi
8094         fi
8096         if test -n "$LIBIDL_PREFIX"; then
8097             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8098             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8099                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8100                 STATIC_LIBIDL=1
8101             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8102                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8103             else
8104                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8105             fi
8106         fi
8107         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8108         ;;
8109     *)
8110         if test -n "LIBIDL_CONFIG" && test "LIBIDL_CONFIG" != "no"; then
8111             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8112             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8113         fi
8114         ;;
8115     esac
8116 else
8117     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8118     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8121 if test -z "$SKIP_PATH_CHECKS"; then
8122 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
8123     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
8124         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8125     else
8126         AM_PATH_GLIB(${GLIB_VERSION})
8127     fi
8131 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8132     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8135 AC_SUBST(LIBIDL_CFLAGS)
8136 AC_SUBST(LIBIDL_LIBS)
8137 AC_SUBST(STATIC_LIBIDL)
8138 AC_SUBST(GLIB_CFLAGS)
8139 AC_SUBST(GLIB_LIBS)
8140 AC_SUBST(GLIB_GMODULE_LIBS)
8141 AC_SUBST(HOST_LIBIDL_CONFIG)
8142 AC_SUBST(HOST_LIBIDL_CFLAGS)
8143 AC_SUBST(HOST_LIBIDL_LIBS)
8145 dnl ========================================================
8146 dnl Check for cairo
8147 dnl ========================================================
8148 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8150 MOZ_TREE_CAIRO=1
8151 MOZ_ARG_ENABLE_BOOL(system-cairo,
8152 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8153 MOZ_TREE_CAIRO=,
8154 MOZ_TREE_CAIRO=1 )
8156 # Check for headers defining standard int types.
8157 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8159 if test "$MOZ_TREE_CAIRO"; then
8160     AC_DEFINE(MOZ_TREE_CAIRO)
8162     # For now we assume that we will have a uint64_t available through
8163     # one of the above headers or mozstdint.h.
8164     AC_DEFINE(HAVE_UINT64_T)
8166     # Define macros for cairo-features.h
8167     if test "$MOZ_X11"; then
8168         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8169         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8170         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8171         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8172         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8173         MOZ_ENABLE_CAIRO_FT=1
8174         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8175     fi
8176     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8177         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8178     fi
8179     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8180         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8181         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8182         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8183     fi
8184     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8185         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8186         if test -z "$WINCE"; then
8187             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8188             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8189                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8190                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8191                 MOZ_ENABLE_D2D_SURFACE=1
8192                 MOZ_ENABLE_DWRITE_FONT=1
8193             else
8194                 WIN32_DWRITE_FONT_FEATURE=
8195                 WIN32_D2D_SURFACE_FEATURE=
8196             fi
8197         else
8198             WIN32_FONT_FEATURE=
8199             WIN32_DWRITE_FONT_FEATURE=
8200             WIN32_D2D_SURFACE_FEATURE=
8201         fi
8203         AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8205         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
8206         if test -z "$HAS_DDRAW"; then
8207             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.])
8208             DDRAW_SURFACE_FEATURE=
8209         else
8210             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
8211         fi
8213         if test -z "$OGLES_SDK_DIR"; then
8214             OGLES_SURFACE_FEATURE=
8215         else
8216             AC_TRY_COMPILE([
8217               #include <EGL/egl.h>
8218               #include <EGL/eglext.h>
8219               #include <GLES2/gl2.h>
8220               #include <GLES2/gl2ext.h>
8221             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
8222             if test -z "$HAS_OGLES"; then
8223               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
8224               OGLES_SURFACE_FEATURE=
8225             else
8226               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
8227             fi
8228         fi
8230         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8231     fi
8232     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8233         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8234         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8235         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8236         MOZ_ENABLE_CAIRO_FT=1
8237         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8238         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8239     fi
8240     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8241         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8242         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8243         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8244         MOZ_ENABLE_CAIRO_FT=1
8245     fi
8246     if test "$USE_FC_FREETYPE"; then
8247         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8248     fi
8249     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8250     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8251     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8252     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8253     AC_SUBST(CAIRO_FT_CFLAGS)
8254     AC_SUBST(HAS_OGLES)
8256     if test "$MOZ_DEBUG"; then
8257       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8258     else
8259       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8260     fi
8262     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8264     AC_SUBST(PS_SURFACE_FEATURE)
8265     AC_SUBST(PDF_SURFACE_FEATURE)
8266     AC_SUBST(SVG_SURFACE_FEATURE)
8267     AC_SUBST(XLIB_SURFACE_FEATURE)
8268     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8269     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8270     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8271     AC_SUBST(XCB_SURFACE_FEATURE)
8272     AC_SUBST(WIN32_SURFACE_FEATURE)
8273     AC_SUBST(DDRAW_SURFACE_FEATURE)
8274     AC_SUBST(OGLES_SURFACE_FEATURE)    
8275     AC_SUBST(OS2_SURFACE_FEATURE)
8276     AC_SUBST(BEOS_SURFACE_FEATURE)
8277     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8278     AC_SUBST(FT_FONT_FEATURE)
8279     AC_SUBST(FC_FONT_FEATURE)
8280     AC_SUBST(WIN32_FONT_FEATURE)
8281     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8282     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8283     AC_SUBST(QUARTZ_FONT_FEATURE)
8284     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8285     AC_SUBST(QT_SURFACE_FEATURE)
8287     if test "$_WIN32_MSVC"; then
8288         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
8289     else
8290         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
8292         if test "$MOZ_X11"; then
8293             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8294         fi
8295     fi
8297     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8298     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8300 else
8301    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8302    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8303    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8304    if test "$MOZ_X11"; then
8305         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8306         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8307         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8308    fi
8311 AC_SUBST(MOZ_TREE_CAIRO)
8312 AC_SUBST(MOZ_CAIRO_CFLAGS)
8313 AC_SUBST(MOZ_CAIRO_LIBS)
8315 dnl qcms
8316 dnl ========================================================
8318 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8319 AC_SUBST(QCMS_LIBS)
8321 dnl ========================================================
8322 dnl disable xul
8323 dnl ========================================================
8324 MOZ_ARG_DISABLE_BOOL(xul,
8325 [  --disable-xul           Disable XUL],
8326     MOZ_XUL= )
8327 if test "$MOZ_XUL"; then
8328   AC_DEFINE(MOZ_XUL)
8329 else
8330   dnl remove extensions that require XUL
8331   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8334 AC_SUBST(MOZ_XUL)
8336 dnl ========================================================
8337 dnl disable profile locking
8338 dnl   do no use this in applications that can have more than
8339 dnl   one process accessing the profile directory.
8340 dnl ========================================================
8341 MOZ_ARG_DISABLE_BOOL(profilelocking,
8342 [  --disable-profilelocking
8343                           Disable profile locking],
8344     MOZ_PROFILELOCKING=,
8345     MOZ_PROFILELOCKING=1 )
8346 if test "$MOZ_PROFILELOCKING"; then
8347   AC_DEFINE(MOZ_PROFILELOCKING)
8350 dnl ========================================================
8351 dnl disable rdf services
8352 dnl ========================================================
8353 MOZ_ARG_DISABLE_BOOL(rdf,
8354 [  --disable-rdf           Disable RDF],
8355     MOZ_RDF= )
8356 if test "$MOZ_RDF"; then
8357   AC_DEFINE(MOZ_RDF)
8360 AC_SUBST(MOZ_RDF)
8362 dnl ========================================================
8363 dnl necko configuration options
8364 dnl ========================================================
8367 dnl option to disable various necko protocols
8369 MOZ_ARG_ENABLE_STRING(necko-protocols,
8370 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8371                           Enable/disable specific protocol handlers],
8372 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8373     if test "$option" = "yes" || test "$option" = "all"; then
8374         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8375     elif test "$option" = "no" || test "$option" = "none"; then
8376         NECKO_PROTOCOLS=""
8377     elif test "$option" = "default"; then
8378         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8379     elif test `echo "$option" | grep -c \^-` != 0; then
8380         option=`echo $option | sed 's/^-//'`
8381         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8382     else
8383         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8384     fi
8385 done],
8386     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8387 dnl Remove dupes
8388 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8389 AC_SUBST(NECKO_PROTOCOLS)
8390 for p in $NECKO_PROTOCOLS; do
8391     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8392 done
8395 dnl option to disable necko's disk cache
8397 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8398 [  --disable-necko-disk-cache
8399                           Disable necko disk cache],
8400     NECKO_DISK_CACHE=,
8401     NECKO_DISK_CACHE=1)
8402 AC_SUBST(NECKO_DISK_CACHE)
8403 if test "$NECKO_DISK_CACHE"; then
8404     AC_DEFINE(NECKO_DISK_CACHE)
8408 dnl option to disable necko's wifi scanner
8410 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8411 [  --disable-necko-wifi    Disable necko wifi scanner],
8412     NECKO_WIFI=,)
8414 if test "$OS_ARCH" = "OS2"; then
8415   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8416   NECKO_WIFI=
8418 if test "$NECKO_WIFI" -a \
8419         "$OS_ARCH" != "Linux" -a \
8420         "$OS_ARCH" != "Darwin" -a \
8421         "$OS_ARCH" != "SunOS" -a \
8422         "$OS_ARCH" != "WINNT" -a \
8423         "$OS_ARCH" != "WINCE"; then
8424   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8427 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8428 then
8429   AC_CHECK_HEADER([iwlib.h])
8430   if test "$ac_cv_header_iwlib_h" != "yes"; then
8431     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])
8432   fi
8435 if test "$NECKO_WIFI"; then
8436   AC_DEFINE(NECKO_WIFI)
8438 AC_SUBST(NECKO_WIFI)
8441 dnl option to disable cookies
8443 MOZ_ARG_DISABLE_BOOL(cookies,
8444 [  --disable-cookies       Disable cookie support],
8445     NECKO_COOKIES=,
8446     NECKO_COOKIES=1)
8447 AC_SUBST(NECKO_COOKIES)
8448 if test "$NECKO_COOKIES"; then
8449     AC_DEFINE(NECKO_COOKIES)
8453 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8455 MOZ_ARG_DISABLE_BOOL(ctypes,
8456 [  --disable-ctypes        Disable js-ctypes],
8457     BUILD_CTYPES=,
8458     BUILD_CTYPES=1)
8459 AC_SUBST(BUILD_CTYPES)
8460 if test "$BUILD_CTYPES"; then
8461   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8462     # Disable ctypes for arm/wince.
8463     BUILD_CTYPES=
8464   else
8465     AC_DEFINE(BUILD_CTYPES)
8466   fi
8469 dnl NECKO_ configuration options are not global
8470 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8472 dnl Only build Mork if it's required
8473 AC_SUBST(MOZ_MORK)
8474 if test "$MOZ_MORK"; then
8475   AC_DEFINE(MOZ_MORK)
8478 dnl Build the lightweight Mork reader if required
8479 AC_SUBST(MOZ_MORKREADER)
8480 if test "$MOZ_MORKREADER"; then
8481   AC_DEFINE(MOZ_MORKREADER)
8484 dnl Build Places if required
8485 if test "$MOZ_PLACES"; then
8486   AC_DEFINE(MOZ_PLACES)
8489 dnl ========================================================
8490 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8491     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8494 dnl ========================================================
8495 dnl =
8496 dnl = Maintainer debug option (no --enable equivalent)
8497 dnl =
8498 dnl ========================================================
8500 AC_SUBST(AR)
8501 AC_SUBST(AR_FLAGS)
8502 AC_SUBST(AR_LIST)
8503 AC_SUBST(AR_EXTRACT)
8504 AC_SUBST(AR_DELETE)
8505 AC_SUBST(AS)
8506 AC_SUBST(ASFLAGS)
8507 AC_SUBST(AS_DASH_C_FLAG)
8508 AC_SUBST(LD)
8509 AC_SUBST(RC)
8510 AC_SUBST(RCFLAGS)
8511 AC_SUBST(WINDRES)
8512 AC_SUBST(IMPLIB)
8513 AC_SUBST(FILTER)
8514 AC_SUBST(BIN_FLAGS)
8515 AC_SUBST(NS_USE_NATIVE)
8516 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8517 AC_SUBST(MOZ_UPDATE_XTERM)
8518 AC_SUBST(MINIMO)
8519 AC_SUBST(MOZ_PLATFORM_MAEMO)
8520 AC_SUBST(MOZ_AUTH_EXTENSION)
8521 AC_SUBST(MOZ_MATHML)
8522 AC_SUBST(MOZ_PERMISSIONS)
8523 AC_SUBST(MOZ_XTF)
8524 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8525 AC_SUBST(MOZ_PREF_EXTENSIONS)
8526 AC_SUBST(MOZ_SVG)
8527 AC_SUBST(MOZ_SMIL)
8528 AC_SUBST(MOZ_XSLT_STANDALONE)
8529 AC_SUBST(MOZ_JS_LIBS)
8530 AC_SUBST(MOZ_PSM)
8531 AC_SUBST(MOZ_DEBUG)
8532 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8533 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8534 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8535 AC_SUBST(MOZ_DEBUG_FLAGS)
8536 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8537 AC_SUBST(WARNINGS_AS_ERRORS)
8538 AC_SUBST(MOZ_EXTENSIONS)
8539 AC_SUBST(MOZ_IMG_DECODERS)
8540 AC_SUBST(MOZ_IMG_ENCODERS)
8541 AC_SUBST(MOZ_JSDEBUGGER)
8542 AC_SUBST(MOZ_PLUGINS)
8543 AC_SUBST(MOZ_LOG_REFCNT)
8544 AC_SUBST(MOZ_LEAKY)
8545 AC_SUBST(MOZ_JPROF)
8546 AC_SUBST(MOZ_SHARK)
8547 AC_SUBST(MOZ_CALLGRIND)
8548 AC_SUBST(MOZ_VTUNE)
8549 AC_SUBST(MOZ_JSLOADER)
8550 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8551 AC_SUBST(MOZ_QUANTIFY)
8552 AC_SUBST(LIBICONV)
8553 AC_SUBST(MOZ_PLACES)
8554 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8555 AC_SUBST(MOZ_STORAGE)
8556 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8557 AC_SUBST(MOZ_FEEDS)
8558 AC_SUBST(NS_PRINTING)
8559 AC_SUBST(MOZ_WEBGL)
8560 AC_SUBST(MOZ_HELP_VIEWER)
8562 AC_SUBST(MOZ_JAVAXPCOM)
8563 AC_SUBST(JAVA_INCLUDE_PATH)
8564 AC_SUBST(JAVA)
8565 AC_SUBST(JAVAC)
8566 AC_SUBST(JAR)
8568 AC_SUBST(MOZ_PROFILELOCKING)
8570 AC_SUBST(HAVE_XIE)
8571 AC_SUBST(MOZ_XIE_LIBS)
8572 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8574 AC_SUBST(BUILD_STATIC_LIBS)
8575 AC_SUBST(MOZ_ENABLE_LIBXUL)
8576 AC_SUBST(ENABLE_TESTS)
8577 AC_SUBST(IBMBIDI)
8578 AC_SUBST(MOZ_UNIVERSALCHARDET)
8579 AC_SUBST(ACCESSIBILITY)
8580 AC_SUBST(MOZ_VIEW_SOURCE)
8581 AC_SUBST(MOZ_SPELLCHECK)
8582 AC_SUBST(MOZ_USER_DIR)
8583 AC_SUBST(MOZ_CRASHREPORTER)
8585 AC_SUBST(ENABLE_STRIP)
8586 AC_SUBST(PKG_SKIP_STRIP)
8587 AC_SUBST(USE_ELF_DYNSTR_GC)
8588 AC_SUBST(INCREMENTAL_LINKER)
8589 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8590 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8592 AC_SUBST(MOZ_FIX_LINK_PATHS)
8593 AC_SUBST(XPCOM_LIBS)
8594 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8595 AC_SUBST(XPCOM_GLUE_LDOPTS)
8596 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8598 AC_SUBST(USE_DEPENDENT_LIBS)
8600 AC_SUBST(MOZ_BUILD_ROOT)
8601 AC_SUBST(MOZ_OS2_TOOLS)
8602 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8604 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8605 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8606 AC_SUBST(MOZ_TIMELINE)
8607 AC_SUBST(OGLES_SDK_DIR)
8609 AC_SUBST(MOZ_APP_NAME)
8610 AC_SUBST(MOZ_APP_DISPLAYNAME)
8611 AC_SUBST(MOZ_APP_VERSION)
8612 AC_SUBST(MOZ_APP_UA_EXTRA)
8613 AC_SUBST(FIREFOX_VERSION)
8615 AC_SUBST(MOZ_PKG_SPECIAL)
8617 AC_SUBST(MOZILLA_OFFICIAL)
8619 dnl win32 options
8620 AC_SUBST(MOZ_MAPINFO)
8621 AC_SUBST(MOZ_BROWSE_INFO)
8622 AC_SUBST(MOZ_TOOLS_DIR)
8623 AC_SUBST(CYGWIN_WRAPPER)
8624 AC_SUBST(AS_PERL)
8625 AC_SUBST(WIN32_REDIST_DIR)
8626 AC_SUBST(PYTHON)
8628 AC_SUBST(WINCE)
8629 AC_SUBST(WINCE_SDK_DIR)
8630 AC_SUBST(WINCE_WINDOWS_MOBILE)
8632 dnl Echo the CFLAGS to remove extra whitespace.
8633 CFLAGS=`echo \
8634         $_WARNINGS_CFLAGS \
8635         $CFLAGS`
8637 CXXFLAGS=`echo \
8638         $_MOZ_RTTI_FLAGS \
8639         $_MOZ_EXCEPTIONS_FLAGS \
8640         $_WARNINGS_CXXFLAGS \
8641         $CXXFLAGS`
8643 COMPILE_CFLAGS=`echo \
8644     $_DEFINES_CFLAGS \
8645         $_DEPEND_CFLAGS \
8646     $COMPILE_CFLAGS`
8648 COMPILE_CXXFLAGS=`echo \
8649     $_DEFINES_CXXFLAGS \
8650         $_DEPEND_CFLAGS \
8651     $COMPILE_CXXFLAGS`
8653 AC_SUBST(SYSTEM_MAKEDEPEND)
8654 AC_SUBST(SYSTEM_LIBXUL)
8655 AC_SUBST(SYSTEM_JPEG)
8656 AC_SUBST(SYSTEM_PNG)
8657 AC_SUBST(SYSTEM_ZLIB)
8658 AC_SUBST(SYSTEM_BZ2)
8660 AC_SUBST(JPEG_CFLAGS)
8661 AC_SUBST(JPEG_LIBS)
8662 AC_SUBST(ZLIB_CFLAGS)
8663 AC_SUBST(ZLIB_LIBS)
8664 AC_SUBST(BZ2_CFLAGS)
8665 AC_SUBST(BZ2_LIBS)
8666 AC_SUBST(PNG_CFLAGS)
8667 AC_SUBST(PNG_LIBS)
8669 AC_SUBST(MOZ_JPEG_CFLAGS)
8670 AC_SUBST(MOZ_JPEG_LIBS)
8671 AC_SUBST(MOZ_ZLIB_CFLAGS)
8672 AC_SUBST(MOZ_ZLIB_LIBS)
8673 AC_SUBST(MOZ_BZ2_CFLAGS)
8674 AC_SUBST(MOZ_BZ2_LIBS)
8675 AC_SUBST(MOZ_PNG_CFLAGS)
8676 AC_SUBST(MOZ_PNG_LIBS)
8678 AC_SUBST(NSPR_CFLAGS)
8679 AC_SUBST(NSPR_LIBS)
8680 AC_SUBST(MOZ_NATIVE_NSPR)
8682 AC_SUBST(NSS_CFLAGS)
8683 AC_SUBST(NSS_LIBS)
8684 AC_SUBST(NSS_DEP_LIBS)
8685 AC_SUBST(MOZ_NATIVE_NSS)
8686 AC_SUBST(NSS_DISABLE_DBM)
8688 AC_SUBST(CFLAGS)
8689 AC_SUBST(CXXFLAGS)
8690 AC_SUBST(CPPFLAGS)
8691 AC_SUBST(COMPILE_CFLAGS)
8692 AC_SUBST(COMPILE_CXXFLAGS)
8693 AC_SUBST(LDFLAGS)
8694 AC_SUBST(LIBS)
8695 AC_SUBST(CROSS_COMPILE)
8696 AC_SUBST(WCHAR_CFLAGS)
8698 AC_SUBST(HOST_CC)
8699 AC_SUBST(HOST_CXX)
8700 AC_SUBST(HOST_CFLAGS)
8701 AC_SUBST(HOST_CXXFLAGS)
8702 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8703 AC_SUBST(HOST_AR)
8704 AC_SUBST(HOST_AR_FLAGS)
8705 AC_SUBST(HOST_LD)
8706 AC_SUBST(HOST_RANLIB)
8707 AC_SUBST(HOST_NSPR_MDCPUCFG)
8708 AC_SUBST(HOST_BIN_SUFFIX)
8709 AC_SUBST(HOST_OS_ARCH)
8711 AC_SUBST(TARGET_CPU)
8712 AC_SUBST(TARGET_VENDOR)
8713 AC_SUBST(TARGET_OS)
8714 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8715 AC_SUBST(TARGET_MD_ARCH)
8716 AC_SUBST(TARGET_XPCOM_ABI)
8717 AC_SUBST(OS_TARGET)
8718 AC_SUBST(OS_ARCH)
8719 AC_SUBST(OS_RELEASE)
8720 AC_SUBST(OS_TEST)
8722 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8723 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8725 AC_SUBST(WRAP_MALLOC_CFLAGS)
8726 AC_SUBST(WRAP_MALLOC_LIB)
8727 AC_SUBST(MKSHLIB)
8728 AC_SUBST(MKCSHLIB)
8729 AC_SUBST(MKSHLIB_FORCE_ALL)
8730 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8731 AC_SUBST(DSO_CFLAGS)
8732 AC_SUBST(DSO_PIC_CFLAGS)
8733 AC_SUBST(DSO_LDOPTS)
8734 AC_SUBST(LIB_PREFIX)
8735 AC_SUBST(DLL_PREFIX)
8736 AC_SUBST(DLL_SUFFIX)
8737 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8738 AC_SUBST(LIB_SUFFIX)
8739 AC_SUBST(OBJ_SUFFIX)
8740 AC_SUBST(BIN_SUFFIX)
8741 AC_SUBST(ASM_SUFFIX)
8742 AC_SUBST(IMPORT_LIB_SUFFIX)
8743 AC_SUBST(USE_N32)
8744 AC_SUBST(CC_VERSION)
8745 AC_SUBST(CXX_VERSION)
8746 AC_SUBST(MSMANIFEST_TOOL)
8747 AC_SUBST(NS_ENABLE_TSF)
8748 AC_SUBST(MOZ_NSS_PATCH)
8750 if test "$USING_HCC"; then
8751    CC='${topsrcdir}/build/hcc'
8752    CC="$CC '$_OLDCC'"
8753    CXX='${topsrcdir}/build/hcpp'
8754    CXX="$CXX '$_OLDCXX'"
8755    AC_SUBST(CC)
8756    AC_SUBST(CXX)
8759 dnl Check for missing components
8760 if test "$COMPILE_ENVIRONMENT"; then
8761 if test "$MOZ_X11"; then
8762     dnl ====================================================
8763     dnl = Check if X headers exist
8764     dnl ====================================================
8765     _SAVE_CFLAGS=$CFLAGS
8766     CFLAGS="$CFLAGS $XCFLAGS"
8767     AC_TRY_COMPILE([
8768         #include <stdio.h>
8769         #include <stdlib.h>
8770         #include <X11/Xlib.h>
8771         #include <X11/Intrinsic.h>
8772     ],
8773     [
8774         Display *dpy = 0;
8775         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8776             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8777             exit(1);
8778         }
8779     ], [], 
8780     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8781     CFLAGS="$_SAVE_CFLAGS"
8783     if test ! -z "$MISSING_X"; then
8784         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8785     fi
8787 fi # MOZ_X11
8789 dnl Check for headers, etc. needed by WebGL.
8790 if test -n "$MOZ_WEBGL_GLX"; then
8791     AC_CHECK_HEADER(GL/glx.h)
8792     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8793         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8794     fi
8795 fi # MOZ_WEBGL_GLX
8796 fi # COMPILE_ENVIRONMENT
8798 if test "$USE_FC_FREETYPE"; then
8799     if test "$COMPILE_ENVIRONMENT"; then
8800         _SAVE_CPPFLAGS="$CPPFLAGS"
8801         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8802         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
8803             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8804         CPPFLAGS="$_SAVE_CPPFLAGS"
8805     else
8806         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8807     fi
8810 dnl Set various defines and substitutions
8811 dnl ========================================================
8813 if test "$OS_ARCH" = "BeOS"; then
8814   AC_DEFINE(XP_BEOS)
8815 elif test "$OS_ARCH" = "Darwin"; then
8816   AC_DEFINE(XP_UNIX)
8817   AC_DEFINE(UNIX_ASYNC_DNS)
8818 elif test "$OS_ARCH" = "OpenVMS"; then
8819   AC_DEFINE(XP_UNIX)
8820 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8821   AC_DEFINE(XP_UNIX)
8822   AC_DEFINE(UNIX_ASYNC_DNS)
8825 if test "$MOZ_DEBUG"; then
8826     AC_DEFINE(MOZ_REFLOW_PERF)
8827     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8830 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8831     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8832     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8833     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8834     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8835     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8836     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8837     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8838     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8841 dnl ========================================================
8842 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8843 dnl ========================================================
8844 case "$host_os" in
8845 mingw*)
8846     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8847     ;;
8848 cygwin*|msvc*|mks*)
8849     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8850     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8851     CC="\$(CYGWIN_WRAPPER) $CC"
8852     CXX="\$(CYGWIN_WRAPPER) $CXX"
8853     CPP="\$(CYGWIN_WRAPPER) $CPP"
8854     LD="\$(CYGWIN_WRAPPER) $LD"
8855     AS="\$(CYGWIN_WRAPPER) $AS"
8856     RC="\$(CYGWIN_WRAPPER) $RC"
8857     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8858     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8859     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8860     ;;
8861 esac
8863 AC_SUBST(CYGDRIVE_MOUNT)
8864 AC_SUBST(WIN_TOP_SRC)
8866 AC_SUBST(MOZILLA_VERSION)
8868 AC_SUBST(ac_configure_args)
8870 dnl Spit out some output
8871 dnl ========================================================
8873 dnl The following defines are used by xpcom
8874 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8875 CPP_THROW_NEW
8876 HAVE_CPP_2BYTE_WCHAR_T
8877 HAVE_CPP_ACCESS_CHANGING_USING
8878 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8879 HAVE_CPP_BOOL
8880 HAVE_CPP_CHAR16_T
8881 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8882 HAVE_CPP_EXPLICIT
8883 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8884 HAVE_CPP_NAMESPACE_STD
8885 HAVE_CPP_NEW_CASTS
8886 HAVE_CPP_PARTIAL_SPECIALIZATION
8887 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8888 HAVE_CPP_TYPENAME
8889 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8890 HAVE_STATVFS
8891 NEED_CPP_UNUSED_IMPLEMENTATIONS
8892 NEW_H
8893 HAVE_GETPAGESIZE
8894 HAVE_ICONV
8895 HAVE_ICONV_WITH_CONST_INPUT
8896 HAVE_MBRTOWC
8897 HAVE_SYS_MOUNT_H
8898 HAVE_SYS_VFS_H
8899 HAVE_WCRTOMB
8902 AC_CONFIG_HEADER(
8903 netwerk/necko-config.h
8904 xpcom/xpcom-config.h
8905 xpcom/xpcom-private.h
8908 # Save the defines header file before autoconf removes it.
8909 # (Do not add AC_DEFINE calls after this line.)
8910   _CONFIG_TMP=confdefs-tmp.h
8911   _CONFIG_DEFS_H=mozilla-config.h
8913   cat > $_CONFIG_TMP <<\EOF
8914 /* List of defines generated by configure. Included with preprocessor flag,
8915  * -include, to avoid long list of -D defines on the compile command-line.
8916  * Do not edit.
8917  */
8919 #ifndef _MOZILLA_CONFIG_H_
8920 #define _MOZILLA_CONFIG_H_
8923 _EGREP_PATTERN='^#define ('
8924 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8925     for f in $_NON_GLOBAL_ACDEFINES; do
8926         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8927     done
8929 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8931   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8933   cat >> $_CONFIG_TMP <<\EOF
8935 #endif /* _MOZILLA_CONFIG_H_ */
8939   # Only write mozilla-config.h when something changes (or it doesn't exist)
8940   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8941     rm $_CONFIG_TMP
8942   else
8943     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8944     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8946     echo ==== $_CONFIG_DEFS_H =================================
8947     cat $_CONFIG_DEFS_H
8948   fi
8950 dnl Probably shouldn't call this manually but we always want the output of DEFS
8951 rm -f confdefs.h.save
8952 mv confdefs.h confdefs.h.save
8953 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8954 AC_OUTPUT_MAKE_DEFS()
8955 MOZ_DEFINES=$DEFS
8956 AC_SUBST(MOZ_DEFINES)
8957 rm -f confdefs.h
8958 mv confdefs.h.save confdefs.h
8960 dnl Load the list of Makefiles to generate.
8961 dnl   To add new Makefiles, edit allmakefiles.sh.
8962 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8963 . ${srcdir}/allmakefiles.sh
8964 dnl 
8965 dnl Run a perl script to quickly create the makefiles.
8966 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8967 dnl   for the files it cannot handle correctly. This way, config.status
8968 dnl   will handle these files.
8969 dnl If it fails, nothing is set and config.status will run as usual.
8971 dnl This does not change the $MAKEFILES variable.
8973 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8975 if test -z "${AS_PERL}"; then
8976 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8977 else
8978 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8980 . ./conftest.sh
8981 rm conftest.sh
8983 echo $MAKEFILES > unallmakefiles
8985 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8987 AC_OUTPUT($MAKEFILES)
8989 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8990 if test "$CAIRO_FEATURES_H"; then
8991   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8992     echo "$CAIRO_FEATURES_H is unchanged"
8993     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8994   else
8995     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8996   fi
8999 dnl ========================================================
9000 dnl = Setup a nice relatively clean build environment for
9001 dnl = sub-configures.
9002 dnl ========================================================
9003 CC="$_SUBDIR_CC" 
9004 CXX="$_SUBDIR_CXX" 
9005 CFLAGS="$_SUBDIR_CFLAGS" 
9006 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9007 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9008 LDFLAGS="$_SUBDIR_LDFLAGS"
9009 HOST_CC="$_SUBDIR_HOST_CC" 
9010 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9011 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9014 unset MAKEFILES
9015 unset CONFIG_FILES
9017 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9018 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9020 if test -n "$MOZ_THUMB2"; then
9021   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9023 if test -n "$_WRAP_MALLOC"; then
9024   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9027 if test -z "$MOZ_NATIVE_NSPR"; then
9028     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9029     if test -z "$MOZ_DEBUG"; then
9030         ac_configure_args="$ac_configure_args --disable-debug"
9031     fi
9032     if test "$MOZ_OPTIMIZE" = "1"; then
9033         ac_configure_args="$ac_configure_args --enable-optimize"
9034     fi
9035     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
9036        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9037     fi
9038     if test -n "$HAVE_64BIT_OS"; then
9039         ac_configure_args="$ac_configure_args --enable-64bit"
9040     fi
9041     if test -n "$USE_ARM_KUSER"; then
9042         ac_configure_args="$ac_configure_args --with-arm-kuser"
9043     fi
9044     AC_OUTPUT_SUBDIRS(nsprpub)
9045     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9048 if test -z "$MOZ_NATIVE_NSPR"; then
9049     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9050     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9051     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
9052        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9053        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9054        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9055        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9056     fi
9057     rm -f config/autoconf.mk.bak
9060 # Run the SpiderMonkey 'configure' script.
9061 dist=$MOZ_BUILD_ROOT/dist
9062 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9063 ac_configure_args="$ac_configure_args --enable-threadsafe"
9064 if test "$BUILD_CTYPES"; then
9065     # Build js-ctypes on the platforms we can.
9066     ac_configure_args="$ac_configure_args --enable-ctypes"
9068 if test -z "$MOZ_NATIVE_NSPR"; then
9069     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9070     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9072 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9073 ac_configure_args="$ac_configure_args --prefix=$dist"
9074 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9075 if test "$MOZ_MEMORY"; then
9076    ac_configure_args="$ac_configure_args --enable-jemalloc"
9077    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9078      export MOZ_MEMORY_LDFLAGS
9079    fi
9081 AC_OUTPUT_SUBDIRS(js/src)
9082 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9084 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9086 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9087 dnl Needs to be at the end to respect possible changes from NSPR configure
9088 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9089   echo "config/autoconf.mk is unchanged"
9090   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9091 else
9092   rm -f config/autoconf.mk.orig 2> /dev/null