Fix trace_tests.py when showing output. (r=jorendorff)
[mozilla-central.git] / configure.in
blobcab5fb8ead597691076e82179ae5f10af526bf70
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 dnl
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
10 dnl
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
14 dnl License.
15 dnl
16 dnl The Original Code is this file as it was released upon August 6, 1998.
17 dnl
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
22 dnl
23 dnl Contributor(s):
24 dnl   Jamie Zawinski <jwz@jwz.org>
25 dnl   gettimeofday args check
26 dnl   Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl   gnomefe update & enable-pthreads
28 dnl   Ramiro Estrugo <ramiro@netscape.com>
29 dnl   X11 makedepend support
30 dnl   Insure support.
31 dnl   Henry Sobotka <sobotka@axess.com>
32 dnl   OS/2 support
33 dnl   Dan Mosedale <dmose@mozilla.org>
34 dnl   LDAP support
35 dnl   Seth Spitzer <sspitzer@netscape.com>
36 dnl   xpctools support
37 dnl   Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl   Howard Chu <hyc@symas.com>
39 dnl   MSYS support
40 dnl   Mark Mentovai <mark@moxienet.com>:
41 dnl   Mac OS X 10.4 support
42 dnl   Giorgio Maone <g.maone@informaction.com>
43 dnl   MSVC l10n compatible version check
44 dnl   Ben Turner <mozilla@songbirdnest.com>
45 dnl   Windows x64 support
46 dnl   Makoto Kato <m_kato@ga2.so-net.ne.jp>
47 dnl
48 dnl Alternatively, the contents of this file may be used under the terms of
49 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
50 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
51 dnl in which case the provisions of the GPL or the LGPL are applicable instead
52 dnl of those above. If you wish to allow use of your version of this file only
53 dnl under the terms of either the GPL or the LGPL, and not to allow others to
54 dnl use your version of this file under the terms of the MPL, indicate your
55 dnl decision by deleting the provisions above and replace them with the notice
56 dnl and other provisions required by the GPL or the LGPL. If you do not delete
57 dnl the provisions above, a recipient may use your version of this file under
58 dnl the terms of any one of the MPL, the GPL or the LGPL.
59 dnl
60 dnl ***** END LICENSE BLOCK *****
62 dnl Process this file with autoconf to produce a configure script.
63 dnl ========================================================
65 AC_PREREQ(2.13)
66 AC_INIT(config/config.mk)
67 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
68 AC_CANONICAL_SYSTEM
69 TARGET_CPU="${target_cpu}"
70 TARGET_VENDOR="${target_vendor}"
71 TARGET_OS="${target_os}"
73 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1` 
74 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
77 dnl =
78 dnl = Don't change the following two lines.  Doing so breaks:
79 dnl =
80 dnl = CFLAGS="-foo" ./configure
81 dnl =
82 dnl ========================================================
83 CFLAGS="${CFLAGS=}"
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
86 LDFLAGS="${LDFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
96 _SUBDIR_CC="$CC"
97 _SUBDIR_CXX="$CXX"
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
110 MOZJPEG=62
111 MOZPNG=10401
112 MOZZLIB=0x1230
113 NSPR_VERSION=4
114 NSS_VERSION=3
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
118 GLIB_VERSION=1.2.0
119 LIBIDL_VERSION=0.6.3
120 PERL_VERSION=5.006
121 PYTHON_VERSION=2.5
122 CAIRO_VERSION=1.8.8
123 PANGO_VERSION=1.14.0
124 GTK2_VERSION=2.10.0
125 WINDRES_VERSION=2.14.90
126 W32API_VERSION=3.8
127 GNOMEVFS_VERSION=2.0
128 GNOMEUI_VERSION=2.2.0
129 GCONF_VERSION=1.2.1
130 GIO_VERSION=2.0
131 STARTUP_NOTIFICATION_VERSION=0.8
132 DBUS_VERSION=0.60
133 SQLITE_VERSION=3.7.1
134 LIBNOTIFY_VERSION=0.4
136 MSMANIFEST_TOOL=
138 dnl Set various checks
139 dnl ========================================================
140 MISSING_X=
141 AC_PROG_AWK
143 dnl Initialize the Pthread test variables early so they can be
144 dnl  overridden by each platform.
145 dnl ========================================================
146 USE_PTHREADS=
147 _PTHREAD_LDFLAGS=""
149 dnl Do not allow a separate objdir build if a srcdir build exists.
150 dnl ==============================================================
151 _topsrcdir=`cd \`dirname $0\`; pwd`
152 _objdir=`pwd`
154 if test "$_topsrcdir" != "$_objdir"
155 then
156   # Check for a couple representative files in the source tree
157   _conflict_files=
158   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
159     if test -f $file; then
160       _conflict_files="$_conflict_files $file"
161     fi
162   done
163   if test "$_conflict_files"; then
164     echo "***"
165     echo "*   Your source tree contains these files:"
166     for file in $_conflict_files; do
167       echo "*         $file"
168     done
169     cat 1>&2 <<-EOF
170         *   This indicates that you previously built in the source tree.
171         *   A source tree build can confuse the separate objdir build.
172         *
173         *   To clean up the source tree:
174         *     1. cd $_topsrcdir
175         *     2. gmake distclean
176         ***
177         EOF
178     exit 1
179     break
180   fi
182 MOZ_BUILD_ROOT=`pwd`
184 dnl Default to MSVC for win32 and gcc-4.2 for darwin
185 dnl ==============================================================
186 if test -z "$CROSS_COMPILE"; then
187 case "$target" in
188 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
189     if test -z "$CC"; then CC=cl; fi
190     if test -z "$CXX"; then CXX=cl; fi
191     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
192     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
193     if test -z "$LD"; then LD=link; fi
194     if test -z "$AS"; then
195         case "${target_cpu}" in
196         i*86)
197             AS=ml;
198             ;;
199         x86_64)
200             AS=ml64;
201             ;;
202         esac
203     fi
204     if test -z "$MIDL"; then MIDL=midl; fi
205     ;;
206 *-darwin*)
207     if test -z "$CC"; then CC=gcc-4.2; fi
208     if test -z "$CXX"; then CXX=g++-4.2; fi
209     ;;
210 esac
213 COMPILE_ENVIRONMENT=1
214 MOZ_ARG_DISABLE_BOOL(compile-environment,
215 [  --disable-compile-environment
216                           Disable compiler/library checks.],
217     COMPILE_ENVIRONMENT= )
218 AC_SUBST(COMPILE_ENVIRONMENT)
220 MOZ_ARG_WITH_STRING(l10n-base,
221 [  --with-l10n-base=DIR    path to l10n repositories],
222     L10NBASEDIR=$withval)
223 if test ! -z "$L10NBASEDIR"; then
224     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
225         AC_MSG_ERROR([--with-l10n-base must specify a path])
226     elif test -d "$L10NBASEDIR"; then
227         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
228     else
229         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
230     fi
232 AC_SUBST(L10NBASEDIR)
234 dnl Check for Perl first -- needed for win32 SDK checks
235 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
236 if test -z "$PERL" -o "$PERL" = ":"; then
237     AC_MSG_ERROR([perl not found in \$PATH])
240 dnl ========================================================
241 dnl = Android uses a very custom (hacky) toolchain; we need to do this
242 dnl = here, so that the compiler checks can succeed
243 dnl ========================================================
245 MOZ_ARG_WITH_STRING(android-ndk,
246 [  --with-android-ndk=DIR
247                           location where the Android NDK can be found],
248     android_ndk=$withval)
250 MOZ_ARG_WITH_STRING(android-toolchain,
251 [  --with-android-toolchain=DIR
252                           location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
253     android_toolchain=$withval)
256 MOZ_ARG_WITH_STRING(android-version,
257 [  --with-android-version=VER
258                           android platform version, default 5],
259     android_version=$withval,
260     android_version=5)
262 MOZ_ARG_WITH_STRING(android-sdk,
263 [  --with-android-sdk=DIR
264                           location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
265     android_sdk=$withval)
267 MOZ_ARG_WITH_STRING(android-tools,
268 [  --with-android-tools=DIR
269                           location where the Android Tools can be found (base directory, e.g. .../android/tools)],
270     android_tools=$withval)
272 if test "$target" = "arm-android-eabi" ; then
273     if test -z "$android_ndk" ; then
274         AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
275     fi
277     if test -z "$android_sdk" ; then
278         AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
279     fi
281     if test -z "$android_tools" ; then
282         AC_MSG_ERROR([You must specify --with-android-tools=/path/to/sdk/tools when targeting Android.])
283     fi
285     if test -z "$android_toolchain" ; then
286         android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
287     fi
289     if test -z "$android_platform" ; then
290        android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
291     fi
293     dnl set up compilers
294     AS="$android_toolchain"/bin/arm-eabi-as
295     CC="$android_toolchain"/bin/arm-eabi-gcc
296     CXX="$android_toolchain"/bin/arm-eabi-g++
297     CPP="$android_toolchain"/bin/arm-eabi-cpp
298     LD="$android_toolchain"/bin/arm-eabi-ld
299     AR="$android_toolchain"/bin/arm-eabi-ar
300     RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
301     STRIP="$android_toolchain"/bin/arm-eabi-strip
303     CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
304     CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS"
305     CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CXXFLAGS"
307     dnl Add -llog by default, since we use it all over the place.
308     dnl Add --allow-shlib-undefined, because libGLESv2 links to an
309     dnl undefined symbol (present on the hardware, just not in the
310     dnl NDK.)
311     LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
313     dnl prevent cross compile section from using these flags as host flags
314     if test -z "$HOST_CPPFLAGS" ; then
315         HOST_CPPFLAGS=" "
316     fi
317     if test -z "$HOST_CFLAGS" ; then
318         HOST_CFLAGS=" "
319     fi
320     if test -z "$HOST_CXXFLAGS" ; then
321         HOST_CXXFLAGS=" "
322     fi
323     if test -z "$HOST_LDFLAGS" ; then
324         HOST_LDFLAGS=" "
325     fi
327     ANDROID_NDK="${android_ndk}"
328     ANDROID_TOOLCHAIN="{android_toolchain}"
329     ANDROID_PLATFORM="{android_platform}"
330     ANDROID_SDK="${android_sdk}"
331     ANDROID_TOOLS="${android_tools}"
332     ANDROID_VERSION="${android_version}"
334     AC_DEFINE(ANDROID)
335     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
336     AC_SUBST(ANDROID_VERSION)
337     CROSS_COMPILE=1
338     MOZ_CHROME_FILE_FORMAT=omni
341 AC_SUBST(ANDROID_NDK)
342 AC_SUBST(ANDROID_TOOLCHAIN)
343 AC_SUBST(ANDROID_PLATFORM)
344 AC_SUBST(ANDROID_SDK)
345 AC_SUBST(ANDROID_TOOLS)
347 dnl ========================================================
348 dnl Checks for compilers.
349 dnl ========================================================
350 dnl Set CROSS_COMPILE in the environment when running configure
351 dnl to use the cross-compile setup for now
352 dnl ========================================================
354 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
355 AR_FLAGS='cr $@'
357 if test "$COMPILE_ENVIRONMENT"; then
359 dnl Do some special WinCE toolchain stuff
360 case "$target" in
361 *wince|*winmo)
363     MOZ_ARG_WITH_STRING(wince-sdk,
364     [  --with-wince-sdk=WINCE_SDK_DIR
365                           The path to the Windows CE SDK],
366     WINCE_SDK_DIR=$withval)
368     MOZ_ARG_WITH_STRING(ogles-sdk,
369     [  --with-ogles-sdk=OGLES_SDK_DIR
370                           The path to the OGLES SDK],
371     OGLES_SDK_DIR=$withval)
373     AC_DEFINE(WINCE)
374     
375     export WINCE=1
377     echo -----------------------------------------------------------------------------
378     echo Building Windows CE Shunt Library and Tool Chain
379     echo Using SDK in:
380     echo $WINCE_SDK_DIR
382     ac_exeext=.exe
384     _pwd=`pwd -W`
385     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
386     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
387     TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
388     -C $srcdir/build/wince/tools
390     CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
391     CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
392     CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
393     CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
394     LD="$_pwd/dist/sdk/bin/$target-link.exe"
395     AR="$_pwd/dist/sdk/bin/$target-lib.exe"
396     AS="$_pwd/dist/sdk/bin/$target-as.exe"
397     RC="$_pwd/dist/sdk/bin/$target-res.exe"
400     echo -----------------------------------------------------------------------------
402     ;;
403 esac
405 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
406     echo "cross compiling from $host to $target"
407     cross_compiling=yes
409     _SAVE_CC="$CC"
410     _SAVE_CFLAGS="$CFLAGS"
411     _SAVE_LDFLAGS="$LDFLAGS"
413     AC_MSG_CHECKING([for host c compiler])
414     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
415     if test -z "$HOST_CC"; then
416         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
417     fi
418     AC_MSG_RESULT([$HOST_CC])
419     AC_MSG_CHECKING([for host c++ compiler])
420     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
421     if test -z "$HOST_CXX"; then
422         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
423     fi
424     AC_MSG_RESULT([$HOST_CXX])
426     if test -z "$HOST_CFLAGS"; then
427         HOST_CFLAGS="$CFLAGS"
428     fi
429     if test -z "$HOST_CXXFLAGS"; then
430         HOST_CXXFLAGS="$CXXFLAGS"
431     fi
432     if test -z "$HOST_LDFLAGS"; then
433         HOST_LDFLAGS="$LDFLAGS"
434     fi
435     if test -z "$HOST_AR_FLAGS"; then
436         HOST_AR_FLAGS="$AR_FLAGS"
437     fi
438     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
439     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
440     CC="$HOST_CC"
441     CFLAGS="$HOST_CFLAGS"
442     LDFLAGS="$HOST_LDFLAGS"
444     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
445     AC_TRY_COMPILE([], [return(0);], 
446         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
447         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
449     CC="$HOST_CXX"
450     CFLAGS="$HOST_CXXFLAGS"
452     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
453     AC_TRY_COMPILE([], [return(0);], 
454         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
455         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
456     
457     CC=$_SAVE_CC
458     CFLAGS=$_SAVE_CFLAGS
459     LDFLAGS=$_SAVE_LDFLAGS
461     case "$build:$target" in
462       powerpc-apple-darwin8*:i?86-apple-darwin*)
463         dnl The Darwin cross compiler doesn't necessarily point itself at a
464         dnl root that has libraries for the proper architecture, it defaults
465         dnl to the system root.  The libraries in the system root on current
466         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
467         dnl checks will fail.  Fake a working SDK in that case.
468         _SAVE_CFLAGS=$CFLAGS
469         _SAVE_CXXFLAGS=$CXXLAGS
470         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
471         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
472         ;;
473     esac
475     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
476     unset ac_cv_prog_CC
477     AC_PROG_CC
478     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
479     unset ac_cv_prog_CXX
480     AC_PROG_CXX
482     case "$build:$target" in
483       powerpc-apple-darwin8*:i?86-apple-darwin*)
484         dnl Revert the changes made above.  From this point on, the target
485         dnl compiler will never be used without applying the SDK to CFLAGS
486         dnl (see --with-macos-sdk below).
487         CFLAGS=$_SAVE_CFLAGS
488         CXXFLAGS=$_SAVE_CXXFLAGS
489         ;;
490     esac
492     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
493     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
494     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
495     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
496     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
497     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
498     AC_DEFINE(CROSS_COMPILE)
499 else
500     AC_PROG_CC
501     AC_PROG_CXX
502     AC_PROG_RANLIB
503     MOZ_PATH_PROGS(AS, $AS as, $CC)
504     AC_CHECK_PROGS(AR, ar, :)
505     AC_CHECK_PROGS(LD, ld, :)
506     AC_CHECK_PROGS(STRIP, strip, :)
507     AC_CHECK_PROGS(WINDRES, windres, :)
508     if test -z "$HOST_CC"; then
509         HOST_CC='$(CC)'
510     fi
511     if test -z "$HOST_CFLAGS"; then
512         HOST_CFLAGS='$(CFLAGS)'
513     fi
514     if test -z "$HOST_CXX"; then
515         HOST_CXX='$(CXX)'
516     fi
517     if test -z "$HOST_CXXFLAGS"; then
518         HOST_CXXFLAGS='$(CXXFLAGS)'
519     fi
520     if test -z "$HOST_LDFLAGS"; then
521         HOST_LDFLAGS='$(LDFLAGS)'
522     fi
523     if test -z "$HOST_RANLIB"; then
524         HOST_RANLIB='$(RANLIB)'
525     fi
526     if test -z "$HOST_AR"; then
527         HOST_AR='$(AR)'
528     fi
529     if test -z "$HOST_AR_FLAGS"; then
530         HOST_AR_FLAGS='$(AR_FLAGS)'
531     fi
534 GNU_AS=
535 GNU_LD=
536 GNU_CC=
537 GNU_CXX=
538 CC_VERSION='N/A'
539 CXX_VERSION='N/A'
540 if test "$GCC" = "yes"; then
541     GNU_CC=1
542     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
544 if test "$GXX" = "yes"; then
545     GNU_CXX=1
546     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
548 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
549     GNU_AS=1
551 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
552     GNU_LD=1
554 if test "$GNU_CC"; then
555     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
556         GCC_USE_GNU_LD=1
557     fi
560 INTEL_CC=
561 INTEL_CXX=
562 if test "$GCC" = yes; then
563    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
564      INTEL_CC=1
565    fi
568 if test "$GXX" = yes; then
569    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
570      INTEL_CXX=1
571    fi
574 dnl Special win32 checks
575 dnl ========================================================
576 case "$target" in
577 *-wince|*-winmo)
578     WINVER=500
579     WINSDK_TARGETVER=502
580     ;;
582     WINVER=502
583     dnl Target the Windows 7 SDK by default
584     WINSDK_TARGETVER=601
585     ;;
586 esac
588 MOZ_ARG_WITH_STRING(windows-version,
589 [  --with-windows-version=WINSDK_TARGETVER
590                           Highest Windows version to target using this SDK
591                               502: Windows Server 2003
592                               600: Windows Vista
593                               601: Windows 7],
594   WINSDK_TARGETVER=$withval)
596 case "$WINSDK_TARGETVER" in
597 502|600|601)
598     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
599     ;;
602     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
603     ;;
605 esac
607 if test -n "$COMPILE_ENVIRONMENT"; then
608 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
609     # We can't build parental controls either
610     MOZ_DISABLE_PARENTAL_CONTROLS=1
614 case "$target" in
615 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
616     if test "$GCC" != "yes"; then
617         # Check to see if we are really running in a msvc environemnt
618         _WIN32_MSVC=1
619         AC_CHECK_PROGS(MIDL, midl)
621         # Make sure compilers are valid
622         CFLAGS="$CFLAGS -TC -nologo"
623         CXXFLAGS="$CXXFLAGS -TP -nologo"
624         AC_LANG_SAVE
625         AC_LANG_C
626         AC_TRY_COMPILE([#include <stdio.h>],
627             [ printf("Hello World\n"); ],,
628             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
630         AC_LANG_CPLUSPLUS
631         AC_TRY_COMPILE([#include <new.h>],
632             [ unsigned *test = new unsigned(42); ],,
633             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
634         AC_LANG_RESTORE
635         
636         changequote(,)
637         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
638         changequote([,])
639         
640         # Determine compiler version
641         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
642         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
643         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
644         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
645         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
646         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
648         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
649         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
651         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
652             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
653         fi
654         if test "$_CC_MAJOR_VERSION" = "13"; then
655             _CC_SUITE=7
656         elif test "$_CC_MAJOR_VERSION" = "14"; then
657             _CC_SUITE=8
658             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
659             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
660             dnl so be very specific here!
661             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
662             if test $_CC_RELEASE -gt 50727; then
663                _USE_DYNAMICBASE=1
664             elif test $_CC_BUILD -ge 762; then
665                _USE_DYNAMICBASE=1
666             fi
667             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
668             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
669         elif test "$_CC_MAJOR_VERSION" = "15"; then
670             _CC_SUITE=9
671             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
672             _USE_DYNAMICBASE=1
673             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
674             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
675         elif test "$_CC_MAJOR_VERSION" = "16"; then
676             _CC_SUITE=10
677             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
678             _USE_DYNAMICBASE=1
679             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
680             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
681         else
682             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
683         fi
685         _MOZ_RTTI_FLAGS_ON='-GR'
686         _MOZ_RTTI_FLAGS_OFF='-GR-'
687         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
688         _MOZ_EXCEPTIONS_FLAGS_OFF=''
690         if test -n "$WIN32_REDIST_DIR"; then
691             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
692         fi
693         
694         # bug #249782
695         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
696         if test "$_CC_SUITE" -ge "8"; then
697                 changequote(,)
698                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
699                 changequote([,])
701                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
702                 if test -n "$MSMT_TOOL"; then
703                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
704                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
705                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
706                         fi
707                         MSMANIFEST_TOOL=1
708                         unset MSMT_TOOL
709                 else
710                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
711                 fi
712         fi
714         # Check linker version
715         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
716         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
717         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
718             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
719         fi
720         INCREMENTAL_LINKER=1
722         # Check midl version
723         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
724         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
725         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
726         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
727         # Add flags if necessary
728         AC_MSG_CHECKING([for midl flags])
729         case "$target" in
730         i*86-*)
731             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
732                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
733                 # MIDL version 7.00.0500 or later has no problem.
734                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
735                 AC_MSG_RESULT([need -env win32])
736             else
737                 AC_MSG_RESULT([none needed])
738             fi
739             ;;
740         x86_64-*)
741             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
742             ;;
743         *)
744             AC_MSG_RESULT([none needed])
745             ;;
746         esac
748         # Identify which version of the SDK we're building with
749         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
750         # from there
751         AC_CHECK_HEADERS([winsdkver.h])
752         if test "$ac_cv_header_winsdkver_h" = "yes"; then
753             # Get the highest _WIN32_WINNT and NTDDI versions supported
754             # Take the higher of the two
755             # This is done because the Windows 7 beta SDK reports its
756             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
757             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
758                            ac_cv_winsdk_maxver,
759                            [cat > conftest.h <<EOF
760 #include <winsdkver.h>
761 #include <sdkddkver.h>
763 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
764 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
765 #else
766 #define WINSDK_MAXVER NTDDI_MAXVER
767 #endif
769 WINSDK_MAXVER
771                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
772                             rm -f conftest.h
773                            ])
774             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
775         else
776             # The Vista SDK is the only one to have sdkddkver.h but not
777             # WinSDKVer.h
778             AC_CHECK_HEADERS([sdkddkver.h])
779             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
780                 MOZ_WINSDK_MAXVER=0x06000000
781             else
782                 # Assume the Server 2003 Platform SDK
783                 MOZ_WINSDK_MAXVER=0x05020000
784             fi
785         fi
787         unset _MSVC_VER_FILTER
789         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
790             [
791                 AC_LANG_SAVE
792                 AC_LANG_CPLUSPLUS
793                 _SAVE_CXXFLAGS="$CXXFLAGS"
794                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
795                 AC_TRY_COMPILE([#include <exception>],
796                             [std::_Throw(std::exception()); return 0;],
797                             ac_cv_have_std__Throw="yes",
798                             ac_cv_have_std__Throw="no")
799                 CXXFLAGS="$_SAVE_CXXFLAGS"
800                 AC_LANG_RESTORE
801             ])
803         if test "$ac_cv_have_std__Throw" == "yes"; then
804             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
805                            ac_cv_have_dllimport_exception_bug,
806                 [
807                     AC_LANG_SAVE
808                     AC_LANG_CPLUSPLUS
809                     _SAVE_CXXFLAGS="$CXXFLAGS"
810                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
811                     AC_TRY_LINK([#include <vector>],
812                                 [std::vector<int> v; return v.at(1);],
813                                 ac_cv_have_dllimport_exception_bug="no",
814                                 ac_cv_have_dllimport_exception_bug="yes")
815                     CXXFLAGS="$_SAVE_CXXFLAGS"
816                     AC_LANG_RESTORE
817                 ])
818             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
819                 WRAP_STL_INCLUDES=1
820                 MOZ_MSVC_STL_WRAP__Throw=1
821                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
822             fi
823         else
824             AC_CACHE_CHECK(for overridable _RAISE,
825                            ac_cv_have__RAISE,
826                 [
827                     AC_LANG_SAVE
828                     AC_LANG_CPLUSPLUS
829                     _SAVE_CXXFLAGS="$CXXFLAGS"
830                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
831                     AC_TRY_COMPILE([#include <xstddef>
832                                     #undef _RAISE
833                                     #define _RAISE(x) externallyDefinedFunction((x).what())
834                                     #include <vector>
835                                    ],
836                                    [std::vector<int> v; return v.at(1);],
837                                    ac_cv_have__RAISE="no",
838                                    ac_cv_have__RAISE="yes")
839                     CXXFLAGS="$_SAVE_CXXFLAGS"
840                     AC_LANG_RESTORE
841                 ])
842             if test "$ac_cv_have__RAISE" = "yes"; then
843                 WRAP_STL_INCLUDES=1
844                 MOZ_MSVC_STL_WRAP__RAISE=1
845                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
846             else
847                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
848             fi
849         fi
851         if test "$WRAP_STL_INCLUDES" = "1"; then
852             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
853         fi
854     else
855         # Check w32api version
856         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
857         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
858         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
859         AC_TRY_COMPILE([#include <w32api.h>],
860             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
861                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
862                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
863                 #error "test failed."
864             #endif
865             , [ res=yes ], [ res=no ])
866         AC_MSG_RESULT([$res])
867         if test "$res" != "yes"; then
868             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
869         fi
870         # Check windres version
871         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
872         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
873         AC_MSG_RESULT([$_WINDRES_VERSION])
874         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
875         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
876         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
877         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
878         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
879         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
880         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
881                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
882                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
883                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
884                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
885                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
886         then
887             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
888         fi
890         # Server 2003 is the highest version supported
891         MOZ_WINSDK_MAXVER=0x05020000
892     fi # !GNU_CC
894     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
895     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
896     # Require OS features provided by IE 5.0
897     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
899     # If the maximum version supported by this SDK is lower than the target
900     # version, error out
901     AC_MSG_CHECKING([for Windows SDK being recent enough])
902     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
903         AC_MSG_RESULT("yes")
904     else
905         AC_MSG_RESULT("no")
906         AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
907     fi
909     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
910     # Definitions matching sdkddkver.h
911     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
912     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
913     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
914     ;;
915 esac
917 dnl Test breaks icc on OS/2 && MSVC
918 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
919     AC_PROG_CC_C_O
920     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
921         USING_HCC=1
922         _OLDCC=$CC
923         _OLDCXX=$CXX
924         CC="${srcdir}/build/hcc '$CC'"
925         CXX="${srcdir}/build/hcpp '$CXX'"
926     fi
929 AC_PROG_CPP
930 AC_PROG_CXXCPP
932 if test -n "$_WIN32_MSVC"; then
933     SKIP_PATH_CHECKS=1
934     SKIP_COMPILER_CHECKS=1
935     SKIP_LIBRARY_CHECKS=1
937     # Since we're skipping compiler and library checks, hard-code
938     # some facts here.
939     case "$target" in
940     *-wince|*-winmo)
941         ;;
942     *)
943         AC_DEFINE(HAVE_IO_H)
944         AC_DEFINE(HAVE_SETBUF)
945         AC_DEFINE(HAVE_ISATTY)
946         ;;
947     esac
950 fi # COMPILE_ENVIRONMENT
952 AC_SUBST(MIDL_FLAGS)
953 AC_SUBST(_MSC_VER)
955 AC_SUBST(GNU_AS)
956 AC_SUBST(GNU_LD)
957 AC_SUBST(GNU_CC)
958 AC_SUBST(GNU_CXX)
959 AC_SUBST(INTEL_CC)
960 AC_SUBST(INTEL_CXX)
962 AC_SUBST(STL_FLAGS)
963 AC_SUBST(WRAP_STL_INCLUDES)
964 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
965 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
967 dnl ========================================================
968 dnl Checks for programs.
969 dnl ========================================================
970 AC_PROG_INSTALL
971 AC_PROG_LN_S
973 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
974 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
975 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
976 _perl_res=$?
977 AC_MSG_RESULT([$_perl_version])
979 if test "$_perl_res" != 0; then
980     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
984 AC_MSG_CHECKING([for full perl installation])
985 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
986 _perl_res=$?
987 if test "$_perl_res" != 0; then
988     AC_MSG_RESULT([no])
989     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
990 else
991     AC_MSG_RESULT([yes])    
994 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.6 python2.5 python2.4 python)
995 if test -z "$PYTHON"; then
996     AC_MSG_ERROR([python was not found in \$PATH])
999 if test -z "$COMPILE_ENVIRONMENT"; then
1000     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1002 AC_SUBST(NSINSTALL_BIN)
1004 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1005 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1006 MOZ_PATH_PROG(UNZIP, unzip, :)
1007 MOZ_PATH_PROGS(ZIP, zip)
1008 if test -z "$ZIP" -o "$ZIP" = ":"; then
1009     AC_MSG_ERROR([zip not found in \$PATH])
1011 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1012 MOZ_PATH_PROG(XARGS, xargs)
1013 if test -z "$XARGS" -o "$XARGS" = ":"; then
1014     AC_MSG_ERROR([xargs not found in \$PATH .])
1017 if test "$COMPILE_ENVIRONMENT"; then
1019 dnl ========================================================
1020 dnl = Mac OS X toolchain support
1021 dnl ========================================================
1023 case "$target_os" in
1024 darwin*)
1025     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1026     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1027     dnl the environment and includedir purposes (when using an SDK, below),
1028     dnl but remember the full version number for the libdir (SDK).
1029     changequote(,)
1030     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1031     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1032     changequote([,])
1033     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1034         dnl Bug 280479, but this keeps popping up in bug 292530 too because
1035         dnl 4.0.0/4061 is the default compiler in Tiger.
1036         changequote(,)
1037         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1038         changequote([,])
1039         if test "$GCC_BUILD" = "4061" ; then
1040             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1041 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1042 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1043         fi
1044     fi
1046     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1047     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
1048     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1049     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1051     case "$PBBUILD" in
1052       *xcodebuild*)
1053         changequote(,)
1054         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1055         changequote([,])
1056         if test -n "$XCODEBUILD_VERSION" -a "$XCODEBUILD_VERSION" -ge 620 ; then
1057           HAS_XCODE_2_1=1;
1058         fi
1059       ;;
1060     esac
1062     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
1063     dnl it has moved into /usr/bin.
1064     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1065     ;;
1066 esac
1068 AC_SUBST(GCC_VERSION)
1069 AC_SUBST(XCODEBUILD_VERSION)
1070 AC_SUBST(HAS_XCODE_2_1)
1072 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1073 dnl that a universal binary is being produced.
1074 AC_SUBST(UNIVERSAL_BINARY)
1076 dnl ========================================================
1077 dnl Check for MacOS deployment target version
1078 dnl ========================================================
1080 MOZ_ARG_ENABLE_STRING(macos-target,
1081                       [  --enable-macos-target=VER (default=10.5)
1082                           Set the minimum MacOS version needed at runtime],
1083                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1085 case "$target" in
1086 *-darwin*)
1087     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1088         dnl Use the specified value
1089         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1090         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1091     else
1092         dnl No value specified on the command line or in the environment,
1093         dnl use architecture minimum.
1094         case "${target_cpu}" in
1095           ppc*)
1096             export MACOSX_DEPLOYMENT_TARGET=10.5
1097             ;;
1098           i*86)
1099             export MACOSX_DEPLOYMENT_TARGET=10.5
1100             ;;
1101           x86_64)
1102             export MACOSX_DEPLOYMENT_TARGET=10.6
1103             ;;
1104         esac
1105     fi
1106     ;;
1107 esac
1109 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1111 dnl ========================================================
1112 dnl = Mac OS X SDK support
1113 dnl ========================================================
1114 MACOS_SDK_DIR=
1115 NEXT_ROOT=
1116 MOZ_ARG_WITH_STRING(macos-sdk,
1117 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
1118     MACOS_SDK_DIR=$withval)
1120 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1121 dnl NEXT_ROOT will be set and exported only if it's needed.
1122 AC_SUBST(MACOS_SDK_DIR)
1123 AC_SUBST(NEXT_ROOT)
1125 if test "$MACOS_SDK_DIR"; then
1126   dnl Sync this section with the ones in NSPR and NSS.
1127   dnl Changes to the cross environment here need to be accounted for in
1128   dnl the libIDL checks (below) and xpidl build.
1130   if test ! -d "$MACOS_SDK_DIR"; then
1131     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1132 specify a valid SDK.  SDKs are installed when the optional cross-development
1133 tools are selected during the Xcode/Developer Tools installation.])
1134   fi
1136   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1137   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1138     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1139   else
1140     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1141     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1143     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1144     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1145     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1147     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1148       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1149       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1150       dnl be ignored and cause warnings when -syslibroot is specified.
1151       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1152       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1153       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1154     fi
1155   fi
1157   AC_LANG_SAVE
1158   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1159   AC_LANG_CPLUSPLUS
1160   AC_TRY_COMPILE([#include <new>
1161                  int main() { return 0; }],
1162    result=yes,
1163    result=no)
1164   AC_LANG_RESTORE
1165   AC_MSG_RESULT($result)
1167   if test "$result" = "no" ; then
1168     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1169   fi
1172 fi # COMPILE_ENVIRONMENT
1174 if test -n "$MAKE"; then
1175   if test `echo $MAKE | grep -c make.py` != 1; then
1176      NOT_PYMAKE=$MAKE
1177   fi
1180 case "$host_os" in
1181 cygwin*|mingw*|mks*|msvc*)
1182     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1183     ;;
1185     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1186     ;;
1187 esac
1188 if test "$GMAKE" = ":"; then
1189    AC_MSG_ERROR([GNU make not found])
1191 AC_SUBST(GMAKE)
1193 if test "$COMPILE_ENVIRONMENT"; then
1195 AC_PATH_XTRA
1197 XCFLAGS="$X_CFLAGS"
1199 fi # COMPILE_ENVIRONMENT
1201 dnl ========================================================
1202 dnl set the defaults first
1203 dnl ========================================================
1204 AS_BIN=$AS
1205 AR_LIST='$(AR) t'
1206 AR_EXTRACT='$(AR) x'
1207 AR_DELETE='$(AR) d'
1208 AS='$(CC)'
1209 AS_DASH_C_FLAG='-c'
1210 DLL_PREFIX=lib
1211 LIB_PREFIX=lib
1212 DLL_SUFFIX=.so
1213 OBJ_SUFFIX=o
1214 LIB_SUFFIX=a
1215 ASM_SUFFIX=s
1216 IMPORT_LIB_SUFFIX=
1217 TARGET_MD_ARCH=unix
1218 DIRENT_INO=d_ino
1219 CYGWIN_WRAPPER=
1220 WIN_TOP_SRC=
1221 MOZ_USER_DIR=".mozilla"
1223 MOZ_JPEG_CFLAGS=
1224 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1225 MOZ_ZLIB_CFLAGS=
1226 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1227 MOZ_BZ2_CFLAGS=
1228 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1229 MOZ_PNG_CFLAGS=
1230 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1232 MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
1233 MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1234 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1235 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1236 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1237 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1238 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1239 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1241 MOZ_FS_LAYOUT=unix
1243 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1245 USE_DEPENDENT_LIBS=1
1247 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1249 if test -n "$CROSS_COMPILE"; then
1250     OS_TARGET="${target_os}"
1251     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1252     OS_RELEASE=
1253     case "${target_os}" in
1254         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1255         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1256         gnu*)         OS_ARCH=GNU ;;
1257         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1258         mingw*)       OS_ARCH=WINNT ;;
1259         wince*)       OS_ARCH=WINCE ;;
1260         winmo*)       OS_ARCH=WINCE ;;
1261         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1262     esac
1263     case "${target}" in
1264         arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1265     esac
1266 else
1267     OS_TARGET=`uname -s`
1268     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1269     OS_RELEASE=`uname -r`
1272 # Before this used `uname -m` when not cross compiling
1273 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1274 OS_TEST="${target_cpu}"
1276 _COMPILER_PREFIX=
1278 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1280 #######################################################################
1281 # Master "Core Components" macros for getting the OS target           #
1282 #######################################################################
1285 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1286 # cross-compilation.
1290 # Define and override various archtecture-specific variables, including
1291 # HOST_OS_ARCH
1292 # OS_ARCH
1293 # OS_TEST
1294 # OS_TARGET
1295 # OS_RELEASE
1296 # OS_MINOR_RELEASE
1299 case "$HOST_OS_ARCH" in
1300 cygwin*|mingw*|mks*|msvc*)
1301     HOST_OS_ARCH=WINNT
1302     ;;
1303 darwin*)
1304     HOST_OS_ARCH=Darwin
1305     ;;
1306 linux*)
1307     HOST_OS_ARCH=Linux
1308     ;;
1309 solaris*)
1310     HOST_OS_ARCH=SunOS
1311     SOLARIS_SUNPRO_CC=
1312     SOLARIS_SUNPRO_CXX=
1313     if test -z "$GNU_CC"; then
1314         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1315             SOLARIS_SUNPRO_CC=1
1316        fi
1317     fi
1319     if test -z "$GNU_CXX"; then
1320        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1321            SOLARIS_SUNPRO_CXX=1
1322        fi
1323     fi
1324     AC_SUBST(SOLARIS_SUNPRO_CC)
1325     AC_SUBST(SOLARIS_SUNPRO_CXX)
1326     ;;
1327 BSD_386)
1328     HOST_OS_ARCH=BSD
1329     ;;
1330 dgux)
1331     HOST_OS_ARCH=DGUX
1332     ;;
1333 IRIX64)
1334     HOST_OS_ARCH=IRIX
1335     ;;
1336 UNIX_SV)
1337     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1338         HOST_OS_ARCH=NCR
1339     else
1340         HOST_OS_ARCH=UNIXWARE
1341     fi
1342     ;;
1343 ncr)
1344     HOST_OS_ARCH=NCR
1345     ;;
1346 UNIX_SYSTEM_V)
1347     HOST_OS_ARCH=NEC
1348     ;;
1349 OSF1)
1350     ;;
1351 *OpenVMS*)
1352     HOST_OS_ARCH=OpenVMS
1353     ;;
1354 OS_2)
1355     HOST_OS_ARCH=OS2
1356     ;;
1357 QNX)
1358     ;;
1359 SCO_SV)
1360     HOST_OS_ARCH=SCOOS
1361     ;;
1362 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1363     HOST_OS_ARCH=SINIX
1364     ;;
1365 UnixWare)
1366     HOST_OS_ARCH=UNIXWARE
1367     ;;
1368 esac
1370 case "$OS_ARCH" in
1371 WINNT)
1372     if test -z "$CROSS_COMPILE" ; then
1373         OS_TEST=`uname -p`
1374     fi
1375     ;;
1376 Windows_NT)
1378 # If uname -s returns "Windows_NT", we assume that we are using
1379 # the uname.exe in MKS toolkit.
1381 # The -r option of MKS uname only returns the major version number.
1382 # So we need to use its -v option to get the minor version number.
1383 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1385     OS_ARCH=WINNT
1386     OS_TARGET=WINNT
1387     OS_MINOR_RELEASE=`uname -v`
1388     if test "$OS_MINOR_RELEASE" = "00"; then
1389         OS_MINOR_RELEASE=0
1390     fi
1391     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1392     ;;
1393 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1395 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1396 # the uname.exe in the Cygwin tools.
1397 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1398 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1399 # the uname.exe in the GNU-Win32 tools.
1400 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1401 # the uname.exe in the MSYS tools.
1403     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1404     OS_ARCH=WINNT
1405     OS_TARGET=WINNT
1406     ;;
1407 AIX)
1408     OS_RELEASE=`uname -v`.`uname -r`
1409     OS_TEST=${target_cpu}
1410     ;;
1411 BSD_386)
1412     OS_ARCH=BSD
1413     ;;
1414 dgux)
1415     OS_ARCH=DGUX
1416     ;;
1417 IRIX64)
1418     OS_ARCH=IRIX
1419     ;;
1420 UNIX_SV)
1421     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1422         OS_ARCH=NCR
1423     else
1424         OS_ARCH=UNIXWARE
1425         OS_RELEASE=`uname -v`
1426     fi
1427     ;;
1428 ncr)
1429     OS_ARCH=NCR
1430     ;;
1431 UNIX_SYSTEM_V)
1432     OS_ARCH=NEC
1433     ;;
1434 OSF1)
1435     case `uname -v` in
1436     148)
1437         OS_RELEASE=V3.2C
1438         ;;
1439     564)
1440         OS_RELEASE=V4.0B
1441         ;;
1442     878)
1443         OS_RELEASE=V4.0D
1444         ;;
1445     esac
1446     ;;
1447 *OpenVMS*)
1448     OS_ARCH=OpenVMS
1449     OS_RELEASE=`uname -v`
1450     OS_TEST=`uname -p`
1451     ;;
1452 OS_2)
1453     OS_ARCH=OS2
1454     OS_TARGET=OS2
1455     OS_RELEASE=`uname -v`
1456     ;;
1457 QNX)
1458     if test "$OS_TARGET" != "NTO"; then
1459         changequote(,)
1460         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1461         changequote([,])
1462     fi
1463     OS_TEST=x86
1464     ;;
1465 SCO_SV)
1466     OS_ARCH=SCOOS
1467     OS_RELEASE=5.0
1468     ;;
1469 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1470     OS_ARCH=SINIX
1471     OS_TEST=`uname -p`
1472     ;;
1473 UnixWare)
1474     OS_ARCH=UNIXWARE
1475     OS_RELEASE=`uname -v`
1476     ;;
1477 WINCE)
1478     OS_ARCH=WINCE
1479     case "${target_os}" in
1480     *winmo)
1481         OS_TARGET=WINMO
1482         WINCE_WINDOWS_MOBILE=1
1483         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1484         ;;
1485     *)
1486         OS_TARGET=WINCE
1487         ;;
1488     esac
1489     ;;
1490 Darwin)
1491     case "${target_cpu}" in
1492     powerpc*)
1493         OS_TEST=ppc
1494         ;;
1495     i*86*)
1496         OS_TEST=i386 
1497         ;;
1498     x86_64)
1499         OS_TEST=x86_64
1500         ;;
1501     *)
1502         if test -z "$CROSS_COMPILE" ; then
1503             OS_TEST=`uname -p`
1504         fi
1505         ;;
1506     esac
1507     ;;
1508 esac
1510 if test "$OS_ARCH" = "NCR"; then
1511     changequote(,)
1512     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1513     changequote([,])
1516 # Only set CPU_ARCH if we recognize the value of OS_TEST
1518 case "$OS_TEST" in
1519 *86 | i86pc)
1520     CPU_ARCH=x86
1521     ;;
1523 powerpc64 | ppc64)
1524     CPU_ARCH=ppc64
1525     ;;
1527 powerpc | ppc | rs6000)
1528     CPU_ARCH=ppc
1529     ;;
1531 Alpha | alpha | ALPHA)
1532     CPU_ARCH=Alpha
1533     ;;
1535 s390)
1536     CPU_ARCH=s390
1537     ;;
1539 s390x)
1540     CPU_ARCH=s390x
1541     ;;
1543 hppa* | parisc)
1544     CPU_ARCH=hppa
1545     ;;
1547 sun4u | sparc*)
1548     CPU_ARCH=sparc
1549     ;;
1551 x86_64 | ia64)
1552     CPU_ARCH="$OS_TEST"
1553     ;;
1555 arm*)
1556     CPU_ARCH=arm
1557     ;;
1558 esac
1560 if test -z "$OS_TARGET"; then
1561     OS_TARGET=$OS_ARCH
1563 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1565 dnl ========================================================
1566 dnl GNU specific defaults
1567 dnl ========================================================
1568 if test "$GNU_CC"; then
1569     # FIXME: Let us build with strict aliasing. bug 414641.
1570     CFLAGS="$CFLAGS -fno-strict-aliasing"
1571     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1572     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1573     DSO_LDOPTS='-shared'
1574     if test "$GCC_USE_GNU_LD"; then
1575         # Don't allow undefined symbols in libraries
1576         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1577     fi
1578     WARNINGS_AS_ERRORS='-Werror'
1579     DSO_CFLAGS=''
1580     DSO_PIC_CFLAGS='-fPIC'
1581     ASFLAGS="$ASFLAGS -fPIC"
1582     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1583     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1584     _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1585     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1587     # Turn on GNU specific features
1588     # -Wall - turn on all warnings
1589     # -pedantic - make compiler warn about non-ANSI stuff, and
1590     #             be a little bit stricter
1591     # Warnings slamm took out for now (these were giving more noise than help):
1592     # -Wbad-function-cast - warns when casting a function to a new return type
1593     # -Wshadow - removed because it generates more noise than help --pete
1594     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1595     if test -z "$INTEL_CC"; then
1596        # Don't use -Wcast-align with ICC
1597        case "$CPU_ARCH" in
1598            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1599            hppa | ia64 | sparc | arm)
1600            ;;
1601            *)
1602         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1603            ;;
1604        esac
1605     fi
1607     dnl Turn pedantic on but disable the warnings for long long
1608     _PEDANTIC=1
1610     if test -z "$INTEL_CC"; then
1611       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1612     fi
1614     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1615     _USE_CPP_INCLUDE_FLAG=1
1616 elif test "$SOLARIS_SUNPRO_CC"; then
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 -fomit-frame-pointer"
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     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2046     # The ExceptionHandling framework is needed for Objective-C exception
2047     # logging code in nsObjCExceptions.h. Currently we only use that in debug
2048     # builds.
2049     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2051     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2052     dnl ===================================================================
2053     if test "x$enable_dtrace" = "xyes"; then
2054         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2055     else
2056         dnl check for the presence of the -dead_strip linker flag
2057         AC_MSG_CHECKING([for -dead_strip option to ld])
2058         _SAVE_LDFLAGS=$LDFLAGS
2059         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2060         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2061         if test -n "$_HAVE_DEAD_STRIP" ; then
2062             AC_MSG_RESULT([yes])
2063             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2064         else
2065             AC_MSG_RESULT([no])
2066         fi
2067         
2068         LDFLAGS=$_SAVE_LDFLAGS
2069     fi
2070     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2071     ;;
2073 *-freebsd*)
2074     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2075         DLL_SUFFIX=".so.1.0"
2076         DSO_LDOPTS="-shared"
2077     fi
2078     if test ! "$GNU_CC"; then
2079         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2080     fi
2081     ;; 
2083 ia64*-hpux*)
2084     DLL_SUFFIX=".so"
2085     if test ! "$GNU_CC"; then
2086        DSO_LDOPTS='-b'
2087        DSO_CFLAGS=""
2088        DSO_PIC_CFLAGS=
2089        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2090        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2091        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2092     else
2093        DSO_LDOPTS='-b -E'
2094        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2095        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2096     fi
2097     MOZ_FIX_LINK_PATHS=
2098     SYSTEM_MAKEDEPEND=
2099     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2100     AC_DEFINE(_LARGEFILE64_SOURCE)
2101     ;;
2103 *-hpux*)
2104     DLL_SUFFIX=".sl"
2105     if test ! "$GNU_CC"; then
2106         DSO_LDOPTS='-b -Wl,+s'
2107         DSO_CFLAGS=""
2108         DSO_PIC_CFLAGS="+Z"
2109         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2110         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2111         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2112     else
2113         DSO_LDOPTS='-b -E +s'
2114         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2115         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2116     fi
2117     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2118     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2119     ;;
2121 *-irix5*)
2122     AC_DEFINE(IRIX)
2123     DSO_LDOPTS='-elf -shared'
2125     if test "$GNU_CC"; then
2126        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2127        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2128        MKSHLIB_FORCE_ALL='-Wl,-all'
2129        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2130        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2131     else
2132        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2133        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2134        MKSHLIB_FORCE_ALL='-all'
2135        MKSHLIB_UNFORCE_ALL='-none'
2136     fi
2137     ;;
2139 *-irix6*)
2140     AC_DEFINE(IRIX)
2141     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2142     dnl compile and link using -n32
2143     USE_N32=1
2144     TARGET_COMPILER_ABI=n32
2145     DSO_LDOPTS='-elf -shared'
2146     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2147     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2148     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2149     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2150     if test "$GNU_CC"; then
2151        MKSHLIB_FORCE_ALL='-Wl,-all'
2152        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2153        _WARNINGS_CFLAGS="-Wall"
2154        _WARNINGS_CXXFLAGS="-Wall"
2155        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2156     else
2157        MKSHLIB_FORCE_ALL='-all'
2158        MKSHLIB_UNFORCE_ALL='-none'
2159            AR_LIST="$AR t"
2160            AR_EXTRACT="$AR x"
2161            AR_DELETE="$AR d"
2162            AR='$(CXX) -ar'
2163            AR_FLAGS='-o $@'
2164        CFLAGS="$CFLAGS -woff 3262 -G 4"
2165        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2166        if test -n "$USE_N32"; then
2167            ASFLAGS="$ASFLAGS -n32"
2168            CFLAGS="$CFLAGS -n32"
2169            CXXFLAGS="$CXXFLAGS -n32"
2170            LDFLAGS="$LDFLAGS -n32"
2171        fi
2172        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2173        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2174        MOZ_FIX_LINK_PATHS=
2175     fi
2176     if test -z "$GNU_CXX"; then
2177       MIPSPRO_CXX=1
2178     fi
2179     ;;
2181 *-*linux*)
2182     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2183     # Similarly for GNU_CXX and INTEL_CXX.
2184     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2185         # -Os has been broken on Intel's C/C++ compilers for quite a
2186         # while; Intel recommends against using it.
2187         MOZ_OPTIMIZE_FLAGS="-O2"
2188         MOZ_DEBUG_FLAGS="-g"
2189     elif test "$GNU_CC" -o "$GNU_CXX"; then
2190         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2191         case $GCC_VERSION in
2192         4.1.*|4.2.*|4.5.*)
2193             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2194             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2195         esac
2196         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2197         MOZ_DEBUG_FLAGS="-g"
2198     fi
2200     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2202     MOZ_MEMORY=1
2204     case "${target_cpu}" in
2205     alpha*)
2206         CFLAGS="$CFLAGS -mieee"
2207         CXXFLAGS="$CXXFLAGS -mieee"
2208     ;;
2209     i*86)
2210         USE_ELF_DYNSTR_GC=1
2211     ;;
2212     mips*)
2213         MOZ_DEBUG_FLAGS="-g" # We want inlining
2214     ;;
2215     esac
2216     ;;
2218 *-wince*|*-winmo*)
2219     TARGET_COMPILER_ABI=msvc
2220     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2221     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2222     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2223     AR_LIST="$AR -list"
2224     AR_EXTRACT="$AR -extract"
2225     AR_DELETE="$AR d"
2226     AR_FLAGS='-OUT:"$@"'
2227     MOZ_MEMORY=1
2228     NSS_DISABLE_DBM=1
2229     MOZ_OGG=
2230     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2232     if test "$AS_BIN"; then
2233         AS="$AS_BIN"
2234     fi
2235     DSO_CFLAGS=
2236     DSO_PIC_CFLAGS=
2237     DLL_SUFFIX=.dll
2238     BIN_SUFFIX='.exe'
2239     if test -z "$RC"; then 
2240         RC=rc.exe  
2241     fi
2242     # certain versions of cygwin's makedepend barf on the 
2243     # #include <string> vs -I./dist/include/string issue so don't use it
2244     SYSTEM_MAKEDEPEND=
2246     HOST_CC=cl
2247     HOST_CXX=cl
2248     HOST_LD=link
2249     HOST_AR='lib -OUT:$@'
2250     HOST_RANLIB='echo ranlib'
2251     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2252         
2253         
2254     WARNINGS_AS_ERRORS='-WX'
2255     MOZ_OPTIMIZE_FLAGS='-Ox'
2256     AR_FLAGS='-NOLOGO -OUT:"$@"'
2257     ASM_SUFFIX=asm
2258     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2259     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2260     DLL_PREFIX=
2261     DOXYGEN=:
2262     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2263     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2264     GARBAGE=
2265     IMPORT_LIB_SUFFIX=lib
2266     dnl Need to force-link against mozalloc because it's used in the shunt
2267     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2268     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2269     LIB_PREFIX=
2270     LIB_SUFFIX=lib 
2271     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2272     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2273     MKSHLIB_FORCE_ALL=
2274     MKSHLIB_UNFORCE_ALL=
2275     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2276     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2277     MOZ_DEBUG_FLAGS='-Zi'
2278     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2279     MOZ_FIX_LINK_PATHS=
2280     MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2281     MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2282     OBJ_SUFFIX=obj
2283     RANLIB='echo not_ranlib'
2284     STRIP='echo not_strip'
2285     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2286     UNZIP=unzip
2287     XARGS=xargs
2288     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2289     ZIP=zip
2290     MOZ_TREE_FREETYPE=1
2292     AC_DEFINE(HAVE_SNPRINTF)
2293     AC_DEFINE(_WINDOWS)
2294     AC_DEFINE(WIN32)
2295     AC_DEFINE(XP_WIN)
2296     AC_DEFINE(XP_WIN32)
2297     AC_DEFINE(HW_THREADS)
2298     AC_DEFINE(STDC_HEADERS)
2299     AC_DEFINE(NEW_H, <new>)
2300     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2301     AC_DEFINE(HAVE_LOCALTIME_R)
2303     TARGET_MD_ARCH=win32
2304     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2305     BIN_SUFFIX='.exe'
2306     MOZ_USER_DIR="Mozilla"
2308     MOZ_GFX_OPTIMIZE_MOBILE=1
2310     # Sanity check for WINCE_WINDOWS_MOBILE
2311     # XXX disabled until we can fix the mobile tinderbox
2312     ##if test "$WINCE_WINDOWS_MOBILE"; then
2313     ##   AC_CHECK_HEADER(tpcshell.h, [],
2314     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2315     ##fi
2319 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2320     DSO_CFLAGS=
2321     DSO_PIC_CFLAGS=
2322     DLL_SUFFIX=.dll
2323     RC=rc.exe
2324     # certain versions of cygwin's makedepend barf on the 
2325     # #include <string> vs -I./dist/include/string issue so don't use it
2326     SYSTEM_MAKEDEPEND=
2327     if test -n "$GNU_CC"; then
2328         CC="$CC -mno-cygwin"
2329         CXX="$CXX -mno-cygwin"
2330         CPP="$CPP -mno-cygwin"
2331         CFLAGS="$CFLAGS -mms-bitfields"
2332         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2333         DSO_LDOPTS='-shared'
2334         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2335         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2336         RC='$(WINDRES)'
2337         # Use temp file for windres (bug 213281)
2338         RCFLAGS='-O coff --use-temp-file'
2339         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2340         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2341         MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
2342         MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
2343         MOZ_FIX_LINK_PATHS=
2344         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2345         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2346         DLL_PREFIX=
2347         IMPORT_LIB_SUFFIX=dll.a
2348         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2349     else
2350         TARGET_COMPILER_ABI=msvc
2351         HOST_CC='$(CC)'
2352         HOST_CXX='$(CXX)'
2353         HOST_LD='$(LD)'
2354         if test "$AS_BIN"; then
2355             AS="$(basename "$AS_BIN")"
2356         fi
2357         AR='lib -NOLOGO -OUT:"$@"'
2358         AR_FLAGS=
2359         RANLIB='echo not_ranlib'
2360         STRIP='echo not_strip'
2361         PKG_SKIP_STRIP=1
2362         XARGS=xargs
2363         ZIP=zip
2364         UNZIP=unzip
2365         DOXYGEN=:
2366         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2367         ASM_SUFFIX=asm
2368         OBJ_SUFFIX=obj
2369         LIB_SUFFIX=lib
2370         DLL_PREFIX=
2371         LIB_PREFIX=
2372         IMPORT_LIB_SUFFIX=lib
2373         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2374         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2375         MKSHLIB_FORCE_ALL=
2376         MKSHLIB_UNFORCE_ALL=
2377         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2378         _USE_CPP_INCLUDE_FLAG=1
2379         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2380         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2381         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2382         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2383         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2384         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2385         MOZ_DEBUG_FLAGS='-Zi'
2386         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2387         WARNINGS_AS_ERRORS='-WX'
2388         MOZ_OPTIMIZE_FLAGS='-O1'
2389         MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2390         MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2391         MOZ_FIX_LINK_PATHS=
2392         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2393         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2394         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2395         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2396         if test $_MSC_VER -ge 1400; then
2397             LDFLAGS="$LDFLAGS -NXCOMPAT"
2398             dnl For profile-guided optimization
2399             PROFILE_GEN_CFLAGS="-GL"
2400             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2401             dnl XXX: PGO builds can fail with warnings treated as errors,
2402             dnl specifically "no profile data available" appears to be
2403             dnl treated as an error sometimes. This might be a consequence
2404             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2405             dnl with the linker doing most of the work in the whole-program
2406             dnl optimization/PGO case. I think it's probably a compiler bug,
2407             dnl but we work around it here.
2408             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2409             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2410             dnl Probably also a compiler bug, but what can you do?
2411             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2412             if test -n "$_USE_DYNAMICBASE"; then
2413                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2414             fi
2415         fi
2416     fi
2417     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2418     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2419     AC_DEFINE(HAVE_SNPRINTF)
2420     AC_DEFINE(_WINDOWS)
2421     AC_DEFINE(WIN32)
2422     AC_DEFINE(XP_WIN)
2423     AC_DEFINE(XP_WIN32)
2424     AC_DEFINE(HW_THREADS)
2425     AC_DEFINE(STDC_HEADERS)
2426     AC_DEFINE(NEW_H, <new>)
2427     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2428     TARGET_MD_ARCH=win32
2429     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2430     BIN_SUFFIX='.exe'
2431     MOZ_USER_DIR="Mozilla"
2433     dnl Hardcode to win95 for now - cls
2434     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2436     dnl set NO_X11 defines here as the general check is skipped on win32
2437     no_x=yes
2438     AC_DEFINE(NO_X11)
2440     dnl MinGW/MSYS doesn't provide or need cygpath
2441     case "$host" in
2442     *-mingw*)
2443         CYGPATH_W=echo
2444         CYGPATH_S=cat
2445         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2446         ;;
2447     *-cygwin*|*-msvc*|*-mks*)
2448         CYGPATH_W="cygpath -a -w"
2449         CYGPATH_S="sed -e s|\\\\|/|g"
2450         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2451         ;;
2452     esac
2453     case "$host" in
2454     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2456     if test -z "$MOZ_TOOLS"; then
2457         AC_MSG_ERROR([MOZ_TOOLS is not set])
2458     fi
2460     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2461     if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2462         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2463     fi
2464     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2465     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2466         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2467     fi
2468     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2469     ;;
2470     esac 
2473     case "$host_os" in
2474     cygwin*|msvc*|mks*)
2475         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])
2476         ;;
2478     *)
2479         AC_CHECK_HEADERS(oleacc.idl)
2481         AC_LANG_SAVE
2482         AC_LANG_CPLUSPLUS
2483         AC_CHECK_HEADERS(atlbase.h)
2484         AC_LANG_RESTORE
2485         ;;
2486     esac
2488     case "$target" in
2489     i*86-*)
2490         if test "$HAVE_64BIT_OS"; then
2491             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2492         fi
2494         if test $_MSC_VER -ge 1400; then
2495             LDFLAGS="$LDFLAGS -SAFESEH"
2496         fi
2497         AC_CHECK_HEADERS(mmintrin.h)
2498         AC_DEFINE(_X86_)
2499         ;;
2500     alpha-*)
2501         AC_DEFINE(_ALPHA_)
2502         ;;
2503     mips-*)
2504         AC_DEFINE(_MIPS_)
2505         ;;
2506     x86_64-*)
2507         AC_DEFINE(_AMD64_)
2508         ;;
2509     *)
2510         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2511         ;;
2512     esac
2514     if test "$HAVE_64BIT_OS"; then
2515         AC_DEFINE(_WIN64)
2516     fi
2517     ;;
2519 *-netbsd*)
2520     DSO_CFLAGS=''
2521     CFLAGS="$CFLAGS -Dunix"
2522     CXXFLAGS="$CXXFLAGS -Dunix"
2523     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2524         DLL_SUFFIX=".so"
2525         DSO_PIC_CFLAGS='-fPIC -DPIC'
2526         DSO_LDOPTS='-shared'
2527         BIN_FLAGS='-Wl,--export-dynamic'
2528     else
2529         DSO_PIC_CFLAGS='-fPIC -DPIC'
2530         DLL_SUFFIX=".so.1.0"
2531         DSO_LDOPTS='-shared'
2532     fi
2533     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2534     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2535     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2536     if test "$LIBRUNPATH"; then
2537         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2538     fi
2539     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2540     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2541     ;;
2543 *-nto*) 
2544         AC_DEFINE(NTO)  
2545         AC_DEFINE(_QNX_SOURCE)
2546         AC_DEFINE(_i386)
2547         OS_TARGET=NTO
2548         WARNINGS_AS_ERRORS=''
2549         MOZ_OPTIMIZE_FLAGS="-O"
2550         MOZ_DEBUG_FLAGS="-gstabs"
2551         USE_PTHREADS=1
2552         _PEDANTIC=
2553         LIBS="$LIBS -lsocket -lstdc++"
2554         _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2555         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2556         if test "$with_x" != "yes"
2557         then
2558                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2559             TK_CFLAGS='-I/usr/include/photon'
2560                 TK_LIBS='-lph'
2561         fi
2562         case "${target_cpu}" in
2563         ppc*)
2564         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2565         ;;
2566         esac
2567         case "${host_cpu}" in
2568         i*86)
2569         USE_ELF_DYNSTR_GC=1
2570         ;;
2571         esac
2572         ;;
2574 *-openbsd*)
2575     DLL_SUFFIX=".so.1.0"
2576     DSO_CFLAGS=''
2577     DSO_PIC_CFLAGS='-fPIC'
2578     DSO_LDOPTS='-shared -fPIC'
2579     if test "$LIBRUNPATH"; then
2580         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2581     fi
2582     ;;
2584 *-openvms*) 
2585     AC_DEFINE(NO_PW_GECOS)
2586     AC_DEFINE(NO_UDSOCK)
2587     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2588     USE_PTHREADS=1
2589     MKSHLIB_FORCE_ALL='-all'
2590     MKSHLIB_UNFORCE_ALL='-none'
2591     AS='as'
2592     AS_DASH_C_FLAG='-Wc/names=as_is'
2593     AR_FLAGS='c $@'
2594     DSO_LDOPTS='-shared -auto_symvec'
2595     DSO_PIC_CFLAGS=
2596     MOZ_DEBUG_LDFLAGS='-g'
2597     COMPAQ_CXX=1
2598     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2599     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2600     ;;
2603 *-os2*)
2604     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2605     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2606     AC_DEFINE(OS2)
2607     AC_DEFINE(XP_OS2)
2608     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2609     AC_DEFINE(TCPV40HDRS)
2610     DLL_PREFIX=
2611     LIB_PREFIX=
2612     LIB_SUFFIX=lib
2613     BIN_SUFFIX=".exe"
2614     DLL_SUFFIX=".dll"
2615     IMPORT_LIB_SUFFIX=lib
2616     DSO_PIC_CFLAGS=
2617     AR=emxomfar
2618     AR_FLAGS='r $@'
2619     CFLAGS="$CFLAGS -Zomf"
2620     CXXFLAGS="$CXXFLAGS -Zomf"
2621     DSO_LDOPTS='-Zdll'
2622     BIN_FLAGS='-Zlinker /ST:0x100000'
2623     IMPLIB='emximp -o'
2624     FILTER='emxexp -o'
2625     LDFLAGS='-Zmap'
2626     WARNINGS_AS_ERRORS='-Werror'
2627     MOZ_DEBUG_FLAGS="-g -fno-inline"
2628     MOZ_OPTIMIZE_FLAGS="-O2"
2629     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2630     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2631     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2632     TARGET_MD_ARCH=os2
2633     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2634     RC=rc.exe
2635     RCFLAGS='-n'
2636     MOZ_USER_DIR="Mozilla"
2638     if test "$MOZTOOLS"; then
2639         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2640     else
2641         AC_MSG_ERROR([MOZTOOLS is not set])
2642     fi
2643     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2644         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2645         LDFLAGS="$LDFLAGS -Zhigh-mem"
2646         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2647         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2648     fi
2650     # GCC for OS/2 currently predefines these, but we don't want them
2651     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2652     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2654     AC_CACHE_CHECK(for __declspec(dllexport),
2655         ac_os2_declspec,
2656         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2657                         [return 0;],
2658                         ac_os2_declspec="yes",
2659                         ac_os2_declspec="no")])
2660     if test "$ac_os2_declspec" = "yes"; then
2661         FILTER='true'
2662         MOZ_OS2_USE_DECLSPEC='1'
2663     fi
2664     ;;
2666 alpha*-*-osf*)
2667     if test "$GNU_CC"; then
2668       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2669       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2671     else
2672         MOZ_DEBUG_FLAGS='-g'
2673         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2674         CFLAGS="$CFLAGS -ieee"
2675         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2676         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2677         DSO_CFLAGS=
2678         DSO_PIC_CFLAGS=
2679         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2680         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2681         MKSHLIB_FORCE_ALL='-all'
2682         MKSHLIB_UNFORCE_ALL='-none'
2683         dnl Might fix the libxpcom.so breakage on this platform as well....
2684         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2685         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2686     fi
2687     if test -z "$GNU_CXX"; then
2688       COMPAQ_CXX=1
2689     fi
2690     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2691     ;;
2693 *-qnx*) 
2694     DIRENT_INO=d_stat.st_ino
2695     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2696     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2697     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2698     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2699     AC_DEFINE(STDC_HEADERS)
2700     if test "$no_x" = "yes"; then
2701             _PLATFORM_DEFAULT_TOOLKIT='photon'
2702             TK_CFLAGS='-I/usr/nto/include/photon'
2703             TK_LIBS='-lphoton -lphrender'
2704     fi
2705     ;;
2707 *-sco*) 
2708     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2709     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2710     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2711     if test ! "$GNU_CC"; then
2712        DSO_LDOPTS='-G'
2713     fi
2714     ;;
2716 *-solaris*) 
2717     AC_DEFINE(SOLARIS)
2718     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2719     SYSTEM_MAKEDEPEND=
2720     MOZ_FIX_LINK_PATHS=
2721     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2722     # libraries one level up (e.g. libnspr4.so)
2723     if test "$SOLARIS_SUNPRO_CC"; then
2724        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2725        LIBS="-lCrun -lCstd -lc $LIBS"
2726        NS_USE_NATIVE=1
2727        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2728        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2729        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2730        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2731        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2732        LDFLAGS="-xildoff $LDFLAGS"
2733        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2734            _SAVE_LDFLAGS=$LDFLAGS
2735            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2736            AC_TRY_LINK([#include <stdio.h>],
2737                        [printf("Hello World\n");],
2738                        ,
2739                        [LDFLAGS=$_SAVE_LDFLAGS])
2740        fi
2741        WARNINGS_AS_ERRORS='-Werror'
2742        MOZ_OPTIMIZE_FLAGS="-xO4"
2743        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2744        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2745        MKSHLIB_FORCE_ALL='-z allextract'
2746        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2747        DSO_LDOPTS='-G'
2748        AR_LIST="$AR t"
2749        AR_EXTRACT="$AR x"
2750        AR_DELETE="$AR d"
2751        AR='$(CXX) -xar'
2752        AR_FLAGS='-o $@'
2753        AS='/usr/ccs/bin/as'
2754        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2755        AS_DASH_C_FLAG=''
2756        TARGET_COMPILER_ABI="sunc"
2757        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2758        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2759        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2760        AC_LANG_SAVE
2761        AC_LANG_CPLUSPLUS
2762        AC_TRY_COMPILE([],
2763            [#if (__SUNPRO_CC < 0x590)
2764            #error "Denied"
2765            #endif],
2766            _BAD_COMPILER=,_BAD_COMPILER=1)
2767        if test -n "$_BAD_COMPILER"; then
2768            _res="no"
2769            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2770        else
2771            _res="yes"
2772        fi
2773        AC_TRY_COMPILE([],
2774            [#if (__SUNPRO_CC >= 0x5100)
2775            #error "Sun C++ 5.10 or above"
2776            #endif],
2777            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2778        if test "$_ABOVE_SS12U1"; then
2779            # disable xannotate
2780            CXXFLAGS="$CXXFLAGS -xannotate=no"
2781        fi
2782        AC_MSG_RESULT([$_res])
2783        AC_LANG_RESTORE
2784     else
2785        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2786        LIBS="-lc $LIBS"
2787        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2788        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2789        ASFLAGS="$ASFLAGS -fPIC"
2790        DSO_LDOPTS='-shared'
2791        _WARNINGS_CFLAGS=''
2792        _WARNINGS_CXXFLAGS=''
2793        if test "$OS_RELEASE" = "5.3"; then
2794            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2795        fi
2796     fi
2797     if test "$OS_RELEASE" = "5.5.1"; then
2798         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2799     fi
2800     ;;
2802 *-sunos*) 
2803     DSO_LDOPTS='-Bdynamic'
2804     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2805     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2806     AC_DEFINE(SUNOS4)
2807     AC_DEFINE(SPRINTF_RETURNS_STRING)
2808     case "$(target_os)" in
2809     sunos4.1*)
2810         DLL_SUFFIX='.so.1.0'
2811         ;;
2812     esac
2813     ;;
2815 *-sysv4.2uw7*) 
2816         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2817     ;;
2819 *-os2*)
2820     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2821     ;;
2823 *-android*)
2824     AC_DEFINE(NO_PW_GECOS)
2825     no_x=yes
2826     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2827     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2829     MOZ_GFX_OPTIMIZE_MOBILE=1
2830     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2831     ;;
2833 esac
2835 dnl Only one oddball right now (QNX), but this gives us flexibility
2836 dnl if any other platforms need to override this in the future.
2837 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2839 dnl ========================================================
2840 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2841 dnl by now will not have any way to link most binaries (tests
2842 dnl as well as viewer, apprunner, etc.), because some symbols
2843 dnl will be left out of the "composite" .so's by ld as unneeded.
2844 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2845 dnl they can link in the static libs that provide the missing
2846 dnl symbols.
2847 dnl ========================================================
2848 NO_LD_ARCHIVE_FLAGS=
2849 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2850     NO_LD_ARCHIVE_FLAGS=1
2852 case "$target" in
2853 *-os2*)
2854     NO_LD_ARCHIVE_FLAGS=
2855     ;;
2856 *-aix4.3*|*-aix5*)
2857     NO_LD_ARCHIVE_FLAGS=
2858     ;;
2859 *-openvms*)
2860     NO_LD_ARCHIVE_FLAGS=
2861     ;;
2862 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2863     if test -z "$GNU_CC"; then
2864         NO_LD_ARCHIVE_FLAGS=
2865     fi
2866     ;;
2867 esac
2868 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2870 dnl ========================================================
2871 dnl = Flags to strip unused symbols from .so components
2872 dnl ========================================================
2873 case "$target" in
2874     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2875         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2876         ;;
2877     *-solaris*)
2878         if test -z "$GNU_CC"; then
2879          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2880         else
2881          if test -z "$GCC_USE_GNU_LD"; then
2882           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2883          else
2884           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2885          fi
2886         fi
2887         ;;
2888     *-nto*) 
2889         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2890         ;;
2891     *-darwin*)
2892         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2893         ;;
2894     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2895         if test -n "$GNU_CC"; then
2896            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2897         fi
2898         ;;
2899 esac
2901 if test -z "$COMPILE_ENVIRONMENT"; then
2902     SKIP_COMPILER_CHECKS=1
2903     SKIP_LIBRARY_CHECKS=1
2906 if test -z "$SKIP_COMPILER_CHECKS"; then
2907 dnl Checks for typedefs, structures, and compiler characteristics.
2908 dnl ========================================================
2909 AC_HEADER_STDC
2910 AC_C_CONST
2911 AC_TYPE_MODE_T
2912 AC_TYPE_OFF_T
2913 AC_TYPE_PID_T
2914 AC_TYPE_SIZE_T
2915 AC_LANG_CPLUSPLUS
2916 AC_MSG_CHECKING(for __stdcall)
2917 AC_CACHE_VAL(ac_cv___stdcall,
2918  [AC_TRY_COMPILE([template <typename Method> struct foo;
2919                   template <> struct foo<void (*)()> {};
2920                   template <> struct foo<void (__stdcall*)()> {};],
2921                  [],
2922                  [ac_cv___stdcall=true],
2923                  [ac_cv___stdcall=false])])
2924 if test "$ac_cv___stdcall" = true ; then
2925   AC_DEFINE(HAVE_STDCALL)
2926   AC_MSG_RESULT(yes)
2927 else
2928   AC_MSG_RESULT(no)
2930 AC_LANG_C
2931 AC_MSG_CHECKING(for ssize_t)
2932 AC_CACHE_VAL(ac_cv_type_ssize_t,
2933  [AC_TRY_COMPILE([#include <stdio.h>
2934                   #include <sys/types.h>],
2935                  [ssize_t foo = 0;],
2936                  [ac_cv_type_ssize_t=true],
2937                  [ac_cv_type_ssize_t=false])])
2938 if test "$ac_cv_type_ssize_t" = true ; then
2939   AC_DEFINE(HAVE_SSIZE_T)
2940   AC_MSG_RESULT(yes)
2941 else
2942   AC_MSG_RESULT(no)
2944 AC_STRUCT_ST_BLKSIZE
2945 AC_MSG_CHECKING(for siginfo_t)
2946 AC_CACHE_VAL(ac_cv_siginfo_t,
2947  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2948                   #include <signal.h>],
2949                  [siginfo_t* info;],
2950                  [ac_cv_siginfo_t=true],
2951                  [ac_cv_siginfo_t=false])])
2952 if test "$ac_cv_siginfo_t" = true ; then
2953   AC_DEFINE(HAVE_SIGINFO_T)
2954   AC_MSG_RESULT(yes)
2955 else
2956   AC_MSG_RESULT(no)
2959 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2960 dnl ========================================================
2961 AC_MSG_CHECKING(for int16_t)
2962 AC_CACHE_VAL(ac_cv_int16_t,
2963  [AC_TRY_COMPILE([#include <stdio.h>
2964                   #include <sys/types.h>],
2965                  [int16_t foo = 0;],
2966                  [ac_cv_int16_t=true],
2967                  [ac_cv_int16_t=false])])
2968 if test "$ac_cv_int16_t" = true ; then
2969   AC_DEFINE(HAVE_INT16_T)
2970   AC_MSG_RESULT(yes)
2971 else
2972   AC_MSG_RESULT(no)
2974 AC_MSG_CHECKING(for int32_t)
2975 AC_CACHE_VAL(ac_cv_int32_t,
2976  [AC_TRY_COMPILE([#include <stdio.h>
2977                   #include <sys/types.h>],
2978                  [int32_t foo = 0;],
2979                  [ac_cv_int32_t=true],
2980                  [ac_cv_int32_t=false])])
2981 if test "$ac_cv_int32_t" = true ; then
2982   AC_DEFINE(HAVE_INT32_T)
2983   AC_MSG_RESULT(yes)
2984 else
2985   AC_MSG_RESULT(no)
2987 AC_MSG_CHECKING(for int64_t)
2988 AC_CACHE_VAL(ac_cv_int64_t,
2989  [AC_TRY_COMPILE([#include <stdio.h>
2990                   #include <sys/types.h>],
2991                  [int64_t foo = 0;],
2992                  [ac_cv_int64_t=true],
2993                  [ac_cv_int64_t=false])])
2994 if test "$ac_cv_int64_t" = true ; then
2995   AC_DEFINE(HAVE_INT64_T)
2996   AC_MSG_RESULT(yes)
2997 else
2998   AC_MSG_RESULT(no)
3000 AC_MSG_CHECKING(for int64)
3001 AC_CACHE_VAL(ac_cv_int64,
3002  [AC_TRY_COMPILE([#include <stdio.h>
3003                   #include <sys/types.h>],
3004                  [int64 foo = 0;],
3005                  [ac_cv_int64=true],
3006                  [ac_cv_int64=false])])
3007 if test "$ac_cv_int64" = true ; then
3008   AC_DEFINE(HAVE_INT64)
3009   AC_MSG_RESULT(yes)
3010 else
3011   AC_MSG_RESULT(no)
3013 AC_MSG_CHECKING(for uint)
3014 AC_CACHE_VAL(ac_cv_uint,
3015  [AC_TRY_COMPILE([#include <stdio.h>
3016                   #include <sys/types.h>],
3017                  [uint foo = 0;],
3018                  [ac_cv_uint=true],
3019                  [ac_cv_uint=false])])
3020 if test "$ac_cv_uint" = true ; then
3021   AC_DEFINE(HAVE_UINT)
3022   AC_MSG_RESULT(yes)
3023 else
3024   AC_MSG_RESULT(no)
3026 AC_MSG_CHECKING(for uint_t)
3027 AC_CACHE_VAL(ac_cv_uint_t,
3028  [AC_TRY_COMPILE([#include <stdio.h>
3029                   #include <sys/types.h>],
3030                  [uint_t foo = 0;],
3031                  [ac_cv_uint_t=true],
3032                  [ac_cv_uint_t=false])])
3033 if test "$ac_cv_uint_t" = true ; then
3034   AC_DEFINE(HAVE_UINT_T)
3035   AC_MSG_RESULT(yes)
3036 else
3037   AC_MSG_RESULT(no)
3039 AC_MSG_CHECKING(for uint16_t)
3040 AC_CACHE_VAL(ac_cv_uint16_t,
3041  [AC_TRY_COMPILE([#include <stdio.h>
3042                   #include <sys/types.h>],
3043                  [uint16_t foo = 0;],
3044                  [ac_cv_uint16_t=true],
3045                  [ac_cv_uint16_t=false])])
3046 if test "$ac_cv_uint16_t" = true ; then
3047   AC_DEFINE(HAVE_UINT16_T)
3048   AC_MSG_RESULT(yes)
3049 else
3050   AC_MSG_RESULT(no)
3053 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3054 dnl are defined when compiling C++ but not C.  Since the result of this
3055 dnl test is used only in C++, do it in C++.
3056 AC_LANG_CPLUSPLUS
3058 AC_MSG_CHECKING(for uname.domainname)
3059 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3060     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3061         [ struct utsname *res; char *domain; 
3062             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3063         [ac_cv_have_uname_domainname_field=true],
3064         [ac_cv_have_uname_domainname_field=false])])
3066 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3067     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3068     AC_MSG_RESULT(yes)
3069 else
3070     AC_MSG_RESULT(no)
3073 AC_MSG_CHECKING(for uname.__domainname)
3074 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3075     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3076         [ struct utsname *res; char *domain; 
3077             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3078         [ac_cv_have_uname_us_domainname_field=true],
3079         [ac_cv_have_uname_us_domainname_field=false])])
3081 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3082     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3083     AC_MSG_RESULT(yes)
3084 else
3085     AC_MSG_RESULT(no)
3088 AC_LANG_CPLUSPLUS
3090 dnl Check for usable char16_t (2 bytes, unsigned)
3091 dnl (we might not need the unsignedness check anymore)
3092 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3093     ac_cv_have_usable_char16_t,
3094     [AC_TRY_COMPILE([$configure_static_assert_macros],
3095                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3096                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3097                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3098                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3099                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3100                     ac_cv_have_usable_char16_t="yes",
3101                     ac_cv_have_usable_char16_t="no")])
3102 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3103     AC_DEFINE(HAVE_CPP_CHAR16_T)
3104     HAVE_CPP_CHAR16_T=1
3107 dnl Check for usable wchar_t (2 bytes, unsigned)
3108 dnl (we really don't need the unsignedness check anymore)
3109 dnl ========================================================
3111 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3112     ac_cv_have_usable_wchar_v2,
3113     [AC_TRY_COMPILE([#include <stddef.h>
3114                      $configure_static_assert_macros],
3115                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3116                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3117                     ac_cv_have_usable_wchar_v2="yes",
3118                     ac_cv_have_usable_wchar_v2="no")])
3119 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3120     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3121     HAVE_CPP_2BYTE_WCHAR_T=1
3122 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3123 dnl This is really gcc-only
3124 dnl Do this test using CXX only since some versions of gcc
3125 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3126 dnl only have short-wchar support for c++.
3127 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3129     _SAVE_CXXFLAGS=$CXXFLAGS
3130     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3132     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3133         ac_cv_have_usable_wchar_option_v2,
3134         [AC_TRY_LINK([#include <stddef.h>
3135                       $configure_static_assert_macros],
3136                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3137                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3138                      ac_cv_have_usable_wchar_option_v2="yes",
3139                      ac_cv_have_usable_wchar_option_v2="no")])
3141     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3142         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3143         HAVE_CPP_2BYTE_WCHAR_T=1
3144         WCHAR_CFLAGS="-fshort-wchar"
3145     else    
3146         CXXFLAGS=$_SAVE_CXXFLAGS
3147     fi
3150 AC_LANG_C
3152 dnl Check for .hidden assembler directive and visibility attribute.
3153 dnl Borrowed from glibc configure.in
3154 dnl ===============================================================
3155 if test "$GNU_CC"; then
3156   AC_CACHE_CHECK(for visibility(hidden) attribute,
3157                  ac_cv_visibility_hidden,
3158                  [cat > conftest.c <<EOF
3159                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3161                   ac_cv_visibility_hidden=no
3162                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3163                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3164                       ac_cv_visibility_hidden=yes
3165                     fi
3166                   fi
3167                   rm -f conftest.[cs]
3168                  ])
3169   if test "$ac_cv_visibility_hidden" = "yes"; then
3170     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3172     AC_CACHE_CHECK(for visibility(default) attribute,
3173                    ac_cv_visibility_default,
3174                    [cat > conftest.c <<EOF
3175                     int foo __attribute__ ((visibility ("default"))) = 1;
3177                     ac_cv_visibility_default=no
3178                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3179                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3180                         ac_cv_visibility_default=yes
3181                       fi
3182                     fi
3183                     rm -f conftest.[cs]
3184                    ])
3185     if test "$ac_cv_visibility_default" = "yes"; then
3186       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3188       AC_CACHE_CHECK(for visibility pragma support,
3189                      ac_cv_visibility_pragma,
3190                      [cat > conftest.c <<EOF
3191 #pragma GCC visibility push(hidden)
3192                       int foo_hidden = 1;
3193 #pragma GCC visibility push(default)
3194                       int foo_default = 1;
3196                       ac_cv_visibility_pragma=no
3197                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3198                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3199                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3200                             ac_cv_visibility_pragma=yes
3201                           fi
3202                         fi
3203                       fi
3204                       rm -f conftest.[cs]
3205                     ])
3206       if test "$ac_cv_visibility_pragma" = "yes"; then
3207         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3208                        ac_cv_have_visibility_class_bug,
3209                        [cat > conftest.c <<EOF
3210 #pragma GCC visibility push(hidden)
3211 struct __attribute__ ((visibility ("default"))) TestStruct {
3212   static void Init();
3214 __attribute__ ((visibility ("default"))) void TestFunc() {
3215   TestStruct::Init();
3218                        ac_cv_have_visibility_class_bug=no
3219                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3220                          ac_cv_have_visibility_class_bug=yes
3221                        else
3222                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3223                            ac_cv_have_visibility_class_bug=yes
3224                          fi
3225                        fi
3226                        rm -rf conftest.{c,S}
3227                        ])
3229         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3230                        ac_cv_have_visibility_builtin_bug,
3231                        [cat > conftest.c <<EOF
3232 #pragma GCC visibility push(hidden)
3233 #pragma GCC visibility push(default)
3234 #include <string.h>
3235 #pragma GCC visibility pop
3237 __attribute__ ((visibility ("default"))) void Func() {
3238   char c[[100]];
3239   memset(c, 0, sizeof(c));
3242                        ac_cv_have_visibility_builtin_bug=no
3243                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3244                          ac_cv_have_visibility_builtin_bug=yes
3245                        else
3246                          if test `grep -c "@PLT" conftest.S` = 0; then
3247                            ac_cv_visibility_builtin_bug=yes
3248                          fi
3249                        fi
3250                        rm -f conftest.{c,S}
3251                        ])
3252         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3253                 "$ac_cv_have_visibility_class_bug" = "no"; then
3254           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3255           WRAP_SYSTEM_INCLUDES=1
3256           STL_FLAGS='-I$(DIST)/stl_wrappers'
3257           WRAP_STL_INCLUDES=1
3258         else
3259           VISIBILITY_FLAGS='-fvisibility=hidden'
3260         fi # have visibility pragma bug
3261       fi   # have visibility pragma
3262     fi     # have visibility(default) attribute
3263   fi       # have visibility(hidden) attribute
3264 fi         # GNU_CC
3266 # visibility hidden flag for Sun Studio on Solaris
3267 if test "$SOLARIS_SUNPRO_CC"; then
3268 VISIBILITY_FLAGS='-xldscope=hidden'
3269 fi         # Sun Studio on Solaris
3271 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3272 AC_SUBST(VISIBILITY_FLAGS)
3274 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3275 dnl ========================================================
3276 if test "$GNU_CC"; then
3277   CFLAGS_save="${CFLAGS}"
3278   CFLAGS="${CFLAGS} -Werror"
3279   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3280                  ac_cv_force_align_arg_pointer,
3281                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3282                                  [],
3283                                  ac_cv_force_align_arg_pointer="yes",
3284                                  ac_cv_force_align_arg_pointer="no")])
3285   CFLAGS="${CFLAGS_save}"
3286   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3287     HAVE_GCC_ALIGN_ARG_POINTER=1
3288   else
3289     HAVE_GCC_ALIGN_ARG_POINTER=
3290   fi
3292 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3294 dnl Checks for header files.
3295 dnl ========================================================
3296 AC_HEADER_DIRENT
3297 case "$target_os" in
3298 freebsd*)
3299 # for stuff like -lXshm
3300     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3301     ;;
3302 esac
3303 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3304 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3305 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3306 AC_CHECK_HEADERS(malloc.h)
3307 AC_CHECK_HEADERS(X11/XKBlib.h)
3308 AC_CHECK_HEADERS(io.h)
3310 dnl These are all the places some variant of statfs can be hiding.
3311 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3313 dnl Quota support
3314 AC_CHECK_HEADERS(sys/quota.h)
3315 AC_CHECK_HEADERS(linux/quota.h)
3317 dnl Try for MMX support
3318 dnl NB - later gcc versions require -mmmx for this header to be successfully
3319 dnl included (or another option which implies it, such as -march=pentium-mmx)
3320 AC_CHECK_HEADERS(mmintrin.h)
3322 dnl Check whether the compiler supports the new-style C++ standard
3323 dnl library headers (i.e. <new>) or needs the old "new.h"
3324 AC_LANG_CPLUSPLUS
3325 NEW_H=new.h
3326 AC_CHECK_HEADER(new, [NEW_H=new])
3327 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3328 AC_LANG_C
3330 AC_ARG_ENABLE(dtrace,
3331               [  --enable-dtrace         build with dtrace support if available (default=no)],
3332               [enable_dtrace="yes"],)
3333 if test "x$enable_dtrace" = "xyes"; then
3334   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3335   if test -n "$HAVE_DTRACE"; then
3336       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3337   else
3338       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3339   fi
3341 AC_SUBST(HAVE_DTRACE)
3343 case $target in
3344 *-aix4.3*|*-aix5*)
3345         ;;
3347         AC_CHECK_HEADERS(sys/cdefs.h)
3348         ;;
3349 esac
3351 dnl Checks for libraries.
3352 dnl ========================================================
3353 case $target in
3354 *-hpux11.*)
3355         ;;
3357         AC_CHECK_LIB(c_r, gethostbyname_r)
3358         ;;
3359 esac
3361 dnl We don't want to link with libdl even if it's present on OS X, since
3362 dnl it's not used and not part of the default installation.
3363 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3364 dnl We don't want to link against libm or libpthread on Darwin since
3365 dnl they both are just symlinks to libSystem and explicitly linking
3366 dnl against libSystem causes issues when debugging (see bug 299601).
3367 case $target in
3368 *-darwin*)
3369     ;;
3370 *-beos*)
3371     ;;
3372 *-os2*)
3373     ;;
3375     AC_CHECK_LIB(m, atan)
3376     AC_CHECK_LIB(dl, dlopen,
3377     AC_CHECK_HEADER(dlfcn.h, 
3378         LIBS="-ldl $LIBS"
3379         AC_DEFINE(HAVE_LIBDL)))
3380     ;;
3381 esac
3383 _SAVE_CFLAGS="$CFLAGS"
3384 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3385 AC_CHECK_FUNCS(dladdr)
3386 CFLAGS="$_SAVE_CFLAGS"
3388 if test ! "$GNU_CXX"; then
3390     case $target in
3391     *-aix*)
3392         AC_CHECK_LIB(C_r, demangle)
3393         ;;
3394      *)
3395         AC_CHECK_LIB(C, demangle)
3396         ;;
3397      esac
3400 dnl OS/2 has socket in libc.
3401 case $target in
3402 *-os2*)
3403     ;;
3405     AC_CHECK_LIB(socket, socket)
3406 esac
3408 dnl ========================================================
3409 dnl Check whether we can compile code for Core Text
3410 dnl (available on Mac OS X 10.5 or later)
3411 dnl ========================================================
3412 case "$target" in
3413 *-darwin*)
3414   AC_MSG_CHECKING([for Core Text])
3415   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3416                  [CTLineRef lineRef;],
3417                   ac_cv_have_core_text="yes",
3418                   ac_cv_have_core_text="no")
3419   AC_MSG_RESULT([$ac_cv_have_core_text])
3421   if test "$ac_cv_have_core_text" = "no"; then
3422     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3423   fi
3424   ;;
3425 esac
3427 XLDFLAGS="$X_LIBS"
3428 XLIBS="$X_EXTRA_LIBS"
3430 dnl ========================================================
3431 dnl Checks for X libraries.
3432 dnl Ordering is important.
3433 dnl Xt is dependent upon SM as of X11R6
3434 dnl ========================================================
3435 if test "$no_x" = "yes"; then
3436     AC_DEFINE(NO_X11)
3437 else
3438     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3439         XLIBS="-lX11 $XLIBS"
3440         _SAVE_LDFLAGS="$LDFLAGS"
3441         LDFLAGS="$XLDFLAGS $LDFLAGS"
3442         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3443                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3444         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3445                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3446      
3447         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3448         unset ac_cv_lib_Xt_XtFree
3449             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3450             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3451         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3452                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3453         ])
3455     # AIX needs the motif library linked before libXt to prevent
3456     # crashes in plugins linked against Motif - Bug #98892
3457     case "${target_os}" in
3458     aix*)
3459         XT_LIBS="-lXm $XT_LIBS"
3460         ;;
3461     esac
3463     dnl ========================================================
3464     dnl = Check for XShm
3465     dnl ========================================================
3466     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3467         $XLIBS $XEXT_LIBS)
3468     AC_CHECK_HEADER(X11/extensions/XShm.h)
3469     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3470         test -n "$_HAVE_XSHM_XEXT"; then
3471         AC_DEFINE(HAVE_XSHM)
3472     fi
3474     dnl ========================================================
3475     dnl = Check for Xss
3476     dnl ========================================================
3477     AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
3478         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3479             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3480              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3482     dnl ========================================================
3483     dnl = Check for XIE
3484     dnl ========================================================
3485     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3486         $XLIBS $XEXT_LIBS)
3487     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3489     if test "$MOZ_XIE_LIBS"; then
3490         dnl ====================================================
3491         dnl = If XIE is present and is desired, turn it on
3492         dnl ====================================================
3493         case $target in
3494             *-hpux*)
3495                 ;;
3496             *)
3497                 HAVE_XIE=1
3498                 ;;
3499         esac
3500     fi
3502         LDFLAGS="$_SAVE_LDFLAGS"
3504     dnl ========================================================
3505     dnl = Check for freetype2 and its functionality
3506     dnl ========================================================
3507     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3509     if test "$_HAVE_FREETYPE2"; then
3510         _SAVE_LIBS="$LIBS"
3511         _SAVE_CFLAGS="$CFLAGS"
3512         LIBS="$LIBS $FT2_LIBS"
3513         CFLAGS="$CFLAGS $FT2_CFLAGS"
3515         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3516             ac_cv_member_FT_Bitmap_Size_y_ppem,
3517             [AC_TRY_COMPILE([#include <ft2build.h>
3518                              #include FT_FREETYPE_H],
3519                             [FT_Bitmap_Size s;
3520                              if (sizeof s.y_ppem) return 0;
3521                              return 1],
3522                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3523                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3524         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3525             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3526         else
3527             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3528         fi
3529         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3530                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3531                            [FT_Bitmap_Size structure includes y_ppem field])
3533         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3535         LIBS="$_SAVE_LIBS"
3536         CFLAGS="$_SAVE_CFLAGS"
3537     fi
3539 fi # $no_x
3541 AC_SUBST(XCFLAGS)
3542 AC_SUBST(XLDFLAGS)
3543 AC_SUBST(XLIBS)
3544 AC_SUBST(XEXT_LIBS)
3545 AC_SUBST(XT_LIBS)
3546 AC_SUBST(XSS_LIBS)
3548 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3549 AC_TRY_COMPILE([],
3550                [asm("uqadd8 r1, r1, r2");],
3551                result="yes", result="no")
3552 AC_MSG_RESULT("$result")
3553 if test "$result" = "yes"; then
3554     AC_DEFINE(HAVE_ARM_SIMD)
3555     HAVE_ARM_SIMD=1
3557 AC_SUBST(HAVE_ARM_SIMD)
3559 AC_MSG_CHECKING(for ARM NEON support in compiler)
3560 _SAVE_CFLAGS="$CFLAGS"
3561 if test "$GNU_CC"; then
3562   # gcc needs -mfpu=neon to recognize NEON instructions
3563   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3565 AC_TRY_COMPILE([],
3566                [asm("vadd.i8 d0, d0, d0");],
3567                result="yes", result="no")
3568 AC_MSG_RESULT("$result")
3569 if test "$result" = "yes"; then
3570     AC_DEFINE(HAVE_ARM_NEON)
3571     HAVE_ARM_NEON=1
3573 CFLAGS="$_SAVE_CFLAGS"
3574 AC_SUBST(HAVE_ARM_NEON)
3576 dnl ========================================================
3577 dnl = pthread support
3578 dnl = Start by checking whether the system support pthreads
3579 dnl ========================================================
3580 case "$target_os" in
3581 darwin*)
3582     USE_PTHREADS=1
3583     ;;
3585     MOZ_CHECK_PTHREADS(pthreads,
3586         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3587         MOZ_CHECK_PTHREADS(pthread,
3588             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3589             MOZ_CHECK_PTHREADS(c_r,
3590                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3591                 MOZ_CHECK_PTHREADS(c,
3592                     USE_PTHREADS=1
3593                 )
3594             )
3595         )
3596     )
3597     ;;
3598 esac
3600 dnl ========================================================
3601 dnl Check the command line for --with-pthreads 
3602 dnl ========================================================
3603 MOZ_ARG_WITH_BOOL(pthreads,
3604 [  --with-pthreads         Force use of system pthread library with NSPR ],
3605 [ if test "$USE_PTHREADS"x = x; then
3606     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3607 fi],
3608     USE_PTHREADS=
3609     _PTHREAD_LDFLAGS=
3612 dnl ========================================================
3613 dnl Do the platform specific pthread hackery
3614 dnl ========================================================
3615 if test "$USE_PTHREADS"x != x
3616 then
3617         dnl
3618         dnl See if -pthread is supported.
3619         dnl
3620         rm -f conftest*
3621         ac_cv_have_dash_pthread=no
3622         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3623         echo 'int main() { return 0; }' | cat > conftest.c
3624         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3625         if test $? -eq 0; then
3626                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3627                         ac_cv_have_dash_pthread=yes
3628                 case "$target_os" in
3629                 freebsd*)
3630 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3631                 ;;
3632                 *)
3633                             CFLAGS="$CFLAGS -pthread"
3634                             CXXFLAGS="$CXXFLAGS -pthread"
3635                 ;;
3636                 esac
3637                 fi
3638         fi
3639         rm -f conftest*
3640     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3642         dnl
3643         dnl See if -pthreads is supported.
3644         dnl
3645     ac_cv_have_dash_pthreads=no
3646     if test "$ac_cv_have_dash_pthread" = "no"; then
3647             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3648         echo 'int main() { return 0; }' | cat > conftest.c
3649             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3650         if test $? -eq 0; then
3651                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3652                             ac_cv_have_dash_pthreads=yes
3653                             CFLAGS="$CFLAGS -pthreads"
3654                             CXXFLAGS="$CXXFLAGS -pthreads"
3655                     fi
3656             fi
3657             rm -f conftest*
3658         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3659     fi
3661         case "$target" in
3662             *-*-freebsd*)
3663                         AC_DEFINE(_REENTRANT)
3664                         AC_DEFINE(_THREAD_SAFE)
3665                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3666                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3667                                 _PTHREAD_LDFLAGS="-pthread"
3668                         else
3669                                 _PTHREAD_LDFLAGS="-lc_r"
3670                         fi
3671                         ;;
3673             *-*-openbsd*|*-*-bsdi*)
3674                         AC_DEFINE(_REENTRANT)
3675                         AC_DEFINE(_THREAD_SAFE)
3676                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3677                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3678                 _PTHREAD_LDFLAGS="-pthread"
3679                         fi
3680                         ;;
3682             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3683                         AC_DEFINE(_REENTRANT) 
3684                         ;;
3686             *-*-nto*) 
3687                         AC_DEFINE(_REENTRANT) 
3688                         ;;
3690             *-aix4.3*|*-aix5*)
3691                         AC_DEFINE(_REENTRANT) 
3692                         ;;
3694             *-hpux11.*)
3695                         AC_DEFINE(_REENTRANT) 
3696                         ;;
3698             alpha*-*-osf*)
3699                         AC_DEFINE(_REENTRANT)
3700                         ;;
3702             *-*-solaris*) 
3703                         AC_DEFINE(_REENTRANT)
3704                         if test "$SOLARIS_SUNPRO_CC"; then
3705                                 CFLAGS="$CFLAGS -mt" 
3706                                 CXXFLAGS="$CXXFLAGS -mt" 
3707                         fi
3708                         ;;
3709         esac
3710     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3713 dnl ========================================================
3714 dnl See if mmap sees writes
3715 dnl For cross compiling, just define it as no, which is a safe default
3716 dnl ========================================================
3717 AC_MSG_CHECKING(whether mmap() sees write()s)
3719 changequote(,)
3720 mmap_test_prog='
3721     #include <stdlib.h>
3722     #include <unistd.h>
3723     #include <sys/mman.h>
3724     #include <sys/types.h>
3725     #include <sys/stat.h>
3726     #include <fcntl.h>
3728     char fname[] = "conftest.file";
3729     char zbuff[1024]; /* Fractional page is probably worst case */
3731     int main() {
3732         char *map;
3733         int fd;
3734         int i;
3735         unlink(fname);
3736         fd = open(fname, O_RDWR | O_CREAT, 0660);
3737         if(fd<0) return 1;
3738         unlink(fname);
3739         write(fd, zbuff, sizeof(zbuff));
3740         lseek(fd, 0, SEEK_SET);
3741         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3742         if(map==(char*)-1) return 2;
3743         for(i=0; fname[i]; i++) {
3744             int rc = write(fd, &fname[i], 1);
3745             if(map[i]!=fname[i]) return 4;
3746         }
3747         return 0;
3748     }
3750 changequote([,])
3752 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3754 AC_MSG_RESULT("$result")
3756 if test "$result" = "no"; then
3757     AC_DEFINE(MMAP_MISSES_WRITES)
3761 dnl Checks for library functions.
3762 dnl ========================================================
3763 AC_PROG_GCC_TRADITIONAL
3764 AC_FUNC_MEMCMP
3765 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3766 AC_CHECK_FUNCS(flockfile getpagesize)
3767 AC_CHECK_FUNCS(localtime_r strtok_r)
3769 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3770 _SAVE_LDFLAGS=$LDFLAGS
3771 LDFLAGS="$LDFLAGS -lrt"
3772 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3773                ac_cv_have_clock_monotonic,
3774                [AC_TRY_LINK([#include <time.h>],
3775                             [ struct timespec ts;
3776                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3777                             ac_cv_have_clock_monotonic=yes,
3778                             ac_cv_have_clock_monotonic=no)])
3779 LDFLAGS=$_SAVE_LDFLAGS
3780 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3781     HAVE_CLOCK_MONOTONIC=1
3782     REALTIME_LIBS=-lrt
3783     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3784     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3785     AC_SUBST(REALTIME_LIBS)
3788 dnl check for wcrtomb/mbrtowc
3789 dnl =======================================================================
3790 if test -z "$MACOS_DEPLOYMENT_TARGET" -o "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3791 AC_LANG_SAVE
3792 AC_LANG_CPLUSPLUS
3793 AC_CACHE_CHECK(for wcrtomb,
3794     ac_cv_have_wcrtomb,
3795     [AC_TRY_LINK([#include <wchar.h>],
3796                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3797                  ac_cv_have_wcrtomb="yes",
3798                  ac_cv_have_wcrtomb="no")])
3799 if test "$ac_cv_have_wcrtomb" = "yes"; then
3800     AC_DEFINE(HAVE_WCRTOMB)
3802 AC_CACHE_CHECK(for mbrtowc,
3803     ac_cv_have_mbrtowc,
3804     [AC_TRY_LINK([#include <wchar.h>],
3805                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3806                  ac_cv_have_mbrtowc="yes",
3807                  ac_cv_have_mbrtowc="no")])
3808 if test "$ac_cv_have_mbrtowc" = "yes"; then
3809     AC_DEFINE(HAVE_MBRTOWC)
3811 AC_LANG_RESTORE
3814 AC_CACHE_CHECK(
3815     [for res_ninit()],
3816     ac_cv_func_res_ninit,
3817     [AC_TRY_LINK([
3818         #ifdef linux
3819         #define _BSD_SOURCE 1
3820         #endif
3821         #include <resolv.h>
3822         ],
3823         [int foo = res_ninit(&_res);],
3824         [ac_cv_func_res_ninit=yes],
3825         [ac_cv_func_res_ninit=no])
3826     ])
3828 if test "$ac_cv_func_res_ninit" = "yes"; then
3829     AC_DEFINE(HAVE_RES_NINIT)
3830 dnl must add the link line we do something as foolish as this... dougt
3831 dnl else
3832 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3833 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3836 AC_LANG_CPLUSPLUS
3837 AC_CACHE_CHECK(
3838     [for gnu_get_libc_version()],
3839     ac_cv_func_gnu_get_libc_version,
3840     [AC_TRY_LINK([
3841         #ifdef HAVE_GNU_LIBC_VERSION_H
3842         #include <gnu/libc-version.h>
3843         #endif
3844         ],
3845         [const char *glibc_version = gnu_get_libc_version();],
3846         [ac_cv_func_gnu_get_libc_version=yes],
3847         [ac_cv_func_gnu_get_libc_version=no] 
3848         )]
3849     )
3851 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3852     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3855 case $target_os in
3856     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3857         ;;
3858     *)
3859     
3860 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3861     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3862         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3863 _SAVE_LIBS=$LIBS
3864 LIBS="$LIBS $_ICONV_LIBS"
3865 AC_CACHE_CHECK(
3866     [for iconv()],
3867     ac_cv_func_iconv,
3868     [AC_TRY_LINK([
3869         #include <stdlib.h>
3870         #include <iconv.h>
3871         ],
3872         [
3873             iconv_t h = iconv_open("", "");
3874             iconv(h, NULL, NULL, NULL, NULL);
3875             iconv_close(h);
3876         ],
3877         [ac_cv_func_iconv=yes],
3878         [ac_cv_func_iconv=no] 
3879         )]
3880     )
3881 if test "$ac_cv_func_iconv" = "yes"; then
3882     AC_DEFINE(HAVE_ICONV)
3883     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3884     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3885     LIBICONV="$_ICONV_LIBS"
3886     AC_CACHE_CHECK(
3887         [for iconv() with const input],
3888         ac_cv_func_const_iconv,
3889         [AC_TRY_COMPILE([
3890             #include <stdlib.h>
3891             #include <iconv.h>
3892             ],
3893             [
3894                 const char *input = "testing";
3895                 iconv_t h = iconv_open("", "");
3896                 iconv(h, &input, NULL, NULL, NULL);
3897                 iconv_close(h);
3898             ],
3899             [ac_cv_func_const_iconv=yes],
3900             [ac_cv_func_const_iconv=no] 
3901             )]
3902         )
3903     if test "$ac_cv_func_const_iconv" = "yes"; then
3904         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3905     fi
3907 LIBS=$_SAVE_LIBS
3909     ;;
3910 esac
3912 AM_LANGINFO_CODESET
3914 AC_LANG_C
3916 dnl **********************
3917 dnl *** va_copy checks ***
3918 dnl **********************
3919 dnl we currently check for all three va_copy possibilities, so we get
3920 dnl all results in config.log for bug reports.
3921 AC_MSG_CHECKING(for an implementation of va_copy())
3922 AC_CACHE_VAL(ac_cv_va_copy,[
3923     AC_TRY_RUN([
3924         #include <stdarg.h>
3925         void f (int i, ...) {
3926             va_list args1, args2;
3927             va_start (args1, i);
3928             va_copy (args2, args1);
3929             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3930                 exit (1);
3931             va_end (args1); va_end (args2);
3932         }
3933         int main() { f (0, 42); return 0; }],
3934         ac_cv_va_copy=yes,
3935         ac_cv_va_copy=no,
3936         ac_cv_va_copy=no
3937     )
3939 AC_MSG_RESULT($ac_cv_va_copy)
3940 AC_MSG_CHECKING(for an implementation of __va_copy())
3941 AC_CACHE_VAL(ac_cv___va_copy,[
3942     AC_TRY_RUN([
3943         #include <stdarg.h>
3944         void f (int i, ...) {
3945             va_list args1, args2;
3946             va_start (args1, i);
3947             __va_copy (args2, args1);
3948             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3949                 exit (1);
3950             va_end (args1); va_end (args2);
3951         }
3952         int main() { f (0, 42); return 0; }],
3953         ac_cv___va_copy=yes,
3954         ac_cv___va_copy=no,
3955         ac_cv___va_copy=no
3956     )
3958 AC_MSG_RESULT($ac_cv___va_copy)
3959 AC_MSG_CHECKING(whether va_lists can be copied by value)
3960 AC_CACHE_VAL(ac_cv_va_val_copy,[
3961     AC_TRY_RUN([
3962         #include <stdarg.h>
3963         void f (int i, ...) {
3964             va_list args1, args2;
3965             va_start (args1, i);
3966             args2 = args1;
3967             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3968                 exit (1);
3969             va_end (args1); va_end (args2);
3970         }
3971         int main() { f (0, 42); return 0; }],
3972         ac_cv_va_val_copy=yes,
3973         ac_cv_va_val_copy=no,
3974         ac_cv_va_val_copy=yes
3975     )
3977 if test "x$ac_cv_va_copy" = "xyes"; then
3978     AC_DEFINE(VA_COPY, va_copy)
3979     AC_DEFINE(HAVE_VA_COPY)
3980 elif test "x$ac_cv___va_copy" = "xyes"; then
3981     AC_DEFINE(VA_COPY, __va_copy)
3982     AC_DEFINE(HAVE_VA_COPY)
3985 if test "x$ac_cv_va_val_copy" = "xno"; then
3986    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3988 AC_MSG_RESULT($ac_cv_va_val_copy)
3990 dnl Check for dll-challenged libc's.
3991 dnl This check is apparently only needed for Linux.
3992 case "$target" in
3993         *-linux*)
3994             dnl ===================================================================
3995             _curdir=`pwd`
3996             export _curdir
3997             rm -rf conftest* _conftest
3998             mkdir _conftest
3999             cat >> conftest.C <<\EOF
4000 #include <stdio.h>
4001 #include <link.h>
4002 #include <dlfcn.h>
4003 #ifdef _dl_loaded
4004 void __dump_link_map(void) {
4005   struct link_map *map = _dl_loaded;
4006   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
4008 int main() {
4009   dlopen("./conftest1.so",RTLD_LAZY);
4010   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
4011   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
4012   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
4013   __dump_link_map();
4015 #else
4016 /* _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).*/
4017 int main() { printf("./conftest1.so\n"); }
4018 #endif
4021             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4023             cat >> conftest1.C <<\EOF
4024 #include <stdio.h>
4025 void foo(void) {printf("foo in dll called\n");}
4027             ${CXX-g++} -fPIC -c -g conftest1.C
4028             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4029             ${CXX-g++} -g conftest.C -o conftest -ldl
4030             cp -f conftest1.so conftest _conftest
4031             cd _conftest
4032             if test `./conftest | grep conftest1.so | wc -l` -gt 1
4033             then
4034                 echo
4035                 echo "*** Your libc has a bug that can result in loading the same dynamic"
4036                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
4037                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
4038                 echo "*** will be excessive memory usage at runtime."
4039                 echo
4040             fi
4041             cd ${_curdir}
4042             rm -rf conftest* _conftest
4043             dnl ===================================================================
4044             ;;
4045 esac
4047 dnl ===================================================================
4048 dnl ========================================================
4049 dnl Put your C++ language/feature checks below
4050 dnl ========================================================
4051 AC_LANG_CPLUSPLUS
4053 ARM_ABI_PREFIX=
4054 HAVE_GCC3_ABI=
4055 if test "$GNU_CC"; then
4056   if test "$CPU_ARCH" = "arm" ; then
4057     AC_CACHE_CHECK(for ARM EABI,
4058         ac_cv_gcc_arm_eabi,
4059         [AC_TRY_COMPILE([],
4060                         [
4061 #if defined(__ARM_EABI__)
4062   return 0;
4063 #else
4064 #error Not ARM EABI.
4065 #endif
4066                         ],
4067                         ac_cv_gcc_arm_eabi="yes",
4068                         ac_cv_gcc_arm_eabi="no")])
4069     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4070         HAVE_ARM_EABI=1
4071         ARM_ABI_PREFIX=eabi-
4072     else
4073         ARM_ABI_PREFIX=oabi-
4074     fi
4075   fi
4077   AC_CACHE_CHECK(for gcc 3.0 ABI,
4078       ac_cv_gcc_three_abi,
4079       [AC_TRY_COMPILE([],
4080                       [
4081 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4082   return 0;
4083 #else
4084 #error Not gcc3.
4085 #endif
4086                       ],
4087                       ac_cv_gcc_three_abi="yes",
4088                       ac_cv_gcc_three_abi="no")])
4089   if test "$ac_cv_gcc_three_abi" = "yes"; then
4090       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4091       HAVE_GCC3_ABI=1
4092   else
4093       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4094   fi
4096 AC_SUBST(HAVE_GCC3_ABI)
4099 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4100                ac_cv_cpp_explicit,
4101                [AC_TRY_COMPILE(class X {
4102                                public: explicit X(int i) : i_(i) {}
4103                                private: int i_;
4104                                };,
4105                                X x(3);,
4106                                ac_cv_cpp_explicit=yes,
4107                                ac_cv_cpp_explicit=no)])
4108 if test "$ac_cv_cpp_explicit" = yes ; then
4109    AC_DEFINE(HAVE_CPP_EXPLICIT)
4112 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4113                ac_cv_cpp_typename,
4114                [AC_TRY_COMPILE(class param {
4115                                public:
4116                                    typedef unsigned long num_type;
4117                                };
4119                                template <class T> class tplt {
4120                                public:
4121                                    typedef typename T::num_type t_num_type;
4122                                    t_num_type foo(typename T::num_type num) {
4123                                        return num;
4124                                    }
4125                                };,
4126                                tplt<param> A;
4127                                A.foo(0);,
4128                                ac_cv_cpp_typename=yes,
4129                                ac_cv_cpp_typename=no)])
4130 if test "$ac_cv_cpp_typename" = yes ; then
4131    AC_DEFINE(HAVE_CPP_TYPENAME)
4134 dnl Check for support of modern template specialization syntax
4135 dnl Test code and requirement from scc@netscape.com.
4136 dnl Autoconf cut-and-paste job by waterson@netscape.com
4137 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4138                ac_cv_cpp_modern_specialize_template_syntax,
4139                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4140                                class Y {};
4141                                template <> struct X<Y> { double a; };,
4142                                X<int> int_x;
4143                                X<Y> y_x;,
4144                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4145                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4146 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4147   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4151 dnl Some compilers support only full specialization, and some don't.
4152 AC_CACHE_CHECK(whether partial template specialization works,
4153                ac_cv_cpp_partial_specialization,
4154                [AC_TRY_COMPILE(template <class T> class Foo {};
4155                                template <class T> class Foo<T*> {};,
4156                                return 0;,
4157                                ac_cv_cpp_partial_specialization=yes,
4158                                ac_cv_cpp_partial_specialization=no)])
4159 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4160   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4163 dnl Some compilers have limited support for operators with templates;
4164 dnl specifically, it is necessary to define derived operators when a base
4165 dnl class's operator declaration should suffice.
4166 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4167                ac_cv_need_derived_template_operators,
4168                [AC_TRY_COMPILE([template <class T> class Base { };
4169                                 template <class T>
4170                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4171                                 template <class T> class Derived : public Base<T> { };],
4172                                [Derived<char> a, b;
4173                                 Base<char> c = a + b;
4174                                 return 0;],
4175                                ac_cv_need_derived_template_operators=no,
4176                                ac_cv_need_derived_template_operators=yes)])
4177 if test "$ac_cv_need_derived_template_operators" = yes ; then
4178   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4182 dnl Some compilers have trouble detecting that a template class
4183 dnl that derives from another template is actually an instance
4184 dnl of the base class. This test checks for that.
4185 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4186                ac_cv_need_cpp_template_cast_to_base,
4187                [AC_TRY_COMPILE([template <class T> class Base { };
4188                                 template <class T> class Derived : public Base<T> { };
4189                                 template <class T> int foo(const Base<T>&) { return 0; }],
4190                                [Derived<char> bar; return foo(bar);],
4191                                ac_cv_need_cpp_template_cast_to_base=no,
4192                                ac_cv_need_cpp_template_cast_to_base=yes)])
4193 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4194   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4197 dnl Some compilers have trouble resolving the ambiguity between two
4198 dnl functions whose arguments differ only by cv-qualifications.
4199 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4200                ac_cv_can_resolve_const_ambiguity,
4201                [AC_TRY_COMPILE([
4202                                 template <class T> class ptrClass {
4203                                   public: T* ptr;
4204                                 };
4206                                 template <class T> T* a(ptrClass<T> *arg) {
4207                                   return arg->ptr;
4208                                 }
4210                                 template <class T>
4211                                 const T* a(const ptrClass<T> *arg) {
4212                                   return arg->ptr;
4213                                 }
4214                                ],
4215                                [ ptrClass<int> i;
4216                                  a(&i); ],
4217                                ac_cv_can_resolve_const_ambiguity=yes,
4218                                ac_cv_can_resolve_const_ambiguity=no)])
4219 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4220   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4224 dnl We don't do exceptions on unix.  The only reason this used to be here
4225 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4226 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4227 dnl So im commenting this out until someone writes some artificial 
4228 dnl intelligence to detect not only if the compiler has exceptions, but if 
4229 dnl they are enabled as well.
4230 dnl 
4231 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4232 dnl                ac_cv_cpp_exceptions,
4233 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4234 dnl                                static void F() { throw X(); },
4235 dnl                                try { F(); } catch(X & e) { },
4236 dnl                                ac_cv_cpp_exceptions=yes,
4237 dnl                                ac_cv_cpp_exceptions=no)])
4238 dnl if test $ac_cv_cpp_exceptions = yes ; then
4239 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4240 dnl fi
4242 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4243 dnl supports it well enough to allow us to use it to change access, but not
4244 dnl to resolve ambiguity. The next two tests determine how well the |using|
4245 dnl keyword is supported.
4247 dnl Check to see if we can change access with |using|.  Test both a
4248 dnl legal and an illegal example.
4249 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4250                ac_cv_cpp_access_changing_using2,
4251                [AC_TRY_COMPILE(
4252                    class A { protected: int foo() { return 0; } };
4253                    class B : public A { public: using A::foo; };,
4254                    B b; return b.foo();,
4255                    [AC_TRY_COMPILE(
4256                        class A { public: int foo() { return 1; } };
4257                        class B : public A { private: using A::foo; };,
4258                        B b; return b.foo();,
4259                        ac_cv_cpp_access_changing_using2=no,
4260                        ac_cv_cpp_access_changing_using2=yes)],
4261                    ac_cv_cpp_access_changing_using2=no)])
4262 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4263    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4266 dnl Check to see if we can resolve ambiguity with |using|.
4267 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4268                ac_cv_cpp_ambiguity_resolving_using,
4269                [AC_TRY_COMPILE(class X { 
4270                                  public: int go(const X&) {return 3;}
4271                                          int jo(const X&) {return 3;}
4272                                };
4273                                class Y : public X {
4274                                  public:  int go(int) {return 2;}
4275                                           int jo(int) {return 2;}
4276                                           using X::jo;
4277                                  private: using X::go;
4278                                };,
4279                                X x; Y y; y.jo(x);,
4280                                ac_cv_cpp_ambiguity_resolving_using=yes,
4281                                ac_cv_cpp_ambiguity_resolving_using=no)])
4282 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4283    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4286 dnl Check to see if the |std| namespace is supported. If so, we'll want
4287 dnl to qualify any standard library calls with "std::" to ensure that
4288 dnl those functions can be resolved.
4289 AC_CACHE_CHECK(for \"std::\" namespace,
4290                ac_cv_cpp_namespace_std,
4291                [AC_TRY_COMPILE([#include <algorithm>],
4292                                [return std::min(0, 1);],
4293                                ac_cv_cpp_namespace_std=yes,
4294                                ac_cv_cpp_namespace_std=no)])
4295 if test "$ac_cv_cpp_namespace_std" = yes ; then
4296    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4299 dnl Older compilers are overly ambitious with respect to using the standard
4300 dnl template library's |operator!=()| when |operator==()| is defined. In
4301 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4302 dnl ambiguity at compile-time. This test checks for that case.
4303 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4304                ac_cv_cpp_unambiguous_std_notequal,
4305                [AC_TRY_COMPILE([#include <algorithm>
4306                                 struct T1 {};
4307                                 int operator==(const T1&, const T1&) { return 0; }
4308                                 int operator!=(const T1&, const T1&) { return 0; }],
4309                                [T1 a,b; return a != b;],
4310                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4311                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4312 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4313   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4317 AC_CACHE_CHECK(for C++ reinterpret_cast,
4318                ac_cv_cpp_reinterpret_cast,
4319                [AC_TRY_COMPILE(struct X { int i; };
4320                                struct Y { int i; };,
4321                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4322                                ac_cv_cpp_reinterpret_cast=yes,
4323                                ac_cv_cpp_reinterpret_cast=no)])
4324 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4325    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4328 dnl See if a dynamic_cast to void* gives the most derived object.
4329 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4330                ac_cv_cpp_dynamic_cast_void_ptr,
4331                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4332                             class Y { int j; public: virtual ~Y() { } };
4333                             class Z : public X, public Y { int k; };
4335                             int main() {
4336                                  Z mdo;
4337                                  X *subx = (X*)&mdo;
4338                                  Y *suby = (Y*)&mdo;
4339                                  return !((((void*)&mdo != (void*)subx) &&
4340                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4341                                           (((void*)&mdo != (void*)suby) &&
4342                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4343                             }],
4344                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4345                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4346                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4347 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4348    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4352 dnl note that this one is reversed - if the test fails, then
4353 dnl we require implementations of unused virtual methods. Which
4354 dnl really blows because it means we'll have useless vtable
4355 dnl bloat.
4356 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4357                ac_cv_cpp_unused_required,
4358                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4359                                X x;,
4360                                ac_cv_cpp_unused_required=no,
4361                                ac_cv_cpp_unused_required=yes)])
4362 if test "$ac_cv_cpp_unused_required" = yes ; then
4363    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4367 dnl Some compilers have trouble comparing a constant reference to a templatized
4368 dnl class to zero, and require an explicit operator==() to be defined that takes
4369 dnl an int. This test separates the strong from the weak.
4371 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4372                ac_cv_trouble_comparing_to_zero,
4373                [AC_TRY_COMPILE([#include <algorithm>
4374                                 template <class T> class Foo {};
4375                                 class T2;
4376                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4377                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4378                                [Foo<int> f; return (0 != f);],
4379                                ac_cv_trouble_comparing_to_zero=no,
4380                                ac_cv_trouble_comparing_to_zero=yes)])
4381 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4382   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4385 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4386 _SAVE_LDFLAGS=$LDFLAGS
4387 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4388 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4389                ac_cv_thread_keyword,
4390                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4391                             [return tlsIsMainThread;],
4392                             ac_cv_thread_keyword=yes,
4393                             ac_cv_thread_keyword=no)])
4394 LDFLAGS=$_SAVE_LDFLAGS
4395 if test "$ac_cv_thread_keyword" = yes; then
4396   # mips builds fail with TLS variables because of a binutils bug.
4397   # See bug 528687
4398   case "${target}" in
4399     mips*-*)
4400       :
4401       ;;
4402     *-android*)
4403       :
4404       ;;
4405     *)
4406       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4407       ;;
4408   esac
4411 dnl Check for the existence of various allocation headers/functions
4413 MALLOC_H=
4414 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4415 if test "$MALLOC_H" = ""; then
4416   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4417   if test "$MALLOC_H" = ""; then
4418     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4419   fi
4421 if test "$MALLOC_H" != ""; then
4422    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4425 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4426 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4428 dnl See if compiler supports some gcc-style attributes
4430 AC_CACHE_CHECK(for __attribute__((always_inline)),
4431                ac_cv_attribute_always_inline,
4432                [AC_TRY_COMPILE([],
4433                                [inline void f(void) __attribute__((always_inline));],
4434                                ac_cv_attribute_always_inline=yes,
4435                                ac_cv_attribute_always_inline=no)])
4437 AC_CACHE_CHECK(for __attribute__((malloc)),
4438                ac_cv_attribute_malloc,
4439                [AC_TRY_COMPILE([],
4440                                [void* f(int) __attribute__((malloc));],
4441                                ac_cv_attribute_malloc=yes,
4442                                ac_cv_attribute_malloc=no)])
4444 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4445                ac_cv_attribute_warn_unused,
4446                [AC_TRY_COMPILE([],
4447                                [int f(void) __attribute__((warn_unused_result));],
4448                                ac_cv_attribute_warn_unused=yes,
4449                                ac_cv_attribute_warn_unused=no)])
4451 AC_CACHE_CHECK(for __attribute__((noreturn)),
4452                ac_cv_attribute_noreturn,
4453                [AC_TRY_COMPILE([],
4454                                [void f(void) __attribute__((noreturn));],
4455                                ac_cv_attribute_noreturn=yes,
4456                                ac_cv_attribute_noreturn=no)])
4458 dnl End of C++ language/feature checks
4459 AC_LANG_C
4461 dnl ========================================================
4462 dnl =  Internationalization checks
4463 dnl ========================================================
4465 dnl Internationalization and Locale support is different
4466 dnl on various UNIX platforms.  Checks for specific i18n
4467 dnl features go here.
4469 dnl check for LC_MESSAGES
4470 AC_CACHE_CHECK(for LC_MESSAGES,
4471                 ac_cv_i18n_lc_messages,
4472                 [AC_TRY_COMPILE([#include <locale.h>],
4473                                 [int category = LC_MESSAGES;],
4474                                 ac_cv_i18n_lc_messages=yes,
4475                                 ac_cv_i18n_lc_messages=no)])
4476 if test "$ac_cv_i18n_lc_messages" = yes; then
4477    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4480 AC_HAVE_FUNCS(localeconv)
4482 fi # SKIP_COMPILER_CHECKS
4484 TARGET_XPCOM_ABI=
4485 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4486     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4489 dnl Mozilla specific options
4490 dnl ========================================================
4491 dnl The macros used for command line options
4492 dnl are defined in build/autoconf/altoptions.m4.
4494 dnl If the compiler supports these attributes, define them as
4495 dnl convenience macros.
4496 if test "$ac_cv_attribute_always_inline" = yes ; then
4497   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4498 else
4499   AC_DEFINE(NS_ALWAYS_INLINE,)
4502 if test "$ac_cv_attribute_malloc" = yes ; then
4503   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4504 else
4505   AC_DEFINE(NS_ATTR_MALLOC,)
4508 if test "$ac_cv_attribute_warn_unused" = yes ; then
4509   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4510 else
4511   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4514 if test "$ac_cv_attribute_noreturn" = yes ; then
4515   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4516 else
4517   AC_DEFINE(NS_NORETURN,)
4520 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4521 dnl features that Windows actually does support.
4523 if test -n "$SKIP_COMPILER_CHECKS"; then
4524    dnl Windows has malloc.h
4525    AC_DEFINE(MALLOC_H, [<malloc.h>])
4526    AC_DEFINE(HAVE_FORCEINLINE)
4527    AC_DEFINE(HAVE_LOCALECONV)
4528 fi # SKIP_COMPILER_CHECKS
4530 dnl ========================================================
4531 dnl =
4532 dnl = Check for external package dependencies
4533 dnl =
4534 dnl ========================================================
4535 MOZ_ARG_HEADER(External Packages)
4537 MOZ_ENABLE_LIBXUL=1
4539 MOZ_ARG_WITH_STRING(libxul-sdk,
4540 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4541   LIBXUL_SDK_DIR=$withval)
4543 if test "$LIBXUL_SDK_DIR" = "yes"; then
4544     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4545 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4546     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4548     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4549         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4550     fi
4552     MOZ_ENABLE_LIBXUL=1
4554 AC_SUBST(LIBXUL_SDK)
4556 if test -n "$LIBXUL_SDK"; then
4557     LIBXUL_DIST="$LIBXUL_SDK"
4558 else
4559     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4561 AC_SUBST(LIBXUL_DIST)
4563 SYSTEM_LIBXUL=
4565 MOZ_ARG_WITH_BOOL(system-libxul,
4566 [  --with-system-libxul    Use system installed libxul SDK],
4567     SYSTEM_LIBXUL=1)
4569 if test -n "$SYSTEM_LIBXUL" -a -z "$MOZ_ENABLE_LIBXUL"; then
4570     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4573 dnl ========================================================
4574 dnl = If NSPR was not detected in the system, 
4575 dnl = use the one in the source tree (mozilla/nsprpub)
4576 dnl ========================================================
4577 MOZ_ARG_WITH_BOOL(system-nspr,
4578 [  --with-system-nspr      Use system installed NSPR],
4579     _USE_SYSTEM_NSPR=1 )
4581 if test -n "$_USE_SYSTEM_NSPR"; then
4582     AM_PATH_NSPR(4.8.6, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4585 if test -n "$MOZ_NATIVE_NSPR"; then
4586     _SAVE_CFLAGS=$CFLAGS
4587     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4588     AC_TRY_COMPILE([#include "prtypes.h"],
4589                 [#ifndef PR_STATIC_ASSERT
4590                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4591                  #endif],
4592                 [MOZ_NATIVE_NSPR=1],
4593                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4594     CFLAGS=$_SAVE_CFLAGS
4595 else
4596     if test "$OS_ARCH" = "WINCE"; then
4597         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4598         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4599     elif test "$OS_ARCH" = "WINNT"; then
4600         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4601         if test -n "$GNU_CC"; then
4602             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4603         else
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         fi
4606     else
4607         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4608         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4609     fi
4612 dnl system libevent Support
4613 dnl ========================================================
4614 MOZ_ARG_WITH_STRING(system-libevent,
4615 [  --with-system-libevent=[PFX]
4616                           Use system libevent [installed at prefix PFX]],
4617     LIBEVENT_DIR=$withval)
4619 _SAVE_CFLAGS=$CFLAGS
4620 _SAVE_LDFLAGS=$LDFLAGS
4621 _SAVE_LIBS=$LIBS
4622 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4623     MOZ_NATIVE_LIBEVENT=
4624 else
4625     if test "${LIBEVENT_DIR}" = "yes"; then
4626         LIBEVENT_DIR=/usr
4627     fi
4628     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4629     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4630     AC_CHECK_HEADER(event.h,
4631                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4632                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4633                      fi],
4634                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4635     AC_CHECK_LIB(event, event_init,
4636                  [MOZ_NATIVE_LIBEVENT=1
4637                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4638                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4639                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4641 CFLAGS=$_SAVE_CFLAGS
4642 LDFLAGS=$_SAVE_LDFLAGS
4643 LIBS=$_SAVE_LIBS
4645 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4646 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4647 AC_SUBST(MOZ_LIBEVENT_LIBS)
4649 dnl ========================================================
4650 dnl = If NSS was not detected in the system, 
4651 dnl = use the one in the source tree (mozilla/security/nss)
4652 dnl ========================================================
4654 MOZ_ARG_WITH_BOOL(system-nss,
4655 [  --with-system-nss       Use system installed NSS],
4656     _USE_SYSTEM_NSS=1 )
4658 if test -n "$_USE_SYSTEM_NSS"; then
4659     AM_PATH_NSS(3.12.8, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4662 if test -n "$MOZ_NATIVE_NSS"; then
4663    NSS_LIBS="$NSS_LIBS -lcrmf"
4664 else
4665    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4666    NSS_DEP_LIBS="\
4667         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4668         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4669         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4670         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4671         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4673    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4674        NSS_LIBS="\
4675         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4676         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4677         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4678         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4679         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4680    else
4681        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4682    fi
4685 dnl ======================
4686 dnl Detect yasm
4687 dnl ======================
4689 AC_MSG_CHECKING([for YASM assembler])
4690 AC_CHECK_PROGS(YASM, yasm, "")
4692 if test -n "$YASM"; then
4693   dnl Pull out yasm's version string
4694   changequote(,)
4695   _YASM_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*|\1|p'
4696   changequote([,])
4698   YASM_VERSION=`yasm --version | sed -nre "$_YASM_VER_FILTER"`
4699   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4700   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4701   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4702   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4705 if test -z "$SKIP_LIBRARY_CHECKS"; then
4706 dnl system JPEG support
4707 dnl ========================================================
4708 MOZ_ARG_WITH_STRING(system-jpeg,
4709 [  --with-system-jpeg[=PFX]
4710                           Use system libjpeg [installed at prefix PFX]],
4711     JPEG_DIR=$withval)
4713 _SAVE_CFLAGS=$CFLAGS
4714 _SAVE_LDFLAGS=$LDFLAGS
4715 _SAVE_LIBS=$LIBS
4716 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4717     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4718     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4720 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4721     SYSTEM_JPEG=
4722 else
4723     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4726 if test "$SYSTEM_JPEG" = 1; then
4727     LIBS="$JPEG_LIBS $LIBS"
4728     AC_TRY_COMPILE([ #include <stdio.h>
4729                      #include <sys/types.h>
4730                      #include <jpeglib.h> ],
4731                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4732                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4733                      #endif ],
4734                    SYSTEM_JPEG=1,
4735                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4736 fi 
4737 CFLAGS=$_SAVE_CFLAGS
4738 LDFLAGS=$_SAVE_LDFLAGS
4739 LIBS=$_SAVE_LIBS
4741 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4742     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4743     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4746 dnl system ZLIB support
4747 dnl ========================================================
4748 MOZ_ARG_WITH_STRING(system-zlib,
4749 [  --with-system-zlib[=PFX]
4750                           Use system libz [installed at prefix PFX]],
4751     ZLIB_DIR=$withval)
4753 _SAVE_CFLAGS=$CFLAGS
4754 _SAVE_LDFLAGS=$LDFLAGS
4755 _SAVE_LIBS=$LIBS
4756 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4757     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4758     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4760 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4761     SYSTEM_ZLIB=
4762 else
4763     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4764         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4766 if test "$SYSTEM_ZLIB" = 1; then
4767     LIBS="$ZLIB_LIBS $LIBS"
4768     AC_TRY_COMPILE([ #include <stdio.h>
4769                      #include <string.h>
4770                      #include <zlib.h> ],
4771                    [ #if ZLIB_VERNUM < $MOZZLIB 
4772                      #error "Insufficient zlib version ($MOZZLIB required)."
4773                      #endif ],
4774                    SYSTEM_ZLIB=1,
4775                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4777 CFLAGS=$_SAVE_CFLAGS
4778 LDFLAGS=$_SAVE_LDFLAGS
4779 LIBS=$_SAVE_LIBS
4781 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4782     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4783     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4786 dnl system BZIP2 Support
4787 dnl ========================================================
4788 MOZ_ARG_WITH_STRING(system-bz2,
4789 [  --with-system-bz2[=PFX]
4790                           Use system libbz2 [installed at prefix PFX]],
4791     BZ2_DIR=$withval)
4793 _SAVE_CFLAGS=$CFLAGS
4794 _SAVE_LDFLAGS=$LDFLAGS
4795 _SAVE_LIBS=$LIBS
4796 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4797     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4798     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4800 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4801     SYSTEM_BZ2=
4802 else
4803     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4804         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4806 CFLAGS=$_SAVE_CFLAGS
4807 LDFLAGS=$_SAVE_LDFLAGS
4808 LIBS=$_SAVE_LIBS
4810 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4811     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4812     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4815 dnl system PNG Support
4816 dnl ========================================================
4817 MOZ_ARG_WITH_STRING(system-png, 
4818 [  --with-system-png[=PFX]
4819                           Use system libpng [installed at prefix PFX]],
4820     PNG_DIR=$withval)
4822 _SAVE_CFLAGS=$CFLAGS
4823 _SAVE_LDFLAGS=$LDFLAGS
4824 _SAVE_LIBS=$LIBS
4825 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4826 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4827 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4828     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4829     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4831 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4832     SYSTEM_PNG=
4833 else
4834     _SAVE_PNG_LIBS=$PNG_LIBS
4835     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4836                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4837                  $PNG_LIBS)
4838     AC_CHECK_LIB(png, png_get_acTL, ,
4839                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4840                  $_SAVE_PNG_LIBS)
4842 if test "$SYSTEM_PNG" = 1; then
4843     LIBS="$PNG_LIBS $LIBS"
4844     AC_TRY_COMPILE([ #include <stdio.h>
4845                      #include <sys/types.h>
4846                      #include <png.h> ],
4847                    [ #if PNG_LIBPNG_VER < $MOZPNG
4848                      #error "Insufficient libpng version ($MOZPNG required)."
4849                      #endif
4850                      #ifndef PNG_UINT_31_MAX
4851                      #error "Insufficient libpng version."
4852                      #endif ],
4853                    SYSTEM_PNG=1,
4854                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4856 CFLAGS=$_SAVE_CFLAGS
4857 LDFLAGS=$_SAVE_LDFLAGS
4858 LIBS=$_SAVE_LIBS
4860 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4861     PNG_CFLAGS="-I${PNG_DIR}/include"
4862     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4865 fi # SKIP_LIBRARY_CHECKS
4867 dnl system HunSpell Support
4868 dnl ========================================================
4869 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4870 [  --enable-system-hunspell
4871                           Use system hunspell (located with pkgconfig)],
4872     SYSTEM_HUNSPELL=1 )
4874 if test -n "$SYSTEM_HUNSPELL"; then
4875     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4878 AC_SUBST(SYSTEM_HUNSPELL)
4880 dnl ========================================================
4881 dnl Java SDK support
4882 dnl ========================================================
4883 JAVA_INCLUDE_PATH=
4884 MOZ_ARG_WITH_STRING(java-include-path,
4885 [  --with-java-include-path=dir
4886                           Location of Java SDK headers],
4887     JAVA_INCLUDE_PATH=$withval)
4889 JAVA_BIN_PATH=
4890 MOZ_ARG_WITH_STRING(java-bin-path,
4891 [  --with-java-bin-path=dir
4892                           Location of Java binaries (java, javac, jar)],
4893     JAVA_BIN_PATH=$withval)
4895 dnl ========================================================
4896 dnl =
4897 dnl = Application
4898 dnl =
4899 dnl ========================================================
4901 MOZ_ARG_HEADER(Application)
4903 BUILD_STATIC_LIBS=
4904 ENABLE_TESTS=1
4905 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4906 MOZ_BRANDING_DIRECTORY=
4907 MOZ_OFFICIAL_BRANDING=
4908 MOZ_FEEDS=1
4909 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4910 MOZ_INSTALLER=1
4911 MOZ_IPC=1
4912 MOZ_JAVAXPCOM=
4913 MOZ_JSDEBUGGER=1
4914 MOZ_JSLOADER=1
4915 MOZ_MATHML=1
4916 MOZ_MORK=
4917 MOZ_MORKREADER=1
4918 MOZ_AUTH_EXTENSION=1
4919 MOZ_NO_ACTIVEX_SUPPORT=1
4920 MOZ_NO_FAST_LOAD=
4921 MOZ_OGG=1
4922 MOZ_RAW=1
4923 MOZ_SYDNEYAUDIO=
4924 MOZ_VORBIS=
4925 MOZ_WAVE=1
4926 MOZ_MEDIA=
4927 MOZ_WEBM=1
4928 VPX_AS=
4929 VPX_ASFLAGS=
4930 VPX_X86_ASM=
4931 MOZ_PANGO=1
4932 MOZ_PERMISSIONS=1
4933 MOZ_PLACES=1
4934 MOZ_PLAINTEXT_EDITOR_ONLY=
4935 MOZ_PLUGINS=1
4936 MOZ_PREF_EXTENSIONS=1
4937 MOZ_PROFILELOCKING=1
4938 MOZ_PSM=1
4939 MOZ_RDF=1
4940 MOZ_REFLOW_PERF=
4941 MOZ_SAFE_BROWSING=
4942 MOZ_FASTSTART=
4943 MOZ_HELP_VIEWER=
4944 MOZ_SPELLCHECK=1
4945 MOZ_SPLASHSCREEN=
4946 MOZ_STORAGE=1
4947 MOZ_SVG=1
4948 MOZ_THUMB2=
4949 MOZ_TIMELINE=
4950 MOZ_TOOLKIT_SEARCH=1
4951 MOZ_UI_LOCALE=en-US
4952 MOZ_UNIVERSALCHARDET=1
4953 MOZ_URL_CLASSIFIER=
4954 MOZ_USE_NATIVE_UCONV=
4955 MOZ_VIEW_SOURCE=1
4956 MOZ_XSLT_STANDALONE=
4957 MOZ_XTF=1
4958 MOZ_XUL=1
4959 MOZ_ZIPWRITER=1
4960 NS_PRINTING=1
4961 MOZ_DISABLE_DOMCRYPTO=
4962 NSS_DISABLE_DBM=
4963 NECKO_WIFI=1
4964 NECKO_COOKIES=1
4965 NECKO_DISK_CACHE=1
4966 NECKO_PROTOCOLS_DEFAULT="about data device file ftp http res viewsource"
4967 USE_ARM_KUSER=
4968 BUILD_CTYPES=1
4969 XPC_IDISPATCH_SUPPORT=
4972 case "$target_os" in
4973 darwin*|*wince*|*winmo*)
4974     ACCESSIBILITY=
4975     ;;
4977     ACCESSIBILITY=1
4978     ;;
4979 esac
4981 case "$target_os" in
4982     msvc*|mks*|cygwin*|mingw*)
4983         NS_ENABLE_TSF=1
4984         if test -z "$GNU_CC"; then 
4985             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4986                 NS_ENABLE_TSF=
4987             fi
4988         fi
4989         if test -n "$NS_ENABLE_TSF"; then
4990             AC_DEFINE(NS_ENABLE_TSF)
4991         fi
4992         ;;
4993 esac
4995 case "${target}" in
4996     arm-android-eabi)
4997         NSS_DISABLE_DBM=1
4998         USE_ARM_KUSER=1
4999         MOZ_INSTALLER=
5000         MOZ_CRASHREPORTER=
5001         NS_PRINTING=
5002         NECKO_WIFI=
5003         MOZ_THUMB2=1
5004         MOZ_THEME_FASTSTRIPE=1
5005         MOZ_TREE_FREETYPE=1
5006         MOZ_MEMORY=1
5007         ;;
5008 esac
5010 MOZ_ARG_ENABLE_STRING(application,
5011 [  --enable-application=APP
5012                           Options include:
5013                             browser (Firefox)
5014                             xulrunner
5015                             content/xslt (Standalone Transformiix XSLT)
5016                             netwerk (Standalone Necko)
5017                             tools/update-packaging (AUS-related packaging tools)
5018                             standalone (use this for standalone
5019                               xpcom/xpconnect or to manually drive a build)],
5020 [ MOZ_BUILD_APP=$enableval ] )
5022 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5023 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
5024   XULRUNNER_STUB_NAME=$withval)
5026 if test -z "$XULRUNNER_STUB_NAME"; then
5027   case "$target_os" in
5028   darwin*)
5029     XULRUNNER_STUB_NAME=xulrunner
5030     ;;
5031   *)
5032     XULRUNNER_STUB_NAME=xulrunner-stub
5033   esac
5035 AC_SUBST(XULRUNNER_STUB_NAME)
5037 if test -z "$MOZ_BUILD_APP"; then
5038   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5039 else
5040   # We have a valid application only if it has a build.mk file in its top
5041   # directory.
5042   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5043     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5044   fi
5047 # Allow the application to influence configure with a confvars.sh script.
5049 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5050 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5051   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5052   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5053 else
5054   AC_MSG_RESULT([no])
5057 # Now is a good time to test for logic errors, define mismatches, etc.
5058 case "$MOZ_BUILD_APP" in
5059 xulrunner)
5060   if test "$LIBXUL_SDK"; then
5061     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5062   fi
5063   ;;
5064 esac
5066 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5067 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5068 # MOZ_BUILD_APP.
5069 case "$MOZ_BUILD_APP" in
5070 browser)
5071   AC_DEFINE(MOZ_PHOENIX)
5072   ;;
5074 xulrunner)
5075   AC_DEFINE(MOZ_XULRUNNER)
5076   ;;
5078 content/xslt)
5079   AC_DEFINE(TX_EXE)
5080   ;;
5082 standalone) 
5083   MOZ_APP_NAME=mozilla
5084   MOZ_APP_DISPLAYNAME=Mozilla
5085   MOZ_APP_VERSION=$MOZILLA_VERSION
5086   ;;
5088 esac
5090 AC_SUBST(MOZ_BUILD_APP)
5091 AC_SUBST(MOZ_PHOENIX)
5092 AC_SUBST(MOZ_XULRUNNER)
5094 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5096 dnl ========================================================
5097 dnl = 
5098 dnl = Toolkit Options
5099 dnl = 
5100 dnl ========================================================
5101 MOZ_ARG_HEADER(Toolkit Options)
5103     dnl ========================================================
5104     dnl = Select the default toolkit
5105     dnl ========================================================
5106         MOZ_ARG_ENABLE_STRING(default-toolkit,
5107         [  --enable-default-toolkit=TK
5108                           Select default toolkit
5109                           Platform specific defaults:
5110                             BeOS - cairo-beos
5111                             Mac OS X - cairo-cocoa
5112                             Neutrino/QNX - photon
5113                             OS/2 - cairo-os2
5114                             Win32/WinCE - cairo-windows
5115                             Gtk2 with DirectFB - cairo-gtk2-dfb
5116                             * - cairo-gtk2
5117                             * - cairo-qt],
5118     [ _DEFAULT_TOOLKIT=$enableval ],
5119     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5121     if test "$_DEFAULT_TOOLKIT" = "photon" \
5122         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5123         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5124         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5125         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5126         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5127         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5128         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5129         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5130         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5131     then
5132         dnl nglayout only supports building with one toolkit,
5133         dnl so ignore everything after the first comma (",").
5134         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5135     else
5136         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5137     fi
5139 dnl ========================================================
5140 dnl = Enable the toolkit as needed                         =
5141 dnl ========================================================
5143 case "$MOZ_WIDGET_TOOLKIT" in
5144 photon)
5145         MOZ_ENABLE_PHOTON=1
5146         AC_DEFINE(MOZ_WIDGET_PHOTON)
5147     ;;
5149 cairo-windows)
5150     MOZ_WIDGET_TOOLKIT=windows
5151     MOZ_WEBGL=1
5152     case "${target}" in
5153     *-wince*)
5154         NS_PRINTING=
5155         ;;
5156     esac
5157     ;;
5159 cairo-gtk2|cairo-gtk2-x11)
5160     MOZ_WIDGET_TOOLKIT=gtk2
5161     MOZ_ENABLE_GTK2=1
5162     MOZ_ENABLE_XREMOTE=1
5163     MOZ_WEBGL=1
5164     MOZ_WEBGL_GLX=1
5166     AC_DEFINE(MOZ_X11)
5167     MOZ_X11=1
5168     USE_FC_FREETYPE=1
5170     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5171     TK_LIBS='$(MOZ_GTK2_LIBS)'
5172     AC_DEFINE(MOZ_WIDGET_GTK2)
5173     ;;
5175 cairo-gtk2-dfb)
5176     MOZ_WIDGET_TOOLKIT=gtk2
5177     MOZ_ENABLE_GTK2=1
5178     MOZ_WEBGL=
5180     AC_DEFINE(MOZ_DFB)
5181     MOZ_DFB=1
5183     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5184     TK_LIBS='$(MOZ_GTK2_LIBS)'
5185     AC_DEFINE(MOZ_WIDGET_GTK2)
5186     if test "$no_x" != "yes"; then
5187         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5188         no_x=yes
5189     fi
5190     ;;
5192 cairo-qt)
5193     MOZ_WIDGET_TOOLKIT=qt
5194     MOZ_ENABLE_QT=1
5195     MOZ_ENABLE_XREMOTE=1
5196     MOZ_WEBGL=1
5197     MOZ_WEBGL_GLX=1
5198     USE_ELF_DYNSTR_GC=
5199     NS_PRINTING=
5201     AC_DEFINE(MOZ_X11)
5202     MOZ_X11=1
5203     USE_FC_FREETYPE=1
5205     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5206     TK_LIBS='$(MOZ_QT_LIBS)'
5207     AC_DEFINE(MOZ_WIDGET_QT)
5208     ;;
5210 cairo-beos)
5211     MOZ_WIDGET_TOOLKIT=beos
5212     USE_FC_FREETYPE=1
5213     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5214     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5215     ;;
5217 cairo-os2)
5218     MOZ_WIDGET_TOOLKIT=os2
5219     USE_FC_FREETYPE=1
5220     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5221     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5222     ;;
5224 cairo-cocoa)
5225     MOZ_WIDGET_TOOLKIT=cocoa
5226     AC_DEFINE(MOZ_WIDGET_COCOA)
5227     MOZ_USER_DIR="Mozilla"
5228     AC_DEFINE(XP_MACOSX)
5229     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5230     TK_CFLAGS="-DNO_X11"
5231     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5232     CFLAGS="$CFLAGS $TK_CFLAGS"
5233     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5234     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5235     MOZ_FS_LAYOUT=bundle
5236     MOZ_WEBGL=1
5237     ;;
5239 cairo-android)
5240     AC_DEFINE(MOZ_WIDGET_ANDROID)
5241     MOZ_WIDGET_TOOLKIT=android
5242     MOZ_WEBGL=1
5243     ;;
5245 esac
5247 if test "$MOZ_ENABLE_XREMOTE"; then
5248     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5251 if test "$COMPILE_ENVIRONMENT"; then
5252   if test "$MOZ_ENABLE_GTK2"; then
5253     if test "$MOZ_X11"; then
5254       GDK_PACKAGES=gdk-x11-2.0
5255     elif test "$MOZ_DFB"; then
5256       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5257       GDK_PACKAGES=directfb
5258     fi
5260     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5261   fi
5263 fi # COMPILE_ENVIRONMENT
5265 AC_SUBST(MOZ_FS_LAYOUT)
5267 dnl ========================================================
5268 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5269 dnl their usage and use them in spidermonkey.
5270 dnl ========================================================
5271 MOZ_ARG_WITH_BOOL(arm-kuser,
5272 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5273     USE_ARM_KUSER=1,)
5274 if test -n "$USE_ARM_KUSER"; then
5275    AC_DEFINE(USE_ARM_KUSER)
5278 dnl ========================================================
5279 dnl = startup-notification support module
5280 dnl ========================================================
5282 if test "$MOZ_ENABLE_GTK2"
5283 then
5284     MOZ_ENABLE_STARTUP_NOTIFICATION=
5286     MOZ_ARG_ENABLE_BOOL(startup-notification,
5287     [  --enable-startup-notification
5288                           Enable startup-notification support (default: disabled) ],
5289         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5290         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5291     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5292     then
5293         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5294                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5295         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5296             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5297             then
5298                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5299             fi
5300             MOZ_ENABLE_STARTUP_NOTIFICATION=
5301         ])
5302     fi
5304     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5305         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5306     fi
5308     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5310 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5311 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5312 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5314 dnl ========================================================
5315 dnl = QT support
5316 dnl ========================================================
5317 if test "$MOZ_ENABLE_QT"
5318 then
5319     MOZ_ARG_WITH_STRING(qtdir,
5320     [  --with-qtdir=\$dir       Specify Qt directory ],
5321     [ QTDIR=$withval])
5323     if test -z "$QTDIR"; then
5324         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5325         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5326     else
5327         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5329         MOZ_QT_CFLAGS="-DQT_SHARED"
5330         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5331         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5332         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5333         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5334         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5335         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5336         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5337         HOST_MOC="$QTDIR/bin/moc"
5338     fi
5339     if test -z "$HOST_MOC"; then
5340         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5341 incorrect])
5342     fi
5343     MOC=$HOST_MOC
5345     MOZ_ENABLE_QTNETWORK=
5346     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5347                       MOZ_ENABLE_QTNETWORK=1,
5348                       MOZ_ENABLE_QTNETWORK=)
5350     if test "$MOZ_ENABLE_QTNETWORK"; then
5351       MOZ_ENABLE_QTNETWORK=1
5352       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5353     fi
5356 AC_SUBST(GTK_CONFIG)
5357 AC_SUBST(TK_CFLAGS)
5358 AC_SUBST(TK_LIBS)
5360 AC_SUBST(MOZ_ENABLE_GTK2)
5361 AC_SUBST(MOZ_ENABLE_PHOTON)
5362 AC_SUBST(MOZ_ENABLE_QT)
5363 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5364 AC_SUBST(MOZ_ENABLE_XREMOTE)
5365 AC_SUBST(MOZ_GTK2_CFLAGS)
5366 AC_SUBST(MOZ_GTK2_LIBS)
5367 AC_SUBST(MOZ_QT_CFLAGS)
5368 AC_SUBST(MOZ_QT_LIBS)
5369 AC_SUBST(MOZ_ENABLE_MEEGOTOUCH)
5371 AC_SUBST(MOC)
5373 AC_SUBST(MOZ_DFB)
5374 AC_SUBST(MOZ_X11)
5376 dnl ========================================================
5377 dnl =
5378 dnl = Components & Features
5379 dnl = 
5380 dnl ========================================================
5381 MOZ_ARG_HEADER(Components and Features)
5383 dnl ========================================================
5384 dnl = Localization
5385 dnl ========================================================
5386 MOZ_ARG_ENABLE_STRING(ui-locale,
5387 [  --enable-ui-locale=ab-CD
5388                           Select the user interface locale (default: en-US)],
5389     MOZ_UI_LOCALE=$enableval )
5390 AC_SUBST(MOZ_UI_LOCALE)
5392 dnl ========================================================
5393 dnl = Trademarked Branding 
5394 dnl ========================================================
5395 MOZ_ARG_ENABLE_BOOL(official-branding,
5396 [  --enable-official-branding
5397                           Enable Official mozilla.org Branding
5398                           Do not distribute builds with
5399                           --enable-official-branding unless you have
5400                           permission to use trademarks per
5401                           http://www.mozilla.org/foundation/trademarks/ .],
5403   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5404     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5405   else
5406     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5407     MOZ_OFFICIAL_BRANDING=1
5408   fi
5409 ], MOZ_OFFICIAL_BRANDING=)
5411 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5412 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5413   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5416 MOZ_ARG_WITH_STRING(branding,
5417 [  --with-branding=dir     Use branding from the specified directory.],
5418     MOZ_BRANDING_DIRECTORY=$withval)
5420 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5421 if test -z "$REAL_BRANDING_DIRECTORY"; then
5422   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5425 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5426   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5429 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5431 dnl ========================================================
5432 dnl = Distribution ID
5433 dnl ========================================================
5434 MOZ_ARG_WITH_STRING(distribution-id,
5435 [  --with-distribution-id=ID
5436                           Set distribution-specific id (default=org.mozilla)],
5437 [ val=`echo $withval`
5438     MOZ_DISTRIBUTION_ID="$val"])
5440 if test -z "$MOZ_DISTRIBUTION_ID"; then
5441    MOZ_DISTRIBUTION_ID="org.mozilla"
5444 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5445 AC_SUBST(MOZ_DISTRIBUTION_ID)
5448 dnl ========================================================
5449 dnl complex text support off by default
5450 dnl ========================================================
5451 MOZ_ARG_DISABLE_BOOL(pango,
5452 [  --disable-pango         Disable usage of Pango ],
5453     MOZ_PANGO=,
5454     MOZ_PANGO=1)
5456 dnl ========================================================
5457 dnl = Pango
5458 dnl ========================================================
5459 if test "$MOZ_ENABLE_GTK2"
5460 then
5461     AC_SUBST(MOZ_PANGO)
5463     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5465     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5466     AC_SUBST(MOZ_PANGO_CFLAGS)
5467     AC_SUBST(MOZ_PANGO_LIBS)
5468     if test "$MOZ_PANGO"
5469     then
5470         AC_DEFINE(MOZ_PANGO)
5471     else
5472         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5473         AC_SUBST(FT2_CFLAGS)
5474         AC_SUBST(FT2_LIBS)
5475     fi
5478 if test "$MOZ_ENABLE_QT"
5479 then
5480     if test "$MOZ_PANGO"
5481     then
5482         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5483         [
5484             AC_SUBST(MOZ_PANGO_CFLAGS)
5485             AC_SUBST(MOZ_PANGO_LIBS)
5486             AC_DEFINE(MOZ_PANGO)
5487         ],
5488         [
5489             echo "Pango library not found, will use FT2 font engine"
5490             MOZ_PANGO=
5491         ])
5492     fi
5493     AC_SUBST(MOZ_PANGO)
5496 dnl ========================================================
5497 dnl = GnomeVFS, GIO and GConf support module
5498 dnl ========================================================
5500 if test "$MOZ_X11"
5501 then
5502     dnl build the gnomevfs extension by default only when the
5503     dnl GTK2 toolkit is in use.
5504     if test "$MOZ_ENABLE_GTK2"
5505     then
5506         MOZ_ENABLE_GNOMEVFS=1
5507         MOZ_ENABLE_GCONF=1
5508     fi
5510     dnl ========================================================
5511     dnl = GnomeVFS support module
5512     dnl ========================================================
5513     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5514     [  --disable-gnomevfs      Disable GnomeVFS support ],
5515         MOZ_ENABLE_GNOMEVFS=,
5516         MOZ_ENABLE_GNOMEVFS=force)
5518     if test "$MOZ_ENABLE_GNOMEVFS"
5519     then
5520         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5521             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5522             MOZ_ENABLE_GNOMEVFS=1
5523             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5524         ],[
5525             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5526             then
5527                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5528             fi
5529             MOZ_ENABLE_GNOMEVFS=
5530         ])
5531     else
5532         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5533             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5534               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5535             ])
5536         fi
5537     fi
5539     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5540     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5541     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5543     dnl ========================================================
5544     dnl = GIO support module
5545     dnl ========================================================
5546     MOZ_ARG_ENABLE_BOOL(gio,
5547     [  --enable-gio            Enable GIO support (default: disabled)],
5548         MOZ_ENABLE_GIO=force,
5549         MOZ_ENABLE_GIO=)
5551     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5552     then
5553         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5554             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5555             MOZ_ENABLE_GIO=1
5556             AC_DEFINE(MOZ_ENABLE_GIO)
5557         ],[
5558             if test "$MOZ_ENABLE_GIO" = "force"
5559             then
5560                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5561             fi
5562             MOZ_ENABLE_GIO=
5563         ])
5564     fi
5566     AC_SUBST(MOZ_ENABLE_GIO)
5567     AC_SUBST(MOZ_GIO_CFLAGS)
5568     AC_SUBST(MOZ_GIO_LIBS)
5569    
5570     dnl ========================================================
5571     dnl = GConf support module
5572     dnl ========================================================
5573     if test "$MOZ_ENABLE_GCONF"
5574     then
5575         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5576             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5577             MOZ_ENABLE_GCONF=1
5578         ],[
5579             if test "$MOZ_ENABLE_GCONF" = "force"
5580             then
5581                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5582             fi
5583             MOZ_ENABLE_GCONF=
5584         ])
5585     fi
5587     if test "$MOZ_ENABLE_GCONF"; then
5588         AC_DEFINE(MOZ_ENABLE_GCONF)
5589     fi
5591     AC_SUBST(MOZ_ENABLE_GCONF)
5592     AC_SUBST(MOZ_GCONF_CFLAGS)
5593     AC_SUBST(MOZ_GCONF_LIBS)
5596 dnl ========================================================
5597 dnl = libproxy support
5598 dnl ========================================================
5600 if test "$MOZ_ENABLE_GTK2"
5601 then
5602     MOZ_ENABLE_LIBPROXY=
5604     MOZ_ARG_ENABLE_BOOL(libproxy,
5605     [  --enable-libproxy         Enable libproxy support ],
5606     MOZ_ENABLE_LIBPROXY=1,
5607     MOZ_ENABLE_LIBPROXY=)
5609     if test "$MOZ_ENABLE_LIBPROXY"
5610     then
5611         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5612         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5613     fi
5615 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5616 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5617 AC_SUBST(MOZ_LIBPROXY_LIBS)
5619 dnl ========================================================
5620 dnl = libnotify support
5621 dnl ========================================================
5623 if test "$MOZ_ENABLE_GTK2"
5624 then
5625     MOZ_ENABLE_LIBNOTIFY=1
5627     MOZ_ARG_DISABLE_BOOL(libnotify,
5628     [  --disable-libnotify     Disable libnotify support ],
5629     MOZ_ENABLE_LIBNOTIFY=,
5630     MOZ_ENABLE_LIBNOTIFY=1)
5632     if test "$MOZ_ENABLE_LIBNOTIFY"
5633     then
5634         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5635     fi
5638 if test -z "$SKIP_LIBRARY_CHECKS"
5639 then
5640     if test "$MOZ_ENABLE_GTK2"
5641     then
5642         if test "$MOZ_ENABLE_LIBNOTIFY"
5643         then
5644             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5645         fi
5646     fi
5648 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5649 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5650 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5652 dnl ========================================================
5653 dnl = GNOME component (mozgnome)
5654 dnl ========================================================
5656 # The GNOME component is built if one of 
5657 # gnome-vfs, gio, gconf or libnotify is available.
5658 if test "$MOZ_ENABLE_GCONF" -o \
5659    "$MOZ_ENABLE_GNOMEVFS" -o \
5660    "$MOZ_ENABLE_GIO" -o \
5661    "$MOZ_ENABLE_LIBNOTIFY"; then
5662     MOZ_ENABLE_GNOME_COMPONENT=1
5663 else
5664     MOZ_ENABLE_GNOME_COMPONENT=
5666 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5668 dnl ========================================================
5669 dnl = libgnomeui support module
5670 dnl ========================================================
5672 if test "$MOZ_ENABLE_GTK2"
5673 then
5674     MOZ_ENABLE_GNOMEUI=1
5676     MOZ_ARG_DISABLE_BOOL(gnomeui,
5677     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5678         MOZ_ENABLE_GNOMEUI=,
5679         MOZ_ENABLE_GNOMEUI=force)
5681     if test "$MOZ_ENABLE_GNOMEUI"
5682     then
5683         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5684         [
5685             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5686             MOZ_ENABLE_GNOMEUI=1
5687         ],[
5688             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5689             then
5690                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5691             fi
5692             MOZ_ENABLE_GNOMEUI=
5693         ])
5694     fi
5696     if test "$MOZ_ENABLE_GNOMEUI"; then
5697         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5698     fi
5701 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5702 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5703 AC_SUBST(MOZ_GNOMEUI_LIBS)
5705 dnl ========================================================
5706 dnl = dbus support
5707 dnl ========================================================
5709 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5710 then
5711     MOZ_ENABLE_DBUS=1
5713     MOZ_ARG_DISABLE_BOOL(dbus,
5714     [  --disable-dbus          Disable dbus support ],
5715         MOZ_ENABLE_DBUS=,
5716         MOZ_ENABLE_DBUS=1)
5718     if test "$MOZ_ENABLE_DBUS"
5719     then
5720         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5721         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5722         AC_DEFINE(MOZ_ENABLE_DBUS)
5723     fi
5725 AC_SUBST(MOZ_ENABLE_DBUS)
5726 AC_SUBST(MOZ_DBUS_CFLAGS)
5727 AC_SUBST(MOZ_DBUS_LIBS)
5728 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5729 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5731 dnl ========================================================
5732 dnl = Build Personal Security Manager
5733 dnl ========================================================
5734 MOZ_ARG_DISABLE_BOOL(crypto,
5735 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5736     MOZ_PSM=,
5737     MOZ_PSM=1 )
5739 dnl ========================================================
5740 dnl = JS Debugger XPCOM component (js/jsd)
5741 dnl ========================================================
5742 MOZ_ARG_DISABLE_BOOL(jsd,
5743 [  --disable-jsd           Disable JavaScript debug library],
5744     MOZ_JSDEBUGGER=,
5745     MOZ_JSDEBUGGER=1)
5748 dnl ========================================================
5749 dnl = Disable IPC support for tabs and plugins
5750 dnl ========================================================
5751 MOZ_ARG_DISABLE_BOOL(ipc,
5752 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5753     MOZ_IPC=,
5754     MOZ_IPC=1)
5756 if test -n "$MOZ_IPC"; then
5757     AC_DEFINE(MOZ_IPC)
5760 AC_SUBST(MOZ_IPC)
5762 dnl ========================================================
5763 dnl = Enable IPDL's "expensive" unit tests
5764 dnl ========================================================
5765 MOZ_IPDL_TESTS=
5767 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5768 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5769     MOZ_IPDL_TESTS=1,
5770     MOZ_IPDL_TESTS=)
5772 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5773     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5776 if test -n "$MOZ_IPDL_TESTS"; then
5777     AC_DEFINE(MOZ_IPDL_TESTS)
5780 AC_SUBST(MOZ_IPDL_TESTS)
5782 dnl ========================================================
5783 dnl = Disable plugin support
5784 dnl ========================================================
5785 MOZ_ARG_DISABLE_BOOL(plugins,
5786 [  --disable-plugins       Disable plugins support],
5787     MOZ_PLUGINS=,
5788     MOZ_PLUGINS=1)
5790 dnl ========================================================
5791 dnl = Disable building dbm
5792 dnl ========================================================
5793 MOZ_ARG_DISABLE_BOOL(dbm,
5794 [  --disable-dbm           Disable building dbm],
5795     NSS_DISABLE_DBM=1,
5796     NSS_DISABLE_DBM=)
5798 dnl bi-directional support always on
5799 IBMBIDI=1
5800 AC_DEFINE(IBMBIDI)
5802 dnl ========================================================
5803 dnl view source support on by default
5804 dnl ========================================================
5805 if test "$MOZ_VIEW_SOURCE"; then
5806     AC_DEFINE(MOZ_VIEW_SOURCE)
5809 dnl ========================================================
5810 dnl accessibility support on by default on all platforms 
5811 dnl except OS X.
5812 dnl ========================================================
5813 MOZ_ARG_DISABLE_BOOL(accessibility,
5814 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5815     ACCESSIBILITY=,
5816     ACCESSIBILITY=1 )
5817 if test "$ACCESSIBILITY"; then
5818     AC_DEFINE(ACCESSIBILITY)
5821 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5822 case "$target" in
5823 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5824     if test "$ac_cv_header_atlbase_h" = "no"; then
5825         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.])
5826     fi
5827     if test "$ac_cv_header_oleacc_idl" = "no"; then
5828         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.])
5829     fi
5830     ;;
5831 esac
5834 dnl ========================================================
5835 dnl xpcom js loader support on by default
5836 dnl ========================================================
5837 if test "$MOZ_JSLOADER"; then
5838     AC_DEFINE(MOZ_JSLOADER)
5841 dnl ========================================================
5842 dnl Disable printing
5843 dnl ========================================================
5844 MOZ_ARG_DISABLE_BOOL(printing,
5845 [  --disable-printing      Disable printing support],
5846     NS_PRINTING=,
5847     NS_PRINTING=1)
5849 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5850     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5851     NS_PRINTING=
5854 if test "$NS_PRINTING"; then
5855     AC_DEFINE(NS_PRINTING)
5856     AC_DEFINE(NS_PRINT_PREVIEW)
5858 dnl ========================================================
5859 dnl use native unicode converters
5860 dnl ========================================================
5861 MOZ_ARG_ENABLE_BOOL(native-uconv,
5862 [  --enable-native-uconv   Enable iconv support],
5863     MOZ_USE_NATIVE_UCONV=1,
5864     MOZ_USE_NATIVE_UCONV= )
5865 if test "$MOZ_USE_NATIVE_UCONV"; then
5866     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5868 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5869     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5873 dnl ========================================================
5874 dnl Libeditor can be build as plaintext-only,
5875 dnl or as a full html and text editing component.
5876 dnl We build both by default.
5877 dnl ========================================================
5878 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5879 [  --enable-plaintext-editor-only
5880                           Allow only plaintext editing],
5881     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5882     MOZ_PLAINTEXT_EDITOR_ONLY= )
5883 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5884 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5886 dnl ========================================================
5887 dnl = Disable Fast Load
5888 dnl ========================================================
5889 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5890 [  --disable-xpcom-fastload
5891                           Disable XPCOM fastload support],
5892     MOZ_NO_FAST_LOAD=1,
5893     MOZ_NO_FAST_LOAD=)
5895 AC_SUBST(MOZ_NO_FAST_LOAD)
5897 if test -n "$MOZ_NO_FAST_LOAD"; then
5898     AC_DEFINE(MOZ_NO_FAST_LOAD)
5901 dnl ========================================================
5902 dnl = Disable Raw Codecs
5903 dnl ========================================================
5904 MOZ_ARG_DISABLE_BOOL(raw,
5905 [  --disable-raw           Disable support for RAW media],
5906     MOZ_RAW=,
5907     MOZ_RAW=1)
5909 if test -n "$MOZ_RAW"; then
5910     AC_DEFINE(MOZ_RAW)
5911     MOZ_MEDIA=1
5914 AC_SUBST(MOZ_RAW)
5916 dnl ========================================================
5917 dnl = Disable Ogg Codecs
5918 dnl ========================================================
5919 MOZ_ARG_DISABLE_BOOL(ogg,
5920 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5921     MOZ_OGG=,
5922     MOZ_OGG=1)
5924 if test -n "$MOZ_OGG"; then
5925     AC_DEFINE(MOZ_OGG)
5926     MOZ_SYDNEYAUDIO=1
5927     MOZ_MEDIA=1
5928     MOZ_VORBIS=1
5930     dnl Checks for __attribute__(aligned()) directive
5931     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5932         [ac_cv_c_attribute_aligned],
5933         [ac_cv_c_attribute_aligned=0
5934          CFLAGS_save="${CFLAGS}"
5935          CFLAGS="${CFLAGS} -Werror"
5936          for ac_cv_c_attr_align_try in 64 32 16 8; do
5937            echo "trying $ac_cv_c_attr_align_try"
5938            AC_TRY_COMPILE([],
5939                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5940                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5941            if test "$ac_cv_c_attribute_aligned" != 0; then
5942              break;
5943            fi
5944          done
5945            CFLAGS="${CFLAGS_save}"])
5946     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5947       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5948                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5949     fi
5952 dnl ========================================================
5953 dnl = Disable VP8 decoder support
5954 dnl ========================================================
5955 MOZ_ARG_DISABLE_BOOL(webm,
5956 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5957     MOZ_WEBM=,
5958     MOZ_WEBM=1)
5960 if test -n "$MOZ_WEBM"; then
5961     AC_DEFINE(MOZ_WEBM)
5962     MOZ_SYDNEYAUDIO=1
5963     MOZ_MEDIA=1
5964     MOZ_VORBIS=1
5966     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5967     dnl We currently require yasm on all platforms and require yasm 1.1.0 on Win32.
5968     VPX_AS=$YASM
5970     dnl See if we have assembly on this platform.  
5971     case "$OS_ARCH:$CPU_ARCH" in
5972     Linux:x86)
5973       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5974       VPX_X86_ASM=1
5975     ;;
5976     Linux:x86_64)
5977       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5978       VPX_X86_ASM=1
5979     ;;
5980     SunOS:x86)
5981       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5982       VPX_X86_ASM=1
5983     ;;
5984     SunOS:x86_64)
5985       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5986       VPX_X86_ASM=1
5987     ;;
5988     Darwin:x86)
5989       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5990       VPX_X86_ASM=1
5991     ;;
5992     Darwin:x86_64)
5993       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5994       VPX_X86_ASM=1
5995     ;;
5996     WINNT:x86_64)
5997       if test -z "$GNU_CC"; then
5998         VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5999         VPX_X86_ASM=1
6000       fi
6001     ;;
6002     WINNT:x86)
6003       if test -z "$GNU_CC"; then
6004         dnl Check for yasm 1.1 or greater.
6005         if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
6006           AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed.  Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
6007         elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6008           AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
6009         else
6010           VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
6011           VPX_X86_ASM=1
6012         fi
6013       fi
6014     ;;
6015     esac
6017     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
6018       AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
6019     fi
6021     if test -n "$VPX_X86_ASM"; then
6022       AC_DEFINE(VPX_X86_ASM)
6023     else
6024       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
6025     fi
6028 dnl ========================================================
6029 dnl = Disable Wave decoder support
6030 dnl ========================================================
6031 MOZ_ARG_DISABLE_BOOL(wave,
6032 [  --disable-wave          Disable Wave decoder support],
6033     MOZ_WAVE=,
6034     MOZ_WAVE=1)
6036 if test -n "$MOZ_WAVE"; then
6037     AC_DEFINE(MOZ_WAVE)
6038     MOZ_SYDNEYAUDIO=1
6039     MOZ_MEDIA=1
6042 dnl ========================================================
6043 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
6044 dnl ========================================================
6046 if test -n "$MOZ_SYDNEYAUDIO"; then
6047     AC_DEFINE(MOZ_SYDNEYAUDIO)
6050 if test -n "$MOZ_MEDIA"; then
6051     AC_DEFINE(MOZ_MEDIA)
6054 if test -n "$MOZ_VORBIS"; then
6055     AC_DEFINE(MOZ_VORBIS)
6058 dnl ========================================================
6059 dnl = Check alsa availability on Linux if using sydneyaudio
6060 dnl ========================================================
6062 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6063 if test -n "$MOZ_SYDNEYAUDIO"; then
6064    case "$target_os" in
6065 linux*)
6066       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6067          [echo "$MOZ_ALSA_PKG_ERRORS"
6068           AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux.  Disable with --disable-ogg --disable-wave --disable-webm.  (On Ubuntu, you might try installing the package libasound2-dev.)])])
6069       ;;
6070    esac
6073 dnl ========================================================
6074 dnl Splashscreen
6075 dnl ========================================================
6076 AC_ARG_ENABLE(splashscreen,
6077               [  --enable-splashscreen   display splashscreen while loading (default=no)],
6078               [enable_splash="yes"],[enable_splash=""])
6079 if test "x$enable_splash" = "xyes"; then
6080   MOZ_SPLASHSCREEN=1
6081   AC_DEFINE(MOZ_SPLASHSCREEN)
6083 AC_SUBST(MOZ_SPLASHSCREEN)
6085 dnl ========================================================
6086 dnl Permissions System
6087 dnl ========================================================
6088 MOZ_ARG_DISABLE_BOOL(permissions,
6089 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
6090     MOZ_PERMISSIONS=,
6091     MOZ_PERMISSIONS=1
6094 dnl ========================================================
6095 dnl NegotiateAuth
6096 dnl ========================================================
6097 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6098 [  --disable-negotiateauth Disable GSS-API negotiation ],
6099     MOZ_AUTH_EXTENSION=,
6100     MOZ_AUTH_EXTENSION=1 )
6102 dnl ========================================================
6103 dnl XTF
6104 dnl ========================================================
6105 MOZ_ARG_DISABLE_BOOL(xtf,
6106 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
6107     MOZ_XTF=,
6108     MOZ_XTF=1 )
6109 if test "$MOZ_XTF"; then
6110   AC_DEFINE(MOZ_XTF)
6113 dnl ========================================================
6114 dnl Pref extensions (autoconfig and system-pref)
6115 dnl ========================================================
6116 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6117 [  --disable-pref-extensions
6118                           Disable pref extensions such as autoconfig and
6119                           system-pref],
6120   MOZ_PREF_EXTENSIONS=,
6121   MOZ_PREF_EXTENSIONS=1 )
6123 dnl ========================================================
6124 dnl = Universalchardet
6125 dnl ========================================================
6126 MOZ_ARG_DISABLE_BOOL(universalchardet,
6127 [  --disable-universalchardet
6128                           Disable universal encoding detection],
6129   MOZ_UNIVERSALCHARDET=,
6130   MOZ_UNIVERSALCHARDET=1 )
6132 dnl ========================================================
6133 dnl JavaXPCOM
6134 dnl ========================================================
6135 case "${target}" in
6136 *-wince*)
6137     MOZ_JAVAXPCOM=
6138     ;;
6139 esac
6141 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6142 [  --enable-javaxpcom
6143                           Enable Java-XPCOM bridge],
6144     MOZ_JAVAXPCOM=1,
6145     MOZ_JAVAXPCOM=)
6147 case "$host_os" in
6148   cygwin*|msvc*|mks*)
6149     if test -n "$JAVA_HOME"; then
6150       JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6151     fi
6152     ;;
6153   *mingw*)
6154     if test -n "$JAVA_HOME"; then
6155       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6156     fi
6157     ;;
6158 esac
6160 if test -n "${JAVA_BIN_PATH}"; then
6161   dnl Look for javac and jar in the specified path.
6162   JAVA_PATH="$JAVA_BIN_PATH"
6163 else
6164   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6165   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6168 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6169 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6170 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6172 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6173   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6174     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}])
6175   fi
6178 if test -n "${MOZ_JAVAXPCOM}"; then
6179   if test -n "${JAVA_INCLUDE_PATH}"; then
6180     dnl Make sure jni.h exists in the given include path.
6181     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6182       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6183     fi
6184   else
6185     case "$target_os" in
6186       darwin*)
6187         dnl Default to java system location
6188         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6189         ;;
6190       *)
6191         dnl Try $JAVA_HOME
6192         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6193         ;;
6194     esac
6195     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6196       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.])
6197     fi
6198   fi
6201 dnl ========================================================
6202 dnl = Breakpad crash reporting (on by default on supported platforms)
6203 dnl ========================================================
6205 case $target in
6206 i?86-*-mingw*)
6207   MOZ_CRASHREPORTER=1
6208   ;;
6209 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6210   MOZ_CRASHREPORTER=1
6211   ;;
6212 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6213   MOZ_CRASHREPORTER=1
6214   ;;
6215 *solaris*)
6216   MOZ_CRASHREPORTER=1
6217   ;;
6218 esac
6220 MOZ_ARG_DISABLE_BOOL(crashreporter,
6221 [  --disable-crashreporter Disable breakpad crash reporting],
6222     MOZ_CRASHREPORTER=,
6223     MOZ_CRASHREPORTER=1)
6225 if test -n "$MOZ_CRASHREPORTER"; then
6226    AC_DEFINE(MOZ_CRASHREPORTER)
6228   if (test "$OS_ARCH" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6229     test -z "$SKIP_LIBRARY_CHECKS"; then
6230     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6231     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6232     AC_SUBST(MOZ_GTHREAD_LIBS)
6234     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.])])
6235   fi
6238 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6239 [  --with-crashreporter-enable-percent=NN
6240                           Enable sending crash reports by default on NN% of users. (default=100)],
6241 [ val=`echo $withval | sed 's/[^0-9]//g'`
6242     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6244 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6245    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6247 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6249 dnl ========================================================
6250 dnl = Enable compilation of specific extension modules
6251 dnl ========================================================
6253 MOZ_ARG_ENABLE_STRING(extensions,
6254 [  --enable-extensions     Enable extensions],
6255 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6256     if test "$option" = "yes" -o "$option" = "all"; then
6257         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6258     elif test "$option" = "no" -o "$option" = "none"; then
6259         MOZ_EXTENSIONS=""
6260     elif test "$option" = "default"; then
6261         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6262     elif test `echo "$option" | grep -c \^-` != 0; then
6263         option=`echo $option | sed 's/^-//'`
6264         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6265     else
6266         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6267     fi
6268 done],
6269     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6271 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6272     # Suppress warning on non-X11 platforms
6273     if test -n "$MOZ_X11"; then
6274         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6275     fi
6276     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6279 dnl Do not build gnomevfs with libxul based apps
6280 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6281     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6284 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6285     # Suppress warning on non-X11 platforms
6286     if test -n "$MOZ_X11"; then
6287         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6288     fi
6289     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6292 dnl Do not build gio with libxul based apps
6293 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6294     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6297 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6298     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6299     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6302 dnl This might be temporary: build tridentprofile only on Windows
6303 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6304     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6305     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6308 dnl cookie must be built before tridentprofile. put it at list's end.
6309 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6310   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6311   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6314 dnl xforms requires xtf and schema-validation
6315 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6316     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6317     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6319 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
6320     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
6321     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6324 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6325     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6326     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6329 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6330     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6331     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6334 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6335     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6336     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6339 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6340     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6341     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6344 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6345     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6346     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6349 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6350     AC_MSG_WARN([spellcheck is no longer an extension.])
6351     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6354 dnl Remove dupes
6355 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6357 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6358 dnl when trying to build a nonexistent extension.
6359 for extension in $MOZ_EXTENSIONS; do
6360     if test ! -d "${srcdir}/extensions/${extension}"; then
6361         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6362     fi
6363 done
6365 dnl ========================================================
6366 dnl Image encoders
6367 dnl ========================================================
6368 MOZ_ARG_ENABLE_STRING(image-encoders,
6369 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
6370                           Enable specific image encoders],
6371 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6372     if test "$option" = "yes" -o "$option" = "all"; then
6373         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6374     elif test "$option" = "no" -o "$option" = "none"; then
6375         MOZ_IMG_ENCODERS=""
6376         addencoder=""
6377     elif test "$option" = "default"; then
6378         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6379     elif test `echo "$option" | grep -c \^-` != 0; then
6380         option=`echo $option | sed 's/^-//'`
6381         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6382     else
6383         addencoder="$option"
6384     fi
6385     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6386 done],
6387     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6389 dnl Remove dupes
6390 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6392 dnl ========================================================
6393 dnl MathML on by default
6394 dnl ========================================================
6395 MOZ_ARG_DISABLE_BOOL(mathml,
6396 [  --disable-mathml        Disable MathML support],
6397     MOZ_MATHML=,
6398     MOZ_MATHML=1 )
6399 if test "$MOZ_MATHML"; then
6400   AC_DEFINE(MOZ_MATHML)
6403 dnl ========================================================
6404 dnl SVG
6405 dnl ========================================================
6406 MOZ_ARG_DISABLE_BOOL(svg,
6407 [  --disable-svg           Disable SVG support],
6408     MOZ_SVG=,
6409     MOZ_SVG=1 )
6410 if test -n "$MOZ_SVG"; then
6411   AC_DEFINE(MOZ_SVG)
6414 dnl ========================================================
6415 dnl SMIL
6416 dnl ========================================================
6417 MOZ_SMIL=1
6418 MOZ_ARG_DISABLE_BOOL(smil,
6419 [  --disable-smil          Disable SMIL animation support],
6420     MOZ_SMIL=,
6421     MOZ_SMIL=1 )
6422 # Automatically disable SMIL if SVG is disabled
6423 if test -z "$MOZ_SVG"; then
6424   MOZ_SMIL=
6426 if test -n "$MOZ_SMIL"; then
6427   AC_DEFINE(MOZ_SMIL)
6430 dnl ========================================================
6431 dnl Build Freetype in the tree
6432 dnl ========================================================
6433 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6434 [  --enable-tree-freetype  Enable Tree FreeType],
6435     MOZ_TREE_FREETYPE=1,
6436     MOZ_TREE_FREETYPE= )
6437 if test -n "$MOZ_TREE_FREETYPE"; then
6438    AC_DEFINE(MOZ_TREE_FREETYPE)
6439    AC_SUBST(MOZ_TREE_FREETYPE)
6440    MOZ_ENABLE_CAIRO_FT=1       
6441    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6442    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6443    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6444    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6445    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6446    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6447    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6448    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6449    AC_SUBST(CAIRO_FT_CFLAGS)
6453 dnl ========================================================
6454 dnl Installer
6455 dnl ========================================================
6456 case "$target_os" in
6457     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6458         MOZ_INSTALLER=1
6459         ;;
6460 esac
6462 MOZ_ARG_DISABLE_BOOL(installer,
6463 [  --disable-installer     Disable building of installer],
6464     MOZ_INSTALLER=,
6465     MOZ_INSTALLER=1)
6466 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6467     # Disable installer for Windows builds that use the new toolkit if the
6468     # required major version and minimum minor version of Unicode NSIS isn't in
6469     # the path.
6470     REQ_NSIS_MAJOR_VER=2
6471     MIN_NSIS_MINOR_VER=33
6472     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6473     if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6474         AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path. To build without the installer reconfigure using --disable-installer.])
6475     fi
6476     changequote(,)
6477     MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6478     changequote([,])
6479     if test ! "$MAKENSISU_VER" == ""; then
6480         MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6481         MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6482     fi
6483     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6484     if test "$MAKENSISU_VER" == "" -o \
6485        ! "$MAKENSISU_MAJOR_VER" == "$REQ_NSIS_MAJOR_VER" -o \
6486        ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6487         AC_MSG_RESULT([no])
6488         AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path. To build without the installer reconfigure using --disable-installer.])
6489     fi
6490     AC_MSG_RESULT([yes])
6491     MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6494 AC_SUBST(MOZ_INSTALLER)
6496 AC_MSG_CHECKING([for tar archiver])
6497 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6498 if test -z "$TAR"; then
6499     AC_MSG_ERROR([no tar archiver found in \$PATH])
6501 AC_MSG_RESULT([$TAR])
6502 AC_SUBST(TAR)
6504 AC_MSG_CHECKING([for wget])
6505 AC_CHECK_PROGS(WGET, wget, "")
6506 AC_MSG_RESULT([$WGET])
6507 AC_SUBST(WGET)
6509 dnl ========================================================
6510 dnl Updater
6511 dnl ========================================================
6513 MOZ_ARG_DISABLE_BOOL(updater,
6514 [  --disable-updater       Disable building of updater],
6515     MOZ_UPDATER=,
6516     MOZ_UPDATER=1 )
6518 if test -n "$MOZ_UPDATER"; then
6519     AC_DEFINE(MOZ_UPDATER)
6522 # app update channel is 'default' when not supplied.
6523 MOZ_ARG_ENABLE_STRING([update-channel],
6524 [  --enable-update-channel=CHANNEL
6525                           Select application update channel (default=default)],
6526     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6528 if test -z "$MOZ_UPDATE_CHANNEL"; then
6529     MOZ_UPDATE_CHANNEL=default
6531 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6532 AC_SUBST(MOZ_UPDATE_CHANNEL)
6534 # tools/update-packaging is not checked out by default.
6535 MOZ_ARG_ENABLE_BOOL(update-packaging,
6536 [  --enable-update-packaging
6537                           Enable tools/update-packaging],
6538     MOZ_UPDATE_PACKAGING=1,
6539     MOZ_UPDATE_PACKAGING= )
6540 AC_SUBST(MOZ_UPDATE_PACKAGING)
6542 dnl ========================================================
6543 dnl ActiveX
6544 dnl ========================================================
6546 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6547 [  --disable-xpconnect-idispatch
6548                           Disable building of xpconnect support for IDispatch
6549                           (win32 only)],
6550     XPC_IDISPATCH_SUPPORT=,
6551     XPC_IDISPATCH_SUPPORT=1)
6552 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6554 MOZ_ARG_DISABLE_BOOL(activex,
6555 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6556     MOZ_NO_ACTIVEX_SUPPORT=1,
6557     MOZ_NO_ACTIVEX_SUPPORT= )
6558 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6560 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6561 [  --enable-activex-scripting
6562                           Enable building of ActiveX scripting support (win32)],
6563     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6564     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6565 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6567 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6568 then
6569     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6572 if test "$COMPILE_ENVIRONMENT" = "1"; then
6573 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6574 case "$target" in
6575 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6576     if test "$ac_cv_header_atlbase_h" = "no"; then
6577         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.])
6578     fi
6579     ;;
6580 esac
6584 dnl ========================================================
6585 dnl leaky
6586 dnl ========================================================
6587 MOZ_ARG_ENABLE_BOOL(leaky,
6588 [  --enable-leaky          Build leaky memory tool],
6589     MOZ_LEAKY=1,
6590     MOZ_LEAKY=)
6593 dnl ========================================================
6594 dnl build the tests by default
6595 dnl ========================================================
6596 MOZ_ARG_DISABLE_BOOL(tests,
6597 [  --disable-tests         Do not build test libraries & programs],
6598     ENABLE_TESTS=,
6599     ENABLE_TESTS=1 )
6601 dnl ========================================================
6602 dnl parental controls (for Windows Vista)
6603 dnl ========================================================
6604 MOZ_ARG_DISABLE_BOOL(parental-controls,
6605 [  --disable-parental-controls
6606                           Do not build parental controls],
6607    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6608    MOZ_DISABLE_PARENTAL_CONTROLS=)
6609 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6610     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6613 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6615 dnl ========================================================
6616 dnl = Disable DOMCrypto
6617 dnl ========================================================
6618 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6619     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6622 dnl ========================================================
6623 dnl =
6624 dnl = Module specific options
6625 dnl =
6626 dnl ========================================================
6627 MOZ_ARG_HEADER(Individual module options)
6629 dnl ========================================================
6630 dnl = Disable feed handling components
6631 dnl ========================================================
6632 MOZ_ARG_DISABLE_BOOL(feeds,
6633 [  --disable-feeds         Disable feed handling and processing components],
6634     MOZ_FEEDS=,
6635     MOZ_FEEDS=1 )
6636 if test -n "$MOZ_FEEDS"; then
6637     AC_DEFINE(MOZ_FEEDS)
6638 else
6639     if test "$MOZ_BUILD_APP" = "browser"; then
6640         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6641     fi
6644 dnl ========================================================
6645 dnl = Enable mozStorage
6646 dnl ========================================================
6647 dnl Implicitly enabled by default if building calendar or places
6648 MOZ_ARG_ENABLE_BOOL(storage,
6649 [  --enable-storage        Enable mozStorage module and related components],
6650     MOZ_STORAGE=1,
6651     MOZ_STORAGE= )
6652 if test -n "$MOZ_STORAGE"; then
6653     AC_DEFINE(MOZ_STORAGE)
6656 dnl ========================================================
6657 dnl Check for sqlite
6658 dnl ========================================================
6660 MOZ_NATIVE_SQLITE=
6661 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6662 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6663 MOZ_NATIVE_SQLITE=1,
6664 MOZ_NATIVE_SQLITE= )
6666 if test -z "$MOZ_NATIVE_SQLITE"
6667 then
6668     SQLITE_CFLAGS=
6669     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6670 else
6671     dnl ============================
6672     dnl === SQLite Version check ===
6673     dnl ============================
6674     dnl Check to see if the system SQLite package is new enough.
6675     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6677     dnl ==================================
6678     dnl === SQLITE_SECURE_DELETE check ===
6679     dnl ==================================
6680     dnl Check to see if the system SQLite package is compiled with
6681     dnl SQLITE_SECURE_DELETE enabled.
6682     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6683     _SAVE_CFLAGS="$CFLAGS"
6684     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6685     _SAVE_LIBS="$LIBS"
6686     LIBS="$LIBS $SQLITE_LIBS"
6687     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6688         AC_TRY_RUN([
6689             #include "sqlite3.h"
6691             int main(int argc, char **argv){
6692               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6693             }],
6694             ac_cv_sqlite_secure_delete=yes,
6695             ac_cv_sqlite_secure_delete=no,
6696             ac_cv_sqlite_secure_delete=no
6697         )
6698     ])
6699     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6700     CFLAGS="$_SAVE_CFLAGS"
6701     LIBS="$_SAVE_LIBS"
6702     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6703         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6704     fi
6706     dnl ===============================
6707     dnl === SQLITE_THREADSAFE check ===
6708     dnl ===============================
6709     dnl Check to see if the system SQLite package is compiled with
6710     dnl SQLITE_THREADSAFE enabled.
6711     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6712     _SAVE_CFLAGS="$CFLAGS"
6713     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6714     _SAVE_LIBS="$LIBS"
6715     LIBS="$LIBS $SQLITE_LIBS"
6716     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6717         AC_TRY_RUN([
6718             #include "sqlite3.h"
6720             int main(int argc, char **argv){
6721               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6722             }],
6723             ac_cv_sqlite_threadsafe=yes,
6724             ac_cv_sqlite_threadsafe=no,
6725             ac_cv_sqlite_threadsafe=no
6726         )
6727     ])
6728     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6729     CFLAGS="$_SAVE_CFLAGS"
6730     LIBS="$_SAVE_LIBS"
6731     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6732         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6733     fi
6735     dnl ================================
6736     dnl === SQLITE_ENABLE_FTS3 check ===
6737     dnl ================================
6738     dnl check to see if the system SQLite package is compiled with
6739     dnl SQLITE_ENABLE_FTS3 enabled.
6740     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6741     _SAVE_CFLAGS="$CFLAGS"
6742     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6743     _SAVE_LIBS="$LIBS"
6744     LIBS="$LIBS $SQLITE_LIBS"
6745     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6746         AC_TRY_RUN([
6747             #include "sqlite3.h"
6749             int main(int argc, char **argv){
6750               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6751             }],
6752             ac_cv_sqlite_enable_fts3=yes,
6753             ac_cv_sqlite_enable_fts3=no,
6754             ac_cv_sqlite_enable_fts3=no
6755         )
6756     ])
6757     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6758     CFLAGS="$_SAVE_CFLAGS"
6759     LIBS="$_SAVE_LIBS"
6760     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6761         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6762     fi
6764     dnl =========================================
6765     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6766     dnl =========================================
6767     dnl check to see if the system SQLite package is compiled with
6768     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6769     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6770     _SAVE_CFLAGS="$CFLAGS"
6771     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6772     _SAVE_LIBS="$LIBS"
6773     LIBS="$LIBS $SQLITE_LIBS"
6774     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6775         AC_TRY_RUN([
6776             #include "sqlite3.h"
6778             int main(int argc, char **argv){
6779               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6780             }],
6781             ac_cv_sqlite_enable_unlock_notify=yes,
6782             ac_cv_sqlite_enable_unlock_notify=no,
6783             ac_cv_sqlite_enable_unlock_notify=no
6784         )
6785     ])
6786     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6787     CFLAGS="$_SAVE_CFLAGS"
6788     LIBS="$_SAVE_LIBS"
6789     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6790         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6791     fi
6794 AC_SUBST(MOZ_NATIVE_SQLITE)
6796 dnl ========================================================
6797 dnl = Enable help viewer (off by default)
6798 dnl ========================================================
6799 if test -n "$MOZ_HELP_VIEWER"; then
6800      dnl Do this if defined in confvars.sh
6801      AC_DEFINE(MOZ_HELP_VIEWER)
6804 dnl ========================================================
6805 dnl = Enable safe browsing (anti-phishing)
6806 dnl ========================================================
6807 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6808 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6809     MOZ_SAFE_BROWSING=1,
6810     MOZ_SAFE_BROWSING= )
6811 if test -n "$MOZ_SAFE_BROWSING"; then
6812     AC_DEFINE(MOZ_SAFE_BROWSING)
6814 AC_SUBST(MOZ_SAFE_BROWSING)
6816 dnl ========================================================
6817 dnl = Enable faststart component
6818 dnl ========================================================
6819 MOZ_ARG_ENABLE_BOOL(faststart,
6820 [  --enable-faststart      Enable the faststart component],
6821     MOZ_FASTSTART=1,
6822     MOZ_FASTSTART= )
6823 if test -n "$MOZ_FASTSTART"; then
6824     AC_DEFINE(MOZ_FASTSTART)
6826 AC_SUBST(MOZ_FASTSTART)
6828 dnl ========================================================
6829 dnl = Enable url-classifier
6830 dnl ========================================================
6831 dnl Implicitly enabled by default if building with safe-browsing
6832 if test -n "$MOZ_SAFE_BROWSING"; then
6833     MOZ_URL_CLASSIFIER=1
6835 MOZ_ARG_ENABLE_BOOL(url-classifier,
6836 [  --enable-url-classifier Enable url classifier module],
6837     MOZ_URL_CLASSIFIER=1,
6838     MOZ_URL_CLASSIFIER= )
6839 if test -n "$MOZ_URL_CLASSIFIER"; then
6840     AC_DEFINE(MOZ_URL_CLASSIFIER)
6842 AC_SUBST(MOZ_URL_CLASSIFIER)
6844 dnl ========================================================
6845 dnl = Disable zipwriter
6846 dnl ========================================================
6847 MOZ_ARG_DISABLE_BOOL(zipwriter,
6848 [  --disable-zipwriter     Disable zipwriter component],
6849     MOZ_ZIPWRITER=,
6850     MOZ_ZIPWRITER=1 )
6851 AC_SUBST(MOZ_ZIPWRITER)
6853 dnl ========================================================
6854 dnl = libconic
6855 dnl ========================================================
6856 dnl superseded by QtNetwork starting from 4.7
6857 MOZ_ENABLE_LIBCONIC=1
6859 if test -n "$MOZ_ENABLE_QT"; then
6860   if test "$MOZ_ENABLE_QTNETWORK"; then
6861     MOZ_ENABLE_LIBCONIC=
6862   fi
6865 MOZ_ARG_DISABLE_BOOL(libconic,
6866 [  --disable-libconic      Disable libconic],
6867     MOZ_ENABLE_LIBCONIC=,
6868     MOZ_ENABLE_LIBCONIC=1 )
6870 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6871     PKG_CHECK_MODULES(LIBCONIC, conic,
6872                       MOZ_ENABLE_LIBCONIC=1,
6873                       MOZ_ENABLE_LIBCONIC=)
6875 if test "$MOZ_ENABLE_LIBCONIC"; then
6876     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6879 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6880 AC_SUBST(LIBCONIC_CFLAGS)
6881 AC_SUBST(LIBCONIC_LIBS)
6883 dnl ========================================================
6884 dnl = Maemo checks
6885 dnl ========================================================
6887 MAEMO_SDK_TARGET_VER=-1
6889 MOZ_ARG_WITH_STRING(maemo-version,
6890 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6891                           Maemo SDK Version],
6892   MAEMO_SDK_TARGET_VER=$withval)
6894 case "$MAEMO_SDK_TARGET_VER" in
6896     MOZ_PLATFORM_MAEMO=5
6897     ;;
6900     MOZ_PLATFORM_MAEMO=6
6901     ;;
6904     dnl We aren't compiling for Maemo, move on.
6905     ;;
6907     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6908     ;;
6909 esac
6911 if test $MOZ_PLATFORM_MAEMO; then
6912    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6914    if test -z "$MOZ_ENABLE_DBUS"; then
6915        AC_MSG_ERROR([DBus is required when building for Maemo])
6916    fi
6918    MOZ_GFX_OPTIMIZE_MOBILE=1
6919    MOZ_WEBGL_GLX=
6920    MOZ_MAEMO_LIBLOCATION=
6922    if test $MOZ_PLATFORM_MAEMO = 5; then
6923       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6924       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6925                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6926       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6927                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6929       AC_SUBST(XCOMPOSITE_LIBS)
6931       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6932       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6933       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6934       if test -z "$_LIB_FOUND"; then
6935          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6936       fi
6939       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6940       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6941       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6942       if test -z "$_LIB_FOUND"; then
6943          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6944       fi
6946       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6947       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6948       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6949       if test -z "$_LIB_FOUND"; then
6950          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6951       fi
6953    fi
6954    if test $MOZ_PLATFORM_MAEMO = 6; then
6955       PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6956       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6957       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6958       if test -z "$_LIB_FOUND"; then
6959          AC_MSG_ERROR([libcontentaction is required when build for Maemo])
6960       fi
6961      
6962      MOZ_THUMB2=1
6963      PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore)
6964      MOZ_ENABLE_MEEGOTOUCH=1
6965      AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6966      MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6967      MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6968    fi
6970    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6971    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6972    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6973    if test "$_LIB_FOUND"; then
6974       MOZ_MAEMO_LIBLOCATION=1
6975       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6976    else
6977       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6978    fi
6979    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6981    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6982    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6985 dnl ========================================================
6986 dnl = Enable building the Thumb2 instruction set
6987 dnl ========================================================
6988 MOZ_ARG_ENABLE_BOOL(thumb2,
6989  [  --enable-thumb2         Enable Thumb2 instruction set],
6990     MOZ_THUMB2=1,
6991     MOZ_THUMB2=)
6993 if test -n "$MOZ_THUMB2"; then
6994   case "$target_cpu" in
6995     arm*)
6996       if test "$GNU_CC"; then
6997         CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6998         CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6999         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
7000       else
7001         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
7002       fi
7003     ;;
7004     *)
7005       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
7006     ;;
7007   esac
7010 dnl ========================================================
7011 dnl = faststripe theme
7012 dnl ========================================================
7013 MOZ_ARG_ENABLE_BOOL(faststripe,
7014 [  --enable-faststripe     Use faststripe theme],
7015     MOZ_THEME_FASTSTRIPE=1,
7016     MOZ_THEME_FASTSTRIPE= )
7017 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7019 dnl ========================================================
7020 dnl =
7021 dnl = Feature options that require extra sources to be pulled
7022 dnl =
7023 dnl ========================================================
7024 dnl MOZ_ARG_HEADER(Features that require extra sources)
7026 dnl ========================================================
7027 dnl =
7028 dnl = Debugging Options
7029 dnl = 
7030 dnl ========================================================
7031 MOZ_ARG_HEADER(Debugging and Optimizations)
7033 dnl ========================================================
7034 dnl = Disable building with debug info.
7035 dnl = Debugging is OFF by default
7036 dnl ========================================================
7037 if test -z "$MOZ_DEBUG_FLAGS"; then
7038   MOZ_DEBUG_FLAGS="-g"
7041 MOZ_ARG_ENABLE_STRING(debug,
7042 [  --enable-debug[=DBG]    Enable building with developer debug info
7043                            (using compiler flags DBG)],
7044 [ if test "$enableval" != "no"; then
7045     MOZ_DEBUG=1
7046     if test -n "$enableval" -a "$enableval" != "yes"; then
7047         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7048         _MOZ_DEBUG_FLAGS_SET=1
7049     fi
7050   else
7051     MOZ_DEBUG=
7052   fi ],
7053   MOZ_DEBUG=)
7055 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7056 MOZ_ARG_WITH_STRING(debug-label,
7057 [  --with-debug-label=LABELS
7058                           Define DEBUG_<value> for each comma-separated
7059                           value given.],
7060 [ for option in `echo $withval | sed 's/,/ /g'`; do
7061     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7062 done])
7064 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7066 if test -n "$MOZ_DEBUG"; then
7067     AC_MSG_CHECKING([for valid debug flags])
7068     _SAVE_CFLAGS=$CFLAGS
7069     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7070     AC_TRY_COMPILE([#include <stdio.h>], 
7071         [printf("Hello World\n");],
7072         _results=yes,
7073         _results=no)
7074     AC_MSG_RESULT([$_results])
7075     if test "$_results" = "no"; then
7076         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7077     fi
7078     CFLAGS=$_SAVE_CFLAGS
7081 dnl ========================================================
7082 dnl enable mobile optimizations
7083 dnl ========================================================
7084 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7085 [  --enable-mobile-optimize
7086                           Enable mobile optimizations],
7087     MOZ_GFX_OPTIMIZE_MOBILE=1)
7089 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7091 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7092     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7095 dnl ========================================================
7096 dnl = Enable code optimization. ON by default.
7097 dnl ========================================================
7098 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7099         MOZ_OPTIMIZE_FLAGS="-O"
7102 MOZ_ARG_ENABLE_STRING(optimize,
7103 [  --disable-optimize      Disable compiler optimization
7104   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7105 [ if test "$enableval" != "no"; then
7106     MOZ_OPTIMIZE=1
7107     if test -n "$enableval" -a "$enableval" != "yes"; then
7108         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7109         MOZ_OPTIMIZE=2
7110     fi
7111 else
7112     MOZ_OPTIMIZE=
7113 fi ], MOZ_OPTIMIZE=1)
7115 if test "$COMPILE_ENVIRONMENT"; then
7116 if test -n "$MOZ_OPTIMIZE"; then
7117     AC_MSG_CHECKING([for valid optimization flags])
7118     _SAVE_CFLAGS=$CFLAGS
7119     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7120     AC_TRY_COMPILE([#include <stdio.h>], 
7121         [printf("Hello World\n");],
7122         _results=yes,
7123         _results=no)
7124     AC_MSG_RESULT([$_results])
7125     if test "$_results" = "no"; then
7126         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7127     fi
7128     CFLAGS=$_SAVE_CFLAGS
7130 fi # COMPILE_ENVIRONMENT
7132 AC_SUBST(MOZ_OPTIMIZE)
7133 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7134 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7135 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7137 dnl ========================================================
7138 dnl = (Deprecated) generation of debugger info for specific modules
7139 dnl ========================================================
7140 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7141 [  --enable-debugger-info-modules
7142                           Enable/disable debugger info for specific modules],
7143 [ if test "$enableval" != "no"; then
7144     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7145     MOZ_DEBUG_SYMBOLS=1
7146   fi ])
7148 dnl ========================================================
7149 dnl = Enable generation of debug symbols
7150 dnl ========================================================
7151 MOZ_ARG_ENABLE_STRING(debug-symbols,
7152 [  --enable-debug-symbols[=DBG]
7153                           Enable debugging symbols (using compiler flags DBG)],
7154 [ if test "$enableval" != "no"; then
7155       MOZ_DEBUG_SYMBOLS=1
7156       if test -n "$enableval" -a "$enableval" != "yes"; then
7157           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7158               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7159           else
7160               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7161           fi
7162       fi
7163   fi ])
7165 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7166     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7167     export MOZ_DEBUG_SYMBOLS
7170 dnl ========================================================
7171 dnl = Disable any treating of compile warnings as errors
7172 dnl ========================================================
7173 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7174 [  --disable-warnings-as-errors
7175                           Disable treating of warnings as errors],
7176     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7177     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7178 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7179    WARNINGS_AS_ERRORS=''
7182 dnl ========================================================
7183 dnl = Disable runtime logging checks
7184 dnl ========================================================
7185 MOZ_ARG_DISABLE_BOOL(logging,
7186 [  --disable-logging       Disable logging facilities],
7187     NS_DISABLE_LOGGING=1,
7188     NS_DISABLE_LOGGING= )
7189 if test "$NS_DISABLE_LOGGING"; then
7190     AC_DEFINE(NS_DISABLE_LOGGING)
7191 else
7192     AC_DEFINE(MOZ_LOGGING)
7195 dnl ========================================================
7196 dnl = This will enable logging of addref, release, ctor, dtor.
7197 dnl ========================================================
7198 _ENABLE_LOGREFCNT=42
7199 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7200 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7201     _ENABLE_LOGREFCNT=1,
7202     _ENABLE_LOGREFCNT= )
7203 if test "$_ENABLE_LOGREFCNT" = "1"; then
7204     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7205 elif test -z "$_ENABLE_LOGREFCNT"; then
7206     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7209 dnl ========================================================
7210 dnl = Enable trace malloc
7211 dnl ========================================================
7212 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7213 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7214 [  --enable-trace-malloc   Enable malloc tracing],
7215     NS_TRACE_MALLOC=1,
7216     NS_TRACE_MALLOC= )
7217 if test "$NS_TRACE_MALLOC"; then
7218   # Please, Mr. Linker Man, don't take away our symbol names
7219   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7220   USE_ELF_DYNSTR_GC=
7221   AC_DEFINE(NS_TRACE_MALLOC)
7223 AC_SUBST(NS_TRACE_MALLOC)
7225 dnl ========================================================
7226 dnl = Enable jemalloc
7227 dnl ========================================================
7228 MOZ_ARG_ENABLE_BOOL(jemalloc,
7229 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7230     MOZ_MEMORY=1,
7231     MOZ_MEMORY=)
7233 if test "$NS_TRACE_MALLOC"; then
7234     MOZ_MEMORY=
7237 if test "$MOZ_MEMORY"; then
7239   dnl Don't try to run compiler tests on Windows  
7240   if test "$OS_ARCH" = "WINNT"; then
7241     if test -z "$HAVE_64BIT_OS"; then
7242       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7243     else
7244       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7245     fi
7246   else
7247     AC_CHECK_SIZEOF([int *], [4])
7248     case "${ac_cv_sizeof_int_p}" in
7249     4)
7250       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7251       ;;
7252     8)
7253       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7254       ;;
7255     *)
7256       AC_MSG_ERROR([Unexpected pointer size])
7257       ;;
7258     esac
7259   fi
7261   AC_DEFINE(MOZ_MEMORY)
7262   if test "x$MOZ_DEBUG" = "x1"; then
7263     AC_DEFINE(MOZ_MEMORY_DEBUG)
7264   fi
7265   dnl The generic feature tests that determine how to compute ncpus are long and
7266   dnl complicated.  Therefore, simply define special cpp variables for the
7267   dnl platforms we have special knowledge of.
7268   case "${target}" in
7269   *-darwin*)
7270     AC_DEFINE(MOZ_MEMORY_DARWIN)
7271     ;;
7272   *-*freebsd*)
7273     AC_DEFINE(MOZ_MEMORY_BSD)
7274     ;;
7275   *-*linux*)
7276     AC_DEFINE(MOZ_MEMORY_LINUX)
7277     ;;
7278   *-netbsd*)
7279     AC_DEFINE(MOZ_MEMORY_BSD)
7280     ;;
7281   *-solaris*)
7282     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7283     ;;
7284   *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7285     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7286     dnl This is sort of awful. Will revisit if we add support for more versions
7287     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7288         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7289     fi
7290     if test -z "$WIN32_CRT_SRC_DIR"; then
7291       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7292         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).])
7293       else
7294         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7295       fi
7296     fi
7297     dnl cpu check
7298     case "${target_cpu}" in
7299     i*86)
7300       MOZ_CRT_CPU_ARCH=intel
7301       ;;
7302     x86_64)
7303       MOZ_CRT_CPU_ARCH=amd64
7304       ;;
7305     *)
7306       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7307       ;;
7308     esac
7310     AC_SUBST(MOZ_CRT_CPU_ARCH)
7312     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7313       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7314     fi
7315     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7316     _objdir_win=`pwd -W`
7317     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7318     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7319     dnl Also pass this to NSPR/NSS
7320     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7321     export DLLFLAGS
7322     ;;
7323   *-*wince)
7324     AC_DEFINE(MOZ_MEMORY_WINCE)
7325     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7326     if test -z "$WINCE_WINDOWS_MOBILE"; then
7327       AC_DEFINE(MOZ_MEMORY_WINCE6)
7328     fi
7329     ;;
7330   *-*winmo)
7331     AC_DEFINE(MOZ_MEMORY_WINCE)
7332     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7333     ;;
7334   *-android*)
7335     AC_DEFINE(MOZ_MEMORY_LINUX)
7336     AC_DEFINE(MOZ_MEMORY_ANDROID)
7337     _WRAP_MALLOC=1
7338     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc"
7339     ;;
7340   *)
7341     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7342     ;;
7343   esac
7345   if test "$OS_ARCH" != "Darwin"; then
7346     dnl NB: this must be kept in sync with jemalloc.h
7347     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7348     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7349     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7350   fi
7352 AC_SUBST(MOZ_MEMORY)
7353 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7354 AC_SUBST(WIN32_CRT_SRC_DIR)
7355 dnl Need to set this for make because NSS doesn't have configure
7356 AC_SUBST(DLLFLAGS)
7358 dnl ========================================================
7359 dnl = Use malloc wrapper lib
7360 dnl ========================================================
7361 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7362 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7363     _WRAP_MALLOC=1,
7364     _WRAP_MALLOC= )
7366 if test -n "$_WRAP_MALLOC"; then
7367     if test "$GNU_CC"; then
7368     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"
7369     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7370     fi
7373 dnl ========================================================
7374 dnl = Location of malloc wrapper lib
7375 dnl ========================================================
7376 MOZ_ARG_WITH_STRING(wrap-malloc,
7377 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7378     WRAP_MALLOC_LIB=$withval)
7380 dnl ========================================================
7381 dnl = Use JS Call tracing
7382 dnl ========================================================
7383 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7384 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7385     MOZ_TRACE_JSCALLS=1,
7386     MOZ_TRACE_JSCALLS= )
7387 if test -n "$MOZ_TRACE_JSCALLS"; then
7388     AC_DEFINE(MOZ_TRACE_JSCALLS)
7391 dnl ========================================================
7392 dnl = Use TraceVis
7393 dnl ========================================================
7394 MOZ_ARG_ENABLE_BOOL(tracevis,
7395 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7396     MOZ_TRACEVIS=1,
7397     MOZ_TRACEVIS= )
7398 if test -n "$MOZ_TRACEVIS"; then
7399     AC_DEFINE(MOZ_TRACEVIS)
7402 dnl ========================================================
7403 dnl = Use GCTimer
7404 dnl ========================================================
7405 MOZ_ARG_ENABLE_BOOL(gctimer,
7406 [  --enable-gctimer        Enable GC timer (default=no)],
7407     MOZ_GCTIMER=1,
7408     MOZ_GCTIMER= )
7409 if test -n "$MOZ_GCTIMER"; then
7410     AC_DEFINE(MOZ_GCTIMER)
7413 dnl ========================================================
7414 dnl = Use Valgrind
7415 dnl ========================================================
7416 MOZ_ARG_ENABLE_BOOL(valgrind,
7417 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7418     MOZ_VALGRIND=1,
7419     MOZ_VALGRIND= )
7420 if test -n "$MOZ_VALGRIND"; then
7421     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7422         AC_MSG_ERROR(
7423             [--enable-valgrind specified but Valgrind is not installed]))
7424     AC_DEFINE(MOZ_VALGRIND)
7427 dnl ========================================================
7428 dnl jprof
7429 dnl ========================================================
7430 MOZ_ARG_ENABLE_BOOL(jprof,
7431 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
7432     MOZ_JPROF=1,
7433     MOZ_JPROF= )
7434 if test -n "$MOZ_JPROF"; then
7435     AC_DEFINE(MOZ_JPROF)
7438 dnl ========================================================
7439 dnl shark
7440 dnl ========================================================
7441 MOZ_ARG_ENABLE_BOOL(shark,
7442 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
7443     MOZ_SHARK=1,
7444     MOZ_SHARK= )
7445 if test -n "$MOZ_SHARK"; then
7446     AC_DEFINE(MOZ_SHARK)
7449 dnl ========================================================
7450 dnl callgrind
7451 dnl ========================================================
7452 MOZ_ARG_ENABLE_BOOL(callgrind,
7453 [  --enable-callgrind      Enable callgrind profiling],
7454     MOZ_CALLGRIND=1,
7455     MOZ_CALLGRIND= )
7456 if test -n "$MOZ_CALLGRIND"; then
7457     AC_DEFINE(MOZ_CALLGRIND)
7460 dnl ========================================================
7461 dnl vtune
7462 dnl ========================================================
7463 MOZ_ARG_ENABLE_BOOL(vtune,
7464 [  --enable-vtune          Enable vtune profiling],
7465     MOZ_VTUNE=1,
7466     MOZ_VTUNE= )
7467 if test -n "$MOZ_VTUNE"; then
7468     AC_DEFINE(MOZ_VTUNE)
7471 dnl ========================================================
7472 dnl Zealous JavaScript GC
7473 dnl ========================================================
7474 MOZ_ARG_ENABLE_BOOL(gczeal,
7475 [  --enable-gczeal         Enable zealous JavaScript GCing],
7476     JS_GC_ZEAL=1,
7477     JS_GC_ZEAL= )
7478 if test -n "$JS_GC_ZEAL"; then
7479     AC_DEFINE(JS_GC_ZEAL)
7482 dnl ======================================================
7483 dnl = Enable compiling with ccache
7484 dnl ======================================================
7485 MOZ_ARG_WITH_STRING(ccache,
7486 [  --with-ccache[=path/to/ccache]
7487                           Enable compiling with ccache],
7488     CCACHE=$withval, CCACHE="no")
7490 if test "$CCACHE" != "no"; then
7491     if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7492         CCACHE=
7493     else
7494         if test ! -e "$CCACHE"; then
7495             AC_MSG_ERROR([$CCACHE not found])
7496         fi
7497     fi
7498     MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7499     if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7500         AC_MSG_ERROR([ccache not found])
7501     elif test -x "$CCACHE"; then
7502         CC="$CCACHE $CC"
7503         CXX="$CCACHE $CXX"
7504     else
7505         AC_MSG_ERROR([$CCACHE is not executable])
7506     fi
7509 dnl ========================================================
7510 dnl = Enable static checking using gcc-dehydra
7511 dnl ========================================================
7513 MOZ_ARG_WITH_STRING(static-checking,
7514 [  --with-static-checking=path/to/gcc_dehydra.so
7515                           Enable static checking of code using GCC-dehydra],
7516     DEHYDRA_PATH=$withval,
7517     DEHYDRA_PATH= )
7519 if test -n "$DEHYDRA_PATH"; then
7520     if test ! -f "$DEHYDRA_PATH"; then
7521         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7522     fi
7523     AC_DEFINE(NS_STATIC_CHECKING)
7525 AC_SUBST(DEHYDRA_PATH)
7527 dnl ========================================================
7528 dnl = Enable stripping of libs & executables
7529 dnl ========================================================
7530 MOZ_ARG_ENABLE_BOOL(strip,
7531 [  --enable-strip          Enable stripping of libs & executables ],
7532     ENABLE_STRIP=1,
7533     ENABLE_STRIP= )
7535 dnl ========================================================
7536 dnl = Enable stripping of libs & executables when packaging
7537 dnl ========================================================
7538 MOZ_ARG_ENABLE_BOOL(install-strip,
7539 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7540     PKG_SKIP_STRIP= ,
7541     PKG_SKIP_STRIP=1)
7543 dnl ========================================================
7544 dnl = --enable-elf-dynstr-gc
7545 dnl ========================================================
7546 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7547 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7548     USE_ELF_DYNSTR_GC=1,
7549     USE_ELF_DYNSTR_GC= )
7551 dnl ========================================================
7552 dnl = 
7553 dnl = Profiling and Instrumenting
7554 dnl = 
7555 dnl ========================================================
7556 MOZ_ARG_HEADER(Profiling and Instrumenting)
7558 dnl ========================================================
7559 dnl = Enable timeline service, which provides lightweight
7560 dnl = instrumentation of mozilla for performance measurement.
7561 dnl = Timeline is off by default.
7562 dnl ========================================================
7563 MOZ_ARG_ENABLE_BOOL(timeline,
7564 [  --enable-timeline       Enable timeline services ],
7565     MOZ_TIMELINE=1,
7566     MOZ_TIMELINE= )
7567 if test -n "$MOZ_TIMELINE"; then
7568     AC_DEFINE(MOZ_TIMELINE)
7571 dnl ========================================================
7572 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7573 dnl = timing for identifying code bottlenecks 
7574 dnl = NS_FUNCTION_TIMER is off by default.
7575 dnl ========================================================
7576 MOZ_ARG_ENABLE_BOOL(functiontimer,
7577 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7578     NS_FUNCTION_TIMER=1,
7579     NS_FUNCTION_TIMER= )
7580 if test -n "$NS_FUNCTION_TIMER"; then
7581     AC_DEFINE(NS_FUNCTION_TIMER)
7584 dnl ========================================================
7585 dnl Turn on reflow counting
7586 dnl ========================================================
7587 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7588 [  --enable-reflow-perf    Enable reflow performance tracing],
7589     MOZ_REFLOW_PERF=1,
7590     MOZ_REFLOW_PERF= )
7591 if test -n "$MOZ_REFLOW_PERF"; then
7592     AC_DEFINE(MOZ_REFLOW_PERF)
7595 dnl ========================================================
7596 dnl Enable code size metrics.
7597 dnl ========================================================
7598 MOZ_ARG_ENABLE_BOOL(codesighs,
7599 [  --enable-codesighs      Enable code size analysis tools],
7600     _ENABLE_CODESIGHS=1,
7601     _ENABLE_CODESIGHS= )
7602 if test -n "$_ENABLE_CODESIGHS"; then
7603     if test -d $srcdir/tools/codesighs; then 
7604         MOZ_MAPINFO=1
7605     else
7606         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7607     fi
7610 dnl ========================================================
7611 dnl = Support for Quantify (Windows)
7612 dnl ========================================================
7613 MOZ_ARG_ENABLE_BOOL(quantify,
7614 [  --enable-quantify       Enable Quantify support (Windows only) ],
7615     MOZ_QUANTIFY=1,
7616     MOZ_QUANTIFY= )
7618 dnl ========================================================
7619 dnl = Support for demangling undefined symbols
7620 dnl ========================================================
7621 if test -z "$SKIP_LIBRARY_CHECKS"; then
7622     AC_LANG_SAVE
7623     AC_LANG_CPLUSPLUS
7624     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7625     AC_LANG_RESTORE
7628 # Demangle only for debug or trace-malloc builds
7629 MOZ_DEMANGLE_SYMBOLS=
7630 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7631     MOZ_DEMANGLE_SYMBOLS=1
7632     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7634 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7636 dnl ========================================================
7637 dnl = Support for gcc stack unwinding (from gcc 3.3)
7638 dnl ========================================================
7639 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7640     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7643 dnl ========================================================
7644 dnl =
7645 dnl = Misc. Options
7646 dnl = 
7647 dnl ========================================================
7648 MOZ_ARG_HEADER(Misc. Options)
7650 dnl ========================================================
7651 dnl update xterm title
7652 dnl ========================================================
7653 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7654 [  --enable-xterm-updates  Update XTERM titles with current command.],
7655     MOZ_UPDATE_XTERM=1,
7656     MOZ_UPDATE_XTERM= )
7658 dnl =========================================================
7659 dnl = Chrome format
7660 dnl =========================================================
7661 MOZ_ARG_ENABLE_STRING([chrome-format],
7662 [  --enable-chrome-format=jar|flat|both|symlink|omni
7663                           Select FORMAT of chrome files (default=jar)],
7664     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7666 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7667     MOZ_CHROME_FILE_FORMAT=jar
7670 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7671     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7672     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7673     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7674     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7675     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7678 dnl =========================================================
7679 dnl Omnijar packaging (bug 552121)
7680 dnl =========================================================
7681 dnl Omnijar packaging is compatible with flat packaging.
7682 dnl In unpackaged builds, omnijar looks for files as if
7683 dnl things were flat packaged. After packaging, all files
7684 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7685 dnl is set to flat since putting files into jars is only
7686 dnl done during packaging with omnijar.
7687 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7688     MOZ_OMNIJAR=1
7689     AC_DEFINE(MOZ_OMNIJAR)
7690     MOZ_CHROME_FILE_FORMAT=flat
7691 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7692     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7695 AC_SUBST(MOZ_OMNIJAR)
7697 dnl ========================================================
7698 dnl = Define default location for MOZILLA_FIVE_HOME
7699 dnl ========================================================
7700 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7701 [  --with-default-mozilla-five-home
7702                           Set the default value for MOZILLA_FIVE_HOME],
7703 [ val=`echo $withval`
7704   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7706 dnl ========================================================
7707 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7708 dnl ========================================================
7709 MOZ_ARG_WITH_STRING(user-appdir,
7710 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7711 [ val=`echo $withval`
7712 if echo "$val" | grep "\/" >/dev/null; then
7713     AC_MSG_ERROR("Homedir must be single relative path.")
7714 else 
7715     MOZ_USER_DIR="$val"
7716 fi])
7718 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7720 dnl ========================================================
7721 dnl = Doxygen configuration
7722 dnl ========================================================
7723 dnl Use commas to specify multiple dirs to this arg
7724 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7725 MOZ_ARG_WITH_STRING(doc-input-dirs,
7726 [  --with-doc-input-dirs=DIRS
7727                           Header/idl dirs to create docs from],
7728 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7729 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7731 dnl Use commas to specify multiple dirs to this arg
7732 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7733 MOZ_ARG_WITH_STRING(doc-include-dirs,
7734 [  --with-doc-include-dirs=DIRS  
7735                           Include dirs to preprocess doc headers],
7736 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7737 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7739 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7740 MOZ_ARG_WITH_STRING(doc-output-dir,
7741 [  --with-doc-output-dir=DIR
7742                           Dir to generate docs into],
7743 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7744 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7746 if test -z "$SKIP_COMPILER_CHECKS"; then
7747 dnl ========================================================
7748 dnl =
7749 dnl = Compiler Options
7750 dnl = 
7751 dnl ========================================================
7752 MOZ_ARG_HEADER(Compiler Options)
7754 dnl ========================================================
7755 dnl Check for gcc -pipe support
7756 dnl ========================================================
7757 AC_MSG_CHECKING([for gcc -pipe support])
7758 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
7759     echo '#include <stdio.h>' > dummy-hello.c
7760     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7761     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7762     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7763     if test $? = 0; then
7764         _res_as_stdin="yes"
7765     else
7766         _res_as_stdin="no"
7767     fi
7768     if test "$_res_as_stdin" = "yes"; then
7769         _SAVE_CFLAGS=$CFLAGS
7770         CFLAGS="$CFLAGS -pipe"
7771         AC_TRY_COMPILE( [ #include <stdio.h> ],
7772             [printf("Hello World\n");],
7773             [_res_gcc_pipe="yes"],
7774             [_res_gcc_pipe="no"] )
7775         CFLAGS=$_SAVE_CFLAGS
7776     fi
7777     if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
7778         _res="yes";
7779         CFLAGS="$CFLAGS -pipe"
7780         CXXFLAGS="$CXXFLAGS -pipe"
7781     else
7782         _res="no"
7783     fi
7784     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7785     AC_MSG_RESULT([$_res])
7786 else
7787     AC_MSG_RESULT([no])
7790 dnl ========================================================
7791 dnl Profile guided optimization
7792 dnl ========================================================
7793 dnl Test for profiling options
7794 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7796 dnl Provide a switch to disable PGO even when called via profiledbuild.
7797 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7798 [  --disable-profile-guided-optimization
7799                           Don't build with PGO even if called via make profiledbuild],
7800 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7801 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7803 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7805 _SAVE_CFLAGS="$CFLAGS"
7806 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7808 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7809 AC_TRY_COMPILE([], [return 0;],
7810                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7811                  result="yes" ], result="no")
7812 AC_MSG_RESULT([$result])
7814 if test $result = "yes"; then
7815   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7816   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7817   PROFILE_USE_LDFLAGS="-fprofile-use"
7820 CFLAGS="$_SAVE_CFLAGS"
7822 if test -n "$INTEL_CC"; then
7823   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7824   PROFILE_GEN_LDFLAGS=
7825   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7826   PROFILE_USE_LDFLAGS=
7829 dnl Sun Studio on Solaris
7830 if test "$SOLARIS_SUNPRO_CC"; then
7831   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7832   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7833   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7834   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7837 AC_SUBST(PROFILE_GEN_CFLAGS)
7838 AC_SUBST(PROFILE_GEN_LDFLAGS)
7839 AC_SUBST(PROFILE_USE_CFLAGS)
7840 AC_SUBST(PROFILE_USE_LDFLAGS)
7842 AC_LANG_CPLUSPLUS
7844 dnl ========================================================
7845 dnl Test for -pedantic bustage
7846 dnl ========================================================
7847 MOZ_ARG_DISABLE_BOOL(pedantic,
7848 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7849 _PEDANTIC= )
7850 if test "$_PEDANTIC"; then
7851     _SAVE_CXXFLAGS=$CXXFLAGS
7852     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7853     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7854     AC_TRY_COMPILE([$configure_static_assert_macros],
7855                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7856                    result="no", result="yes" )
7857     AC_MSG_RESULT([$result])
7858     CXXFLAGS="$_SAVE_CXXFLAGS"
7860     case "$result" in
7861     no)
7862         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7863         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7864         ;;
7865     yes)
7866         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7867         ;;
7868     esac
7871 dnl ========================================================
7872 dnl Test for correct temporary object destruction order
7873 dnl ========================================================
7874 dnl We want to make sure the compiler follows the C++ spec here as 
7875 dnl xpcom and the string classes depend on it (bug 235381).
7876 AC_MSG_CHECKING([for correct temporary object destruction order])
7877 AC_TRY_RUN([ class A {
7878              public:  A(int& x) : mValue(x) {}
7879                       ~A() { mValue--; }
7880                       operator char**() { return 0; }
7881              private:  int& mValue;
7882              };
7883              void func(char **arg) {}
7884              int m=2;
7885              void test() {
7886                   func(A(m));
7887                   if (m==1) m = 0;
7888              }
7889              int main() {
7890                  test();
7891                  return(m);
7892              }
7893              ],
7894      result="yes", result="no", result="maybe")
7895 AC_MSG_RESULT([$result])
7897 if test "$result" = "no"; then
7898     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7901 dnl ========================================================
7902 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7903 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7904 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7905 dnl ========================================================
7906 _SAVE_CXXFLAGS=$CXXFLAGS
7907 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7908 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7909     ac_nscap_nonconst_opeq_bug,
7910     [AC_TRY_COMPILE([
7911                       template <class T>
7912                       class Pointer
7913                         {
7914                         public:
7915                           T* myPtr;
7916                         };
7917                       
7918                       template <class T, class U>
7919                       int operator==(const Pointer<T>& rhs, U* lhs)
7920                         {
7921                           return rhs.myPtr == lhs;
7922                         }
7923                       
7924                       template <class T, class U>
7925                       int operator==(const Pointer<T>& rhs, const U* lhs)
7926                         {
7927                           return rhs.myPtr == lhs;
7928                         }
7929                     ],
7930                     [
7931                       Pointer<int> foo;
7932                       const int* bar;
7933                       return foo == bar;
7934                     ],
7935                     ac_nscap_nonconst_opeq_bug="no",
7936                     ac_nscap_nonconst_opeq_bug="yes")])
7937 CXXFLAGS="$_SAVE_CXXFLAGS"
7939 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7940     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7942 fi # SKIP_COMPILER_CHECKS
7944 dnl ========================================================
7945 dnl C++ rtti
7946 dnl Should be smarter and check that the compiler does indeed have rtti
7947 dnl ========================================================
7949 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7950 [  --enable-cpp-rtti       Enable C++ RTTI ],
7951 [ _MOZ_USE_RTTI=1 ],
7952 [ _MOZ_USE_RTTI= ])
7954 if test "$_MOZ_USE_RTTI"; then
7955    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7956 else
7957    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7960 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7962 dnl ========================================================
7963 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
7964 dnl Should be smarter and check that the compiler does indeed have exceptions
7965 dnl ========================================================
7966 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7967 [  --enable-cpp-exceptions Enable C++ exceptions ],
7968 [ _MOZ_CPP_EXCEPTIONS=1 ],
7969 [ _MOZ_CPP_EXCEPTIONS= ])
7971 if test "$_MOZ_CPP_EXCEPTIONS"; then
7972     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7973     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
7974 else
7975     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7978 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7980 # Irix & OSF native compilers do not like exception declarations 
7981 # when exceptions are disabled
7982 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7983     AC_DEFINE(CPP_THROW_NEW, [])
7984 else
7985     AC_DEFINE(CPP_THROW_NEW, [throw()])
7987 AC_LANG_C
7989 dnl ========================================================
7990 dnl =
7991 dnl = Build depencency options
7992 dnl =
7993 dnl ========================================================
7994 MOZ_ARG_HEADER(Build dependencies)
7996 dnl ========================================================
7997 dnl = Do not auto generate dependency info
7998 dnl ========================================================
7999 MOZ_AUTO_DEPS=1
8000 MOZ_ARG_DISABLE_BOOL(auto-deps,
8001 [  --disable-auto-deps     Do not automatically generate dependency info],
8002     MOZ_AUTO_DEPS=,
8003     MOZ_AUTO_DEPS=1)
8005 if test -n "$MOZ_AUTO_DEPS"; then
8006 dnl ========================================================
8007 dnl = Use mkdepend instead of $CC -MD for dependency generation
8008 dnl ========================================================
8009 _cpp_md_flag=
8010 MOZ_ARG_DISABLE_BOOL(md,
8011 [  --disable-md            Do not use compiler-based dependencies ],
8012   [_cpp_md_flag=],
8013   [_cpp_md_flag=1],
8014   [dnl Default is to turn on -MD if using GNU-compatible compilers
8015    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
8016      _cpp_md_flag=1
8017    fi
8018   dnl Default is to use -xM if using Sun Studio on Solaris
8019    if test "$SOLARIS_SUNPRO_CC"; then
8020      _cpp_md_flag=1
8021    fi])
8022 if test "$_cpp_md_flag"; then
8023   COMPILER_DEPEND=1
8024   if test "$OS_ARCH" = "OpenVMS"; then
8025     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
8026   else
8027     _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8028   fi
8029   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8030   if test "$SOLARIS_SUNPRO_CC"; then
8031     _DEPEND_CFLAGS=
8032   fi
8033 else
8034   COMPILER_DEPEND=
8035   dnl Don't override this for MSVC
8036   if test -z "$_WIN32_MSVC"; then
8037     _USE_CPP_INCLUDE_FLAG=
8038     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8039     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8040   else
8041     echo '#include <stdio.h>' > dummy-hello.c
8042     changequote(,)
8043     CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8044     changequote([,])
8045     if test -z "$CL_INCLUDES_PREFIX"; then
8046         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8047     fi
8048     AC_SUBST(CL_INCLUDES_PREFIX)
8049     rm -f dummy-hello.c
8050     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8051     dnl cl.py provides dependency generation for MSVC
8052     CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8053     CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8054     COMPILER_DEPEND=1
8055   fi
8057 fi # MOZ_AUTO_DEPS
8058 MDDEPDIR='.deps'
8059 AC_SUBST(MOZ_AUTO_DEPS)
8060 AC_SUBST(COMPILER_DEPEND)
8061 AC_SUBST(MDDEPDIR)
8062 AC_SUBST(CC_WRAPPER)
8063 AC_SUBST(CXX_WRAPPER)
8066 dnl ========================================================
8067 dnl =
8068 dnl = Static Build Options
8069 dnl =
8070 dnl ========================================================
8071 MOZ_ARG_HEADER(Static build options)
8073 MOZ_ARG_ENABLE_BOOL(static,
8074 [  --enable-static         Enable building of internal static libs],
8075     BUILD_STATIC_LIBS=1,
8076     BUILD_STATIC_LIBS=)
8078 MOZ_ARG_ENABLE_BOOL(libxul,
8079 [  --enable-libxul         Enable building of libxul],
8080     MOZ_ENABLE_LIBXUL=1,
8081     MOZ_ENABLE_LIBXUL=)
8083 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8084 if test "$OS_ARCH" = "WINNT"; then
8085   ENABLE_SHARED_JS=1
8088 MOZ_ARG_ENABLE_BOOL(shared-js,
8089 [  --enable-shared-js
8090                           Create a shared JavaScript library.],
8091     ENABLE_SHARED_JS=1,
8092     ENABLE_SHARED_JS=)
8094 if test -z "$MOZ_ENABLE_LIBXUL"; then
8095   dnl --disable-libxul implies shared js
8096   ENABLE_SHARED_JS=1
8099 if test -n "$ENABLE_SHARED_JS"; then
8100   JS_SHARED_LIBRARY=1
8101   MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
8102 else
8103   MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
8104   AC_DEFINE(MOZ_STATIC_JS)
8106 AC_SUBST(JS_SHARED_LIBRARY)
8108 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8109         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
8112 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8113         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8116 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
8117     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
8120 if test -z "$MOZ_ENABLE_LIBXUL" -a -n "$MOZ_OMNIJAR"; then
8121     AC_MSG_ERROR([Omnijar packaging is incompatible with --disable-libxul. Please either --enable-libxul or --enable-chrome-format=jar|flat|symlink]);
8124 AC_SUBST(LIBXUL_LIBS)
8126 if test -n "$MOZ_ENABLE_LIBXUL"; then
8127     XPCOM_LIBS="$LIBXUL_LIBS"
8128     AC_DEFINE(MOZ_ENABLE_LIBXUL)
8129 else
8130     if test -n "$BUILD_STATIC_LIBS"; then
8131         AC_DEFINE(MOZ_STATIC_BUILD)
8132     fi
8133     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
8136 dnl ========================================================
8137 dnl =
8138 dnl = Standalone module options
8139 dnl = 
8140 dnl ========================================================
8141 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8143 dnl Check for GLib and libIDL.
8144 dnl ========================================================
8145 SKIP_IDL_CHECK="no"
8147 if test -z "$COMPILE_ENVIRONMENT"; then
8148     SKIP_IDL_CHECK="yes"
8151 dnl = Allow users to disable libIDL checking for standalone modules
8152 MOZ_ARG_WITHOUT_BOOL(libIDL,
8153 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
8154         SKIP_IDL_CHECK="yes")
8156 if test -z "$CROSS_COMPILE"; then
8157     if test -z "$HOST_LIBIDL_CONFIG"; then
8158         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8159     fi
8160     if test -z "$HOST_LIBIDL_PREFIX"; then
8161         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8162     fi
8165 if test "$SKIP_IDL_CHECK" = "no"
8166 then
8167     _LIBIDL_FOUND=
8168     case "$host" in
8169     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8170         if test -n "$GLIB_PREFIX"; then
8171             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8172             if test "$?" = "0"; then
8173                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8174                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8175                 fi
8176                 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8177             else
8178                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8179             fi
8180         else
8181             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8182         fi
8183         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8184             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8185         fi
8186         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8187         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8188             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8189         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8190             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8191         else
8192             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8193         fi
8195         if test -n "$HOST_LIBIDL_PREFIX"; then
8196             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8197             if test "$?" = "0"; then
8198                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8199                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8200                 fi
8201                 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8202             else
8203                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8204             fi
8205         else
8206             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8207         fi        
8208         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8209             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8210         fi
8211         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8212         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8213             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8214             STATIC_LIBIDL=1
8215         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8216             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8217         else
8218             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8219         fi
8220         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8221         _LIBIDL_FOUND=1
8222         ;;
8223     esac
8225     if test -z "$_LIBIDL_FOUND"; then
8226         if test "$MACOS_SDK_DIR"; then 
8227             dnl xpidl, and therefore libIDL, is only needed on the build host.
8228             dnl Don't build it against the SDK, as that causes problems.
8229             _MACSAVE_CFLAGS="$CFLAGS"
8230             _MACSAVE_LIBS="$LIBS"
8231             _MACSAVE_LDFLAGS="$LDFLAGS"
8232             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8233           changequote(,)
8234           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"`
8235           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8236           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8237           changequote([,])
8238           unset NEXT_ROOT
8239         fi
8241         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8242     fi
8244     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8245     dnl to either libIDL1 or libIDL2.
8246     if test -z "$_LIBIDL_FOUND"; then
8247         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8248         if test -z "$_LIBIDL_FOUND"; then
8249             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8250         fi
8251     fi
8252     dnl
8253     dnl If we don't have a libIDL config program & not cross-compiling, 
8254     dnl     look for orbit-config instead.
8255     dnl
8256     if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8257         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8258         if test -n "$ORBIT_CONFIG"; then
8259             AC_MSG_CHECKING([for ORBit libIDL usability])
8260                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8261             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8262             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8263             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8264             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8265             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8266             HOST_LIBIDL_CONFIG=
8267             _SAVE_CFLAGS="$CFLAGS"
8268             _SAVE_LIBS="$LIBS"
8269             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8270             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8271             AC_TRY_RUN([
8272 #include <stdlib.h>
8273 #include <libIDL/IDL.h>
8274 int main() {
8275   char *s;
8276   s=strdup(IDL_get_libver_string());
8277   if(s==NULL) {
8278     exit(1);
8279   }
8280   exit(0);
8282             ], [_LIBIDL_FOUND=1
8283                 result="yes"],
8284                [HOST_LIBIDL_CFLAGS=
8285                 HOST_LIBIDL_LIBS=
8286                 result="no"],
8287                [_LIBIDL_FOUND=1
8288                 result="maybe"] )
8289             AC_MSG_RESULT($result)
8290             CFLAGS="$_SAVE_CFLAGS"
8291             LIBS="$_SAVE_LIBS"
8292         fi
8293     fi
8294     if test -z "$_LIBIDL_FOUND"; then
8295         AC_MSG_ERROR([libIDL not found.
8296         libIDL $LIBIDL_VERSION or higher is required.])
8297     fi
8298     if test "$MACOS_SDK_DIR"; then
8299       CFLAGS="$_MACSAVE_CFLAGS"
8300       LIBS="$_MACSAVE_LIBS"
8301       LDFLAGS="$_MACSAVE_LDFLAGS"
8302       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8303         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8304       fi
8305     fi
8308 if test -n "$CROSS_COMPILE"; then
8309     case "$target" in
8310     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8311         if test -n "$GLIB_PREFIX"; then
8312             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8313             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8314                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8315             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8316                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8317             else
8318                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8319             fi
8320         fi
8322         if test -n "$LIBIDL_PREFIX"; then
8323             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8324             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8325                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8326                 STATIC_LIBIDL=1
8327             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8328                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8329             else
8330                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8331             fi
8332         fi
8333         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8334         ;;
8335     *)
8336         if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8337             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8338             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8339         fi
8340         ;;
8341     esac
8342 else
8343     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8344     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8347 if test -z "$SKIP_PATH_CHECKS"; then
8348 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8349     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8350         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8351     else
8352         AM_PATH_GLIB(${GLIB_VERSION})
8353     fi
8357 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8358     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8361 AC_SUBST(LIBIDL_CFLAGS)
8362 AC_SUBST(LIBIDL_LIBS)
8363 AC_SUBST(STATIC_LIBIDL)
8364 AC_SUBST(GLIB_CFLAGS)
8365 AC_SUBST(GLIB_LIBS)
8366 AC_SUBST(GLIB_GMODULE_LIBS)
8367 AC_SUBST(HOST_LIBIDL_CONFIG)
8368 AC_SUBST(HOST_LIBIDL_CFLAGS)
8369 AC_SUBST(HOST_LIBIDL_LIBS)
8371 dnl ========================================================
8372 dnl Check for cairo
8373 dnl ========================================================
8374 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8376 MOZ_TREE_CAIRO=1
8377 MOZ_ARG_ENABLE_BOOL(system-cairo,
8378 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8379 MOZ_TREE_CAIRO=,
8380 MOZ_TREE_CAIRO=1 )
8382 MOZ_TREE_PIXMAN=1
8383 MOZ_ARG_ENABLE_BOOL(system-pixman,
8384 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8385 MOZ_TREE_PIXMAN=,
8386 MOZ_TREE_PIXMAN=1 )
8388 # Check for headers defining standard int types.
8389 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8391 if test "$MOZ_TREE_CAIRO"; then
8392     AC_DEFINE(MOZ_TREE_CAIRO)
8394     # For now we assume that we will have a uint64_t available through
8395     # one of the above headers or mozstdint.h.
8396     AC_DEFINE(HAVE_UINT64_T)
8398     # Define macros for cairo-features.h
8399     if test "$MOZ_X11"; then
8400         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8401         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8402         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8403         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8404         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8405         MOZ_ENABLE_CAIRO_FT=1
8406         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8407     fi
8408     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8409         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8410     fi
8411     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8412         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8413         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8414         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8415     fi
8416     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8417         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8418         if test -z "$WINCE"; then
8419             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8420             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8421                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8422                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8423                 MOZ_ENABLE_D2D_SURFACE=1
8424                 MOZ_ENABLE_DWRITE_FONT=1
8425             else
8426                 WIN32_DWRITE_FONT_FEATURE=
8427                 WIN32_D2D_SURFACE_FEATURE=
8428             fi
8429         else
8430             WIN32_FONT_FEATURE=
8431             WIN32_DWRITE_FONT_FEATURE=
8432             WIN32_D2D_SURFACE_FEATURE=
8433         fi
8435         AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8436         AC_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8438         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
8439         if test -z "$HAS_DDRAW"; then
8440             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.])
8441             DDRAW_SURFACE_FEATURE=
8442         else
8443             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
8444         fi
8446         if test -z "$OGLES_SDK_DIR"; then
8447             OGLES_SURFACE_FEATURE=
8448         else
8449             AC_TRY_COMPILE([
8450               #include <EGL/egl.h>
8451               #include <EGL/eglext.h>
8452               #include <GLES2/gl2.h>
8453               #include <GLES2/gl2ext.h>
8454             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
8455             if test -z "$HAS_OGLES"; then
8456               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
8457               OGLES_SURFACE_FEATURE=
8458             else
8459               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
8460             fi
8461         fi
8463         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8464     fi
8465     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8466         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8467         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8468         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8469         MOZ_ENABLE_CAIRO_FT=1
8470         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8471         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8472     fi
8473     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8474         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8475         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8476         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8477         MOZ_ENABLE_CAIRO_FT=1
8478     fi
8479     if test "$USE_FC_FREETYPE"; then
8480         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8481     fi
8482     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8483     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8484     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8485     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8486     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8487     AC_SUBST(CAIRO_FT_CFLAGS)
8488     AC_SUBST(HAS_OGLES)
8490     if test "$MOZ_DEBUG"; then
8491       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8492     else
8493       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8494     fi
8496     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8498     AC_SUBST(PS_SURFACE_FEATURE)
8499     AC_SUBST(PDF_SURFACE_FEATURE)
8500     AC_SUBST(SVG_SURFACE_FEATURE)
8501     AC_SUBST(XLIB_SURFACE_FEATURE)
8502     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8503     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8504     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8505     AC_SUBST(XCB_SURFACE_FEATURE)
8506     AC_SUBST(WIN32_SURFACE_FEATURE)
8507     AC_SUBST(DDRAW_SURFACE_FEATURE)
8508     AC_SUBST(OGLES_SURFACE_FEATURE)    
8509     AC_SUBST(OS2_SURFACE_FEATURE)
8510     AC_SUBST(BEOS_SURFACE_FEATURE)
8511     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8512     AC_SUBST(FT_FONT_FEATURE)
8513     AC_SUBST(FC_FONT_FEATURE)
8514     AC_SUBST(WIN32_FONT_FEATURE)
8515     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8516     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8517     AC_SUBST(QUARTZ_FONT_FEATURE)
8518     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8519     AC_SUBST(QT_SURFACE_FEATURE)
8521     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8523     if test "$MOZ_TREE_PIXMAN"; then
8524         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8525     else
8526         PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.17.3)
8527         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8528         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8529     fi
8531     if test "$MOZ_X11"; then
8532         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8533     fi
8535     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8536     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8538 else
8539    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8540    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8541    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8542    if test "$MOZ_X11"; then
8543         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8544         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8545         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8546    fi
8549 AC_SUBST(MOZ_TREE_CAIRO)
8550 AC_SUBST(MOZ_CAIRO_CFLAGS)
8551 AC_SUBST(MOZ_CAIRO_LIBS)
8552 AC_SUBST(MOZ_TREE_PIXMAN)
8554 dnl ========================================================
8555 dnl qcms
8556 dnl ========================================================
8558 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8559 AC_SUBST(QCMS_LIBS)
8561 dnl ========================================================
8562 dnl HarfBuzz
8563 dnl ========================================================
8564 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8565 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8567 dnl ========================================================
8568 dnl disable xul
8569 dnl ========================================================
8570 MOZ_ARG_DISABLE_BOOL(xul,
8571 [  --disable-xul           Disable XUL],
8572     MOZ_XUL= )
8573 if test "$MOZ_XUL"; then
8574   AC_DEFINE(MOZ_XUL)
8575 else
8576   dnl remove extensions that require XUL
8577   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8580 AC_SUBST(MOZ_XUL)
8582 dnl ========================================================
8583 dnl disable profile locking
8584 dnl   do no use this in applications that can have more than
8585 dnl   one process accessing the profile directory.
8586 dnl ========================================================
8587 MOZ_ARG_DISABLE_BOOL(profilelocking,
8588 [  --disable-profilelocking
8589                           Disable profile locking],
8590     MOZ_PROFILELOCKING=,
8591     MOZ_PROFILELOCKING=1 )
8592 if test "$MOZ_PROFILELOCKING"; then
8593   AC_DEFINE(MOZ_PROFILELOCKING)
8596 dnl ========================================================
8597 dnl disable rdf services
8598 dnl ========================================================
8599 MOZ_ARG_DISABLE_BOOL(rdf,
8600 [  --disable-rdf           Disable RDF],
8601     MOZ_RDF= )
8602 if test "$MOZ_RDF"; then
8603   AC_DEFINE(MOZ_RDF)
8606 AC_SUBST(MOZ_RDF)
8608 dnl ========================================================
8609 dnl necko configuration options
8610 dnl ========================================================
8613 dnl option to disable various necko protocols
8615 MOZ_ARG_ENABLE_STRING(necko-protocols,
8616 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8617                           Enable/disable specific protocol handlers],
8618 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8619     if test "$option" = "yes" -o "$option" = "all"; then
8620         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8621     elif test "$option" = "no" -o "$option" = "none"; then
8622         NECKO_PROTOCOLS=""
8623     elif test "$option" = "default"; then
8624         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8625     elif test `echo "$option" | grep -c \^-` != 0; then
8626         option=`echo $option | sed 's/^-//'`
8627         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8628     else
8629         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8630     fi
8631 done],
8632     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8633 dnl Remove dupes
8634 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8635 AC_SUBST(NECKO_PROTOCOLS)
8636 for p in $NECKO_PROTOCOLS; do
8637     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8638 done
8641 dnl option to disable necko's disk cache
8643 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8644 [  --disable-necko-disk-cache
8645                           Disable necko disk cache],
8646     NECKO_DISK_CACHE=,
8647     NECKO_DISK_CACHE=1)
8648 AC_SUBST(NECKO_DISK_CACHE)
8649 if test "$NECKO_DISK_CACHE"; then
8650     AC_DEFINE(NECKO_DISK_CACHE)
8654 dnl option to disable necko's wifi scanner
8656 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8657 [  --disable-necko-wifi    Disable necko wifi scanner],
8658     NECKO_WIFI=,
8659     NECKO_WIFI=1)
8661 if test "$OS_ARCH" = "OS2"; then
8662   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8663   NECKO_WIFI=
8665 if test "$NECKO_WIFI" -a \
8666         "$OS_ARCH" != "Linux" -a \
8667         "$OS_ARCH" != "Darwin" -a \
8668         "$OS_ARCH" != "SunOS" -a \
8669         "$OS_ARCH" != "WINNT" -a \
8670         "$OS_ARCH" != "WINCE"; then
8671   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8674 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8675 then
8676   AC_CHECK_HEADER([iwlib.h])
8677   if test "$ac_cv_header_iwlib_h" != "yes"; then
8678     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])
8679   fi
8682 if test "$NECKO_WIFI"; then
8683   AC_DEFINE(NECKO_WIFI)
8685 AC_SUBST(NECKO_WIFI)
8688 dnl option to disable cookies
8690 MOZ_ARG_DISABLE_BOOL(cookies,
8691 [  --disable-cookies       Disable cookie support],
8692     NECKO_COOKIES=,
8693     NECKO_COOKIES=1)
8694 AC_SUBST(NECKO_COOKIES)
8695 if test "$NECKO_COOKIES"; then
8696     AC_DEFINE(NECKO_COOKIES)
8700 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8702 MOZ_ARG_DISABLE_BOOL(ctypes,
8703 [  --disable-ctypes        Disable js-ctypes],
8704     BUILD_CTYPES=,
8705     BUILD_CTYPES=1)
8706 AC_SUBST(BUILD_CTYPES)
8707 if test "$BUILD_CTYPES"; then
8708   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8709     # Disable ctypes for arm/wince.
8710     BUILD_CTYPES=
8711   else
8712     AC_DEFINE(BUILD_CTYPES)
8713   fi
8716 dnl NECKO_ configuration options are not global
8717 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8719 dnl Only build Mork if it's required
8720 AC_SUBST(MOZ_MORK)
8721 if test "$MOZ_MORK"; then
8722   AC_DEFINE(MOZ_MORK)
8725 dnl Build the lightweight Mork reader if required
8726 AC_SUBST(MOZ_MORKREADER)
8727 if test "$MOZ_MORKREADER"; then
8728   AC_DEFINE(MOZ_MORKREADER)
8731 dnl Build Places if required
8732 if test "$MOZ_PLACES"; then
8733   AC_DEFINE(MOZ_PLACES)
8736 dnl Build Sync Services if required
8737 AC_SUBST(MOZ_SERVICES_SYNC)
8738 if test -n "$MOZ_SERVICES_SYNC"; then
8739   AC_DEFINE(MOZ_SERVICES_SYNC)
8742 dnl ========================================================
8743 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8744     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8747 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8748   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8751 dnl ========================================================
8752 dnl =
8753 dnl = Maintainer debug option (no --enable equivalent)
8754 dnl =
8755 dnl ========================================================
8757 AC_SUBST(AR)
8758 AC_SUBST(AR_FLAGS)
8759 AC_SUBST(AR_LIST)
8760 AC_SUBST(AR_EXTRACT)
8761 AC_SUBST(AR_DELETE)
8762 AC_SUBST(AS)
8763 AC_SUBST(ASFLAGS)
8764 AC_SUBST(AS_DASH_C_FLAG)
8765 AC_SUBST(LD)
8766 AC_SUBST(RC)
8767 AC_SUBST(RCFLAGS)
8768 AC_SUBST(WINDRES)
8769 AC_SUBST(IMPLIB)
8770 AC_SUBST(FILTER)
8771 AC_SUBST(BIN_FLAGS)
8772 AC_SUBST(NS_USE_NATIVE)
8773 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8774 AC_SUBST(MOZ_UPDATE_XTERM)
8775 AC_SUBST(MINIMO)
8776 AC_SUBST(MOZ_PLATFORM_MAEMO)
8777 AC_SUBST(MOZ_AUTH_EXTENSION)
8778 AC_SUBST(MOZ_MATHML)
8779 AC_SUBST(MOZ_PERMISSIONS)
8780 AC_SUBST(MOZ_XTF)
8781 AC_SUBST(MOZ_PREF_EXTENSIONS)
8782 AC_SUBST(MOZ_SVG)
8783 AC_SUBST(MOZ_SMIL)
8784 AC_SUBST(MOZ_XSLT_STANDALONE)
8785 AC_SUBST(MOZ_JS_LIBS)
8786 AC_SUBST(MOZ_PSM)
8787 AC_SUBST(MOZ_DEBUG)
8788 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8789 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8790 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8791 AC_SUBST(MOZ_DEBUG_FLAGS)
8792 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8793 AC_SUBST(WARNINGS_AS_ERRORS)
8794 AC_SUBST(MOZ_EXTENSIONS)
8795 AC_SUBST(MOZ_IMG_ENCODERS)
8796 AC_SUBST(MOZ_JSDEBUGGER)
8797 AC_SUBST(MOZ_PLUGINS)
8798 AC_SUBST(MOZ_LOG_REFCNT)
8799 AC_SUBST(MOZ_LEAKY)
8800 AC_SUBST(MOZ_JPROF)
8801 AC_SUBST(MOZ_SHARK)
8802 AC_SUBST(MOZ_CALLGRIND)
8803 AC_SUBST(MOZ_VTUNE)
8804 AC_SUBST(MOZ_JSLOADER)
8805 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8806 AC_SUBST(MOZ_QUANTIFY)
8807 AC_SUBST(LIBICONV)
8808 AC_SUBST(MOZ_PLACES)
8809 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8810 AC_SUBST(MOZ_STORAGE)
8811 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8812 AC_SUBST(MOZ_FEEDS)
8813 AC_SUBST(NS_PRINTING)
8814 AC_SUBST(MOZ_WEBGL)
8815 AC_SUBST(MOZ_HELP_VIEWER)
8817 AC_SUBST(MOZ_JAVAXPCOM)
8818 AC_SUBST(JAVA_INCLUDE_PATH)
8819 AC_SUBST(JAVA)
8820 AC_SUBST(JAVAC)
8821 AC_SUBST(JAR)
8823 AC_SUBST(MOZ_PROFILELOCKING)
8825 AC_SUBST(HAVE_XIE)
8826 AC_SUBST(MOZ_XIE_LIBS)
8828 AC_SUBST(BUILD_STATIC_LIBS)
8829 AC_SUBST(MOZ_ENABLE_LIBXUL)
8830 AC_SUBST(ENABLE_TESTS)
8831 AC_SUBST(IBMBIDI)
8832 AC_SUBST(MOZ_UNIVERSALCHARDET)
8833 AC_SUBST(ACCESSIBILITY)
8834 AC_SUBST(MOZ_VIEW_SOURCE)
8835 AC_SUBST(MOZ_SPELLCHECK)
8836 AC_SUBST(MOZ_USER_DIR)
8837 AC_SUBST(MOZ_CRASHREPORTER)
8838 AC_SUBST(MOZ_UPDATER)
8840 AC_SUBST(ENABLE_STRIP)
8841 AC_SUBST(PKG_SKIP_STRIP)
8842 AC_SUBST(USE_ELF_DYNSTR_GC)
8843 AC_SUBST(INCREMENTAL_LINKER)
8844 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8845 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8847 AC_SUBST(MOZ_FIX_LINK_PATHS)
8848 AC_SUBST(XPCOM_LIBS)
8849 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8850 AC_SUBST(XPCOM_GLUE_LDOPTS)
8851 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8853 AC_SUBST(USE_DEPENDENT_LIBS)
8855 AC_SUBST(MOZ_BUILD_ROOT)
8856 AC_SUBST(MOZ_OS2_TOOLS)
8857 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8859 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8860 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8861 AC_SUBST(MOZ_TIMELINE)
8862 AC_SUBST(OGLES_SDK_DIR)
8864 AC_SUBST(MOZ_APP_NAME)
8865 AC_SUBST(MOZ_APP_DISPLAYNAME)
8866 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8867 AC_SUBST(MOZ_APP_UA_NAME)
8868 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8869 AC_SUBST(MOZ_APP_VERSION)
8870 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
8871 AC_SUBST(MOZ_UA_FIREFOX_VERSION)
8872 AC_SUBST(FIREFOX_VERSION)
8873 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8874 AC_SUBST(MOZ_UA_BUILDID)
8876 AC_SUBST(MOZ_PKG_SPECIAL)
8878 AC_SUBST(MOZILLA_OFFICIAL)
8880 dnl win32 options
8881 AC_SUBST(MOZ_MAPINFO)
8882 AC_SUBST(MOZ_BROWSE_INFO)
8883 AC_SUBST(MOZ_TOOLS_DIR)
8884 AC_SUBST(CYGWIN_WRAPPER)
8885 AC_SUBST(AS_PERL)
8886 AC_SUBST(WIN32_REDIST_DIR)
8887 AC_SUBST(PYTHON)
8888 AC_SUBST(MAKENSISU)
8890 AC_SUBST(WINCE)
8891 AC_SUBST(WINCE_SDK_DIR)
8892 AC_SUBST(WINCE_WINDOWS_MOBILE)
8894 dnl Echo the CFLAGS to remove extra whitespace.
8895 CFLAGS=`echo \
8896         $_WARNINGS_CFLAGS \
8897         $CFLAGS`
8899 CXXFLAGS=`echo \
8900         $_MOZ_RTTI_FLAGS \
8901         $_MOZ_EXCEPTIONS_FLAGS \
8902         $_WARNINGS_CXXFLAGS \
8903         $CXXFLAGS`
8905 COMPILE_CFLAGS=`echo \
8906     $_DEFINES_CFLAGS \
8907         $_DEPEND_CFLAGS \
8908     $COMPILE_CFLAGS`
8910 COMPILE_CXXFLAGS=`echo \
8911     $_DEFINES_CXXFLAGS \
8912         $_DEPEND_CFLAGS \
8913     $COMPILE_CXXFLAGS`
8915 AC_SUBST(SYSTEM_MAKEDEPEND)
8916 AC_SUBST(SYSTEM_LIBXUL)
8917 AC_SUBST(SYSTEM_JPEG)
8918 AC_SUBST(SYSTEM_PNG)
8919 AC_SUBST(SYSTEM_ZLIB)
8920 AC_SUBST(SYSTEM_BZ2)
8922 AC_SUBST(JPEG_CFLAGS)
8923 AC_SUBST(JPEG_LIBS)
8924 AC_SUBST(ZLIB_CFLAGS)
8925 AC_SUBST(ZLIB_LIBS)
8926 AC_SUBST(BZ2_CFLAGS)
8927 AC_SUBST(BZ2_LIBS)
8928 AC_SUBST(PNG_CFLAGS)
8929 AC_SUBST(PNG_LIBS)
8931 AC_SUBST(MOZ_JPEG_CFLAGS)
8932 AC_SUBST(MOZ_JPEG_LIBS)
8933 AC_SUBST(MOZ_ZLIB_CFLAGS)
8934 AC_SUBST(MOZ_ZLIB_LIBS)
8935 AC_SUBST(MOZ_BZ2_CFLAGS)
8936 AC_SUBST(MOZ_BZ2_LIBS)
8937 AC_SUBST(MOZ_PNG_CFLAGS)
8938 AC_SUBST(MOZ_PNG_LIBS)
8940 AC_SUBST(NSPR_CFLAGS)
8941 AC_SUBST(NSPR_LIBS)
8942 AC_SUBST(MOZ_NATIVE_NSPR)
8944 AC_SUBST(NSS_CFLAGS)
8945 AC_SUBST(NSS_LIBS)
8946 AC_SUBST(NSS_DEP_LIBS)
8947 AC_SUBST(MOZ_NATIVE_NSS)
8948 AC_SUBST(NSS_DISABLE_DBM)
8950 AC_SUBST(CFLAGS)
8951 AC_SUBST(CXXFLAGS)
8952 AC_SUBST(CPPFLAGS)
8953 AC_SUBST(COMPILE_CFLAGS)
8954 AC_SUBST(COMPILE_CXXFLAGS)
8955 AC_SUBST(LDFLAGS)
8956 AC_SUBST(LIBS)
8957 AC_SUBST(CROSS_COMPILE)
8958 AC_SUBST(WCHAR_CFLAGS)
8960 AC_SUBST(HOST_CC)
8961 AC_SUBST(HOST_CXX)
8962 AC_SUBST(HOST_CFLAGS)
8963 AC_SUBST(HOST_CXXFLAGS)
8964 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8965 AC_SUBST(HOST_AR)
8966 AC_SUBST(HOST_AR_FLAGS)
8967 AC_SUBST(HOST_LD)
8968 AC_SUBST(HOST_RANLIB)
8969 AC_SUBST(HOST_NSPR_MDCPUCFG)
8970 AC_SUBST(HOST_BIN_SUFFIX)
8971 AC_SUBST(HOST_OS_ARCH)
8973 AC_SUBST(TARGET_CPU)
8974 AC_SUBST(TARGET_VENDOR)
8975 AC_SUBST(TARGET_OS)
8976 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8977 AC_SUBST(TARGET_MD_ARCH)
8978 AC_SUBST(TARGET_XPCOM_ABI)
8979 AC_SUBST(OS_TARGET)
8980 AC_SUBST(OS_ARCH)
8981 AC_SUBST(OS_RELEASE)
8982 AC_SUBST(OS_TEST)
8984 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8985 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8987 AC_SUBST(WRAP_MALLOC_CFLAGS)
8988 AC_SUBST(WRAP_MALLOC_LIB)
8989 AC_SUBST(MKSHLIB)
8990 AC_SUBST(MKCSHLIB)
8991 AC_SUBST(MKSHLIB_FORCE_ALL)
8992 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8993 AC_SUBST(DSO_CFLAGS)
8994 AC_SUBST(DSO_PIC_CFLAGS)
8995 AC_SUBST(DSO_LDOPTS)
8996 AC_SUBST(LIB_PREFIX)
8997 AC_SUBST(DLL_PREFIX)
8998 AC_SUBST(DLL_SUFFIX)
8999 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
9000 AC_SUBST(LIB_SUFFIX)
9001 AC_SUBST(OBJ_SUFFIX)
9002 AC_SUBST(BIN_SUFFIX)
9003 AC_SUBST(ASM_SUFFIX)
9004 AC_SUBST(IMPORT_LIB_SUFFIX)
9005 AC_SUBST(USE_N32)
9006 AC_SUBST(CC_VERSION)
9007 AC_SUBST(CXX_VERSION)
9008 AC_SUBST(MSMANIFEST_TOOL)
9009 AC_SUBST(NS_ENABLE_TSF)
9010 AC_SUBST(MOZ_NSS_PATCH)
9011 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9012 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9014 AC_SUBST(MOZ_MEDIA)
9015 AC_SUBST(MOZ_SYDNEYAUDIO)
9016 AC_SUBST(MOZ_WAVE)
9017 AC_SUBST(MOZ_VORBIS)
9018 AC_SUBST(MOZ_WEBM)
9019 AC_SUBST(MOZ_OGG)
9020 AC_SUBST(MOZ_ALSA_LIBS)
9021 AC_SUBST(VPX_AS)
9022 AC_SUBST(VPX_ASFLAGS)
9023 AC_SUBST(VPX_X86_ASM)
9025 if test "$USING_HCC"; then
9026    CC='${topsrcdir}/build/hcc'
9027    CC="$CC '$_OLDCC'"
9028    CXX='${topsrcdir}/build/hcpp'
9029    CXX="$CXX '$_OLDCXX'"
9030    AC_SUBST(CC)
9031    AC_SUBST(CXX)
9034 AC_MSG_CHECKING([for posix_fallocate])       
9035 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9036   #include <fcntl.h>],
9037                  [posix_fallocate(0, 0, 0);],
9038                  [ac_cv___posix_fallocate=true],
9039                  [ac_cv___posix_fallocate=false])
9041 if test "$ac_cv___posix_fallocate" = true ; then
9042   AC_DEFINE(HAVE_POSIX_FALLOCATE)
9043   AC_MSG_RESULT(yes)
9044 else
9045   AC_MSG_RESULT(no)
9048 dnl Check for missing components
9049 if test "$COMPILE_ENVIRONMENT"; then
9050 if test "$MOZ_X11"; then
9051     dnl ====================================================
9052     dnl = Check if X headers exist
9053     dnl ====================================================
9054     _SAVE_CFLAGS=$CFLAGS
9055     CFLAGS="$CFLAGS $XCFLAGS"
9056     AC_TRY_COMPILE([
9057         #include <stdio.h>
9058         #include <stdlib.h>
9059         #include <X11/Xlib.h>
9060         #include <X11/Intrinsic.h>
9061     ],
9062     [
9063         Display *dpy = 0;
9064         if ((dpy = XOpenDisplay(NULL)) == NULL) {
9065             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9066             exit(1);
9067         }
9068     ], [], 
9069     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9070     CFLAGS="$_SAVE_CFLAGS"
9072     if test ! -z "$MISSING_X"; then
9073         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9074     fi
9076 fi # MOZ_X11
9078 dnl Check for headers, etc. needed by WebGL.
9079 if test -n "$MOZ_WEBGL_GLX"; then
9080     AC_CHECK_HEADER(GL/glx.h)
9081     if test "$ac_cv_header_GL_glx_h" != "yes"; then
9082         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
9083     fi
9084 fi # MOZ_WEBGL_GLX
9085 fi # COMPILE_ENVIRONMENT
9087 if test "$USE_FC_FREETYPE"; then
9088     if test "$COMPILE_ENVIRONMENT"; then
9089         _SAVE_CPPFLAGS="$CPPFLAGS"
9090         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
9091         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
9092             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
9093         CPPFLAGS="$_SAVE_CPPFLAGS"
9094     else
9095         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
9096     fi
9099 dnl Set various defines and substitutions
9100 dnl ========================================================
9102 if test "$OS_ARCH" = "BeOS"; then
9103   AC_DEFINE(XP_BEOS)
9104 elif test "$OS_ARCH" = "Darwin"; then
9105   AC_DEFINE(XP_UNIX)
9106   AC_DEFINE(UNIX_ASYNC_DNS)
9107 elif test "$OS_ARCH" = "OpenVMS"; then
9108   AC_DEFINE(XP_UNIX)
9109 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
9110   AC_DEFINE(XP_UNIX)
9111   AC_DEFINE(UNIX_ASYNC_DNS)
9114 if test "$MOZ_DEBUG"; then
9115     AC_DEFINE(MOZ_REFLOW_PERF)
9116     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9119 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9120     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9121     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9122     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9123     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9124     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9125     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9126     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9127     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9130 dnl ========================================================
9131 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
9132 dnl ========================================================
9133 case "$host_os" in
9134 mingw*)
9135     WIN_TOP_SRC=`cd $srcdir; pwd -W`
9136     ;;
9137 cygwin*|msvc*|mks*)
9138     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
9139     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
9140     CC="\$(CYGWIN_WRAPPER) $CC"
9141     CXX="\$(CYGWIN_WRAPPER) $CXX"
9142     CPP="\$(CYGWIN_WRAPPER) $CPP"
9143     LD="\$(CYGWIN_WRAPPER) $LD"
9144     AS="\$(CYGWIN_WRAPPER) $AS"
9145     RC="\$(CYGWIN_WRAPPER) $RC"
9146     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
9147     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
9148     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
9149     ;;
9150 esac
9152 AC_SUBST(CYGDRIVE_MOUNT)
9153 AC_SUBST(WIN_TOP_SRC)
9155 AC_SUBST(MOZILLA_VERSION)
9157 AC_SUBST(ac_configure_args)
9159 dnl Spit out some output
9160 dnl ========================================================
9162 dnl The following defines are used by xpcom
9163 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9164 CPP_THROW_NEW
9165 HAVE_CPP_2BYTE_WCHAR_T
9166 HAVE_CPP_ACCESS_CHANGING_USING
9167 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9168 HAVE_CPP_BOOL
9169 HAVE_CPP_CHAR16_T
9170 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9171 HAVE_CPP_EXPLICIT
9172 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9173 HAVE_CPP_NAMESPACE_STD
9174 HAVE_CPP_NEW_CASTS
9175 HAVE_CPP_PARTIAL_SPECIALIZATION
9176 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9177 HAVE_CPP_TYPENAME
9178 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9179 HAVE_STATVFS
9180 NEED_CPP_UNUSED_IMPLEMENTATIONS
9181 NEW_H
9182 HAVE_GETPAGESIZE
9183 HAVE_ICONV
9184 HAVE_ICONV_WITH_CONST_INPUT
9185 HAVE_MBRTOWC
9186 HAVE_SYS_MOUNT_H
9187 HAVE_SYS_VFS_H
9188 HAVE_WCRTOMB
9191 AC_CONFIG_HEADER(
9192 netwerk/necko-config.h
9193 xpcom/xpcom-config.h
9194 xpcom/xpcom-private.h
9197 # Save the defines header file before autoconf removes it.
9198 # (Do not add AC_DEFINE calls after this line.)
9199   _CONFIG_TMP=confdefs-tmp.h
9200   _CONFIG_DEFS_H=mozilla-config.h
9202   cat > $_CONFIG_TMP <<\EOF
9203 /* List of defines generated by configure. Included with preprocessor flag,
9204  * -include, to avoid long list of -D defines on the compile command-line.
9205  * Do not edit.
9206  */
9208 #ifndef _MOZILLA_CONFIG_H_
9209 #define _MOZILLA_CONFIG_H_
9212 _EGREP_PATTERN='^#define ('
9213 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9214     for f in $_NON_GLOBAL_ACDEFINES; do
9215         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9216     done
9218 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9220   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9222   cat >> $_CONFIG_TMP <<\EOF
9224 #endif /* _MOZILLA_CONFIG_H_ */
9228   # Only write mozilla-config.h when something changes (or it doesn't exist)
9229   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9230     rm $_CONFIG_TMP
9231   else
9232     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9233     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9235     echo ==== $_CONFIG_DEFS_H =================================
9236     cat $_CONFIG_DEFS_H
9237   fi
9239 dnl Probably shouldn't call this manually but we always want the output of DEFS
9240 rm -f confdefs.h.save
9241 mv confdefs.h confdefs.h.save
9242 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9243 AC_OUTPUT_MAKE_DEFS()
9244 MOZ_DEFINES=$DEFS
9245 AC_SUBST(MOZ_DEFINES)
9246 rm -f confdefs.h
9247 mv confdefs.h.save confdefs.h
9249 dnl Load the list of Makefiles to generate.
9250 dnl   To add new Makefiles, edit allmakefiles.sh.
9251 dnl   allmakefiles.sh sets the variable, MAKEFILES.
9252 . ${srcdir}/allmakefiles.sh
9253 dnl 
9254 dnl Run a perl script to quickly create the makefiles.
9255 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9256 dnl   for the files it cannot handle correctly. This way, config.status
9257 dnl   will handle these files.
9258 dnl If it fails, nothing is set and config.status will run as usual.
9260 dnl This does not change the $MAKEFILES variable.
9262 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9264 if test -z "${AS_PERL}"; then
9265 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9266 else
9267 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9269 . ./conftest.sh
9270 rm conftest.sh
9272 echo $MAKEFILES > unallmakefiles
9274 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9276 AC_OUTPUT($MAKEFILES)
9278 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9279 if test "$CAIRO_FEATURES_H"; then
9280   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9281     echo "$CAIRO_FEATURES_H is unchanged"
9282     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9283   else
9284     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9285   fi
9288 dnl ========================================================
9289 dnl = Setup a nice relatively clean build environment for
9290 dnl = sub-configures.
9291 dnl ========================================================
9292 CC="$_SUBDIR_CC" 
9293 CXX="$_SUBDIR_CXX" 
9294 CFLAGS="$_SUBDIR_CFLAGS" 
9295 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9296 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9297 LDFLAGS="$_SUBDIR_LDFLAGS"
9298 HOST_CC="$_SUBDIR_HOST_CC" 
9299 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9300 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9303 unset MAKEFILES
9304 unset CONFIG_FILES
9306 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9307 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9309 if test -n "$MOZ_THUMB2"; then
9310   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9312 if test -n "$_WRAP_MALLOC"; then
9313   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9316 if test -z "$MOZ_NATIVE_NSPR"; then
9317     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9318     if test -z "$MOZ_DEBUG"; then
9319         ac_configure_args="$ac_configure_args --disable-debug"
9320     fi
9321     if test "$MOZ_OPTIMIZE" = "1"; then
9322         ac_configure_args="$ac_configure_args --enable-optimize"
9323     fi
9324     if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9325        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9326     fi
9327     if test -n "$HAVE_64BIT_OS"; then
9328         ac_configure_args="$ac_configure_args --enable-64bit"
9329     fi
9330     if test -n "$USE_ARM_KUSER"; then
9331         ac_configure_args="$ac_configure_args --with-arm-kuser"
9332     fi
9333     AC_OUTPUT_SUBDIRS(nsprpub)
9334     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9337 if test -z "$MOZ_NATIVE_NSPR"; then
9338     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9339     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9340     if test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
9341        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9342        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9343        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9344        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9345     fi
9346     rm -f config/autoconf.mk.bak
9349 # Run the SpiderMonkey 'configure' script.
9350 dist=$MOZ_BUILD_ROOT/dist
9351 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9352 ac_configure_args="$ac_configure_args --enable-threadsafe"
9353 if test "$BUILD_CTYPES"; then
9354     # Build js-ctypes on the platforms we can.
9355     ac_configure_args="$ac_configure_args --enable-ctypes"
9357 if test -z "$JS_SHARED_LIBRARY" ; then
9358     ac_configure_args="$ac_configure_args --disable-shared-js"
9360 if test -z "$MOZ_NATIVE_NSPR"; then
9361     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9362     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9364 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9365 ac_configure_args="$ac_configure_args --prefix=$dist"
9366 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9367 if test "$MOZ_MEMORY"; then
9368    ac_configure_args="$ac_configure_args --enable-jemalloc"
9369    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9370      export MOZ_MEMORY_LDFLAGS
9371    fi
9373 AC_OUTPUT_SUBDIRS(js/src)
9374 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9376 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9378 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9379 dnl Needs to be at the end to respect possible changes from NSPR configure
9380 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9381   echo "config/autoconf.mk is unchanged"
9382   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9383 else
9384   rm -f config/autoconf.mk.orig 2> /dev/null