Fix register allocation inside STRICTEQ (bug 610498, r=dmandelin).
[mozilla-central.git] / configure.in
blob93ea427e81b5b82cc82b2d25fe6aa14e8e71ef21
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.10
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
339     ZLIB_DIR=yes
342 AC_SUBST(ANDROID_NDK)
343 AC_SUBST(ANDROID_TOOLCHAIN)
344 AC_SUBST(ANDROID_PLATFORM)
345 AC_SUBST(ANDROID_SDK)
346 AC_SUBST(ANDROID_TOOLS)
348 dnl ========================================================
349 dnl Checks for compilers.
350 dnl ========================================================
351 dnl Set CROSS_COMPILE in the environment when running configure
352 dnl to use the cross-compile setup for now
353 dnl ========================================================
355 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
356 AR_FLAGS='cr $@'
358 if test "$COMPILE_ENVIRONMENT"; then
360 dnl Do some special WinCE toolchain stuff
361 case "$target" in
362 *wince|*winmo)
364     MOZ_ARG_WITH_STRING(wince-sdk,
365     [  --with-wince-sdk=WINCE_SDK_DIR
366                           The path to the Windows CE SDK],
367     WINCE_SDK_DIR=$withval)
369     MOZ_ARG_WITH_STRING(ogles-sdk,
370     [  --with-ogles-sdk=OGLES_SDK_DIR
371                           The path to the OGLES SDK],
372     OGLES_SDK_DIR=$withval)
374     AC_DEFINE(WINCE)
375     
376     export WINCE=1
378     echo -----------------------------------------------------------------------------
379     echo Building Windows CE Shunt Library and Tool Chain
380     echo Using SDK in:
381     echo $WINCE_SDK_DIR
383     ac_exeext=.exe
385     _pwd=`pwd -W`
386     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
387     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
388     TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
389     -C $srcdir/build/wince/tools
391     CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
392     CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
393     CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
394     CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
395     LD="$_pwd/dist/sdk/bin/$target-link.exe"
396     AR="$_pwd/dist/sdk/bin/$target-lib.exe"
397     AS="$_pwd/dist/sdk/bin/$target-as.exe"
398     RC="$_pwd/dist/sdk/bin/$target-res.exe"
401     echo -----------------------------------------------------------------------------
403     ;;
404 esac
406 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
407     echo "cross compiling from $host to $target"
408     cross_compiling=yes
410     _SAVE_CC="$CC"
411     _SAVE_CFLAGS="$CFLAGS"
412     _SAVE_LDFLAGS="$LDFLAGS"
414     AC_MSG_CHECKING([for host c compiler])
415     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
416     if test -z "$HOST_CC"; then
417         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
418     fi
419     AC_MSG_RESULT([$HOST_CC])
420     AC_MSG_CHECKING([for host c++ compiler])
421     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
422     if test -z "$HOST_CXX"; then
423         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
424     fi
425     AC_MSG_RESULT([$HOST_CXX])
427     if test -z "$HOST_CFLAGS"; then
428         HOST_CFLAGS="$CFLAGS"
429     fi
430     if test -z "$HOST_CXXFLAGS"; then
431         HOST_CXXFLAGS="$CXXFLAGS"
432     fi
433     if test -z "$HOST_LDFLAGS"; then
434         HOST_LDFLAGS="$LDFLAGS"
435     fi
436     if test -z "$HOST_AR_FLAGS"; then
437         HOST_AR_FLAGS="$AR_FLAGS"
438     fi
439     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
440     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
441     CC="$HOST_CC"
442     CFLAGS="$HOST_CFLAGS"
443     LDFLAGS="$HOST_LDFLAGS"
445     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
446     AC_TRY_COMPILE([], [return(0);], 
447         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
448         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
450     CC="$HOST_CXX"
451     CFLAGS="$HOST_CXXFLAGS"
453     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
454     AC_TRY_COMPILE([], [return(0);], 
455         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
456         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
457     
458     CC=$_SAVE_CC
459     CFLAGS=$_SAVE_CFLAGS
460     LDFLAGS=$_SAVE_LDFLAGS
462     case "$build:$target" in
463       powerpc-apple-darwin8*:i?86-apple-darwin*)
464         dnl The Darwin cross compiler doesn't necessarily point itself at a
465         dnl root that has libraries for the proper architecture, it defaults
466         dnl to the system root.  The libraries in the system root on current
467         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
468         dnl checks will fail.  Fake a working SDK in that case.
469         _SAVE_CFLAGS=$CFLAGS
470         _SAVE_CXXFLAGS=$CXXLAGS
471         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
472         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
473         ;;
474     esac
476     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
477     unset ac_cv_prog_CC
478     AC_PROG_CC
479     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
480     unset ac_cv_prog_CXX
481     AC_PROG_CXX
483     case "$build:$target" in
484       powerpc-apple-darwin8*:i?86-apple-darwin*)
485         dnl Revert the changes made above.  From this point on, the target
486         dnl compiler will never be used without applying the SDK to CFLAGS
487         dnl (see --with-macos-sdk below).
488         CFLAGS=$_SAVE_CFLAGS
489         CXXFLAGS=$_SAVE_CXXFLAGS
490         ;;
491     esac
493     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
494     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
495     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
496     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
497     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
498     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
499     AC_DEFINE(CROSS_COMPILE)
500 else
501     AC_PROG_CC
502     AC_PROG_CXX
503     AC_PROG_RANLIB
504     MOZ_PATH_PROGS(AS, $AS as, $CC)
505     AC_CHECK_PROGS(AR, ar, :)
506     AC_CHECK_PROGS(LD, ld, :)
507     AC_CHECK_PROGS(STRIP, strip, :)
508     AC_CHECK_PROGS(WINDRES, windres, :)
509     if test -z "$HOST_CC"; then
510         HOST_CC='$(CC)'
511     fi
512     if test -z "$HOST_CFLAGS"; then
513         HOST_CFLAGS='$(CFLAGS)'
514     fi
515     if test -z "$HOST_CXX"; then
516         HOST_CXX='$(CXX)'
517     fi
518     if test -z "$HOST_CXXFLAGS"; then
519         HOST_CXXFLAGS='$(CXXFLAGS)'
520     fi
521     if test -z "$HOST_LDFLAGS"; then
522         HOST_LDFLAGS='$(LDFLAGS)'
523     fi
524     if test -z "$HOST_RANLIB"; then
525         HOST_RANLIB='$(RANLIB)'
526     fi
527     if test -z "$HOST_AR"; then
528         HOST_AR='$(AR)'
529     fi
530     if test -z "$HOST_AR_FLAGS"; then
531         HOST_AR_FLAGS='$(AR_FLAGS)'
532     fi
535 GNU_AS=
536 GNU_LD=
537 GNU_CC=
538 GNU_CXX=
539 CC_VERSION='N/A'
540 CXX_VERSION='N/A'
541 if test "$GCC" = "yes"; then
542     GNU_CC=1
543     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
545 if test "$GXX" = "yes"; then
546     GNU_CXX=1
547     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
549 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
550     GNU_AS=1
552 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
553     GNU_LD=1
555 if test "$GNU_CC"; then
556     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
557         GCC_USE_GNU_LD=1
558     fi
561 INTEL_CC=
562 INTEL_CXX=
563 if test "$GCC" = yes; then
564    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
565      INTEL_CC=1
566    fi
569 if test "$GXX" = yes; then
570    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
571      INTEL_CXX=1
572    fi
575 dnl Special win32 checks
576 dnl ========================================================
577 case "$target" in
578 *-wince|*-winmo)
579     WINVER=500
580     WINSDK_TARGETVER=502
581     ;;
583     WINVER=502
584     dnl Target the Windows 7 SDK by default
585     WINSDK_TARGETVER=601
586     ;;
587 esac
589 MOZ_ARG_WITH_STRING(windows-version,
590 [  --with-windows-version=WINSDK_TARGETVER
591                           Highest Windows version to target using this SDK
592                               502: Windows Server 2003
593                               600: Windows Vista
594                               601: Windows 7],
595   WINSDK_TARGETVER=$withval)
597 case "$WINSDK_TARGETVER" in
598 502|600|601)
599     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
600     ;;
603     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
604     ;;
606 esac
608 if test -n "$COMPILE_ENVIRONMENT"; then
609 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
610     # We can't build parental controls either
611     MOZ_DISABLE_PARENTAL_CONTROLS=1
615 case "$target" in
616 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
617     if test "$GCC" != "yes"; then
618         # Check to see if we are really running in a msvc environemnt
619         _WIN32_MSVC=1
620         AC_CHECK_PROGS(MIDL, midl)
622         # Make sure compilers are valid
623         CFLAGS="$CFLAGS -TC -nologo"
624         CXXFLAGS="$CXXFLAGS -TP -nologo"
625         AC_LANG_SAVE
626         AC_LANG_C
627         AC_TRY_COMPILE([#include <stdio.h>],
628             [ printf("Hello World\n"); ],,
629             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
631         AC_LANG_CPLUSPLUS
632         AC_TRY_COMPILE([#include <new.h>],
633             [ unsigned *test = new unsigned(42); ],,
634             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
635         AC_LANG_RESTORE
636         
637         changequote(,)
638         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
639         changequote([,])
640         
641         # Determine compiler version
642         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
643         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
644         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
645         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
646         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
647         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
649         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
650         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
652         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
653             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
654         fi
655         if test "$_CC_MAJOR_VERSION" = "13"; then
656             _CC_SUITE=7
657         elif test "$_CC_MAJOR_VERSION" = "14"; then
658             _CC_SUITE=8
659             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
660             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
661             dnl so be very specific here!
662             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
663             if test $_CC_RELEASE -gt 50727; then
664                _USE_DYNAMICBASE=1
665             elif test $_CC_BUILD -ge 762; then
666                _USE_DYNAMICBASE=1
667             fi
668             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
669             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
670         elif test "$_CC_MAJOR_VERSION" = "15"; then
671             _CC_SUITE=9
672             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
673             _USE_DYNAMICBASE=1
674             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
675             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
676         elif test "$_CC_MAJOR_VERSION" = "16"; then
677             _CC_SUITE=10
678             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
679             _USE_DYNAMICBASE=1
680             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
681             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
682         else
683             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
684         fi
686         _MOZ_RTTI_FLAGS_ON='-GR'
687         _MOZ_RTTI_FLAGS_OFF='-GR-'
688         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
689         _MOZ_EXCEPTIONS_FLAGS_OFF=''
691         if test -n "$WIN32_REDIST_DIR"; then
692             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
693         fi
694         
695         # bug #249782
696         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
697         if test "$_CC_SUITE" -ge "8"; then
698                 changequote(,)
699                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
700                 changequote([,])
702                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
703                 if test -n "$MSMT_TOOL"; then
704                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
705                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
706                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
707                         fi
708                         MSMANIFEST_TOOL=1
709                         unset MSMT_TOOL
710                 else
711                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
712                 fi
713         fi
715         # Check linker version
716         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
717         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
718         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
719             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
720         fi
721         INCREMENTAL_LINKER=1
723         # Check midl version
724         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
725         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
726         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
727         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
728         # Add flags if necessary
729         AC_MSG_CHECKING([for midl flags])
730         case "$target" in
731         i*86-*)
732             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
733                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
734                 # MIDL version 7.00.0500 or later has no problem.
735                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
736                 AC_MSG_RESULT([need -env win32])
737             else
738                 AC_MSG_RESULT([none needed])
739             fi
740             ;;
741         x86_64-*)
742             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
743             ;;
744         *)
745             AC_MSG_RESULT([none needed])
746             ;;
747         esac
749         # Identify which version of the SDK we're building with
750         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
751         # from there
752         AC_CHECK_HEADERS([winsdkver.h])
753         if test "$ac_cv_header_winsdkver_h" = "yes"; then
754             # Get the highest _WIN32_WINNT and NTDDI versions supported
755             # Take the higher of the two
756             # This is done because the Windows 7 beta SDK reports its
757             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
758             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
759                            ac_cv_winsdk_maxver,
760                            [cat > conftest.h <<EOF
761 #include <winsdkver.h>
762 #include <sdkddkver.h>
764 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
765 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
766 #else
767 #define WINSDK_MAXVER NTDDI_MAXVER
768 #endif
770 WINSDK_MAXVER
772                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
773                             rm -f conftest.h
774                            ])
775             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
776         else
777             # The Vista SDK is the only one to have sdkddkver.h but not
778             # WinSDKVer.h
779             AC_CHECK_HEADERS([sdkddkver.h])
780             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
781                 MOZ_WINSDK_MAXVER=0x06000000
782             else
783                 # Assume the Server 2003 Platform SDK
784                 MOZ_WINSDK_MAXVER=0x05020000
785             fi
786         fi
788         unset _MSVC_VER_FILTER
790         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
791             [
792                 AC_LANG_SAVE
793                 AC_LANG_CPLUSPLUS
794                 _SAVE_CXXFLAGS="$CXXFLAGS"
795                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
796                 AC_TRY_COMPILE([#include <exception>],
797                             [std::_Throw(std::exception()); return 0;],
798                             ac_cv_have_std__Throw="yes",
799                             ac_cv_have_std__Throw="no")
800                 CXXFLAGS="$_SAVE_CXXFLAGS"
801                 AC_LANG_RESTORE
802             ])
804         if test "$ac_cv_have_std__Throw" == "yes"; then
805             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
806                            ac_cv_have_dllimport_exception_bug,
807                 [
808                     AC_LANG_SAVE
809                     AC_LANG_CPLUSPLUS
810                     _SAVE_CXXFLAGS="$CXXFLAGS"
811                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
812                     AC_TRY_LINK([#include <vector>],
813                                 [std::vector<int> v; return v.at(1);],
814                                 ac_cv_have_dllimport_exception_bug="no",
815                                 ac_cv_have_dllimport_exception_bug="yes")
816                     CXXFLAGS="$_SAVE_CXXFLAGS"
817                     AC_LANG_RESTORE
818                 ])
819             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
820                 WRAP_STL_INCLUDES=1
821                 MOZ_MSVC_STL_WRAP__Throw=1
822                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
823             fi
824         else
825             AC_CACHE_CHECK(for overridable _RAISE,
826                            ac_cv_have__RAISE,
827                 [
828                     AC_LANG_SAVE
829                     AC_LANG_CPLUSPLUS
830                     _SAVE_CXXFLAGS="$CXXFLAGS"
831                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
832                     AC_TRY_COMPILE([#include <xstddef>
833                                     #undef _RAISE
834                                     #define _RAISE(x) externallyDefinedFunction((x).what())
835                                     #include <vector>
836                                    ],
837                                    [std::vector<int> v; return v.at(1);],
838                                    ac_cv_have__RAISE="no",
839                                    ac_cv_have__RAISE="yes")
840                     CXXFLAGS="$_SAVE_CXXFLAGS"
841                     AC_LANG_RESTORE
842                 ])
843             if test "$ac_cv_have__RAISE" = "yes"; then
844                 WRAP_STL_INCLUDES=1
845                 MOZ_MSVC_STL_WRAP__RAISE=1
846                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
847             else
848                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
849             fi
850         fi
852         if test "$WRAP_STL_INCLUDES" = "1"; then
853             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
854         fi
855     else
856         # Check w32api version
857         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
858         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
859         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
860         AC_TRY_COMPILE([#include <w32api.h>],
861             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
862                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
863                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
864                 #error "test failed."
865             #endif
866             , [ res=yes ], [ res=no ])
867         AC_MSG_RESULT([$res])
868         if test "$res" != "yes"; then
869             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
870         fi
871         # Check windres version
872         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
873         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
874         AC_MSG_RESULT([$_WINDRES_VERSION])
875         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
876         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
877         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
878         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
879         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
880         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
881         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
882                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
883                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
884                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
885                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
886                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
887         then
888             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
889         fi
891         # Server 2003 is the highest version supported
892         MOZ_WINSDK_MAXVER=0x05020000
893     fi # !GNU_CC
895     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
896     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
897     # Require OS features provided by IE 5.0
898     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
900     # If the maximum version supported by this SDK is lower than the target
901     # version, error out
902     AC_MSG_CHECKING([for Windows SDK being recent enough])
903     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
904         AC_MSG_RESULT("yes")
905     else
906         AC_MSG_RESULT("no")
907         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.])
908     fi
910     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
911     # Definitions matching sdkddkver.h
912     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
913     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
914     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
915     ;;
916 esac
918 dnl Test breaks icc on OS/2 && MSVC
919 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
920     AC_PROG_CC_C_O
921     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
922         USING_HCC=1
923         _OLDCC=$CC
924         _OLDCXX=$CXX
925         CC="${srcdir}/build/hcc '$CC'"
926         CXX="${srcdir}/build/hcpp '$CXX'"
927     fi
930 AC_PROG_CPP
931 AC_PROG_CXXCPP
933 if test -n "$_WIN32_MSVC"; then
934     SKIP_PATH_CHECKS=1
935     SKIP_COMPILER_CHECKS=1
936     SKIP_LIBRARY_CHECKS=1
938     # Since we're skipping compiler and library checks, hard-code
939     # some facts here.
940     case "$target" in
941     *-wince|*-winmo)
942         ;;
943     *)
944         AC_DEFINE(HAVE_IO_H)
945         AC_DEFINE(HAVE_SETBUF)
946         AC_DEFINE(HAVE_ISATTY)
947         ;;
948     esac
951 fi # COMPILE_ENVIRONMENT
953 AC_SUBST(MIDL_FLAGS)
954 AC_SUBST(_MSC_VER)
956 AC_SUBST(GNU_AS)
957 AC_SUBST(GNU_LD)
958 AC_SUBST(GNU_CC)
959 AC_SUBST(GNU_CXX)
960 AC_SUBST(INTEL_CC)
961 AC_SUBST(INTEL_CXX)
963 AC_SUBST(STL_FLAGS)
964 AC_SUBST(WRAP_STL_INCLUDES)
965 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
966 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
968 dnl ========================================================
969 dnl Checks for programs.
970 dnl ========================================================
971 AC_PROG_INSTALL
972 AC_PROG_LN_S
974 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
975 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
976 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
977 _perl_res=$?
978 AC_MSG_RESULT([$_perl_version])
980 if test "$_perl_res" != 0; then
981     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
985 AC_MSG_CHECKING([for full perl installation])
986 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
987 _perl_res=$?
988 if test "$_perl_res" != 0; then
989     AC_MSG_RESULT([no])
990     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
991 else
992     AC_MSG_RESULT([yes])    
995 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
996 if test -z "$PYTHON"; then
997     AC_MSG_ERROR([python was not found in \$PATH])
1000 if test -z "$COMPILE_ENVIRONMENT"; then
1001     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1003 AC_SUBST(NSINSTALL_BIN)
1005 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1006 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1007 MOZ_PATH_PROG(UNZIP, unzip, :)
1008 MOZ_PATH_PROGS(ZIP, zip)
1009 if test -z "$ZIP" -o "$ZIP" = ":"; then
1010     AC_MSG_ERROR([zip not found in \$PATH])
1012 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1013 MOZ_PATH_PROG(XARGS, xargs)
1014 if test -z "$XARGS" -o "$XARGS" = ":"; then
1015     AC_MSG_ERROR([xargs not found in \$PATH .])
1018 if test "$COMPILE_ENVIRONMENT"; then
1020 dnl ========================================================
1021 dnl = Mac OS X toolchain support
1022 dnl ========================================================
1024 case "$target_os" in
1025 darwin*)
1026     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1027     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1028     dnl the environment and includedir purposes (when using an SDK, below),
1029     dnl but remember the full version number for the libdir (SDK).
1030     changequote(,)
1031     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1032     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1033     changequote([,])
1034     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1035         dnl Bug 280479, but this keeps popping up in bug 292530 too because
1036         dnl 4.0.0/4061 is the default compiler in Tiger.
1037         changequote(,)
1038         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1039         changequote([,])
1040         if test "$GCC_BUILD" = "4061" ; then
1041             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1042 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1043 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1044         fi
1045     fi
1047     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1048     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
1049     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1050     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1052     case "$PBBUILD" in
1053       *xcodebuild*)
1054         changequote(,)
1055         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1056         changequote([,])
1057         if test -n "$XCODEBUILD_VERSION" -a "$XCODEBUILD_VERSION" -ge 620 ; then
1058           HAS_XCODE_2_1=1;
1059         fi
1060       ;;
1061     esac
1063     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
1064     dnl it has moved into /usr/bin.
1065     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1066     ;;
1067 esac
1069 AC_SUBST(GCC_VERSION)
1070 AC_SUBST(XCODEBUILD_VERSION)
1071 AC_SUBST(HAS_XCODE_2_1)
1073 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1074 dnl that a universal binary is being produced.
1075 AC_SUBST(UNIVERSAL_BINARY)
1077 dnl ========================================================
1078 dnl Check for MacOS deployment target version
1079 dnl ========================================================
1081 MOZ_ARG_ENABLE_STRING(macos-target,
1082                       [  --enable-macos-target=VER (default=10.5)
1083                           Set the minimum MacOS version needed at runtime],
1084                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1086 case "$target" in
1087 *-darwin*)
1088     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1089         dnl Use the specified value
1090         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1091         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1092     else
1093         dnl No value specified on the command line or in the environment,
1094         dnl use architecture minimum.
1095         case "${target_cpu}" in
1096           ppc*)
1097             export MACOSX_DEPLOYMENT_TARGET=10.5
1098             ;;
1099           i*86)
1100             export MACOSX_DEPLOYMENT_TARGET=10.5
1101             ;;
1102           x86_64)
1103             export MACOSX_DEPLOYMENT_TARGET=10.6
1104             ;;
1105         esac
1106     fi
1107     ;;
1108 esac
1110 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1112 dnl ========================================================
1113 dnl = Mac OS X SDK support
1114 dnl ========================================================
1115 MACOS_SDK_DIR=
1116 NEXT_ROOT=
1117 MOZ_ARG_WITH_STRING(macos-sdk,
1118 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
1119     MACOS_SDK_DIR=$withval)
1121 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1122 dnl NEXT_ROOT will be set and exported only if it's needed.
1123 AC_SUBST(MACOS_SDK_DIR)
1124 AC_SUBST(NEXT_ROOT)
1126 if test "$MACOS_SDK_DIR"; then
1127   dnl Sync this section with the ones in NSPR and NSS.
1128   dnl Changes to the cross environment here need to be accounted for in
1129   dnl the libIDL checks (below) and xpidl build.
1131   if test ! -d "$MACOS_SDK_DIR"; then
1132     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1133 specify a valid SDK.  SDKs are installed when the optional cross-development
1134 tools are selected during the Xcode/Developer Tools installation.])
1135   fi
1137   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1138   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1139     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1140   else
1141     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1142     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1144     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1145     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1146     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1148     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1149       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1150       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1151       dnl be ignored and cause warnings when -syslibroot is specified.
1152       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1153       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1154       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1155     fi
1156   fi
1158   AC_LANG_SAVE
1159   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1160   AC_LANG_CPLUSPLUS
1161   AC_TRY_COMPILE([#include <new>
1162                  int main() { return 0; }],
1163    result=yes,
1164    result=no)
1165   AC_LANG_RESTORE
1166   AC_MSG_RESULT($result)
1168   if test "$result" = "no" ; then
1169     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1170   fi
1173 fi # COMPILE_ENVIRONMENT
1175 if test -n "$MAKE"; then
1176   if test `echo $MAKE | grep -c make.py` != 1; then
1177      NOT_PYMAKE=$MAKE
1178   fi
1181 case "$host_os" in
1182 cygwin*|mingw*|mks*|msvc*)
1183     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1184     ;;
1186     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1187     ;;
1188 esac
1189 if test "$GMAKE" = ":"; then
1190    AC_MSG_ERROR([GNU make not found])
1192 AC_SUBST(GMAKE)
1194 if test "$COMPILE_ENVIRONMENT"; then
1196 AC_PATH_XTRA
1198 XCFLAGS="$X_CFLAGS"
1200 fi # COMPILE_ENVIRONMENT
1202 dnl ========================================================
1203 dnl set the defaults first
1204 dnl ========================================================
1205 AS_BIN=$AS
1206 AR_LIST='$(AR) t'
1207 AR_EXTRACT='$(AR) x'
1208 AR_DELETE='$(AR) d'
1209 AS='$(CC)'
1210 AS_DASH_C_FLAG='-c'
1211 DLL_PREFIX=lib
1212 LIB_PREFIX=lib
1213 DLL_SUFFIX=.so
1214 OBJ_SUFFIX=o
1215 LIB_SUFFIX=a
1216 ASM_SUFFIX=s
1217 IMPORT_LIB_SUFFIX=
1218 TARGET_MD_ARCH=unix
1219 DIRENT_INO=d_ino
1220 CYGWIN_WRAPPER=
1221 WIN_TOP_SRC=
1222 MOZ_USER_DIR=".mozilla"
1224 MOZ_JPEG_CFLAGS=
1225 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1226 MOZ_ZLIB_CFLAGS=
1227 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1228 MOZ_BZ2_CFLAGS=
1229 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1230 MOZ_PNG_CFLAGS=
1231 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1233 MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
1234 MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1235 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1236 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1237 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1238 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1239 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1240 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1242 MOZ_FS_LAYOUT=unix
1244 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1246 USE_DEPENDENT_LIBS=1
1248 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1250 if test -n "$CROSS_COMPILE"; then
1251     OS_TARGET="${target_os}"
1252     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1253     OS_RELEASE=
1254     case "${target_os}" in
1255         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1256         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1257         gnu*)         OS_ARCH=GNU ;;
1258         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1259         mingw*)       OS_ARCH=WINNT ;;
1260         wince*)       OS_ARCH=WINCE ;;
1261         winmo*)       OS_ARCH=WINCE ;;
1262         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1263     esac
1264     case "${target}" in
1265         arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1266     esac
1267 else
1268     OS_TARGET=`uname -s`
1269     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1270     OS_RELEASE=`uname -r`
1273 # Before this used `uname -m` when not cross compiling
1274 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1275 OS_TEST="${target_cpu}"
1277 _COMPILER_PREFIX=
1279 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1281 #######################################################################
1282 # Master "Core Components" macros for getting the OS target           #
1283 #######################################################################
1286 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1287 # cross-compilation.
1291 # Define and override various archtecture-specific variables, including
1292 # HOST_OS_ARCH
1293 # OS_ARCH
1294 # OS_TEST
1295 # OS_TARGET
1296 # OS_RELEASE
1297 # OS_MINOR_RELEASE
1300 case "$HOST_OS_ARCH" in
1301 cygwin*|mingw*|mks*|msvc*)
1302     HOST_OS_ARCH=WINNT
1303     ;;
1304 darwin*)
1305     HOST_OS_ARCH=Darwin
1306     ;;
1307 linux*)
1308     HOST_OS_ARCH=Linux
1309     ;;
1310 solaris*)
1311     HOST_OS_ARCH=SunOS
1312     SOLARIS_SUNPRO_CC=
1313     SOLARIS_SUNPRO_CXX=
1314     if test -z "$GNU_CC"; then
1315         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1316             SOLARIS_SUNPRO_CC=1
1317        fi
1318     fi
1320     if test -z "$GNU_CXX"; then
1321        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1322            SOLARIS_SUNPRO_CXX=1
1323        fi
1324     fi
1325     AC_SUBST(SOLARIS_SUNPRO_CC)
1326     AC_SUBST(SOLARIS_SUNPRO_CXX)
1327     ;;
1328 BSD_386)
1329     HOST_OS_ARCH=BSD
1330     ;;
1331 dgux)
1332     HOST_OS_ARCH=DGUX
1333     ;;
1334 IRIX64)
1335     HOST_OS_ARCH=IRIX
1336     ;;
1337 UNIX_SV)
1338     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1339         HOST_OS_ARCH=NCR
1340     else
1341         HOST_OS_ARCH=UNIXWARE
1342     fi
1343     ;;
1344 ncr)
1345     HOST_OS_ARCH=NCR
1346     ;;
1347 UNIX_SYSTEM_V)
1348     HOST_OS_ARCH=NEC
1349     ;;
1350 OSF1)
1351     ;;
1352 *OpenVMS*)
1353     HOST_OS_ARCH=OpenVMS
1354     ;;
1355 OS_2)
1356     HOST_OS_ARCH=OS2
1357     ;;
1358 QNX)
1359     ;;
1360 SCO_SV)
1361     HOST_OS_ARCH=SCOOS
1362     ;;
1363 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1364     HOST_OS_ARCH=SINIX
1365     ;;
1366 UnixWare)
1367     HOST_OS_ARCH=UNIXWARE
1368     ;;
1369 esac
1371 case "$OS_ARCH" in
1372 WINNT)
1373     if test -z "$CROSS_COMPILE" ; then
1374         OS_TEST=`uname -p`
1375     fi
1376     ;;
1377 Windows_NT)
1379 # If uname -s returns "Windows_NT", we assume that we are using
1380 # the uname.exe in MKS toolkit.
1382 # The -r option of MKS uname only returns the major version number.
1383 # So we need to use its -v option to get the minor version number.
1384 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1386     OS_ARCH=WINNT
1387     OS_TARGET=WINNT
1388     OS_MINOR_RELEASE=`uname -v`
1389     if test "$OS_MINOR_RELEASE" = "00"; then
1390         OS_MINOR_RELEASE=0
1391     fi
1392     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1393     ;;
1394 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1396 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1397 # the uname.exe in the Cygwin tools.
1398 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1399 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1400 # the uname.exe in the GNU-Win32 tools.
1401 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1402 # the uname.exe in the MSYS tools.
1404     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1405     OS_ARCH=WINNT
1406     OS_TARGET=WINNT
1407     ;;
1408 AIX)
1409     OS_RELEASE=`uname -v`.`uname -r`
1410     OS_TEST=${target_cpu}
1411     ;;
1412 BSD_386)
1413     OS_ARCH=BSD
1414     ;;
1415 dgux)
1416     OS_ARCH=DGUX
1417     ;;
1418 IRIX64)
1419     OS_ARCH=IRIX
1420     ;;
1421 UNIX_SV)
1422     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1423         OS_ARCH=NCR
1424     else
1425         OS_ARCH=UNIXWARE
1426         OS_RELEASE=`uname -v`
1427     fi
1428     ;;
1429 ncr)
1430     OS_ARCH=NCR
1431     ;;
1432 UNIX_SYSTEM_V)
1433     OS_ARCH=NEC
1434     ;;
1435 OSF1)
1436     case `uname -v` in
1437     148)
1438         OS_RELEASE=V3.2C
1439         ;;
1440     564)
1441         OS_RELEASE=V4.0B
1442         ;;
1443     878)
1444         OS_RELEASE=V4.0D
1445         ;;
1446     esac
1447     ;;
1448 *OpenVMS*)
1449     OS_ARCH=OpenVMS
1450     OS_RELEASE=`uname -v`
1451     OS_TEST=`uname -p`
1452     ;;
1453 OS_2)
1454     OS_ARCH=OS2
1455     OS_TARGET=OS2
1456     OS_RELEASE=`uname -v`
1457     ;;
1458 QNX)
1459     if test "$OS_TARGET" != "NTO"; then
1460         changequote(,)
1461         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1462         changequote([,])
1463     fi
1464     OS_TEST=x86
1465     ;;
1466 SCO_SV)
1467     OS_ARCH=SCOOS
1468     OS_RELEASE=5.0
1469     ;;
1470 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1471     OS_ARCH=SINIX
1472     OS_TEST=`uname -p`
1473     ;;
1474 UnixWare)
1475     OS_ARCH=UNIXWARE
1476     OS_RELEASE=`uname -v`
1477     ;;
1478 WINCE)
1479     OS_ARCH=WINCE
1480     case "${target_os}" in
1481     *winmo)
1482         OS_TARGET=WINMO
1483         WINCE_WINDOWS_MOBILE=1
1484         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1485         ;;
1486     *)
1487         OS_TARGET=WINCE
1488         ;;
1489     esac
1490     ;;
1491 Darwin)
1492     case "${target_cpu}" in
1493     powerpc*)
1494         OS_TEST=ppc
1495         ;;
1496     i*86*)
1497         OS_TEST=i386 
1498         ;;
1499     x86_64)
1500         OS_TEST=x86_64
1501         ;;
1502     *)
1503         if test -z "$CROSS_COMPILE" ; then
1504             OS_TEST=`uname -p`
1505         fi
1506         ;;
1507     esac
1508     ;;
1509 esac
1511 if test "$OS_ARCH" = "NCR"; then
1512     changequote(,)
1513     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1514     changequote([,])
1517 # Only set CPU_ARCH if we recognize the value of OS_TEST
1519 case "$OS_TEST" in
1520 *86 | i86pc)
1521     CPU_ARCH=x86
1522     ;;
1524 powerpc64 | ppc64)
1525     CPU_ARCH=ppc64
1526     ;;
1528 powerpc | ppc | rs6000)
1529     CPU_ARCH=ppc
1530     ;;
1532 Alpha | alpha | ALPHA)
1533     CPU_ARCH=Alpha
1534     ;;
1536 s390)
1537     CPU_ARCH=s390
1538     ;;
1540 s390x)
1541     CPU_ARCH=s390x
1542     ;;
1544 hppa* | parisc)
1545     CPU_ARCH=hppa
1546     ;;
1548 sun4u | sparc*)
1549     CPU_ARCH=sparc
1550     ;;
1552 x86_64 | ia64)
1553     CPU_ARCH="$OS_TEST"
1554     ;;
1556 arm*)
1557     CPU_ARCH=arm
1558     ;;
1559 esac
1561 if test -z "$OS_TARGET"; then
1562     OS_TARGET=$OS_ARCH
1564 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1566 dnl ========================================================
1567 dnl GNU specific defaults
1568 dnl ========================================================
1569 if test "$GNU_CC"; then
1570     # FIXME: Let us build with strict aliasing. bug 414641.
1571     CFLAGS="$CFLAGS -fno-strict-aliasing"
1572     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1573     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1574     DSO_LDOPTS='-shared'
1575     if test "$GCC_USE_GNU_LD"; then
1576         # Don't allow undefined symbols in libraries
1577         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1578     fi
1579     WARNINGS_AS_ERRORS='-Werror'
1580     DSO_CFLAGS=''
1581     DSO_PIC_CFLAGS='-fPIC'
1582     ASFLAGS="$ASFLAGS -fPIC"
1583     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1584     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1585     _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1586     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1588     # Turn on GNU specific features
1589     # -Wall - turn on all warnings
1590     # -pedantic - make compiler warn about non-ANSI stuff, and
1591     #             be a little bit stricter
1592     # Warnings slamm took out for now (these were giving more noise than help):
1593     # -Wbad-function-cast - warns when casting a function to a new return type
1594     # -Wshadow - removed because it generates more noise than help --pete
1595     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1596     if test -z "$INTEL_CC"; then
1597        # Don't use -Wcast-align with ICC
1598        case "$CPU_ARCH" in
1599            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1600            hppa | ia64 | sparc | arm)
1601            ;;
1602            *)
1603         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1604            ;;
1605        esac
1606     fi
1608     dnl Turn pedantic on but disable the warnings for long long
1609     _PEDANTIC=1
1611     if test -z "$INTEL_CC"; then
1612       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1613     fi
1615     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1616     _USE_CPP_INCLUDE_FLAG=1
1617 elif test "$SOLARIS_SUNPRO_CC"; then
1618     DSO_CFLAGS=''
1619     if test "$CPU_ARCH" = "sparc"; then
1620         # for Sun Studio on Solaris/SPARC
1621         DSO_PIC_CFLAGS='-xcode=pic32'
1622     else
1623         DSO_PIC_CFLAGS='-KPIC'
1624     fi
1625     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1626 else
1627     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1628     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1630     DSO_LDOPTS='-shared'
1631     if test "$GNU_LD"; then
1632         # Don't allow undefined symbols in libraries
1633         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1634     fi
1636     DSO_CFLAGS=''
1637     DSO_PIC_CFLAGS='-KPIC'
1638     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1641 if test "$GNU_CXX"; then
1642     # FIXME: Let us build with strict aliasing. bug 414641.
1643     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1644     # Turn on GNU specific features
1645     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1646     if test -z "$INTEL_CC"; then
1647        # Don't use -Wcast-align with ICC
1648        case "$CPU_ARCH" in
1649            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1650            hppa | ia64 | sparc | arm)
1651            ;;
1652            *)
1653         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1654            ;;
1655        esac
1656     fi
1658     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1659     _USE_CPP_INCLUDE_FLAG=1
1661     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1662                    ac_has_wno_invalid_offsetof,
1663         [
1664             AC_LANG_SAVE
1665             AC_LANG_CPLUSPLUS
1666             _SAVE_CXXFLAGS="$CXXFLAGS"
1667             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1668             AC_TRY_COMPILE([],
1669                            [return(0);],
1670                            ac_has_wno_invalid_offsetof="yes",
1671                            ac_has_wno_invalid_offsetof="no")
1672             CXXFLAGS="$_SAVE_CXXFLAGS"
1673             AC_LANG_RESTORE
1674         ])
1675     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1676         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1677     fi
1679     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1680                    ac_has_wno_variadic_macros,
1681         [
1682             AC_LANG_SAVE
1683             AC_LANG_CPLUSPLUS
1684             _SAVE_CXXFLAGS="$CXXFLAGS"
1685             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1686             AC_TRY_COMPILE([],
1687                            [return(0);],
1688                            ac_has_wno_variadic_macros="yes",
1689                            ac_has_wno_variadic_macros="no")
1690             CXXFLAGS="$_SAVE_CXXFLAGS"
1691             AC_LANG_RESTORE
1692         ])
1693     if test "$ac_has_wno_variadic_macros" = "yes"; then
1694         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1695     fi
1697     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1698                    ac_has_werror_return_type,
1699         [
1700             AC_LANG_SAVE
1701             AC_LANG_CPLUSPLUS
1702             _SAVE_CXXFLAGS="$CXXFLAGS"
1703             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1704             AC_TRY_COMPILE([],
1705                            [return(0);],
1706                            ac_has_werror_return_type="yes",
1707                            ac_has_werror_return_type="no")
1708             CXXFLAGS="$_SAVE_CXXFLAGS"
1709             AC_LANG_RESTORE
1710         ])
1711     if test "$ac_has_werror_return_type" = "yes"; then
1712         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1713     fi
1715 else
1716     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1719 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1720 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1721 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1722 dnl normal behavior.
1723 dnl ========================================================
1724 MKSHLIB_FORCE_ALL=
1725 MKSHLIB_UNFORCE_ALL=
1727 if test "$COMPILE_ENVIRONMENT"; then
1728 if test "$GNU_CC"; then
1729   AC_MSG_CHECKING(whether ld has archive extraction flags)
1730   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1731    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1732     ac_cv_mkshlib_force_and_unforce="no"
1733     exec 3<&0 <<LOOP_INPUT
1734         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1735         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1736         force="-Wl,-all";              unforce="-Wl,-none"
1737 LOOP_INPUT
1738     while read line
1739     do
1740       eval $line
1741       LDFLAGS=$force
1742       LIBS=$unforce
1743       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1744     done
1745     exec 0<&3 3<&-
1746     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1747    ])
1748   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1749     AC_MSG_RESULT(no)
1750   else
1751     AC_MSG_RESULT(yes)
1752     eval $ac_cv_mkshlib_force_and_unforce
1753     MKSHLIB_FORCE_ALL=$force
1754     MKSHLIB_UNFORCE_ALL=$unforce
1755   fi
1756 fi # GNU_CC
1757 fi # COMPILE_ENVIRONMENT
1759 dnl =================================================================
1760 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1761 dnl which is bad when cross compiling.
1762 dnl =================================================================
1763 if test "$COMPILE_ENVIRONMENT"; then
1764 configure_static_assert_macros='
1765 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1766 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1767 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1770 dnl test that the macros actually work:
1771 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1772 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1773  [AC_LANG_SAVE
1774   AC_LANG_C
1775   ac_cv_static_assertion_macros_work="yes"
1776   AC_TRY_COMPILE([$configure_static_assert_macros],
1777                  [CONFIGURE_STATIC_ASSERT(1)],
1778                  ,
1779                  ac_cv_static_assertion_macros_work="no")
1780   AC_TRY_COMPILE([$configure_static_assert_macros],
1781                  [CONFIGURE_STATIC_ASSERT(0)],
1782                  ac_cv_static_assertion_macros_work="no",
1783                  )
1784   AC_LANG_CPLUSPLUS
1785   AC_TRY_COMPILE([$configure_static_assert_macros],
1786                  [CONFIGURE_STATIC_ASSERT(1)],
1787                  ,
1788                  ac_cv_static_assertion_macros_work="no")
1789   AC_TRY_COMPILE([$configure_static_assert_macros],
1790                  [CONFIGURE_STATIC_ASSERT(0)],
1791                  ac_cv_static_assertion_macros_work="no",
1792                  )
1793   AC_LANG_RESTORE
1794  ])
1795 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1796 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1797     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1799 fi # COMPILE_ENVIRONMENT
1801 dnl ========================================================
1802 dnl Checking for 64-bit OS
1803 dnl ========================================================
1804 if test "$COMPILE_ENVIRONMENT"; then
1805 AC_LANG_SAVE
1806 AC_LANG_C
1807 AC_MSG_CHECKING(for 64-bit OS)
1808 AC_TRY_COMPILE([$configure_static_assert_macros],
1809                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1810                result="yes", result="no")
1811 AC_MSG_RESULT("$result")
1812 if test "$result" = "yes"; then
1813     AC_DEFINE(HAVE_64BIT_OS)
1814     HAVE_64BIT_OS=1
1816 AC_SUBST(HAVE_64BIT_OS)
1817 AC_LANG_RESTORE
1818 fi # COMPILE_ENVIRONMENT
1820 dnl ========================================================
1821 dnl Enable high-memory support on OS/2 by default.
1822 dnl ========================================================
1823 MOZ_OS2_HIGH_MEMORY=1
1824 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1825 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1826     MOZ_OS2_HIGH_MEMORY=,
1827     MOZ_OS2_HIGH_MEMORY=1 )
1828 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1830 dnl ========================================================
1831 dnl = Use profiling compile flags
1832 dnl ========================================================
1833 MOZ_ARG_ENABLE_BOOL(profiling,
1834 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1835     MOZ_PROFILING=1,
1836     MOZ_PROFILING= )
1838 dnl ========================================================
1839 dnl System overrides of the defaults for host
1840 dnl ========================================================
1841 case "$host" in
1842 *-beos*)
1843     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1844     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1845     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1846     ;;
1848 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1849     if test -n "$_WIN32_MSVC"; then
1850         HOST_AR=lib
1851         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1852         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1853         HOST_RANLIB='echo ranlib'
1854     else
1855         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1856     fi
1857     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1858     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1859     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1860     HOST_BIN_SUFFIX=.exe
1861     case "$host" in
1862     *mingw*)
1863     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1864         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1865         ;;
1866     *)
1867         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1868         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1869             _pwd=`pwd`
1870             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1871         fi
1872         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1873             AS_PERL=1
1874             PERL="${CYGWIN_WRAPPER} $PERL"
1875         fi
1877         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1878             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1879         fi
1880         ;;
1881     esac
1883     case "${host_cpu}" in
1884     x86_64)
1885         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1886         ;;
1887     esac
1888     ;;
1890 *-darwin*)
1891     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1892     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1893     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1894     ;;
1896 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1897     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1898     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1899     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1900     ;;
1902 *os2*)
1903     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1904     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1905     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1906     HOST_BIN_SUFFIX=.exe
1907     MOZ_FIX_LINK_PATHS=
1908     ;;
1910 *-osf*)
1911     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1912     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1913     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1914     ;;
1917     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1918     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1919     ;;
1920 esac
1922 dnl We require version 2.5 or newer of Python to build.
1923 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1924 changequote(,)
1925 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1926 _python_res=$?
1927 changequote([,])
1928 if test "$_python_res" != 0; then
1929     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1931 AC_MSG_RESULT([yes])
1933 dnl Get mozilla version from central milestone file
1934 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1936 dnl Get version of various core apps from the version files.
1937 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1939 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1940 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1942 dnl ========================================================
1943 dnl System overrides of the defaults for target
1944 dnl ========================================================
1946 case "$target" in
1947 *-aix*)
1948     AC_DEFINE(AIX)
1949     if test ! "$GNU_CC"; then
1950         if test ! "$HAVE_64BIT_OS"; then
1951             # Compiling with Visual Age C++ object model compat is the
1952             # default. To compile with object model ibm, add 
1953             # AIX_OBJMODEL=ibm to .mozconfig.
1954             if test "$AIX_OBJMODEL" = "ibm"; then
1955                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1956             else
1957                 AIX_OBJMODEL=compat
1958             fi
1959         else
1960             AIX_OBJMODEL=compat
1961         fi
1962         AC_SUBST(AIX_OBJMODEL)
1963         DSO_LDOPTS='-qmkshrobj=1'
1964         DSO_CFLAGS='-qflag=w:w'
1965         DSO_PIC_CFLAGS=
1966         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1967         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1968         MOZ_FIX_LINK_PATHS=
1969         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1970         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1971         if test "$COMPILE_ENVIRONMENT"; then
1972             AC_LANG_SAVE
1973             AC_LANG_CPLUSPLUS
1974             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1975             AC_TRY_COMPILE([],
1976                 [#if (__IBMCPP__ < 600)
1977                  #error "Bad compiler"
1978                  #endif],
1979                 _BAD_COMPILER=,_BAD_COMPILER=1)
1980             if test -n "$_BAD_COMPILER"; then
1981                 AC_MSG_RESULT([no])    
1982                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1983             else
1984                 AC_MSG_RESULT([yes])    
1985             fi
1986             AC_LANG_RESTORE
1987             TARGET_COMPILER_ABI="ibmc"
1988             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1989             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1990         fi
1991     fi
1992     case "${target_os}" in
1993     aix4.1*)
1994         DLL_SUFFIX='_shr.a'
1995         ;;
1996     esac
1997     if test "$COMPILE_ENVIRONMENT"; then
1998         AC_CHECK_HEADERS(sys/inttypes.h)
1999     fi
2000     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2001     ;;
2003 *-beos*)
2004     no_x=yes
2005     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
2006     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
2007     DSO_LDOPTS='-nostart'
2008     TK_LIBS='-lbe -lroot'
2009     LIBS="$LIBS -lbe"
2010     if test "$COMPILE_ENVIRONMENT"; then
2011         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
2012         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
2013     fi
2014     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
2015     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
2016     _MOZ_USE_RTTI=1
2017     USE_DEPENDENT_LIBS=
2018     MOZ_USER_DIR="Mozilla"
2019     ;;
2021 *-bsdi*)
2022     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2023     _PEDANTIC=
2024     case $OS_RELEASE in
2025         4.*|5.*)
2026             STRIP="$STRIP -d"
2027             ;;
2028         *)
2029             DSO_CFLAGS=''
2030             DSO_LDOPTS='-r'
2031             _WARNINGS_CFLAGS="-Wall"
2032             _WARNINGS_CXXFLAGS="-Wall"
2033             # The test above doesn't work properly, at least on 3.1.
2034             MKSHLIB_FORCE_ALL=''
2035             MKSHLIB_UNFORCE_ALL=''
2036         ;;
2037     esac
2038     ;;
2040 *-darwin*) 
2041     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2042     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2043     # If we're building with --enable-profiling, we need a frame pointer.
2044     if test -z "$MOZ_PROFILING"; then
2045         MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
2046     else
2047         MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
2048     fi
2049     _PEDANTIC=
2050     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2051     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2052     DLL_SUFFIX=".dylib"
2053     DSO_LDOPTS=''
2054     STRIP="$STRIP -x -S"
2055     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2056     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2057     # The ExceptionHandling framework is needed for Objective-C exception
2058     # logging code in nsObjCExceptions.h. Currently we only use that in debug
2059     # builds.
2060     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2062     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2063     dnl ===================================================================
2064     if test "x$enable_dtrace" = "xyes"; then
2065         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2066     else
2067         dnl check for the presence of the -dead_strip linker flag
2068         AC_MSG_CHECKING([for -dead_strip option to ld])
2069         _SAVE_LDFLAGS=$LDFLAGS
2070         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2071         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2072         if test -n "$_HAVE_DEAD_STRIP" ; then
2073             AC_MSG_RESULT([yes])
2074             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2075         else
2076             AC_MSG_RESULT([no])
2077         fi
2078         
2079         LDFLAGS=$_SAVE_LDFLAGS
2080     fi
2081     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2082     ;;
2084 *-freebsd*)
2085     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2086         DLL_SUFFIX=".so.1.0"
2087         DSO_LDOPTS="-shared"
2088     fi
2089     if test ! "$GNU_CC"; then
2090         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2091     fi
2092     ;; 
2094 ia64*-hpux*)
2095     DLL_SUFFIX=".so"
2096     if test ! "$GNU_CC"; then
2097        DSO_LDOPTS='-b'
2098        DSO_CFLAGS=""
2099        DSO_PIC_CFLAGS=
2100        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2101        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2102        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2103     else
2104        DSO_LDOPTS='-b -E'
2105        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2106        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2107     fi
2108     MOZ_FIX_LINK_PATHS=
2109     SYSTEM_MAKEDEPEND=
2110     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2111     AC_DEFINE(_LARGEFILE64_SOURCE)
2112     ;;
2114 *-hpux*)
2115     DLL_SUFFIX=".sl"
2116     if test ! "$GNU_CC"; then
2117         DSO_LDOPTS='-b -Wl,+s'
2118         DSO_CFLAGS=""
2119         DSO_PIC_CFLAGS="+Z"
2120         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2121         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2122         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2123     else
2124         DSO_LDOPTS='-b -E +s'
2125         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2126         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2127     fi
2128     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2129     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2130     ;;
2132 *-irix5*)
2133     AC_DEFINE(IRIX)
2134     DSO_LDOPTS='-elf -shared'
2136     if test "$GNU_CC"; then
2137        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2138        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2139        MKSHLIB_FORCE_ALL='-Wl,-all'
2140        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2141        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2142     else
2143        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2144        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2145        MKSHLIB_FORCE_ALL='-all'
2146        MKSHLIB_UNFORCE_ALL='-none'
2147     fi
2148     ;;
2150 *-irix6*)
2151     AC_DEFINE(IRIX)
2152     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2153     dnl compile and link using -n32
2154     USE_N32=1
2155     TARGET_COMPILER_ABI=n32
2156     DSO_LDOPTS='-elf -shared'
2157     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2158     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2159     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2160     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2161     if test "$GNU_CC"; then
2162        MKSHLIB_FORCE_ALL='-Wl,-all'
2163        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2164        _WARNINGS_CFLAGS="-Wall"
2165        _WARNINGS_CXXFLAGS="-Wall"
2166        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2167     else
2168        MKSHLIB_FORCE_ALL='-all'
2169        MKSHLIB_UNFORCE_ALL='-none'
2170            AR_LIST="$AR t"
2171            AR_EXTRACT="$AR x"
2172            AR_DELETE="$AR d"
2173            AR='$(CXX) -ar'
2174            AR_FLAGS='-o $@'
2175        CFLAGS="$CFLAGS -woff 3262 -G 4"
2176        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2177        if test -n "$USE_N32"; then
2178            ASFLAGS="$ASFLAGS -n32"
2179            CFLAGS="$CFLAGS -n32"
2180            CXXFLAGS="$CXXFLAGS -n32"
2181            LDFLAGS="$LDFLAGS -n32"
2182        fi
2183        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2184        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2185        MOZ_FIX_LINK_PATHS=
2186     fi
2187     if test -z "$GNU_CXX"; then
2188       MIPSPRO_CXX=1
2189     fi
2190     ;;
2192 *-*linux*)
2193     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2194     # Similarly for GNU_CXX and INTEL_CXX.
2195     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2196         # -Os has been broken on Intel's C/C++ compilers for quite a
2197         # while; Intel recommends against using it.
2198         MOZ_OPTIMIZE_FLAGS="-O2"
2199         MOZ_DEBUG_FLAGS="-g"
2200     elif test "$GNU_CC" -o "$GNU_CXX"; then
2201         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2202         case $GCC_VERSION in
2203         4.1.*|4.2.*|4.5.*)
2204             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2205             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2206         esac
2207         # If we're building with --enable-profiling, we need a frame pointer.
2208         if test -z "$MOZ_PROFILING"; then
2209             MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2210         else
2211             MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-omit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2212         fi
2213         MOZ_DEBUG_FLAGS="-g"
2214     fi
2216     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2218     MOZ_MEMORY=1
2220     case "${target_cpu}" in
2221     alpha*)
2222         CFLAGS="$CFLAGS -mieee"
2223         CXXFLAGS="$CXXFLAGS -mieee"
2224     ;;
2225     i*86)
2226         USE_ELF_DYNSTR_GC=1
2227     ;;
2228     mips*)
2229         MOZ_DEBUG_FLAGS="-g" # We want inlining
2230     ;;
2231     esac
2232     ;;
2234 *-wince*|*-winmo*)
2235     TARGET_COMPILER_ABI=msvc
2236     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2237     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2238     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2239     AR_LIST="$AR -list"
2240     AR_EXTRACT="$AR -extract"
2241     AR_DELETE="$AR d"
2242     AR_FLAGS='-OUT:"$@"'
2243     MOZ_MEMORY=1
2244     NSS_DISABLE_DBM=1
2245     MOZ_OGG=
2246     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2248     if test "$AS_BIN"; then
2249         AS="$AS_BIN"
2250     fi
2251     DSO_CFLAGS=
2252     DSO_PIC_CFLAGS=
2253     DLL_SUFFIX=.dll
2254     BIN_SUFFIX='.exe'
2255     if test -z "$RC"; then 
2256         RC=rc.exe  
2257     fi
2258     # certain versions of cygwin's makedepend barf on the 
2259     # #include <string> vs -I./dist/include/string issue so don't use it
2260     SYSTEM_MAKEDEPEND=
2262     HOST_CC=cl
2263     HOST_CXX=cl
2264     HOST_LD=link
2265     HOST_AR='lib -OUT:$@'
2266     HOST_RANLIB='echo ranlib'
2267     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2268         
2269         
2270     WARNINGS_AS_ERRORS='-WX'
2271     MOZ_OPTIMIZE_FLAGS='-Ox'
2272     AR_FLAGS='-NOLOGO -OUT:"$@"'
2273     ASM_SUFFIX=asm
2274     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2275     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2276     DLL_PREFIX=
2277     DOXYGEN=:
2278     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2279     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2280     GARBAGE=
2281     IMPORT_LIB_SUFFIX=lib
2282     dnl Need to force-link against mozalloc because it's used in the shunt
2283     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2284     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2285     LIB_PREFIX=
2286     LIB_SUFFIX=lib 
2287     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2288     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2289     MKSHLIB_FORCE_ALL=
2290     MKSHLIB_UNFORCE_ALL=
2291     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2292     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2293     MOZ_DEBUG_FLAGS='-Zi'
2294     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2295     MOZ_FIX_LINK_PATHS=
2296     MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2297     MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2298     OBJ_SUFFIX=obj
2299     RANLIB='echo not_ranlib'
2300     STRIP='echo not_strip'
2301     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2302     UNZIP=unzip
2303     XARGS=xargs
2304     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2305     ZIP=zip
2306     MOZ_TREE_FREETYPE=1
2308     AC_DEFINE(HAVE_SNPRINTF)
2309     AC_DEFINE(_WINDOWS)
2310     AC_DEFINE(WIN32)
2311     AC_DEFINE(XP_WIN)
2312     AC_DEFINE(XP_WIN32)
2313     AC_DEFINE(HW_THREADS)
2314     AC_DEFINE(STDC_HEADERS)
2315     AC_DEFINE(NEW_H, <new>)
2316     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2317     AC_DEFINE(HAVE_LOCALTIME_R)
2319     TARGET_MD_ARCH=win32
2320     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2321     BIN_SUFFIX='.exe'
2322     MOZ_USER_DIR="Mozilla"
2324     MOZ_GFX_OPTIMIZE_MOBILE=1
2326     # Sanity check for WINCE_WINDOWS_MOBILE
2327     # XXX disabled until we can fix the mobile tinderbox
2328     ##if test "$WINCE_WINDOWS_MOBILE"; then
2329     ##   AC_CHECK_HEADER(tpcshell.h, [],
2330     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2331     ##fi
2335 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2336     DSO_CFLAGS=
2337     DSO_PIC_CFLAGS=
2338     DLL_SUFFIX=.dll
2339     RC=rc.exe
2340     # certain versions of cygwin's makedepend barf on the 
2341     # #include <string> vs -I./dist/include/string issue so don't use it
2342     SYSTEM_MAKEDEPEND=
2343     if test -n "$GNU_CC"; then
2344         CC="$CC -mno-cygwin"
2345         CXX="$CXX -mno-cygwin"
2346         CPP="$CPP -mno-cygwin"
2347         CFLAGS="$CFLAGS -mms-bitfields"
2348         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2349         DSO_LDOPTS='-shared'
2350         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2351         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2352         RC='$(WINDRES)'
2353         # Use temp file for windres (bug 213281)
2354         RCFLAGS='-O coff --use-temp-file'
2355         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2356         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2357         MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
2358         MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
2359         MOZ_FIX_LINK_PATHS=
2360         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2361         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2362         DLL_PREFIX=
2363         IMPORT_LIB_SUFFIX=dll.a
2364         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2365     else
2366         TARGET_COMPILER_ABI=msvc
2367         HOST_CC='$(CC)'
2368         HOST_CXX='$(CXX)'
2369         HOST_LD='$(LD)'
2370         if test "$AS_BIN"; then
2371             AS="$(basename "$AS_BIN")"
2372         fi
2373         AR='lib -NOLOGO -OUT:"$@"'
2374         AR_FLAGS=
2375         RANLIB='echo not_ranlib'
2376         STRIP='echo not_strip'
2377         PKG_SKIP_STRIP=1
2378         XARGS=xargs
2379         ZIP=zip
2380         UNZIP=unzip
2381         DOXYGEN=:
2382         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2383         ASM_SUFFIX=asm
2384         OBJ_SUFFIX=obj
2385         LIB_SUFFIX=lib
2386         DLL_PREFIX=
2387         LIB_PREFIX=
2388         IMPORT_LIB_SUFFIX=lib
2389         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2390         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2391         MKSHLIB_FORCE_ALL=
2392         MKSHLIB_UNFORCE_ALL=
2393         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2394         _USE_CPP_INCLUDE_FLAG=1
2395         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2396         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2397         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2398         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2399         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2400         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2401         MOZ_DEBUG_FLAGS='-Zi'
2402         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2403         WARNINGS_AS_ERRORS='-WX'
2404         # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
2405         if test -z "$MOZ_PROFILING"; then
2406             MOZ_OPTIMIZE_FLAGS='-O1'
2407         else
2408             MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
2409         fi
2410         MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2411         MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2412         MOZ_FIX_LINK_PATHS=
2413         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2414         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2415         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2416         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2417         if test $_MSC_VER -ge 1400; then
2418             LDFLAGS="$LDFLAGS -NXCOMPAT"
2419             dnl For profile-guided optimization
2420             PROFILE_GEN_CFLAGS="-GL"
2421             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2422             dnl XXX: PGO builds can fail with warnings treated as errors,
2423             dnl specifically "no profile data available" appears to be
2424             dnl treated as an error sometimes. This might be a consequence
2425             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2426             dnl with the linker doing most of the work in the whole-program
2427             dnl optimization/PGO case. I think it's probably a compiler bug,
2428             dnl but we work around it here.
2429             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2430             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2431             dnl Probably also a compiler bug, but what can you do?
2432             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2433             if test -n "$_USE_DYNAMICBASE"; then
2434                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2435             fi
2436         fi
2437     fi
2438     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2439     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2440     AC_DEFINE(HAVE_SNPRINTF)
2441     AC_DEFINE(_WINDOWS)
2442     AC_DEFINE(WIN32)
2443     AC_DEFINE(XP_WIN)
2444     AC_DEFINE(XP_WIN32)
2445     AC_DEFINE(HW_THREADS)
2446     AC_DEFINE(STDC_HEADERS)
2447     AC_DEFINE(NEW_H, <new>)
2448     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2449     TARGET_MD_ARCH=win32
2450     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2451     BIN_SUFFIX='.exe'
2452     MOZ_USER_DIR="Mozilla"
2454     dnl Hardcode to win95 for now - cls
2455     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2457     dnl set NO_X11 defines here as the general check is skipped on win32
2458     no_x=yes
2459     AC_DEFINE(NO_X11)
2461     dnl MinGW/MSYS doesn't provide or need cygpath
2462     case "$host" in
2463     *-mingw*)
2464         CYGPATH_W=echo
2465         CYGPATH_S=cat
2466         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2467         ;;
2468     *-cygwin*|*-msvc*|*-mks*)
2469         CYGPATH_W="cygpath -a -w"
2470         CYGPATH_S="sed -e s|\\\\|/|g"
2471         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2472         ;;
2473     esac
2474     case "$host" in
2475     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2477     if test -z "$MOZ_TOOLS"; then
2478         AC_MSG_ERROR([MOZ_TOOLS is not set])
2479     fi
2481     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2482     if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2483         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2484     fi
2485     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2486     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2487         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2488     fi
2489     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2490     ;;
2491     esac 
2494     case "$host_os" in
2495     cygwin*|msvc*|mks*)
2496         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])
2497         ;;
2499     *)
2500         AC_CHECK_HEADERS(oleacc.idl)
2502         AC_LANG_SAVE
2503         AC_LANG_CPLUSPLUS
2504         AC_CHECK_HEADERS(atlbase.h)
2505         AC_LANG_RESTORE
2506         ;;
2507     esac
2509     case "$target" in
2510     i*86-*)
2511         if test "$HAVE_64BIT_OS"; then
2512             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2513         fi
2515         if test $_MSC_VER -ge 1400; then
2516             LDFLAGS="$LDFLAGS -SAFESEH"
2517         fi
2518         AC_CHECK_HEADERS(mmintrin.h)
2519         AC_DEFINE(_X86_)
2520         ;;
2521     alpha-*)
2522         AC_DEFINE(_ALPHA_)
2523         ;;
2524     mips-*)
2525         AC_DEFINE(_MIPS_)
2526         ;;
2527     x86_64-*)
2528         AC_DEFINE(_AMD64_)
2529         ;;
2530     *)
2531         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2532         ;;
2533     esac
2535     if test "$HAVE_64BIT_OS"; then
2536         AC_DEFINE(_WIN64)
2537     fi
2538     ;;
2540 *-netbsd*)
2541     DSO_CFLAGS=''
2542     CFLAGS="$CFLAGS -Dunix"
2543     CXXFLAGS="$CXXFLAGS -Dunix"
2544     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2545         DLL_SUFFIX=".so"
2546         DSO_PIC_CFLAGS='-fPIC -DPIC'
2547         DSO_LDOPTS='-shared'
2548         BIN_FLAGS='-Wl,--export-dynamic'
2549     else
2550         DSO_PIC_CFLAGS='-fPIC -DPIC'
2551         DLL_SUFFIX=".so.1.0"
2552         DSO_LDOPTS='-shared'
2553     fi
2554     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2555     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2556     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2557     if test "$LIBRUNPATH"; then
2558         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2559     fi
2560     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2561     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2562     ;;
2564 *-nto*) 
2565         AC_DEFINE(NTO)  
2566         AC_DEFINE(_QNX_SOURCE)
2567         AC_DEFINE(_i386)
2568         OS_TARGET=NTO
2569         WARNINGS_AS_ERRORS=''
2570         MOZ_OPTIMIZE_FLAGS="-O"
2571         MOZ_DEBUG_FLAGS="-gstabs"
2572         USE_PTHREADS=1
2573         _PEDANTIC=
2574         LIBS="$LIBS -lsocket -lstdc++"
2575         _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2576         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2577         if test "$with_x" != "yes"
2578         then
2579                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2580             TK_CFLAGS='-I/usr/include/photon'
2581                 TK_LIBS='-lph'
2582         fi
2583         case "${target_cpu}" in
2584         ppc*)
2585         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2586         ;;
2587         esac
2588         case "${host_cpu}" in
2589         i*86)
2590         USE_ELF_DYNSTR_GC=1
2591         ;;
2592         esac
2593         ;;
2595 *-openbsd*)
2596     DLL_SUFFIX=".so.1.0"
2597     DSO_CFLAGS=''
2598     DSO_PIC_CFLAGS='-fPIC'
2599     DSO_LDOPTS='-shared -fPIC'
2600     if test "$LIBRUNPATH"; then
2601         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2602     fi
2603     ;;
2605 *-openvms*) 
2606     AC_DEFINE(NO_PW_GECOS)
2607     AC_DEFINE(NO_UDSOCK)
2608     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2609     USE_PTHREADS=1
2610     MKSHLIB_FORCE_ALL='-all'
2611     MKSHLIB_UNFORCE_ALL='-none'
2612     AS='as'
2613     AS_DASH_C_FLAG='-Wc/names=as_is'
2614     AR_FLAGS='c $@'
2615     DSO_LDOPTS='-shared -auto_symvec'
2616     DSO_PIC_CFLAGS=
2617     MOZ_DEBUG_LDFLAGS='-g'
2618     COMPAQ_CXX=1
2619     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2620     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2621     ;;
2624 *-os2*)
2625     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2626     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2627     AC_DEFINE(OS2)
2628     AC_DEFINE(XP_OS2)
2629     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2630     AC_DEFINE(TCPV40HDRS)
2631     DLL_PREFIX=
2632     LIB_PREFIX=
2633     LIB_SUFFIX=lib
2634     BIN_SUFFIX=".exe"
2635     DLL_SUFFIX=".dll"
2636     IMPORT_LIB_SUFFIX=lib
2637     DSO_PIC_CFLAGS=
2638     AR=emxomfar
2639     AR_FLAGS='r $@'
2640     CFLAGS="$CFLAGS -Zomf"
2641     CXXFLAGS="$CXXFLAGS -Zomf"
2642     DSO_LDOPTS='-Zdll'
2643     BIN_FLAGS='-Zlinker /ST:0x100000'
2644     IMPLIB='emximp -o'
2645     FILTER='true'
2646     LDFLAGS='-Zmap'
2647     WARNINGS_AS_ERRORS='-Werror'
2648     MOZ_DEBUG_FLAGS="-g -fno-inline"
2649     MOZ_OPTIMIZE_FLAGS="-O2"
2650     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2651     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2652     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2653     TARGET_MD_ARCH=os2
2654     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2655     RC=rc.exe
2656     RCFLAGS='-n'
2657     MOZ_USER_DIR="Mozilla"
2659     if test "$MOZTOOLS"; then
2660         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2661     else
2662         AC_MSG_ERROR([MOZTOOLS is not set])
2663     fi
2664     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2665         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2666         LDFLAGS="$LDFLAGS -Zhigh-mem"
2667         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2668         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2669     fi
2671     # GCC for OS/2 currently predefines these, but we don't want them
2672     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2673     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2675     AC_CACHE_CHECK(for __declspec(dllexport),
2676         ac_os2_declspec,
2677         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2678                         [return 0;],
2679                         ac_os2_declspec="yes",
2680                         ac_os2_declspec="no")])
2681     if test "$ac_os2_declspec" != "yes"; then
2682         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2683     fi
2684     ;;
2686 alpha*-*-osf*)
2687     if test "$GNU_CC"; then
2688       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2689       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2691     else
2692         MOZ_DEBUG_FLAGS='-g'
2693         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2694         CFLAGS="$CFLAGS -ieee"
2695         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2696         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2697         DSO_CFLAGS=
2698         DSO_PIC_CFLAGS=
2699         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2700         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2701         MKSHLIB_FORCE_ALL='-all'
2702         MKSHLIB_UNFORCE_ALL='-none'
2703         dnl Might fix the libxpcom.so breakage on this platform as well....
2704         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2705         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2706     fi
2707     if test -z "$GNU_CXX"; then
2708       COMPAQ_CXX=1
2709     fi
2710     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2711     ;;
2713 *-qnx*) 
2714     DIRENT_INO=d_stat.st_ino
2715     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2716     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2717     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2718     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2719     AC_DEFINE(STDC_HEADERS)
2720     if test "$no_x" = "yes"; then
2721             _PLATFORM_DEFAULT_TOOLKIT='photon'
2722             TK_CFLAGS='-I/usr/nto/include/photon'
2723             TK_LIBS='-lphoton -lphrender'
2724     fi
2725     ;;
2727 *-sco*) 
2728     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2729     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2730     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2731     if test ! "$GNU_CC"; then
2732        DSO_LDOPTS='-G'
2733     fi
2734     ;;
2736 *-solaris*) 
2737     AC_DEFINE(SOLARIS)
2738     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2739     SYSTEM_MAKEDEPEND=
2740     MOZ_FIX_LINK_PATHS=
2741     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2742     # libraries one level up (e.g. libnspr4.so)
2743     if test "$SOLARIS_SUNPRO_CC"; then
2744        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2745        LIBS="-lCrun -lCstd -lc $LIBS"
2746        NS_USE_NATIVE=1
2747        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2748        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2749        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2750        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2751        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2752        LDFLAGS="-xildoff $LDFLAGS"
2753        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2754            _SAVE_LDFLAGS=$LDFLAGS
2755            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2756            AC_TRY_LINK([#include <stdio.h>],
2757                        [printf("Hello World\n");],
2758                        ,
2759                        [LDFLAGS=$_SAVE_LDFLAGS])
2760        fi
2761        WARNINGS_AS_ERRORS='-Werror'
2762        MOZ_OPTIMIZE_FLAGS="-xO4"
2763        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2764        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2765        MKSHLIB_FORCE_ALL='-z allextract'
2766        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2767        DSO_LDOPTS='-G'
2768        AR_LIST="$AR t"
2769        AR_EXTRACT="$AR x"
2770        AR_DELETE="$AR d"
2771        AR='$(CXX) -xar'
2772        AR_FLAGS='-o $@'
2773        AS='/usr/ccs/bin/as'
2774        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2775        AS_DASH_C_FLAG=''
2776        TARGET_COMPILER_ABI="sunc"
2777        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2778        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2779        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2780        AC_LANG_SAVE
2781        AC_LANG_CPLUSPLUS
2782        AC_TRY_COMPILE([],
2783            [#if (__SUNPRO_CC < 0x590)
2784            #error "Denied"
2785            #endif],
2786            _BAD_COMPILER=,_BAD_COMPILER=1)
2787        if test -n "$_BAD_COMPILER"; then
2788            _res="no"
2789            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2790        else
2791            _res="yes"
2792        fi
2793        AC_TRY_COMPILE([],
2794            [#if (__SUNPRO_CC >= 0x5100)
2795            #error "Sun C++ 5.10 or above"
2796            #endif],
2797            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2798        if test "$_ABOVE_SS12U1"; then
2799            # disable xannotate
2800            CXXFLAGS="$CXXFLAGS -xannotate=no"
2801        fi
2802        AC_MSG_RESULT([$_res])
2803        AC_LANG_RESTORE
2804     else
2805        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2806        LIBS="-lc $LIBS"
2807        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2808        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2809        ASFLAGS="$ASFLAGS -fPIC"
2810        DSO_LDOPTS='-shared'
2811        _WARNINGS_CFLAGS=''
2812        _WARNINGS_CXXFLAGS=''
2813        if test "$OS_RELEASE" = "5.3"; then
2814            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2815        fi
2816     fi
2817     if test "$OS_RELEASE" = "5.5.1"; then
2818         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2819     fi
2820     ;;
2822 *-sunos*) 
2823     DSO_LDOPTS='-Bdynamic'
2824     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2825     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2826     AC_DEFINE(SUNOS4)
2827     AC_DEFINE(SPRINTF_RETURNS_STRING)
2828     case "$(target_os)" in
2829     sunos4.1*)
2830         DLL_SUFFIX='.so.1.0'
2831         ;;
2832     esac
2833     ;;
2835 *-sysv4.2uw7*) 
2836         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2837     ;;
2839 *-os2*)
2840     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2841     ;;
2843 *-android*)
2844     AC_DEFINE(NO_PW_GECOS)
2845     no_x=yes
2846     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2847     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2849     MOZ_GFX_OPTIMIZE_MOBILE=1
2850     # If we're building with --enable-profiling, we need a frame pointer.
2851     if test -z "$MOZ_PROFILING"; then
2852         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2853     else
2854         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
2855     fi
2856     ;;
2858 esac
2860 dnl Only one oddball right now (QNX), but this gives us flexibility
2861 dnl if any other platforms need to override this in the future.
2862 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2864 dnl ========================================================
2865 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2866 dnl by now will not have any way to link most binaries (tests
2867 dnl as well as viewer, apprunner, etc.), because some symbols
2868 dnl will be left out of the "composite" .so's by ld as unneeded.
2869 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2870 dnl they can link in the static libs that provide the missing
2871 dnl symbols.
2872 dnl ========================================================
2873 NO_LD_ARCHIVE_FLAGS=
2874 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2875     NO_LD_ARCHIVE_FLAGS=1
2877 case "$target" in
2878 *-os2*)
2879     NO_LD_ARCHIVE_FLAGS=
2880     ;;
2881 *-aix4.3*|*-aix5*)
2882     NO_LD_ARCHIVE_FLAGS=
2883     ;;
2884 *-openvms*)
2885     NO_LD_ARCHIVE_FLAGS=
2886     ;;
2887 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2888     if test -z "$GNU_CC"; then
2889         NO_LD_ARCHIVE_FLAGS=
2890     fi
2891     ;;
2892 esac
2893 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2895 dnl ========================================================
2896 dnl = Flags to strip unused symbols from .so components
2897 dnl ========================================================
2898 case "$target" in
2899     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2900         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2901         ;;
2902     *-solaris*)
2903         if test -z "$GNU_CC"; then
2904          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2905         else
2906          if test -z "$GCC_USE_GNU_LD"; then
2907           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2908          else
2909           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2910          fi
2911         fi
2912         ;;
2913     *-nto*) 
2914         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2915         ;;
2916     *-darwin*)
2917         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2918         ;;
2919     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2920         if test -n "$GNU_CC"; then
2921            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2922         fi
2923         ;;
2924 esac
2926 if test -z "$COMPILE_ENVIRONMENT"; then
2927     SKIP_COMPILER_CHECKS=1
2928     SKIP_LIBRARY_CHECKS=1
2931 if test -z "$SKIP_COMPILER_CHECKS"; then
2932 dnl Checks for typedefs, structures, and compiler characteristics.
2933 dnl ========================================================
2934 AC_HEADER_STDC
2935 AC_C_CONST
2936 AC_TYPE_MODE_T
2937 AC_TYPE_OFF_T
2938 AC_TYPE_PID_T
2939 AC_TYPE_SIZE_T
2940 AC_LANG_CPLUSPLUS
2941 AC_MSG_CHECKING(for __stdcall)
2942 AC_CACHE_VAL(ac_cv___stdcall,
2943  [AC_TRY_COMPILE([template <typename Method> struct foo;
2944                   template <> struct foo<void (*)()> {};
2945                   template <> struct foo<void (__stdcall*)()> {};],
2946                  [],
2947                  [ac_cv___stdcall=true],
2948                  [ac_cv___stdcall=false])])
2949 if test "$ac_cv___stdcall" = true ; then
2950   AC_DEFINE(HAVE_STDCALL)
2951   AC_MSG_RESULT(yes)
2952 else
2953   AC_MSG_RESULT(no)
2955 AC_LANG_C
2956 AC_MSG_CHECKING(for ssize_t)
2957 AC_CACHE_VAL(ac_cv_type_ssize_t,
2958  [AC_TRY_COMPILE([#include <stdio.h>
2959                   #include <sys/types.h>],
2960                  [ssize_t foo = 0;],
2961                  [ac_cv_type_ssize_t=true],
2962                  [ac_cv_type_ssize_t=false])])
2963 if test "$ac_cv_type_ssize_t" = true ; then
2964   AC_DEFINE(HAVE_SSIZE_T)
2965   AC_MSG_RESULT(yes)
2966 else
2967   AC_MSG_RESULT(no)
2969 AC_STRUCT_ST_BLKSIZE
2970 AC_MSG_CHECKING(for siginfo_t)
2971 AC_CACHE_VAL(ac_cv_siginfo_t,
2972  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2973                   #include <signal.h>],
2974                  [siginfo_t* info;],
2975                  [ac_cv_siginfo_t=true],
2976                  [ac_cv_siginfo_t=false])])
2977 if test "$ac_cv_siginfo_t" = true ; then
2978   AC_DEFINE(HAVE_SIGINFO_T)
2979   AC_MSG_RESULT(yes)
2980 else
2981   AC_MSG_RESULT(no)
2984 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2985 dnl ========================================================
2986 AC_MSG_CHECKING(for int16_t)
2987 AC_CACHE_VAL(ac_cv_int16_t,
2988  [AC_TRY_COMPILE([#include <stdio.h>
2989                   #include <sys/types.h>],
2990                  [int16_t foo = 0;],
2991                  [ac_cv_int16_t=true],
2992                  [ac_cv_int16_t=false])])
2993 if test "$ac_cv_int16_t" = true ; then
2994   AC_DEFINE(HAVE_INT16_T)
2995   AC_MSG_RESULT(yes)
2996 else
2997   AC_MSG_RESULT(no)
2999 AC_MSG_CHECKING(for int32_t)
3000 AC_CACHE_VAL(ac_cv_int32_t,
3001  [AC_TRY_COMPILE([#include <stdio.h>
3002                   #include <sys/types.h>],
3003                  [int32_t foo = 0;],
3004                  [ac_cv_int32_t=true],
3005                  [ac_cv_int32_t=false])])
3006 if test "$ac_cv_int32_t" = true ; then
3007   AC_DEFINE(HAVE_INT32_T)
3008   AC_MSG_RESULT(yes)
3009 else
3010   AC_MSG_RESULT(no)
3012 AC_MSG_CHECKING(for int64_t)
3013 AC_CACHE_VAL(ac_cv_int64_t,
3014  [AC_TRY_COMPILE([#include <stdio.h>
3015                   #include <sys/types.h>],
3016                  [int64_t foo = 0;],
3017                  [ac_cv_int64_t=true],
3018                  [ac_cv_int64_t=false])])
3019 if test "$ac_cv_int64_t" = true ; then
3020   AC_DEFINE(HAVE_INT64_T)
3021   AC_MSG_RESULT(yes)
3022 else
3023   AC_MSG_RESULT(no)
3025 AC_MSG_CHECKING(for int64)
3026 AC_CACHE_VAL(ac_cv_int64,
3027  [AC_TRY_COMPILE([#include <stdio.h>
3028                   #include <sys/types.h>],
3029                  [int64 foo = 0;],
3030                  [ac_cv_int64=true],
3031                  [ac_cv_int64=false])])
3032 if test "$ac_cv_int64" = true ; then
3033   AC_DEFINE(HAVE_INT64)
3034   AC_MSG_RESULT(yes)
3035 else
3036   AC_MSG_RESULT(no)
3038 AC_MSG_CHECKING(for uint)
3039 AC_CACHE_VAL(ac_cv_uint,
3040  [AC_TRY_COMPILE([#include <stdio.h>
3041                   #include <sys/types.h>],
3042                  [uint foo = 0;],
3043                  [ac_cv_uint=true],
3044                  [ac_cv_uint=false])])
3045 if test "$ac_cv_uint" = true ; then
3046   AC_DEFINE(HAVE_UINT)
3047   AC_MSG_RESULT(yes)
3048 else
3049   AC_MSG_RESULT(no)
3051 AC_MSG_CHECKING(for uint_t)
3052 AC_CACHE_VAL(ac_cv_uint_t,
3053  [AC_TRY_COMPILE([#include <stdio.h>
3054                   #include <sys/types.h>],
3055                  [uint_t foo = 0;],
3056                  [ac_cv_uint_t=true],
3057                  [ac_cv_uint_t=false])])
3058 if test "$ac_cv_uint_t" = true ; then
3059   AC_DEFINE(HAVE_UINT_T)
3060   AC_MSG_RESULT(yes)
3061 else
3062   AC_MSG_RESULT(no)
3064 AC_MSG_CHECKING(for uint16_t)
3065 AC_CACHE_VAL(ac_cv_uint16_t,
3066  [AC_TRY_COMPILE([#include <stdio.h>
3067                   #include <sys/types.h>],
3068                  [uint16_t foo = 0;],
3069                  [ac_cv_uint16_t=true],
3070                  [ac_cv_uint16_t=false])])
3071 if test "$ac_cv_uint16_t" = true ; then
3072   AC_DEFINE(HAVE_UINT16_T)
3073   AC_MSG_RESULT(yes)
3074 else
3075   AC_MSG_RESULT(no)
3078 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3079 dnl are defined when compiling C++ but not C.  Since the result of this
3080 dnl test is used only in C++, do it in C++.
3081 AC_LANG_CPLUSPLUS
3083 AC_MSG_CHECKING(for uname.domainname)
3084 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3085     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3086         [ struct utsname *res; char *domain; 
3087             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3088         [ac_cv_have_uname_domainname_field=true],
3089         [ac_cv_have_uname_domainname_field=false])])
3091 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3092     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3093     AC_MSG_RESULT(yes)
3094 else
3095     AC_MSG_RESULT(no)
3098 AC_MSG_CHECKING(for uname.__domainname)
3099 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3100     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3101         [ struct utsname *res; char *domain; 
3102             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3103         [ac_cv_have_uname_us_domainname_field=true],
3104         [ac_cv_have_uname_us_domainname_field=false])])
3106 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3107     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3108     AC_MSG_RESULT(yes)
3109 else
3110     AC_MSG_RESULT(no)
3113 AC_LANG_CPLUSPLUS
3115 dnl Check for usable char16_t (2 bytes, unsigned)
3116 dnl (we might not need the unsignedness check anymore)
3117 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3118     ac_cv_have_usable_char16_t,
3119     [AC_TRY_COMPILE([$configure_static_assert_macros],
3120                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3121                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3122                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3123                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3124                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3125                     ac_cv_have_usable_char16_t="yes",
3126                     ac_cv_have_usable_char16_t="no")])
3127 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3128     AC_DEFINE(HAVE_CPP_CHAR16_T)
3129     HAVE_CPP_CHAR16_T=1
3132 dnl Check for usable wchar_t (2 bytes, unsigned)
3133 dnl (we really don't need the unsignedness check anymore)
3134 dnl ========================================================
3136 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3137     ac_cv_have_usable_wchar_v2,
3138     [AC_TRY_COMPILE([#include <stddef.h>
3139                      $configure_static_assert_macros],
3140                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3141                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3142                     ac_cv_have_usable_wchar_v2="yes",
3143                     ac_cv_have_usable_wchar_v2="no")])
3144 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3145     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3146     HAVE_CPP_2BYTE_WCHAR_T=1
3147 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3148 dnl This is really gcc-only
3149 dnl Do this test using CXX only since some versions of gcc
3150 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3151 dnl only have short-wchar support for c++.
3152 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3154     _SAVE_CXXFLAGS=$CXXFLAGS
3155     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3157     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3158         ac_cv_have_usable_wchar_option_v2,
3159         [AC_TRY_LINK([#include <stddef.h>
3160                       $configure_static_assert_macros],
3161                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3162                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3163                      ac_cv_have_usable_wchar_option_v2="yes",
3164                      ac_cv_have_usable_wchar_option_v2="no")])
3166     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3167         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3168         HAVE_CPP_2BYTE_WCHAR_T=1
3169         if test "$OS_TARGET" = Android; then
3170             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3171             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3172             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3173             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3174         else
3175             WCHAR_CFLAGS="-fshort-wchar"
3176         fi
3177     else    
3178         CXXFLAGS=$_SAVE_CXXFLAGS
3179     fi
3182 AC_LANG_C
3184 dnl Check for .hidden assembler directive and visibility attribute.
3185 dnl Borrowed from glibc configure.in
3186 dnl ===============================================================
3187 if test "$GNU_CC"; then
3188   AC_CACHE_CHECK(for visibility(hidden) attribute,
3189                  ac_cv_visibility_hidden,
3190                  [cat > conftest.c <<EOF
3191                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3193                   ac_cv_visibility_hidden=no
3194                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3195                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3196                       ac_cv_visibility_hidden=yes
3197                     fi
3198                   fi
3199                   rm -f conftest.[cs]
3200                  ])
3201   if test "$ac_cv_visibility_hidden" = "yes"; then
3202     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3204     AC_CACHE_CHECK(for visibility(default) attribute,
3205                    ac_cv_visibility_default,
3206                    [cat > conftest.c <<EOF
3207                     int foo __attribute__ ((visibility ("default"))) = 1;
3209                     ac_cv_visibility_default=no
3210                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3211                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3212                         ac_cv_visibility_default=yes
3213                       fi
3214                     fi
3215                     rm -f conftest.[cs]
3216                    ])
3217     if test "$ac_cv_visibility_default" = "yes"; then
3218       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3220       AC_CACHE_CHECK(for visibility pragma support,
3221                      ac_cv_visibility_pragma,
3222                      [cat > conftest.c <<EOF
3223 #pragma GCC visibility push(hidden)
3224                       int foo_hidden = 1;
3225 #pragma GCC visibility push(default)
3226                       int foo_default = 1;
3228                       ac_cv_visibility_pragma=no
3229                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3230                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3231                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3232                             ac_cv_visibility_pragma=yes
3233                           fi
3234                         fi
3235                       fi
3236                       rm -f conftest.[cs]
3237                     ])
3238       if test "$ac_cv_visibility_pragma" = "yes"; then
3239         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3240                        ac_cv_have_visibility_class_bug,
3241                        [cat > conftest.c <<EOF
3242 #pragma GCC visibility push(hidden)
3243 struct __attribute__ ((visibility ("default"))) TestStruct {
3244   static void Init();
3246 __attribute__ ((visibility ("default"))) void TestFunc() {
3247   TestStruct::Init();
3250                        ac_cv_have_visibility_class_bug=no
3251                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3252                          ac_cv_have_visibility_class_bug=yes
3253                        else
3254                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3255                            ac_cv_have_visibility_class_bug=yes
3256                          fi
3257                        fi
3258                        rm -rf conftest.{c,S}
3259                        ])
3261         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3262                        ac_cv_have_visibility_builtin_bug,
3263                        [cat > conftest.c <<EOF
3264 #pragma GCC visibility push(hidden)
3265 #pragma GCC visibility push(default)
3266 #include <string.h>
3267 #pragma GCC visibility pop
3269 __attribute__ ((visibility ("default"))) void Func() {
3270   char c[[100]];
3271   memset(c, 0, sizeof(c));
3274                        ac_cv_have_visibility_builtin_bug=no
3275                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3276                          ac_cv_have_visibility_builtin_bug=yes
3277                        else
3278                          if test `grep -c "@PLT" conftest.S` = 0; then
3279                            ac_cv_visibility_builtin_bug=yes
3280                          fi
3281                        fi
3282                        rm -f conftest.{c,S}
3283                        ])
3284         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3285                 "$ac_cv_have_visibility_class_bug" = "no"; then
3286           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3287           WRAP_SYSTEM_INCLUDES=1
3288           STL_FLAGS='-I$(DIST)/stl_wrappers'
3289           WRAP_STL_INCLUDES=1
3290         else
3291           VISIBILITY_FLAGS='-fvisibility=hidden'
3292         fi # have visibility pragma bug
3293       fi   # have visibility pragma
3294     fi     # have visibility(default) attribute
3295   fi       # have visibility(hidden) attribute
3296 fi         # GNU_CC
3298 # visibility hidden flag for Sun Studio on Solaris
3299 if test "$SOLARIS_SUNPRO_CC"; then
3300 VISIBILITY_FLAGS='-xldscope=hidden'
3301 fi         # Sun Studio on Solaris
3303 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3304 AC_SUBST(VISIBILITY_FLAGS)
3306 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3307 dnl ========================================================
3308 if test "$GNU_CC"; then
3309   CFLAGS_save="${CFLAGS}"
3310   CFLAGS="${CFLAGS} -Werror"
3311   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3312                  ac_cv_force_align_arg_pointer,
3313                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3314                                  [],
3315                                  ac_cv_force_align_arg_pointer="yes",
3316                                  ac_cv_force_align_arg_pointer="no")])
3317   CFLAGS="${CFLAGS_save}"
3318   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3319     HAVE_GCC_ALIGN_ARG_POINTER=1
3320   else
3321     HAVE_GCC_ALIGN_ARG_POINTER=
3322   fi
3324 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3326 dnl Checks for header files.
3327 dnl ========================================================
3328 AC_HEADER_DIRENT
3329 case "$target_os" in
3330 freebsd*)
3331 # for stuff like -lXshm
3332     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3333     ;;
3334 esac
3335 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3336 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3337 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3338 AC_CHECK_HEADERS(malloc.h)
3339 AC_CHECK_HEADERS(X11/XKBlib.h)
3340 AC_CHECK_HEADERS(io.h)
3342 dnl These are all the places some variant of statfs can be hiding.
3343 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3345 dnl Quota support
3346 AC_CHECK_HEADERS(sys/quota.h)
3347 AC_CHECK_HEADERS(linux/quota.h)
3349 dnl Try for MMX support
3350 dnl NB - later gcc versions require -mmmx for this header to be successfully
3351 dnl included (or another option which implies it, such as -march=pentium-mmx)
3352 AC_CHECK_HEADERS(mmintrin.h)
3354 dnl Check whether the compiler supports the new-style C++ standard
3355 dnl library headers (i.e. <new>) or needs the old "new.h"
3356 AC_LANG_CPLUSPLUS
3357 NEW_H=new.h
3358 AC_CHECK_HEADER(new, [NEW_H=new])
3359 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3360 AC_LANG_C
3362 AC_ARG_ENABLE(dtrace,
3363               [  --enable-dtrace         build with dtrace support if available (default=no)],
3364               [enable_dtrace="yes"],)
3365 if test "x$enable_dtrace" = "xyes"; then
3366   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3367   if test -n "$HAVE_DTRACE"; then
3368       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3369   else
3370       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3371   fi
3373 AC_SUBST(HAVE_DTRACE)
3375 case $target in
3376 *-aix4.3*|*-aix5*)
3377         ;;
3379         AC_CHECK_HEADERS(sys/cdefs.h)
3380         ;;
3381 esac
3383 dnl Checks for libraries.
3384 dnl ========================================================
3385 case $target in
3386 *-hpux11.*)
3387         ;;
3389         AC_CHECK_LIB(c_r, gethostbyname_r)
3390         ;;
3391 esac
3393 dnl We don't want to link with libdl even if it's present on OS X, since
3394 dnl it's not used and not part of the default installation.
3395 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3396 dnl We don't want to link against libm or libpthread on Darwin since
3397 dnl they both are just symlinks to libSystem and explicitly linking
3398 dnl against libSystem causes issues when debugging (see bug 299601).
3399 case $target in
3400 *-darwin*)
3401     ;;
3402 *-beos*)
3403     ;;
3404 *-os2*)
3405     ;;
3407     AC_SEARCH_LIBS(dlopen, dl, 
3408         AC_CHECK_HEADER(dlfcn.h, 
3409         AC_DEFINE(HAVE_DLOPEN)))
3410     ;;
3411 esac
3413 _SAVE_CFLAGS="$CFLAGS"
3414 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3415 AC_CHECK_FUNCS(dladdr)
3416 CFLAGS="$_SAVE_CFLAGS"
3418 if test ! "$GNU_CXX"; then
3420     case $target in
3421     *-aix*)
3422         AC_CHECK_LIB(C_r, demangle)
3423         ;;
3424      *)
3425         AC_CHECK_LIB(C, demangle)
3426         ;;
3427      esac
3430 dnl OS/2 has socket in libc.
3431 case $target in
3432 *-os2*)
3433     ;;
3435     AC_CHECK_LIB(socket, socket)
3436 esac
3438 dnl ========================================================
3439 dnl Check whether we can compile code for Core Text
3440 dnl (available on Mac OS X 10.5 or later)
3441 dnl ========================================================
3442 case "$target" in
3443 *-darwin*)
3444   AC_MSG_CHECKING([for Core Text])
3445   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3446                  [CTLineRef lineRef;],
3447                   ac_cv_have_core_text="yes",
3448                   ac_cv_have_core_text="no")
3449   AC_MSG_RESULT([$ac_cv_have_core_text])
3451   if test "$ac_cv_have_core_text" = "no"; then
3452     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3453   fi
3454   ;;
3455 esac
3457 XLDFLAGS="$X_LIBS"
3458 XLIBS="$X_EXTRA_LIBS"
3460 dnl ========================================================
3461 dnl Checks for X libraries.
3462 dnl Ordering is important.
3463 dnl Xt is dependent upon SM as of X11R6
3464 dnl ========================================================
3465 if test "$no_x" = "yes"; then
3466     AC_DEFINE(NO_X11)
3467 else
3468     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3469         XLIBS="-lX11 $XLIBS"
3470         _SAVE_LDFLAGS="$LDFLAGS"
3471         LDFLAGS="$XLDFLAGS $LDFLAGS"
3472         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3473                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3474         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3475                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3476      
3477         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3478         unset ac_cv_lib_Xt_XtFree
3479             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3480             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3481         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3482                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3483         ])
3485     # AIX needs the motif library linked before libXt to prevent
3486     # crashes in plugins linked against Motif - Bug #98892
3487     case "${target_os}" in
3488     aix*)
3489         XT_LIBS="-lXm $XT_LIBS"
3490         ;;
3491     esac
3493     dnl ========================================================
3494     dnl = Check for XShm
3495     dnl ========================================================
3496     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3497         $XLIBS $XEXT_LIBS)
3498     AC_CHECK_HEADER(X11/extensions/XShm.h)
3499     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3500         test -n "$_HAVE_XSHM_XEXT"; then
3501         AC_DEFINE(HAVE_XSHM)
3502     fi
3504     dnl ========================================================
3505     dnl = Check for Xss
3506     dnl ========================================================
3507     AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
3508         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3509             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3510              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3512     dnl ========================================================
3513     dnl = Check for XIE
3514     dnl ========================================================
3515     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3516         $XLIBS $XEXT_LIBS)
3517     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3519     if test "$MOZ_XIE_LIBS"; then
3520         dnl ====================================================
3521         dnl = If XIE is present and is desired, turn it on
3522         dnl ====================================================
3523         case $target in
3524             *-hpux*)
3525                 ;;
3526             *)
3527                 HAVE_XIE=1
3528                 ;;
3529         esac
3530     fi
3532         LDFLAGS="$_SAVE_LDFLAGS"
3534     dnl ========================================================
3535     dnl = Check for freetype2 and its functionality
3536     dnl ========================================================
3537     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3539     if test "$_HAVE_FREETYPE2"; then
3540         _SAVE_LIBS="$LIBS"
3541         _SAVE_CFLAGS="$CFLAGS"
3542         LIBS="$LIBS $FT2_LIBS"
3543         CFLAGS="$CFLAGS $FT2_CFLAGS"
3545         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3546             ac_cv_member_FT_Bitmap_Size_y_ppem,
3547             [AC_TRY_COMPILE([#include <ft2build.h>
3548                              #include FT_FREETYPE_H],
3549                             [FT_Bitmap_Size s;
3550                              if (sizeof s.y_ppem) return 0;
3551                              return 1],
3552                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3553                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3554         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3555             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3556         else
3557             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3558         fi
3559         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3560                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3561                            [FT_Bitmap_Size structure includes y_ppem field])
3563         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3565         LIBS="$_SAVE_LIBS"
3566         CFLAGS="$_SAVE_CFLAGS"
3567     fi
3569 fi # $no_x
3571 AC_SUBST(XCFLAGS)
3572 AC_SUBST(XLDFLAGS)
3573 AC_SUBST(XLIBS)
3574 AC_SUBST(XEXT_LIBS)
3575 AC_SUBST(XT_LIBS)
3576 AC_SUBST(XSS_LIBS)
3578 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3579 AC_TRY_COMPILE([],
3580                [asm("uqadd8 r1, r1, r2");],
3581                result="yes", result="no")
3582 AC_MSG_RESULT("$result")
3583 if test "$result" = "yes"; then
3584     AC_DEFINE(HAVE_ARM_SIMD)
3585     HAVE_ARM_SIMD=1
3587 AC_SUBST(HAVE_ARM_SIMD)
3589 AC_MSG_CHECKING(for ARM NEON support in compiler)
3590 _SAVE_CFLAGS="$CFLAGS"
3591 if test "$GNU_CC"; then
3592   # gcc needs -mfpu=neon to recognize NEON instructions
3593   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3595 AC_TRY_COMPILE([],
3596                [asm("vadd.i8 d0, d0, d0");],
3597                result="yes", result="no")
3598 AC_MSG_RESULT("$result")
3599 if test "$result" = "yes"; then
3600     AC_DEFINE(HAVE_ARM_NEON)
3601     HAVE_ARM_NEON=1
3603 CFLAGS="$_SAVE_CFLAGS"
3604 AC_SUBST(HAVE_ARM_NEON)
3606 dnl ========================================================
3607 dnl = pthread support
3608 dnl = Start by checking whether the system support pthreads
3609 dnl ========================================================
3610 case "$target_os" in
3611 darwin*)
3612     USE_PTHREADS=1
3613     ;;
3615     MOZ_CHECK_PTHREADS(pthreads,
3616         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3617         MOZ_CHECK_PTHREADS(pthread,
3618             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3619             MOZ_CHECK_PTHREADS(c_r,
3620                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3621                 MOZ_CHECK_PTHREADS(c,
3622                     USE_PTHREADS=1
3623                 )
3624             )
3625         )
3626     )
3627     ;;
3628 esac
3630 dnl ========================================================
3631 dnl Check the command line for --with-pthreads 
3632 dnl ========================================================
3633 MOZ_ARG_WITH_BOOL(pthreads,
3634 [  --with-pthreads         Force use of system pthread library with NSPR ],
3635 [ if test "$USE_PTHREADS"x = x; then
3636     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3637 fi],
3638     USE_PTHREADS=
3639     _PTHREAD_LDFLAGS=
3642 dnl ========================================================
3643 dnl Do the platform specific pthread hackery
3644 dnl ========================================================
3645 if test "$USE_PTHREADS"x != x
3646 then
3647         dnl
3648         dnl See if -pthread is supported.
3649         dnl
3650         rm -f conftest*
3651         ac_cv_have_dash_pthread=no
3652         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3653         echo 'int main() { return 0; }' | cat > conftest.c
3654         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3655         if test $? -eq 0; then
3656                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3657                         ac_cv_have_dash_pthread=yes
3658                 case "$target_os" in
3659                 freebsd*)
3660 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3661                 ;;
3662                 *)
3663                             CFLAGS="$CFLAGS -pthread"
3664                             CXXFLAGS="$CXXFLAGS -pthread"
3665                 ;;
3666                 esac
3667                 fi
3668         fi
3669         rm -f conftest*
3670     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3672         dnl
3673         dnl See if -pthreads is supported.
3674         dnl
3675     ac_cv_have_dash_pthreads=no
3676     if test "$ac_cv_have_dash_pthread" = "no"; then
3677             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3678         echo 'int main() { return 0; }' | cat > conftest.c
3679             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3680         if test $? -eq 0; then
3681                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3682                             ac_cv_have_dash_pthreads=yes
3683                             CFLAGS="$CFLAGS -pthreads"
3684                             CXXFLAGS="$CXXFLAGS -pthreads"
3685                     fi
3686             fi
3687             rm -f conftest*
3688         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3689     fi
3691         case "$target" in
3692             *-*-freebsd*)
3693                         AC_DEFINE(_REENTRANT)
3694                         AC_DEFINE(_THREAD_SAFE)
3695                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3696                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3697                                 _PTHREAD_LDFLAGS="-pthread"
3698                         else
3699                                 _PTHREAD_LDFLAGS="-lc_r"
3700                         fi
3701                         ;;
3703             *-*-openbsd*|*-*-bsdi*)
3704                         AC_DEFINE(_REENTRANT)
3705                         AC_DEFINE(_THREAD_SAFE)
3706                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3707                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3708                 _PTHREAD_LDFLAGS="-pthread"
3709                         fi
3710                         ;;
3712             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3713                         AC_DEFINE(_REENTRANT) 
3714                         ;;
3716             *-*-nto*) 
3717                         AC_DEFINE(_REENTRANT) 
3718                         ;;
3720             *-aix4.3*|*-aix5*)
3721                         AC_DEFINE(_REENTRANT) 
3722                         ;;
3724             *-hpux11.*)
3725                         AC_DEFINE(_REENTRANT) 
3726                         ;;
3728             alpha*-*-osf*)
3729                         AC_DEFINE(_REENTRANT)
3730                         ;;
3732             *-*-solaris*) 
3733                         AC_DEFINE(_REENTRANT)
3734                         if test "$SOLARIS_SUNPRO_CC"; then
3735                                 CFLAGS="$CFLAGS -mt" 
3736                                 CXXFLAGS="$CXXFLAGS -mt" 
3737                         fi
3738                         ;;
3739         esac
3740     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3743 dnl ========================================================
3744 dnl See if mmap sees writes
3745 dnl For cross compiling, just define it as no, which is a safe default
3746 dnl ========================================================
3747 AC_MSG_CHECKING(whether mmap() sees write()s)
3749 changequote(,)
3750 mmap_test_prog='
3751     #include <stdlib.h>
3752     #include <unistd.h>
3753     #include <sys/mman.h>
3754     #include <sys/types.h>
3755     #include <sys/stat.h>
3756     #include <fcntl.h>
3758     char fname[] = "conftest.file";
3759     char zbuff[1024]; /* Fractional page is probably worst case */
3761     int main() {
3762         char *map;
3763         int fd;
3764         int i;
3765         unlink(fname);
3766         fd = open(fname, O_RDWR | O_CREAT, 0660);
3767         if(fd<0) return 1;
3768         unlink(fname);
3769         write(fd, zbuff, sizeof(zbuff));
3770         lseek(fd, 0, SEEK_SET);
3771         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3772         if(map==(char*)-1) return 2;
3773         for(i=0; fname[i]; i++) {
3774             int rc = write(fd, &fname[i], 1);
3775             if(map[i]!=fname[i]) return 4;
3776         }
3777         return 0;
3778     }
3780 changequote([,])
3782 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3784 AC_MSG_RESULT("$result")
3786 if test "$result" = "no"; then
3787     AC_DEFINE(MMAP_MISSES_WRITES)
3791 dnl Checks for library functions.
3792 dnl ========================================================
3793 AC_PROG_GCC_TRADITIONAL
3794 AC_FUNC_MEMCMP
3795 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3796 AC_CHECK_FUNCS(flockfile getpagesize)
3797 AC_CHECK_FUNCS(localtime_r strtok_r)
3799 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3800 _SAVE_LDFLAGS=$LDFLAGS
3801 LDFLAGS="$LDFLAGS -lrt"
3802 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3803                ac_cv_have_clock_monotonic,
3804                [AC_TRY_LINK([#include <time.h>],
3805                             [ struct timespec ts;
3806                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3807                             ac_cv_have_clock_monotonic=yes,
3808                             ac_cv_have_clock_monotonic=no)])
3809 LDFLAGS=$_SAVE_LDFLAGS
3810 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3811     HAVE_CLOCK_MONOTONIC=1
3812     REALTIME_LIBS=-lrt
3813     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3814     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3815     AC_SUBST(REALTIME_LIBS)
3818 dnl check for wcrtomb/mbrtowc
3819 dnl =======================================================================
3820 if test -z "$MACOS_DEPLOYMENT_TARGET" -o "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3821 AC_LANG_SAVE
3822 AC_LANG_CPLUSPLUS
3823 AC_CACHE_CHECK(for wcrtomb,
3824     ac_cv_have_wcrtomb,
3825     [AC_TRY_LINK([#include <wchar.h>],
3826                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3827                  ac_cv_have_wcrtomb="yes",
3828                  ac_cv_have_wcrtomb="no")])
3829 if test "$ac_cv_have_wcrtomb" = "yes"; then
3830     AC_DEFINE(HAVE_WCRTOMB)
3832 AC_CACHE_CHECK(for mbrtowc,
3833     ac_cv_have_mbrtowc,
3834     [AC_TRY_LINK([#include <wchar.h>],
3835                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3836                  ac_cv_have_mbrtowc="yes",
3837                  ac_cv_have_mbrtowc="no")])
3838 if test "$ac_cv_have_mbrtowc" = "yes"; then
3839     AC_DEFINE(HAVE_MBRTOWC)
3841 AC_LANG_RESTORE
3844 AC_CACHE_CHECK(
3845     [for res_ninit()],
3846     ac_cv_func_res_ninit,
3847     [AC_TRY_LINK([
3848         #ifdef linux
3849         #define _BSD_SOURCE 1
3850         #endif
3851         #include <resolv.h>
3852         ],
3853         [int foo = res_ninit(&_res);],
3854         [ac_cv_func_res_ninit=yes],
3855         [ac_cv_func_res_ninit=no])
3856     ])
3858 if test "$ac_cv_func_res_ninit" = "yes"; then
3859     AC_DEFINE(HAVE_RES_NINIT)
3860 dnl must add the link line we do something as foolish as this... dougt
3861 dnl else
3862 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3863 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3866 AC_LANG_CPLUSPLUS
3867 AC_CACHE_CHECK(
3868     [for gnu_get_libc_version()],
3869     ac_cv_func_gnu_get_libc_version,
3870     [AC_TRY_LINK([
3871         #ifdef HAVE_GNU_LIBC_VERSION_H
3872         #include <gnu/libc-version.h>
3873         #endif
3874         ],
3875         [const char *glibc_version = gnu_get_libc_version();],
3876         [ac_cv_func_gnu_get_libc_version=yes],
3877         [ac_cv_func_gnu_get_libc_version=no] 
3878         )]
3879     )
3881 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3882     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3885 case $target_os in
3886     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3887         ;;
3888     *)
3889     
3890 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3891     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3892         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3893 _SAVE_LIBS=$LIBS
3894 LIBS="$LIBS $_ICONV_LIBS"
3895 AC_CACHE_CHECK(
3896     [for iconv()],
3897     ac_cv_func_iconv,
3898     [AC_TRY_LINK([
3899         #include <stdlib.h>
3900         #include <iconv.h>
3901         ],
3902         [
3903             iconv_t h = iconv_open("", "");
3904             iconv(h, NULL, NULL, NULL, NULL);
3905             iconv_close(h);
3906         ],
3907         [ac_cv_func_iconv=yes],
3908         [ac_cv_func_iconv=no] 
3909         )]
3910     )
3911 if test "$ac_cv_func_iconv" = "yes"; then
3912     AC_DEFINE(HAVE_ICONV)
3913     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3914     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3915     LIBICONV="$_ICONV_LIBS"
3916     AC_CACHE_CHECK(
3917         [for iconv() with const input],
3918         ac_cv_func_const_iconv,
3919         [AC_TRY_COMPILE([
3920             #include <stdlib.h>
3921             #include <iconv.h>
3922             ],
3923             [
3924                 const char *input = "testing";
3925                 iconv_t h = iconv_open("", "");
3926                 iconv(h, &input, NULL, NULL, NULL);
3927                 iconv_close(h);
3928             ],
3929             [ac_cv_func_const_iconv=yes],
3930             [ac_cv_func_const_iconv=no] 
3931             )]
3932         )
3933     if test "$ac_cv_func_const_iconv" = "yes"; then
3934         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3935     fi
3937 LIBS=$_SAVE_LIBS
3939     ;;
3940 esac
3942 AM_LANGINFO_CODESET
3944 AC_LANG_C
3946 dnl **********************
3947 dnl *** va_copy checks ***
3948 dnl **********************
3949 dnl we currently check for all three va_copy possibilities, so we get
3950 dnl all results in config.log for bug reports.
3951 AC_MSG_CHECKING(for an implementation of va_copy())
3952 AC_CACHE_VAL(ac_cv_va_copy,[
3953     AC_TRY_RUN([
3954         #include <stdarg.h>
3955         void f (int i, ...) {
3956             va_list args1, args2;
3957             va_start (args1, i);
3958             va_copy (args2, args1);
3959             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3960                 exit (1);
3961             va_end (args1); va_end (args2);
3962         }
3963         int main() { f (0, 42); return 0; }],
3964         ac_cv_va_copy=yes,
3965         ac_cv_va_copy=no,
3966         ac_cv_va_copy=no
3967     )
3969 AC_MSG_RESULT($ac_cv_va_copy)
3970 AC_MSG_CHECKING(for an implementation of __va_copy())
3971 AC_CACHE_VAL(ac_cv___va_copy,[
3972     AC_TRY_RUN([
3973         #include <stdarg.h>
3974         void f (int i, ...) {
3975             va_list args1, args2;
3976             va_start (args1, i);
3977             __va_copy (args2, args1);
3978             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3979                 exit (1);
3980             va_end (args1); va_end (args2);
3981         }
3982         int main() { f (0, 42); return 0; }],
3983         ac_cv___va_copy=yes,
3984         ac_cv___va_copy=no,
3985         ac_cv___va_copy=no
3986     )
3988 AC_MSG_RESULT($ac_cv___va_copy)
3989 AC_MSG_CHECKING(whether va_lists can be copied by value)
3990 AC_CACHE_VAL(ac_cv_va_val_copy,[
3991     AC_TRY_RUN([
3992         #include <stdarg.h>
3993         void f (int i, ...) {
3994             va_list args1, args2;
3995             va_start (args1, i);
3996             args2 = args1;
3997             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3998                 exit (1);
3999             va_end (args1); va_end (args2);
4000         }
4001         int main() { f (0, 42); return 0; }],
4002         ac_cv_va_val_copy=yes,
4003         ac_cv_va_val_copy=no,
4004         ac_cv_va_val_copy=yes
4005     )
4007 if test "x$ac_cv_va_copy" = "xyes"; then
4008     AC_DEFINE(VA_COPY, va_copy)
4009     AC_DEFINE(HAVE_VA_COPY)
4010 elif test "x$ac_cv___va_copy" = "xyes"; then
4011     AC_DEFINE(VA_COPY, __va_copy)
4012     AC_DEFINE(HAVE_VA_COPY)
4015 if test "x$ac_cv_va_val_copy" = "xno"; then
4016    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
4018 AC_MSG_RESULT($ac_cv_va_val_copy)
4020 dnl Check for dll-challenged libc's.
4021 dnl This check is apparently only needed for Linux.
4022 case "$target" in
4023         *-linux*)
4024             dnl ===================================================================
4025             _curdir=`pwd`
4026             export _curdir
4027             rm -rf conftest* _conftest
4028             mkdir _conftest
4029             cat >> conftest.C <<\EOF
4030 #include <stdio.h>
4031 #include <link.h>
4032 #include <dlfcn.h>
4033 #ifdef _dl_loaded
4034 void __dump_link_map(void) {
4035   struct link_map *map = _dl_loaded;
4036   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
4038 int main() {
4039   dlopen("./conftest1.so",RTLD_LAZY);
4040   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
4041   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
4042   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
4043   __dump_link_map();
4045 #else
4046 /* _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).*/
4047 int main() { printf("./conftest1.so\n"); }
4048 #endif
4051             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4053             cat >> conftest1.C <<\EOF
4054 #include <stdio.h>
4055 void foo(void) {printf("foo in dll called\n");}
4057             ${CXX-g++} -fPIC -c -g conftest1.C
4058             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4059             ${CXX-g++} -g conftest.C -o conftest -ldl
4060             cp -f conftest1.so conftest _conftest
4061             cd _conftest
4062             if test `./conftest | grep conftest1.so | wc -l` -gt 1
4063             then
4064                 echo
4065                 echo "*** Your libc has a bug that can result in loading the same dynamic"
4066                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
4067                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
4068                 echo "*** will be excessive memory usage at runtime."
4069                 echo
4070             fi
4071             cd ${_curdir}
4072             rm -rf conftest* _conftest
4073             dnl ===================================================================
4074             ;;
4075 esac
4077 dnl ===================================================================
4078 dnl ========================================================
4079 dnl Put your C++ language/feature checks below
4080 dnl ========================================================
4081 AC_LANG_CPLUSPLUS
4083 ARM_ABI_PREFIX=
4084 HAVE_GCC3_ABI=
4085 if test "$GNU_CC"; then
4086   if test "$CPU_ARCH" = "arm" ; then
4087     AC_CACHE_CHECK(for ARM EABI,
4088         ac_cv_gcc_arm_eabi,
4089         [AC_TRY_COMPILE([],
4090                         [
4091 #if defined(__ARM_EABI__)
4092   return 0;
4093 #else
4094 #error Not ARM EABI.
4095 #endif
4096                         ],
4097                         ac_cv_gcc_arm_eabi="yes",
4098                         ac_cv_gcc_arm_eabi="no")])
4099     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4100         HAVE_ARM_EABI=1
4101         ARM_ABI_PREFIX=eabi-
4102     else
4103         ARM_ABI_PREFIX=oabi-
4104     fi
4105   fi
4107   AC_CACHE_CHECK(for gcc 3.0 ABI,
4108       ac_cv_gcc_three_abi,
4109       [AC_TRY_COMPILE([],
4110                       [
4111 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4112   return 0;
4113 #else
4114 #error Not gcc3.
4115 #endif
4116                       ],
4117                       ac_cv_gcc_three_abi="yes",
4118                       ac_cv_gcc_three_abi="no")])
4119   if test "$ac_cv_gcc_three_abi" = "yes"; then
4120       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4121       HAVE_GCC3_ABI=1
4122   else
4123       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4124   fi
4126 AC_SUBST(HAVE_GCC3_ABI)
4129 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4130                ac_cv_cpp_explicit,
4131                [AC_TRY_COMPILE(class X {
4132                                public: explicit X(int i) : i_(i) {}
4133                                private: int i_;
4134                                };,
4135                                X x(3);,
4136                                ac_cv_cpp_explicit=yes,
4137                                ac_cv_cpp_explicit=no)])
4138 if test "$ac_cv_cpp_explicit" = yes ; then
4139    AC_DEFINE(HAVE_CPP_EXPLICIT)
4142 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4143                ac_cv_cpp_typename,
4144                [AC_TRY_COMPILE(class param {
4145                                public:
4146                                    typedef unsigned long num_type;
4147                                };
4149                                template <class T> class tplt {
4150                                public:
4151                                    typedef typename T::num_type t_num_type;
4152                                    t_num_type foo(typename T::num_type num) {
4153                                        return num;
4154                                    }
4155                                };,
4156                                tplt<param> A;
4157                                A.foo(0);,
4158                                ac_cv_cpp_typename=yes,
4159                                ac_cv_cpp_typename=no)])
4160 if test "$ac_cv_cpp_typename" = yes ; then
4161    AC_DEFINE(HAVE_CPP_TYPENAME)
4164 dnl Check for support of modern template specialization syntax
4165 dnl Test code and requirement from scc@netscape.com.
4166 dnl Autoconf cut-and-paste job by waterson@netscape.com
4167 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4168                ac_cv_cpp_modern_specialize_template_syntax,
4169                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4170                                class Y {};
4171                                template <> struct X<Y> { double a; };,
4172                                X<int> int_x;
4173                                X<Y> y_x;,
4174                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4175                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4176 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4177   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4181 dnl Some compilers support only full specialization, and some don't.
4182 AC_CACHE_CHECK(whether partial template specialization works,
4183                ac_cv_cpp_partial_specialization,
4184                [AC_TRY_COMPILE(template <class T> class Foo {};
4185                                template <class T> class Foo<T*> {};,
4186                                return 0;,
4187                                ac_cv_cpp_partial_specialization=yes,
4188                                ac_cv_cpp_partial_specialization=no)])
4189 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4190   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4193 dnl Some compilers have limited support for operators with templates;
4194 dnl specifically, it is necessary to define derived operators when a base
4195 dnl class's operator declaration should suffice.
4196 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4197                ac_cv_need_derived_template_operators,
4198                [AC_TRY_COMPILE([template <class T> class Base { };
4199                                 template <class T>
4200                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4201                                 template <class T> class Derived : public Base<T> { };],
4202                                [Derived<char> a, b;
4203                                 Base<char> c = a + b;
4204                                 return 0;],
4205                                ac_cv_need_derived_template_operators=no,
4206                                ac_cv_need_derived_template_operators=yes)])
4207 if test "$ac_cv_need_derived_template_operators" = yes ; then
4208   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4212 dnl Some compilers have trouble detecting that a template class
4213 dnl that derives from another template is actually an instance
4214 dnl of the base class. This test checks for that.
4215 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4216                ac_cv_need_cpp_template_cast_to_base,
4217                [AC_TRY_COMPILE([template <class T> class Base { };
4218                                 template <class T> class Derived : public Base<T> { };
4219                                 template <class T> int foo(const Base<T>&) { return 0; }],
4220                                [Derived<char> bar; return foo(bar);],
4221                                ac_cv_need_cpp_template_cast_to_base=no,
4222                                ac_cv_need_cpp_template_cast_to_base=yes)])
4223 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4224   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4227 dnl Some compilers have trouble resolving the ambiguity between two
4228 dnl functions whose arguments differ only by cv-qualifications.
4229 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4230                ac_cv_can_resolve_const_ambiguity,
4231                [AC_TRY_COMPILE([
4232                                 template <class T> class ptrClass {
4233                                   public: T* ptr;
4234                                 };
4236                                 template <class T> T* a(ptrClass<T> *arg) {
4237                                   return arg->ptr;
4238                                 }
4240                                 template <class T>
4241                                 const T* a(const ptrClass<T> *arg) {
4242                                   return arg->ptr;
4243                                 }
4244                                ],
4245                                [ ptrClass<int> i;
4246                                  a(&i); ],
4247                                ac_cv_can_resolve_const_ambiguity=yes,
4248                                ac_cv_can_resolve_const_ambiguity=no)])
4249 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4250   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4254 dnl We don't do exceptions on unix.  The only reason this used to be here
4255 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4256 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4257 dnl So im commenting this out until someone writes some artificial 
4258 dnl intelligence to detect not only if the compiler has exceptions, but if 
4259 dnl they are enabled as well.
4260 dnl 
4261 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4262 dnl                ac_cv_cpp_exceptions,
4263 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4264 dnl                                static void F() { throw X(); },
4265 dnl                                try { F(); } catch(X & e) { },
4266 dnl                                ac_cv_cpp_exceptions=yes,
4267 dnl                                ac_cv_cpp_exceptions=no)])
4268 dnl if test $ac_cv_cpp_exceptions = yes ; then
4269 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4270 dnl fi
4272 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4273 dnl supports it well enough to allow us to use it to change access, but not
4274 dnl to resolve ambiguity. The next two tests determine how well the |using|
4275 dnl keyword is supported.
4277 dnl Check to see if we can change access with |using|.  Test both a
4278 dnl legal and an illegal example.
4279 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4280                ac_cv_cpp_access_changing_using2,
4281                [AC_TRY_COMPILE(
4282                    class A { protected: int foo() { return 0; } };
4283                    class B : public A { public: using A::foo; };,
4284                    B b; return b.foo();,
4285                    [AC_TRY_COMPILE(
4286                        class A { public: int foo() { return 1; } };
4287                        class B : public A { private: using A::foo; };,
4288                        B b; return b.foo();,
4289                        ac_cv_cpp_access_changing_using2=no,
4290                        ac_cv_cpp_access_changing_using2=yes)],
4291                    ac_cv_cpp_access_changing_using2=no)])
4292 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4293    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4296 dnl Check to see if we can resolve ambiguity with |using|.
4297 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4298                ac_cv_cpp_ambiguity_resolving_using,
4299                [AC_TRY_COMPILE(class X { 
4300                                  public: int go(const X&) {return 3;}
4301                                          int jo(const X&) {return 3;}
4302                                };
4303                                class Y : public X {
4304                                  public:  int go(int) {return 2;}
4305                                           int jo(int) {return 2;}
4306                                           using X::jo;
4307                                  private: using X::go;
4308                                };,
4309                                X x; Y y; y.jo(x);,
4310                                ac_cv_cpp_ambiguity_resolving_using=yes,
4311                                ac_cv_cpp_ambiguity_resolving_using=no)])
4312 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4313    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4316 dnl Check to see if the |std| namespace is supported. If so, we'll want
4317 dnl to qualify any standard library calls with "std::" to ensure that
4318 dnl those functions can be resolved.
4319 AC_CACHE_CHECK(for \"std::\" namespace,
4320                ac_cv_cpp_namespace_std,
4321                [AC_TRY_COMPILE([#include <algorithm>],
4322                                [return std::min(0, 1);],
4323                                ac_cv_cpp_namespace_std=yes,
4324                                ac_cv_cpp_namespace_std=no)])
4325 if test "$ac_cv_cpp_namespace_std" = yes ; then
4326    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4329 dnl Older compilers are overly ambitious with respect to using the standard
4330 dnl template library's |operator!=()| when |operator==()| is defined. In
4331 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4332 dnl ambiguity at compile-time. This test checks for that case.
4333 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4334                ac_cv_cpp_unambiguous_std_notequal,
4335                [AC_TRY_COMPILE([#include <algorithm>
4336                                 struct T1 {};
4337                                 int operator==(const T1&, const T1&) { return 0; }
4338                                 int operator!=(const T1&, const T1&) { return 0; }],
4339                                [T1 a,b; return a != b;],
4340                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4341                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4342 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4343   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4347 AC_CACHE_CHECK(for C++ reinterpret_cast,
4348                ac_cv_cpp_reinterpret_cast,
4349                [AC_TRY_COMPILE(struct X { int i; };
4350                                struct Y { int i; };,
4351                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4352                                ac_cv_cpp_reinterpret_cast=yes,
4353                                ac_cv_cpp_reinterpret_cast=no)])
4354 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4355    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4358 dnl See if a dynamic_cast to void* gives the most derived object.
4359 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4360                ac_cv_cpp_dynamic_cast_void_ptr,
4361                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4362                             class Y { int j; public: virtual ~Y() { } };
4363                             class Z : public X, public Y { int k; };
4365                             int main() {
4366                                  Z mdo;
4367                                  X *subx = (X*)&mdo;
4368                                  Y *suby = (Y*)&mdo;
4369                                  return !((((void*)&mdo != (void*)subx) &&
4370                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4371                                           (((void*)&mdo != (void*)suby) &&
4372                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4373                             }],
4374                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4375                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4376                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4377 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4378    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4382 dnl note that this one is reversed - if the test fails, then
4383 dnl we require implementations of unused virtual methods. Which
4384 dnl really blows because it means we'll have useless vtable
4385 dnl bloat.
4386 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4387                ac_cv_cpp_unused_required,
4388                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4389                                X x;,
4390                                ac_cv_cpp_unused_required=no,
4391                                ac_cv_cpp_unused_required=yes)])
4392 if test "$ac_cv_cpp_unused_required" = yes ; then
4393    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4397 dnl Some compilers have trouble comparing a constant reference to a templatized
4398 dnl class to zero, and require an explicit operator==() to be defined that takes
4399 dnl an int. This test separates the strong from the weak.
4401 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4402                ac_cv_trouble_comparing_to_zero,
4403                [AC_TRY_COMPILE([#include <algorithm>
4404                                 template <class T> class Foo {};
4405                                 class T2;
4406                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4407                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4408                                [Foo<int> f; return (0 != f);],
4409                                ac_cv_trouble_comparing_to_zero=no,
4410                                ac_cv_trouble_comparing_to_zero=yes)])
4411 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4412   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4415 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4416 _SAVE_LDFLAGS=$LDFLAGS
4417 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4418 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4419                ac_cv_thread_keyword,
4420                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4421                             [return tlsIsMainThread;],
4422                             ac_cv_thread_keyword=yes,
4423                             ac_cv_thread_keyword=no)])
4424 LDFLAGS=$_SAVE_LDFLAGS
4425 if test "$ac_cv_thread_keyword" = yes; then
4426   # mips builds fail with TLS variables because of a binutils bug.
4427   # See bug 528687
4428   case "${target}" in
4429     mips*-*)
4430       :
4431       ;;
4432     *-android*)
4433       :
4434       ;;
4435     *)
4436       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4437       ;;
4438   esac
4441 dnl Check for the existence of various allocation headers/functions
4443 MALLOC_H=
4444 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4445 if test "$MALLOC_H" = ""; then
4446   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4447   if test "$MALLOC_H" = ""; then
4448     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4449   fi
4451 if test "$MALLOC_H" != ""; then
4452    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4455 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4456 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4458 dnl See if compiler supports some gcc-style attributes
4460 AC_CACHE_CHECK(for __attribute__((always_inline)),
4461                ac_cv_attribute_always_inline,
4462                [AC_TRY_COMPILE([],
4463                                [inline void f(void) __attribute__((always_inline));],
4464                                ac_cv_attribute_always_inline=yes,
4465                                ac_cv_attribute_always_inline=no)])
4467 AC_CACHE_CHECK(for __attribute__((malloc)),
4468                ac_cv_attribute_malloc,
4469                [AC_TRY_COMPILE([],
4470                                [void* f(int) __attribute__((malloc));],
4471                                ac_cv_attribute_malloc=yes,
4472                                ac_cv_attribute_malloc=no)])
4474 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4475                ac_cv_attribute_warn_unused,
4476                [AC_TRY_COMPILE([],
4477                                [int f(void) __attribute__((warn_unused_result));],
4478                                ac_cv_attribute_warn_unused=yes,
4479                                ac_cv_attribute_warn_unused=no)])
4481 AC_CACHE_CHECK(for __attribute__((noreturn)),
4482                ac_cv_attribute_noreturn,
4483                [AC_TRY_COMPILE([],
4484                                [void f(void) __attribute__((noreturn));],
4485                                ac_cv_attribute_noreturn=yes,
4486                                ac_cv_attribute_noreturn=no)])
4488 dnl End of C++ language/feature checks
4489 AC_LANG_C
4491 dnl ========================================================
4492 dnl =  Internationalization checks
4493 dnl ========================================================
4495 dnl Internationalization and Locale support is different
4496 dnl on various UNIX platforms.  Checks for specific i18n
4497 dnl features go here.
4499 dnl check for LC_MESSAGES
4500 AC_CACHE_CHECK(for LC_MESSAGES,
4501                 ac_cv_i18n_lc_messages,
4502                 [AC_TRY_COMPILE([#include <locale.h>],
4503                                 [int category = LC_MESSAGES;],
4504                                 ac_cv_i18n_lc_messages=yes,
4505                                 ac_cv_i18n_lc_messages=no)])
4506 if test "$ac_cv_i18n_lc_messages" = yes; then
4507    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4510 AC_HAVE_FUNCS(localeconv)
4512 fi # SKIP_COMPILER_CHECKS
4514 TARGET_XPCOM_ABI=
4515 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4516     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4519 dnl Mozilla specific options
4520 dnl ========================================================
4521 dnl The macros used for command line options
4522 dnl are defined in build/autoconf/altoptions.m4.
4524 dnl If the compiler supports these attributes, define them as
4525 dnl convenience macros.
4526 if test "$ac_cv_attribute_always_inline" = yes ; then
4527   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4528 else
4529   AC_DEFINE(NS_ALWAYS_INLINE,)
4532 if test "$ac_cv_attribute_malloc" = yes ; then
4533   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4534 else
4535   AC_DEFINE(NS_ATTR_MALLOC,)
4538 if test "$ac_cv_attribute_warn_unused" = yes ; then
4539   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4540 else
4541   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4544 if test "$ac_cv_attribute_noreturn" = yes ; then
4545   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4546 else
4547   AC_DEFINE(NS_NORETURN,)
4550 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4551 dnl features that Windows actually does support.
4553 if test -n "$SKIP_COMPILER_CHECKS"; then
4554    dnl Windows has malloc.h
4555    AC_DEFINE(MALLOC_H, [<malloc.h>])
4556    AC_DEFINE(HAVE_FORCEINLINE)
4557    AC_DEFINE(HAVE_LOCALECONV)
4558 fi # SKIP_COMPILER_CHECKS
4560 dnl ========================================================
4561 dnl =
4562 dnl = Check for external package dependencies
4563 dnl =
4564 dnl ========================================================
4565 MOZ_ARG_HEADER(External Packages)
4567 MOZ_ENABLE_LIBXUL=1
4569 MOZ_ARG_WITH_STRING(libxul-sdk,
4570 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4571   LIBXUL_SDK_DIR=$withval)
4573 if test "$LIBXUL_SDK_DIR" = "yes"; then
4574     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4575 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4576     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4578     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4579         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4580     fi
4582     MOZ_ENABLE_LIBXUL=1
4584 AC_SUBST(LIBXUL_SDK)
4586 if test -n "$LIBXUL_SDK"; then
4587     LIBXUL_DIST="$LIBXUL_SDK"
4588 else
4589     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4591 AC_SUBST(LIBXUL_DIST)
4593 SYSTEM_LIBXUL=
4595 MOZ_ARG_WITH_BOOL(system-libxul,
4596 [  --with-system-libxul    Use system installed libxul SDK],
4597     SYSTEM_LIBXUL=1)
4599 if test -n "$SYSTEM_LIBXUL" -a -z "$MOZ_ENABLE_LIBXUL"; then
4600     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4603 dnl ========================================================
4604 dnl = If NSPR was not detected in the system, 
4605 dnl = use the one in the source tree (mozilla/nsprpub)
4606 dnl ========================================================
4607 MOZ_ARG_WITH_BOOL(system-nspr,
4608 [  --with-system-nspr      Use system installed NSPR],
4609     _USE_SYSTEM_NSPR=1 )
4611 if test -n "$_USE_SYSTEM_NSPR"; then
4612     AM_PATH_NSPR(4.8.6, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4615 if test -n "$MOZ_NATIVE_NSPR"; then
4616     _SAVE_CFLAGS=$CFLAGS
4617     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4618     AC_TRY_COMPILE([#include "prtypes.h"],
4619                 [#ifndef PR_STATIC_ASSERT
4620                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4621                  #endif],
4622                 [MOZ_NATIVE_NSPR=1],
4623                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4624     CFLAGS=$_SAVE_CFLAGS
4625 else
4626     if test "$OS_ARCH" = "WINCE"; then
4627         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4628         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4629     elif test "$OS_ARCH" = "WINNT"; then
4630         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4631         if test -n "$GNU_CC"; then
4632             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4633         else
4634             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4635         fi
4636     else
4637         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4638         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4639     fi
4642 dnl system libevent Support
4643 dnl ========================================================
4644 MOZ_ARG_WITH_STRING(system-libevent,
4645 [  --with-system-libevent=[PFX]
4646                           Use system libevent [installed at prefix PFX]],
4647     LIBEVENT_DIR=$withval)
4649 _SAVE_CFLAGS=$CFLAGS
4650 _SAVE_LDFLAGS=$LDFLAGS
4651 _SAVE_LIBS=$LIBS
4652 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4653     MOZ_NATIVE_LIBEVENT=
4654 else
4655     if test "${LIBEVENT_DIR}" = "yes"; then
4656         LIBEVENT_DIR=/usr
4657     fi
4658     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4659     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4660     AC_CHECK_HEADER(event.h,
4661                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4662                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4663                      fi],
4664                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4665     AC_CHECK_LIB(event, event_init,
4666                  [MOZ_NATIVE_LIBEVENT=1
4667                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4668                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4669                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4671 CFLAGS=$_SAVE_CFLAGS
4672 LDFLAGS=$_SAVE_LDFLAGS
4673 LIBS=$_SAVE_LIBS
4675 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4676 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4677 AC_SUBST(MOZ_LIBEVENT_LIBS)
4679 dnl ========================================================
4680 dnl = If NSS was not detected in the system, 
4681 dnl = use the one in the source tree (mozilla/security/nss)
4682 dnl ========================================================
4684 MOZ_ARG_WITH_BOOL(system-nss,
4685 [  --with-system-nss       Use system installed NSS],
4686     _USE_SYSTEM_NSS=1 )
4688 if test -n "$_USE_SYSTEM_NSS"; then
4689     AM_PATH_NSS(3.12.8, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4692 if test -n "$MOZ_NATIVE_NSS"; then
4693    NSS_LIBS="$NSS_LIBS -lcrmf"
4694 else
4695    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4696    NSS_DEP_LIBS="\
4697         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4698         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4699         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4700         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4701         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4703    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4704        NSS_LIBS="\
4705         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4706         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4707         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4708         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4709         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4710    else
4711        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4712    fi
4715 dnl ======================
4716 dnl Detect yasm
4717 dnl ======================
4719 AC_MSG_CHECKING([for YASM assembler])
4720 AC_CHECK_PROGS(YASM, yasm, "")
4722 if test -n "$YASM"; then
4723   dnl Pull out yasm's version string
4724   changequote(,)
4725   _YASM_VER_FILTER='s|.* \([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\).*|\1|p'
4726   changequote([,])
4728   YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4729   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4730   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4731   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4732   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4735 if test -z "$SKIP_LIBRARY_CHECKS"; then
4736 dnl system JPEG support
4737 dnl ========================================================
4738 MOZ_ARG_WITH_STRING(system-jpeg,
4739 [  --with-system-jpeg[=PFX]
4740                           Use system libjpeg [installed at prefix PFX]],
4741     JPEG_DIR=$withval)
4743 _SAVE_CFLAGS=$CFLAGS
4744 _SAVE_LDFLAGS=$LDFLAGS
4745 _SAVE_LIBS=$LIBS
4746 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4747     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4748     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4750 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4751     SYSTEM_JPEG=
4752 else
4753     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4756 if test "$SYSTEM_JPEG" = 1; then
4757     LIBS="$JPEG_LIBS $LIBS"
4758     AC_TRY_COMPILE([ #include <stdio.h>
4759                      #include <sys/types.h>
4760                      #include <jpeglib.h> ],
4761                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4762                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4763                      #endif ],
4764                    SYSTEM_JPEG=1,
4765                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4766 fi 
4767 CFLAGS=$_SAVE_CFLAGS
4768 LDFLAGS=$_SAVE_LDFLAGS
4769 LIBS=$_SAVE_LIBS
4771 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4772     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4773     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4776 dnl system ZLIB support
4777 dnl ========================================================
4778 MOZ_ARG_WITH_STRING(system-zlib,
4779 [  --with-system-zlib[=PFX]
4780                           Use system libz [installed at prefix PFX]],
4781     ZLIB_DIR=$withval)
4783 _SAVE_CFLAGS=$CFLAGS
4784 _SAVE_LDFLAGS=$LDFLAGS
4785 _SAVE_LIBS=$LIBS
4786 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4787     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4788     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4790 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4791     SYSTEM_ZLIB=
4792 else
4793     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4794         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4796 if test "$SYSTEM_ZLIB" = 1; then
4797     LIBS="$ZLIB_LIBS $LIBS"
4798     AC_TRY_COMPILE([ #include <stdio.h>
4799                      #include <string.h>
4800                      #include <zlib.h> ],
4801                    [ #if ZLIB_VERNUM < $MOZZLIB 
4802                      #error "Insufficient zlib version ($MOZZLIB required)."
4803                      #endif ],
4804                    SYSTEM_ZLIB=1,
4805                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4807 CFLAGS=$_SAVE_CFLAGS
4808 LDFLAGS=$_SAVE_LDFLAGS
4809 LIBS=$_SAVE_LIBS
4811 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4812     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4813     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4816 dnl system BZIP2 Support
4817 dnl ========================================================
4818 MOZ_ARG_WITH_STRING(system-bz2,
4819 [  --with-system-bz2[=PFX]
4820                           Use system libbz2 [installed at prefix PFX]],
4821     BZ2_DIR=$withval)
4823 _SAVE_CFLAGS=$CFLAGS
4824 _SAVE_LDFLAGS=$LDFLAGS
4825 _SAVE_LIBS=$LIBS
4826 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4827     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4828     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4830 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4831     SYSTEM_BZ2=
4832 else
4833     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4834         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4836 CFLAGS=$_SAVE_CFLAGS
4837 LDFLAGS=$_SAVE_LDFLAGS
4838 LIBS=$_SAVE_LIBS
4840 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4841     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4842     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4845 dnl system PNG Support
4846 dnl ========================================================
4847 MOZ_ARG_WITH_STRING(system-png, 
4848 [  --with-system-png[=PFX]
4849                           Use system libpng [installed at prefix PFX]],
4850     PNG_DIR=$withval)
4852 _SAVE_CFLAGS=$CFLAGS
4853 _SAVE_LDFLAGS=$LDFLAGS
4854 _SAVE_LIBS=$LIBS
4855 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4856 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4857 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4858     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4859     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4861 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4862     SYSTEM_PNG=
4863 else
4864     _SAVE_PNG_LIBS=$PNG_LIBS
4865     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4866                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4867                  $PNG_LIBS)
4868     AC_CHECK_LIB(png, png_get_acTL, ,
4869                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4870                  $_SAVE_PNG_LIBS)
4872 if test "$SYSTEM_PNG" = 1; then
4873     LIBS="$PNG_LIBS $LIBS"
4874     AC_TRY_COMPILE([ #include <stdio.h>
4875                      #include <sys/types.h>
4876                      #include <png.h> ],
4877                    [ #if PNG_LIBPNG_VER < $MOZPNG
4878                      #error "Insufficient libpng version ($MOZPNG required)."
4879                      #endif
4880                      #ifndef PNG_UINT_31_MAX
4881                      #error "Insufficient libpng version."
4882                      #endif ],
4883                    SYSTEM_PNG=1,
4884                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4886 CFLAGS=$_SAVE_CFLAGS
4887 LDFLAGS=$_SAVE_LDFLAGS
4888 LIBS=$_SAVE_LIBS
4890 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4891     PNG_CFLAGS="-I${PNG_DIR}/include"
4892     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4895 fi # SKIP_LIBRARY_CHECKS
4897 dnl system HunSpell Support
4898 dnl ========================================================
4899 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4900 [  --enable-system-hunspell
4901                           Use system hunspell (located with pkgconfig)],
4902     SYSTEM_HUNSPELL=1 )
4904 if test -n "$SYSTEM_HUNSPELL"; then
4905     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4908 AC_SUBST(SYSTEM_HUNSPELL)
4910 dnl ========================================================
4911 dnl Java SDK support
4912 dnl ========================================================
4913 JAVA_INCLUDE_PATH=
4914 MOZ_ARG_WITH_STRING(java-include-path,
4915 [  --with-java-include-path=dir
4916                           Location of Java SDK headers],
4917     JAVA_INCLUDE_PATH=$withval)
4919 JAVA_BIN_PATH=
4920 MOZ_ARG_WITH_STRING(java-bin-path,
4921 [  --with-java-bin-path=dir
4922                           Location of Java binaries (java, javac, jar)],
4923     JAVA_BIN_PATH=$withval)
4925 dnl ========================================================
4926 dnl =
4927 dnl = Application
4928 dnl =
4929 dnl ========================================================
4931 MOZ_ARG_HEADER(Application)
4933 BUILD_STATIC_LIBS=
4934 ENABLE_TESTS=1
4935 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4936 MOZ_BRANDING_DIRECTORY=
4937 MOZ_OFFICIAL_BRANDING=
4938 MOZ_FEEDS=1
4939 MOZ_INSTALLER=1
4940 MOZ_IPC=1
4941 MOZ_JAVAXPCOM=
4942 MOZ_JSDEBUGGER=1
4943 MOZ_JSLOADER=1
4944 MOZ_MATHML=1
4945 MOZ_MORK=
4946 MOZ_MORKREADER=1
4947 MOZ_AUTH_EXTENSION=1
4948 MOZ_NO_ACTIVEX_SUPPORT=1
4949 MOZ_NO_FAST_LOAD=
4950 MOZ_OGG=1
4951 MOZ_RAW=
4952 MOZ_SYDNEYAUDIO=
4953 MOZ_VORBIS=
4954 MOZ_TREMOR=
4955 MOZ_WAVE=1
4956 MOZ_MEDIA=
4957 MOZ_WEBM=1
4958 VPX_AS=
4959 VPX_ASFLAGS=
4960 VPX_AS_DASH_C_FLAG=
4961 VPX_AS_CONVERSION=
4962 VPX_ASM_SUFFIX=
4963 VPX_X86_ASM=
4964 VPX_ARM_ASM=
4965 MOZ_PANGO=1
4966 MOZ_PERMISSIONS=1
4967 MOZ_PLACES=1
4968 MOZ_PLAINTEXT_EDITOR_ONLY=
4969 MOZ_PLUGINS=1
4970 MOZ_PREF_EXTENSIONS=1
4971 MOZ_PROFILELOCKING=1
4972 MOZ_PSM=1
4973 MOZ_RDF=1
4974 MOZ_REFLOW_PERF=
4975 MOZ_SAFE_BROWSING=
4976 MOZ_FASTSTART=
4977 MOZ_HELP_VIEWER=
4978 MOZ_SPELLCHECK=1
4979 MOZ_SPLASHSCREEN=
4980 MOZ_STORAGE=1
4981 MOZ_SVG=1
4982 MOZ_THUMB2=
4983 MOZ_TIMELINE=
4984 MOZ_TOOLKIT_SEARCH=1
4985 MOZ_UI_LOCALE=en-US
4986 MOZ_UNIVERSALCHARDET=1
4987 MOZ_URL_CLASSIFIER=
4988 MOZ_USE_NATIVE_UCONV=
4989 MOZ_VIEW_SOURCE=1
4990 MOZ_XSLT_STANDALONE=
4991 MOZ_XTF=1
4992 MOZ_XUL=1
4993 MOZ_ZIPWRITER=1
4994 NS_PRINTING=1
4995 MOZ_DISABLE_DOMCRYPTO=
4996 NSS_DISABLE_DBM=
4997 NECKO_WIFI=1
4998 NECKO_COOKIES=1
4999 NECKO_DISK_CACHE=1
5000 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource wyciwyg"
5001 USE_ARM_KUSER=
5002 BUILD_CTYPES=1
5003 XPC_IDISPATCH_SUPPORT=
5006 case "${target}" in
5007 *android*|*darwin*|*wince*|*winmo*)
5008     ACCESSIBILITY=
5009     ;;
5011     ACCESSIBILITY=1
5012     ;;
5013 esac
5015 case "$target_os" in
5016     msvc*|mks*|cygwin*|mingw*)
5017         NS_ENABLE_TSF=1
5018         if test -z "$GNU_CC"; then 
5019             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
5020                 NS_ENABLE_TSF=
5021             fi
5022         fi
5023         if test -n "$NS_ENABLE_TSF"; then
5024             AC_DEFINE(NS_ENABLE_TSF)
5025         fi
5026         ;;
5027 esac
5029 case "${target}" in
5030     arm-android-eabi)
5031         NSS_DISABLE_DBM=1
5032         USE_ARM_KUSER=1
5033         MOZ_INSTALLER=
5034         NS_PRINTING=
5035         NECKO_WIFI=
5036         MOZ_THUMB2=1
5037         MOZ_THEME_FASTSTRIPE=1
5038         MOZ_TREE_FREETYPE=1
5039         MOZ_MEMORY=1
5040         ;;
5041 esac
5043 MOZ_ARG_ENABLE_STRING(application,
5044 [  --enable-application=APP
5045                           Options include:
5046                             browser (Firefox)
5047                             xulrunner
5048                             content/xslt (Standalone Transformiix XSLT)
5049                             netwerk (Standalone Necko)
5050                             tools/update-packaging (AUS-related packaging tools)
5051                             standalone (use this for standalone
5052                               xpcom/xpconnect or to manually drive a build)],
5053 [ MOZ_BUILD_APP=$enableval ] )
5055 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5056 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
5057   XULRUNNER_STUB_NAME=$withval)
5059 if test -z "$XULRUNNER_STUB_NAME"; then
5060   case "$target_os" in
5061   darwin*)
5062     XULRUNNER_STUB_NAME=xulrunner
5063     ;;
5064   *)
5065     XULRUNNER_STUB_NAME=xulrunner-stub
5066   esac
5068 AC_SUBST(XULRUNNER_STUB_NAME)
5070 if test -z "$MOZ_BUILD_APP"; then
5071   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5072 else
5073   # We have a valid application only if it has a build.mk file in its top
5074   # directory.
5075   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5076     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5077   fi
5080 # Allow the application to influence configure with a confvars.sh script.
5082 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5083 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5084   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5085   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5086 else
5087   AC_MSG_RESULT([no])
5090 # Now is a good time to test for logic errors, define mismatches, etc.
5091 case "$MOZ_BUILD_APP" in
5092 xulrunner)
5093   if test "$LIBXUL_SDK"; then
5094     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5095   fi
5096   ;;
5097 esac
5099 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5100 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5101 # MOZ_BUILD_APP.
5102 case "$MOZ_BUILD_APP" in
5103 browser)
5104   AC_DEFINE(MOZ_PHOENIX)
5105   ;;
5107 xulrunner)
5108   AC_DEFINE(MOZ_XULRUNNER)
5109   ;;
5111 content/xslt)
5112   AC_DEFINE(TX_EXE)
5113   ;;
5115 standalone) 
5116   MOZ_APP_NAME=mozilla
5117   MOZ_APP_DISPLAYNAME=Mozilla
5118   MOZ_APP_VERSION=$MOZILLA_VERSION
5119   ;;
5121 esac
5123 AC_SUBST(MOZ_BUILD_APP)
5124 AC_SUBST(MOZ_PHOENIX)
5125 AC_SUBST(MOZ_XULRUNNER)
5127 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5129 dnl ========================================================
5130 dnl = 
5131 dnl = Toolkit Options
5132 dnl = 
5133 dnl ========================================================
5134 MOZ_ARG_HEADER(Toolkit Options)
5136     dnl ========================================================
5137     dnl = Select the default toolkit
5138     dnl ========================================================
5139         MOZ_ARG_ENABLE_STRING(default-toolkit,
5140         [  --enable-default-toolkit=TK
5141                           Select default toolkit
5142                           Platform specific defaults:
5143                             BeOS - cairo-beos
5144                             Mac OS X - cairo-cocoa
5145                             Neutrino/QNX - photon
5146                             OS/2 - cairo-os2
5147                             Win32/WinCE - cairo-windows
5148                             Gtk2 with DirectFB - cairo-gtk2-dfb
5149                             * - cairo-gtk2
5150                             * - cairo-qt],
5151     [ _DEFAULT_TOOLKIT=$enableval ],
5152     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5154     if test "$_DEFAULT_TOOLKIT" = "photon" \
5155         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5156         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5157         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5158         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5159         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5160         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5161         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5162         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5163         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5164     then
5165         dnl nglayout only supports building with one toolkit,
5166         dnl so ignore everything after the first comma (",").
5167         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5168     else
5169         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5170     fi
5172 dnl ========================================================
5173 dnl = Enable the toolkit as needed                         =
5174 dnl ========================================================
5176 case "$MOZ_WIDGET_TOOLKIT" in
5177 photon)
5178         MOZ_ENABLE_PHOTON=1
5179         AC_DEFINE(MOZ_WIDGET_PHOTON)
5180     ;;
5182 cairo-windows)
5183     MOZ_WIDGET_TOOLKIT=windows
5184     MOZ_WEBGL=1
5185     case "${target}" in
5186     *-wince*)
5187         NS_PRINTING=
5188         ;;
5189     esac
5190     ;;
5192 cairo-gtk2|cairo-gtk2-x11)
5193     MOZ_WIDGET_TOOLKIT=gtk2
5194     MOZ_ENABLE_GTK2=1
5195     MOZ_ENABLE_XREMOTE=1
5196     MOZ_WEBGL=1
5197     MOZ_WEBGL_GLX=1
5199     AC_DEFINE(MOZ_X11)
5200     MOZ_X11=1
5201     USE_FC_FREETYPE=1
5203     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5204     TK_LIBS='$(MOZ_GTK2_LIBS)'
5205     AC_DEFINE(MOZ_WIDGET_GTK2)
5206     ;;
5208 cairo-gtk2-dfb)
5209     MOZ_WIDGET_TOOLKIT=gtk2
5210     MOZ_ENABLE_GTK2=1
5211     MOZ_WEBGL=
5213     AC_DEFINE(MOZ_DFB)
5214     MOZ_DFB=1
5216     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5217     TK_LIBS='$(MOZ_GTK2_LIBS)'
5218     AC_DEFINE(MOZ_WIDGET_GTK2)
5219     if test "$no_x" != "yes"; then
5220         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5221         no_x=yes
5222     fi
5223     ;;
5225 cairo-qt)
5226     MOZ_WIDGET_TOOLKIT=qt
5227     MOZ_ENABLE_QT=1
5228     MOZ_ENABLE_XREMOTE=1
5229     MOZ_WEBGL=1
5230     MOZ_WEBGL_GLX=1
5231     USE_ELF_DYNSTR_GC=
5233     AC_DEFINE(MOZ_X11)
5234     MOZ_X11=1
5235     USE_FC_FREETYPE=1
5237     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5238     TK_LIBS='$(MOZ_QT_LIBS)'
5239     AC_DEFINE(MOZ_WIDGET_QT)
5240     ;;
5242 cairo-beos)
5243     MOZ_WIDGET_TOOLKIT=beos
5244     USE_FC_FREETYPE=1
5245     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5246     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5247     ;;
5249 cairo-os2)
5250     MOZ_WIDGET_TOOLKIT=os2
5251     USE_FC_FREETYPE=1
5252     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5253     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5254     ;;
5256 cairo-cocoa)
5257     MOZ_WIDGET_TOOLKIT=cocoa
5258     AC_DEFINE(MOZ_WIDGET_COCOA)
5259     MOZ_USER_DIR="Mozilla"
5260     AC_DEFINE(XP_MACOSX)
5261     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5262     TK_CFLAGS="-DNO_X11"
5263     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5264     CFLAGS="$CFLAGS $TK_CFLAGS"
5265     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5266     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5267     MOZ_FS_LAYOUT=bundle
5268     MOZ_WEBGL=1
5269     ;;
5271 cairo-android)
5272     AC_DEFINE(MOZ_WIDGET_ANDROID)
5273     MOZ_WIDGET_TOOLKIT=android
5274     MOZ_WEBGL=1
5275     ;;
5277 esac
5279 if test "$MOZ_ENABLE_XREMOTE"; then
5280     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5283 if test "$COMPILE_ENVIRONMENT"; then
5284   if test "$MOZ_ENABLE_GTK2"; then
5285     if test "$MOZ_X11"; then
5286       GDK_PACKAGES=gdk-x11-2.0
5287     elif test "$MOZ_DFB"; then
5288       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5289       GDK_PACKAGES=directfb
5290     fi
5292     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5293   fi
5295 fi # COMPILE_ENVIRONMENT
5297 AC_SUBST(MOZ_FS_LAYOUT)
5299 dnl ========================================================
5300 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5301 dnl their usage and use them in spidermonkey.
5302 dnl ========================================================
5303 MOZ_ARG_WITH_BOOL(arm-kuser,
5304 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5305     USE_ARM_KUSER=1,)
5306 if test -n "$USE_ARM_KUSER"; then
5307    AC_DEFINE(USE_ARM_KUSER)
5310 dnl ========================================================
5311 dnl = startup-notification support module
5312 dnl ========================================================
5314 if test "$MOZ_ENABLE_GTK2"
5315 then
5316     MOZ_ENABLE_STARTUP_NOTIFICATION=
5318     MOZ_ARG_ENABLE_BOOL(startup-notification,
5319     [  --enable-startup-notification
5320                           Enable startup-notification support (default: disabled) ],
5321         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5322         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5323     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5324     then
5325         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5326                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5327         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5328             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5329             then
5330                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5331             fi
5332             MOZ_ENABLE_STARTUP_NOTIFICATION=
5333         ])
5334     fi
5336     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5337         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5338     fi
5340     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5342 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5343 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5344 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5346 dnl ========================================================
5347 dnl = QT support
5348 dnl ========================================================
5349 if test "$MOZ_ENABLE_QT"
5350 then
5351     MOZ_ARG_WITH_STRING(qtdir,
5352     [  --with-qtdir=\$dir       Specify Qt directory ],
5353     [ QTDIR=$withval])
5355     if test -z "$QTDIR"; then
5356         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5357         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5358     else
5359         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5361         MOZ_QT_CFLAGS="-DQT_SHARED"
5362         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5363         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5364         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5365         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5366         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5367         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5368         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5369         HOST_MOC="$QTDIR/bin/moc"
5370     fi
5371     if test -z "$HOST_MOC"; then
5372         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5373 incorrect])
5374     fi
5375     MOC=$HOST_MOC
5377     MOZ_ENABLE_QTNETWORK=
5378     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5379                       MOZ_ENABLE_QTNETWORK=1,
5380                       MOZ_ENABLE_QTNETWORK=)
5382     if test "$MOZ_ENABLE_QTNETWORK"; then
5383       MOZ_ENABLE_QTNETWORK=1
5384       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5385     fi
5388 AC_SUBST(GTK_CONFIG)
5389 AC_SUBST(TK_CFLAGS)
5390 AC_SUBST(TK_LIBS)
5392 AC_SUBST(MOZ_ENABLE_GTK2)
5393 AC_SUBST(MOZ_ENABLE_PHOTON)
5394 AC_SUBST(MOZ_ENABLE_QT)
5395 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5396 AC_SUBST(MOZ_ENABLE_XREMOTE)
5397 AC_SUBST(MOZ_GTK2_CFLAGS)
5398 AC_SUBST(MOZ_GTK2_LIBS)
5399 AC_SUBST(MOZ_QT_CFLAGS)
5400 AC_SUBST(MOZ_QT_LIBS)
5401 AC_SUBST(MOZ_ENABLE_MEEGOTOUCH)
5403 AC_SUBST(MOC)
5405 AC_SUBST(MOZ_DFB)
5406 AC_SUBST(MOZ_X11)
5408 dnl ========================================================
5409 dnl =
5410 dnl = Components & Features
5411 dnl = 
5412 dnl ========================================================
5413 MOZ_ARG_HEADER(Components and Features)
5415 dnl ========================================================
5416 dnl = Localization
5417 dnl ========================================================
5418 MOZ_ARG_ENABLE_STRING(ui-locale,
5419 [  --enable-ui-locale=ab-CD
5420                           Select the user interface locale (default: en-US)],
5421     MOZ_UI_LOCALE=$enableval )
5422 AC_SUBST(MOZ_UI_LOCALE)
5424 dnl ========================================================
5425 dnl = Trademarked Branding 
5426 dnl ========================================================
5427 MOZ_ARG_ENABLE_BOOL(official-branding,
5428 [  --enable-official-branding
5429                           Enable Official mozilla.org Branding
5430                           Do not distribute builds with
5431                           --enable-official-branding unless you have
5432                           permission to use trademarks per
5433                           http://www.mozilla.org/foundation/trademarks/ .],
5435   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5436     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5437   else
5438     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5439     MOZ_OFFICIAL_BRANDING=1
5440   fi
5441 ], MOZ_OFFICIAL_BRANDING=)
5443 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5444 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5445   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5448 MOZ_ARG_WITH_STRING(branding,
5449 [  --with-branding=dir     Use branding from the specified directory.],
5450     MOZ_BRANDING_DIRECTORY=$withval)
5452 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5453 if test -z "$REAL_BRANDING_DIRECTORY"; then
5454   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5457 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5458   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5461 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5463 dnl ========================================================
5464 dnl = Distribution ID
5465 dnl ========================================================
5466 MOZ_ARG_WITH_STRING(distribution-id,
5467 [  --with-distribution-id=ID
5468                           Set distribution-specific id (default=org.mozilla)],
5469 [ val=`echo $withval`
5470     MOZ_DISTRIBUTION_ID="$val"])
5472 if test -z "$MOZ_DISTRIBUTION_ID"; then
5473    MOZ_DISTRIBUTION_ID="org.mozilla"
5476 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5477 AC_SUBST(MOZ_DISTRIBUTION_ID)
5480 dnl ========================================================
5481 dnl complex text support off by default
5482 dnl ========================================================
5483 MOZ_ARG_DISABLE_BOOL(pango,
5484 [  --disable-pango         Disable usage of Pango ],
5485     MOZ_PANGO=,
5486     MOZ_PANGO=1)
5488 dnl ========================================================
5489 dnl = Pango
5490 dnl ========================================================
5491 if test "$MOZ_ENABLE_GTK2"
5492 then
5493     AC_SUBST(MOZ_PANGO)
5495     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5497     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5498     AC_SUBST(MOZ_PANGO_CFLAGS)
5499     AC_SUBST(MOZ_PANGO_LIBS)
5500     if test "$MOZ_PANGO"
5501     then
5502         AC_DEFINE(MOZ_PANGO)
5503     else
5504         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5505         AC_SUBST(FT2_CFLAGS)
5506         AC_SUBST(FT2_LIBS)
5507     fi
5510 if test "$MOZ_ENABLE_QT"
5511 then
5512     if test "$MOZ_PANGO"
5513     then
5514         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5515         [
5516             AC_SUBST(MOZ_PANGO_CFLAGS)
5517             AC_SUBST(MOZ_PANGO_LIBS)
5518             AC_DEFINE(MOZ_PANGO)
5519         ],
5520         [
5521             echo "Pango library not found, will use FT2 font engine"
5522             MOZ_PANGO=
5523         ])
5524     fi
5525     AC_SUBST(MOZ_PANGO)
5528 dnl ========================================================
5529 dnl = GnomeVFS, GIO and GConf support module
5530 dnl ========================================================
5532 if test "$MOZ_X11"
5533 then
5534     dnl build the gnomevfs extension by default only when the
5535     dnl GTK2 toolkit is in use.
5536     if test "$MOZ_ENABLE_GTK2"
5537     then
5538         MOZ_ENABLE_GNOMEVFS=1
5539         MOZ_ENABLE_GCONF=1
5540     fi
5542     dnl ========================================================
5543     dnl = GnomeVFS support module
5544     dnl ========================================================
5545     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5546     [  --disable-gnomevfs      Disable GnomeVFS support ],
5547         MOZ_ENABLE_GNOMEVFS=,
5548         MOZ_ENABLE_GNOMEVFS=force)
5550     if test "$MOZ_ENABLE_GNOMEVFS"
5551     then
5552         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5553             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5554             MOZ_ENABLE_GNOMEVFS=1
5555             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5556         ],[
5557             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5558             then
5559                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5560             fi
5561             MOZ_ENABLE_GNOMEVFS=
5562         ])
5563     else
5564         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5565             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5566               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5567             ])
5568         fi
5569     fi
5571     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5572     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5573     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5575     dnl ========================================================
5576     dnl = GIO support module
5577     dnl ========================================================
5578     MOZ_ARG_ENABLE_BOOL(gio,
5579     [  --enable-gio            Enable GIO support (default: disabled)],
5580         MOZ_ENABLE_GIO=force,
5581         MOZ_ENABLE_GIO=)
5583     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5584     then
5585         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5586             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5587             MOZ_ENABLE_GIO=1
5588             AC_DEFINE(MOZ_ENABLE_GIO)
5589         ],[
5590             if test "$MOZ_ENABLE_GIO" = "force"
5591             then
5592                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5593             fi
5594             MOZ_ENABLE_GIO=
5595         ])
5596     fi
5598     AC_SUBST(MOZ_ENABLE_GIO)
5599     AC_SUBST(MOZ_GIO_CFLAGS)
5600     AC_SUBST(MOZ_GIO_LIBS)
5601    
5602     dnl ========================================================
5603     dnl = GConf support module
5604     dnl ========================================================
5605     if test "$MOZ_ENABLE_GCONF"
5606     then
5607         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5608             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5609             MOZ_ENABLE_GCONF=1
5610         ],[
5611             if test "$MOZ_ENABLE_GCONF" = "force"
5612             then
5613                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5614             fi
5615             MOZ_ENABLE_GCONF=
5616         ])
5617     fi
5619     if test "$MOZ_ENABLE_GCONF"; then
5620         AC_DEFINE(MOZ_ENABLE_GCONF)
5621     fi
5623     AC_SUBST(MOZ_ENABLE_GCONF)
5624     AC_SUBST(MOZ_GCONF_CFLAGS)
5625     AC_SUBST(MOZ_GCONF_LIBS)
5628 dnl ========================================================
5629 dnl = libproxy support
5630 dnl ========================================================
5632 if test "$MOZ_ENABLE_GTK2"
5633 then
5634     MOZ_ENABLE_LIBPROXY=
5636     MOZ_ARG_ENABLE_BOOL(libproxy,
5637     [  --enable-libproxy         Enable libproxy support ],
5638     MOZ_ENABLE_LIBPROXY=1,
5639     MOZ_ENABLE_LIBPROXY=)
5641     if test "$MOZ_ENABLE_LIBPROXY"
5642     then
5643         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5644         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5645     fi
5647 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5648 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5649 AC_SUBST(MOZ_LIBPROXY_LIBS)
5651 dnl ========================================================
5652 dnl = libnotify support
5653 dnl ========================================================
5655 if test "$MOZ_ENABLE_GTK2"
5656 then
5657     MOZ_ENABLE_LIBNOTIFY=1
5659     MOZ_ARG_DISABLE_BOOL(libnotify,
5660     [  --disable-libnotify     Disable libnotify support ],
5661     MOZ_ENABLE_LIBNOTIFY=,
5662     MOZ_ENABLE_LIBNOTIFY=1)
5664     if test "$MOZ_ENABLE_LIBNOTIFY"
5665     then
5666         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5667     fi
5670 if test -z "$SKIP_LIBRARY_CHECKS"
5671 then
5672     if test "$MOZ_ENABLE_GTK2"
5673     then
5674         if test "$MOZ_ENABLE_LIBNOTIFY"
5675         then
5676             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5677         fi
5678     fi
5680 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5681 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5682 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5684 dnl ========================================================
5685 dnl = GNOME component (mozgnome)
5686 dnl ========================================================
5688 # The GNOME component is built if one of 
5689 # gnome-vfs, gio, gconf or libnotify is available.
5690 if test "$MOZ_ENABLE_GCONF" -o \
5691    "$MOZ_ENABLE_GNOMEVFS" -o \
5692    "$MOZ_ENABLE_GIO" -o \
5693    "$MOZ_ENABLE_LIBNOTIFY"; then
5694     MOZ_ENABLE_GNOME_COMPONENT=1
5695 else
5696     MOZ_ENABLE_GNOME_COMPONENT=
5698 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5700 dnl ========================================================
5701 dnl = libgnomeui support module
5702 dnl ========================================================
5704 if test "$MOZ_ENABLE_GTK2"
5705 then
5706     MOZ_ENABLE_GNOMEUI=1
5708     MOZ_ARG_DISABLE_BOOL(gnomeui,
5709     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5710         MOZ_ENABLE_GNOMEUI=,
5711         MOZ_ENABLE_GNOMEUI=force)
5713     if test "$MOZ_ENABLE_GNOMEUI"
5714     then
5715         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5716         [
5717             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5718             MOZ_ENABLE_GNOMEUI=1
5719         ],[
5720             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5721             then
5722                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5723             fi
5724             MOZ_ENABLE_GNOMEUI=
5725         ])
5726     fi
5728     if test "$MOZ_ENABLE_GNOMEUI"; then
5729         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5730     fi
5733 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5734 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5735 AC_SUBST(MOZ_GNOMEUI_LIBS)
5737 dnl ========================================================
5738 dnl = dbus support
5739 dnl ========================================================
5741 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5742 then
5743     MOZ_ENABLE_DBUS=1
5745     MOZ_ARG_DISABLE_BOOL(dbus,
5746     [  --disable-dbus          Disable dbus support ],
5747         MOZ_ENABLE_DBUS=,
5748         MOZ_ENABLE_DBUS=1)
5750     if test "$MOZ_ENABLE_DBUS"
5751     then
5752         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5753         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5754         AC_DEFINE(MOZ_ENABLE_DBUS)
5755     fi
5757 AC_SUBST(MOZ_ENABLE_DBUS)
5758 AC_SUBST(MOZ_DBUS_CFLAGS)
5759 AC_SUBST(MOZ_DBUS_LIBS)
5760 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5761 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5763 dnl ========================================================
5764 dnl = Build Personal Security Manager
5765 dnl ========================================================
5766 MOZ_ARG_DISABLE_BOOL(crypto,
5767 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5768     MOZ_PSM=,
5769     MOZ_PSM=1 )
5771 dnl ========================================================
5772 dnl = JS Debugger XPCOM component (js/jsd)
5773 dnl ========================================================
5774 MOZ_ARG_DISABLE_BOOL(jsd,
5775 [  --disable-jsd           Disable JavaScript debug library],
5776     MOZ_JSDEBUGGER=,
5777     MOZ_JSDEBUGGER=1)
5780 dnl ========================================================
5781 dnl = Disable IPC support for tabs and plugins
5782 dnl ========================================================
5783 MOZ_ARG_DISABLE_BOOL(ipc,
5784 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5785     MOZ_IPC=,
5786     MOZ_IPC=1)
5788 if test -n "$MOZ_IPC"; then
5789     AC_DEFINE(MOZ_IPC)
5792 AC_SUBST(MOZ_IPC)
5794 dnl ========================================================
5795 dnl = Enable IPDL's "expensive" unit tests
5796 dnl ========================================================
5797 MOZ_IPDL_TESTS=
5799 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5800 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5801     MOZ_IPDL_TESTS=1,
5802     MOZ_IPDL_TESTS=)
5804 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5805     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5808 if test -n "$MOZ_IPDL_TESTS"; then
5809     AC_DEFINE(MOZ_IPDL_TESTS)
5812 AC_SUBST(MOZ_IPDL_TESTS)
5814 dnl ========================================================
5815 dnl = Disable plugin support
5816 dnl ========================================================
5817 MOZ_ARG_DISABLE_BOOL(plugins,
5818 [  --disable-plugins       Disable plugins support],
5819     MOZ_PLUGINS=,
5820     MOZ_PLUGINS=1)
5822 dnl ========================================================
5823 dnl = Disable building dbm
5824 dnl ========================================================
5825 MOZ_ARG_DISABLE_BOOL(dbm,
5826 [  --disable-dbm           Disable building dbm],
5827     NSS_DISABLE_DBM=1,
5828     NSS_DISABLE_DBM=)
5830 dnl bi-directional support always on
5831 IBMBIDI=1
5832 AC_DEFINE(IBMBIDI)
5834 dnl ========================================================
5835 dnl view source support on by default
5836 dnl ========================================================
5837 if test "$MOZ_VIEW_SOURCE"; then
5838     AC_DEFINE(MOZ_VIEW_SOURCE)
5841 dnl ========================================================
5842 dnl accessibility support on by default on all platforms 
5843 dnl except OS X.
5844 dnl ========================================================
5845 MOZ_ARG_DISABLE_BOOL(accessibility,
5846 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5847     ACCESSIBILITY=,
5848     ACCESSIBILITY=1 )
5849 if test "$ACCESSIBILITY"; then
5850     AC_DEFINE(ACCESSIBILITY)
5853 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5854 case "$target" in
5855 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5856     if test "$ac_cv_header_atlbase_h" = "no"; then
5857         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.])
5858     fi
5859     if test "$ac_cv_header_oleacc_idl" = "no"; then
5860         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.])
5861     fi
5862     ;;
5863 esac
5866 dnl ========================================================
5867 dnl xpcom js loader support on by default
5868 dnl ========================================================
5869 if test "$MOZ_JSLOADER"; then
5870     AC_DEFINE(MOZ_JSLOADER)
5873 dnl ========================================================
5874 dnl Disable printing
5875 dnl ========================================================
5876 MOZ_ARG_DISABLE_BOOL(printing,
5877 [  --disable-printing      Disable printing support],
5878     NS_PRINTING=,
5879     NS_PRINTING=1)
5881 if test "$NS_PRINTING"; then
5882     AC_DEFINE(NS_PRINTING)
5883     AC_DEFINE(NS_PRINT_PREVIEW)
5885 dnl ========================================================
5886 dnl use native unicode converters
5887 dnl ========================================================
5888 MOZ_ARG_ENABLE_BOOL(native-uconv,
5889 [  --enable-native-uconv   Enable iconv support],
5890     MOZ_USE_NATIVE_UCONV=1,
5891     MOZ_USE_NATIVE_UCONV= )
5892 if test "$MOZ_USE_NATIVE_UCONV"; then
5893     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5895 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5896     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5900 dnl ========================================================
5901 dnl Libeditor can be build as plaintext-only,
5902 dnl or as a full html and text editing component.
5903 dnl We build both by default.
5904 dnl ========================================================
5905 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5906 [  --enable-plaintext-editor-only
5907                           Allow only plaintext editing],
5908     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5909     MOZ_PLAINTEXT_EDITOR_ONLY= )
5910 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5911 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5913 dnl ========================================================
5914 dnl = Disable Fast Load
5915 dnl ========================================================
5916 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5917 [  --disable-xpcom-fastload
5918                           Disable XPCOM fastload support],
5919     MOZ_NO_FAST_LOAD=1,
5920     MOZ_NO_FAST_LOAD=)
5922 AC_SUBST(MOZ_NO_FAST_LOAD)
5924 if test -n "$MOZ_NO_FAST_LOAD"; then
5925     AC_DEFINE(MOZ_NO_FAST_LOAD)
5928 dnl ========================================================
5929 dnl = Enable Raw Codecs
5930 dnl ========================================================
5931 MOZ_ARG_ENABLE_BOOL(raw,
5932 [  --enable-raw           Enable support for RAW media],
5933     MOZ_RAW=1,
5934     MOZ_RAW=)
5936 if test -n "$MOZ_RAW"; then
5937     AC_DEFINE(MOZ_RAW)
5938     MOZ_MEDIA=1
5941 AC_SUBST(MOZ_RAW)
5943 dnl ========================================================
5944 dnl = Disable Ogg Codecs
5945 dnl ========================================================
5946 MOZ_ARG_DISABLE_BOOL(ogg,
5947 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5948     MOZ_OGG=,
5949     MOZ_OGG=1)
5951 if test -n "$MOZ_OGG"; then
5952     AC_DEFINE(MOZ_OGG)
5953     MOZ_SYDNEYAUDIO=1
5954     MOZ_MEDIA=1
5955     case "$target_cpu" in
5956     arm*)
5957         MOZ_TREMOR=1
5958     ;;
5959     *)
5960         MOZ_VORBIS=1
5961     ;;
5962     esac
5964     dnl Checks for __attribute__(aligned()) directive
5965     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5966         [ac_cv_c_attribute_aligned],
5967         [ac_cv_c_attribute_aligned=0
5968          CFLAGS_save="${CFLAGS}"
5969          CFLAGS="${CFLAGS} -Werror"
5970          for ac_cv_c_attr_align_try in 64 32 16 8; do
5971            echo "trying $ac_cv_c_attr_align_try"
5972            AC_TRY_COMPILE([],
5973                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5974                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5975            if test "$ac_cv_c_attribute_aligned" != 0; then
5976              break;
5977            fi
5978          done
5979            CFLAGS="${CFLAGS_save}"])
5980     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5981       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5982                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5983     fi
5986 dnl ========================================================
5987 dnl = Disable VP8 decoder support
5988 dnl ========================================================
5989 MOZ_ARG_DISABLE_BOOL(webm,
5990 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5991     MOZ_WEBM=,
5992     MOZ_WEBM=1)
5994 dnl system libvpx Support
5995 dnl ========================================================
5996 MOZ_ARG_WITH_STRING(system-libvpx,
5997 [  --with-system-libvpx=[PFX]
5998                           Use system libvpx [installed at prefix PFX]],
5999     LIBVPX_DIR=$withval)
6001 MOZ_NATIVE_LIBVPX=
6002 MOZ_LIBVPX_INCLUDES=
6003 MOZ_LIBVPX_LIBS=
6005 if test -n "$MOZ_WEBM"; then
6006     AC_DEFINE(MOZ_WEBM)
6008     if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
6009         _SAVE_CFLAGS=$CFLAGS
6010         _SAVE_LDFLAGS=$LDFLAGS
6011         _SAVE_LIBS=$LIBS
6012         if test "${LIBVPX_DIR}" = "yes"; then
6013             LIBVPX_DIR=/usr
6014         fi
6015         CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
6016         LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
6017         AC_CHECK_HEADER(vpx/vpx_decoder.h,
6018                         [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
6019                              AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
6020                          fi],
6021                         AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
6022         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
6023                      [MOZ_NATIVE_LIBVPX=1
6024                       MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
6025                       MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
6026                      ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
6027         CFLAGS=$_SAVE_CFLAGS
6028         LDFLAGS=$_SAVE_LDFLAGS
6029         LIBS=$_SAVE_LIBS
6030     fi
6033 AC_SUBST(MOZ_NATIVE_LIBVPX)
6034 AC_SUBST(MOZ_LIBVPX_INCLUDES)
6035 AC_SUBST(MOZ_LIBVPX_LIBS)
6037 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
6038     MOZ_SYDNEYAUDIO=1
6039     MOZ_MEDIA=1
6040     case "$target_cpu" in
6041     arm*)
6042         MOZ_TREMOR=1
6043     ;;
6044     *)
6045         MOZ_VORBIS=1
6046     ;;
6047     esac
6050     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
6051     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
6052     dnl We currently require gcc on all arm platforms.
6053     VPX_AS=$YASM
6054     VPX_ASM_SUFFIX=asm
6056     dnl See if we have assembly on this platform.  
6057     case "$OS_ARCH:$CPU_ARCH" in
6058     Linux:x86)
6059       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6060       VPX_X86_ASM=1
6061     ;;
6062     Linux:x86_64)
6063       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6064       VPX_X86_ASM=1
6065     ;;
6066     SunOS:x86)
6067       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6068       VPX_X86_ASM=1
6069     ;;
6070     SunOS:x86_64)
6071       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6072       VPX_X86_ASM=1
6073     ;;
6074     Darwin:x86)
6075       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
6076       VPX_X86_ASM=1
6077     ;;
6078     Darwin:x86_64)
6079       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
6080       VPX_X86_ASM=1
6081     ;;
6082     WINNT:x86_64)
6083       if test -z "$GNU_CC"; then
6084         VPX_ASFLAGS="-f x64 -rnasm -pnasm"
6085         VPX_X86_ASM=1
6086       fi
6087     ;;
6088     WINNT:x86)
6089       if test -z "$GNU_CC"; then
6090         dnl Check for yasm 1.1 or greater.
6091         if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
6092           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.])
6093         elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6094           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.])
6095         else
6096           VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
6097           VPX_X86_ASM=1
6098         fi
6099       fi
6100     ;;
6101     *:arm*)
6102       if test -n "$GNU_AS" ; then
6103         VPX_AS=$AS
6104         dnl These flags are a lie; they're just used to enable the requisite
6105         dnl opcodes; actual arch detection is done at runtime.
6106         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
6107         VPX_DASH_C_FLAG="-c"
6108         VPX_AS_CONVERSION="$PERL ${srcdir}/media/libvpx/build/make/ads2gas.pl"
6109         VPX_ASM_SUFFIX="$ASM_SUFFIX"
6110         VPX_ARM_ASM=1
6111       fi
6112     esac
6114     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
6115       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.])
6116     fi
6118     if test -n "$VPX_X86_ASM"; then
6119       AC_DEFINE(VPX_X86_ASM)
6120     elif test -n "$VPX_ARM_ASM"; then
6121       AC_DEFINE(VPX_ARM_ASM)
6122     else
6123       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
6124     fi
6127 dnl ========================================================
6128 dnl = Disable Wave decoder support
6129 dnl ========================================================
6130 MOZ_ARG_DISABLE_BOOL(wave,
6131 [  --disable-wave          Disable Wave decoder support],
6132     MOZ_WAVE=,
6133     MOZ_WAVE=1)
6135 if test -n "$MOZ_WAVE"; then
6136     AC_DEFINE(MOZ_WAVE)
6137     MOZ_SYDNEYAUDIO=1
6138     MOZ_MEDIA=1
6141 dnl ========================================================
6142 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
6143 dnl ========================================================
6145 if test -n "$MOZ_SYDNEYAUDIO"; then
6146     AC_DEFINE(MOZ_SYDNEYAUDIO)
6149 if test -n "$MOZ_MEDIA"; then
6150     AC_DEFINE(MOZ_MEDIA)
6153 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
6154     AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive!  The build system should not allow them both to be set, but they are.  Please file a bug at https://bugzilla.mozilla.org/])
6157 if test -n "$MOZ_VORBIS"; then
6158     AC_DEFINE(MOZ_VORBIS)
6161 if test -n "$MOZ_TREMOR"; then
6162     AC_DEFINE(MOZ_TREMOR)
6165 dnl ========================================================
6166 dnl = Check alsa availability on Linux if using sydneyaudio
6167 dnl ========================================================
6169 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6170 if test -n "$MOZ_SYDNEYAUDIO"; then
6171    case "$target_os" in
6172 linux*)
6173       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6174          [echo "$MOZ_ALSA_PKG_ERRORS"
6175           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.)])])
6176       ;;
6177    esac
6180 dnl ========================================================
6181 dnl Splashscreen
6182 dnl ========================================================
6183 AC_ARG_ENABLE(splashscreen,
6184               [  --enable-splashscreen   display splashscreen while loading (default=no)],
6185               [enable_splash="yes"],[enable_splash=""])
6186 if test "x$enable_splash" = "xyes"; then
6187   MOZ_SPLASHSCREEN=1
6188   AC_DEFINE(MOZ_SPLASHSCREEN)
6190 AC_SUBST(MOZ_SPLASHSCREEN)
6192 dnl ========================================================
6193 dnl Permissions System
6194 dnl ========================================================
6195 MOZ_ARG_DISABLE_BOOL(permissions,
6196 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
6197     MOZ_PERMISSIONS=,
6198     MOZ_PERMISSIONS=1
6201 dnl ========================================================
6202 dnl NegotiateAuth
6203 dnl ========================================================
6204 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6205 [  --disable-negotiateauth Disable GSS-API negotiation ],
6206     MOZ_AUTH_EXTENSION=,
6207     MOZ_AUTH_EXTENSION=1 )
6209 dnl ========================================================
6210 dnl XTF
6211 dnl ========================================================
6212 MOZ_ARG_DISABLE_BOOL(xtf,
6213 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
6214     MOZ_XTF=,
6215     MOZ_XTF=1 )
6216 if test "$MOZ_XTF"; then
6217   AC_DEFINE(MOZ_XTF)
6220 dnl ========================================================
6221 dnl Pref extensions (autoconfig and system-pref)
6222 dnl ========================================================
6223 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6224 [  --disable-pref-extensions
6225                           Disable pref extensions such as autoconfig and
6226                           system-pref],
6227   MOZ_PREF_EXTENSIONS=,
6228   MOZ_PREF_EXTENSIONS=1 )
6230 dnl ========================================================
6231 dnl = Universalchardet
6232 dnl ========================================================
6233 MOZ_ARG_DISABLE_BOOL(universalchardet,
6234 [  --disable-universalchardet
6235                           Disable universal encoding detection],
6236   MOZ_UNIVERSALCHARDET=,
6237   MOZ_UNIVERSALCHARDET=1 )
6239 dnl ========================================================
6240 dnl JavaXPCOM
6241 dnl ========================================================
6242 case "${target}" in
6243 *-wince*)
6244     MOZ_JAVAXPCOM=
6245     ;;
6246 esac
6248 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6249 [  --enable-javaxpcom
6250                           Enable Java-XPCOM bridge],
6251     MOZ_JAVAXPCOM=1,
6252     MOZ_JAVAXPCOM=)
6254 case "$host_os" in
6255   cygwin*|msvc*|mks*)
6256     if test -n "$JAVA_HOME"; then
6257       JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6258     fi
6259     ;;
6260   *mingw*)
6261     if test -n "$JAVA_HOME"; then
6262       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6263     fi
6264     ;;
6265 esac
6267 if test -n "${JAVA_BIN_PATH}"; then
6268   dnl Look for javac and jar in the specified path.
6269   JAVA_PATH="$JAVA_BIN_PATH"
6270 else
6271   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6272   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6275 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6276 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6277 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6279 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6280   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6281     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}])
6282   fi
6285 if test -n "${MOZ_JAVAXPCOM}"; then
6286   if test -n "${JAVA_INCLUDE_PATH}"; then
6287     dnl Make sure jni.h exists in the given include path.
6288     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6289       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6290     fi
6291   else
6292     case "$target_os" in
6293       darwin*)
6294         dnl Default to java system location
6295         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6296         ;;
6297       *)
6298         dnl Try $JAVA_HOME
6299         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6300         ;;
6301     esac
6302     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6303       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.])
6304     fi
6305   fi
6308 dnl ========================================================
6309 dnl = Breakpad crash reporting (on by default on supported platforms)
6310 dnl ========================================================
6312 case $target in
6313 i?86-*-mingw*|x86_64-*-mingw*)
6314   MOZ_CRASHREPORTER=1
6315   ;;
6316 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6317   MOZ_CRASHREPORTER=1
6318   ;;
6319 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6320   MOZ_CRASHREPORTER=1
6321   ;;
6322 arm-android-eabi)
6323   MOZ_CRASHREPORTER=1
6324   ;;
6325 *solaris*)
6326   MOZ_CRASHREPORTER=1
6327   ;;
6328 esac
6330 MOZ_ARG_DISABLE_BOOL(crashreporter,
6331 [  --disable-crashreporter Disable breakpad crash reporting],
6332     MOZ_CRASHREPORTER=,
6333     MOZ_CRASHREPORTER=1)
6335 if test -n "$MOZ_CRASHREPORTER"; then
6336    AC_DEFINE(MOZ_CRASHREPORTER)
6338   if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6339     test -z "$SKIP_LIBRARY_CHECKS"; then
6340     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6341     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6342     AC_SUBST(MOZ_GTHREAD_LIBS)
6344     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.])])
6345   fi
6348 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6349 [  --with-crashreporter-enable-percent=NN
6350                           Enable sending crash reports by default on NN% of users. (default=100)],
6351 [ val=`echo $withval | sed 's/[^0-9]//g'`
6352     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6354 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6355    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6357 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6359 dnl ========================================================
6360 dnl = Enable compilation of specific extension modules
6361 dnl ========================================================
6363 MOZ_ARG_ENABLE_STRING(extensions,
6364 [  --enable-extensions     Enable extensions],
6365 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6366     if test "$option" = "yes" -o "$option" = "all"; then
6367         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6368     elif test "$option" = "no" -o "$option" = "none"; then
6369         MOZ_EXTENSIONS=""
6370     elif test "$option" = "default"; then
6371         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6372     elif test `echo "$option" | grep -c \^-` != 0; then
6373         option=`echo $option | sed 's/^-//'`
6374         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6375     else
6376         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6377     fi
6378 done],
6379     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6381 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6382     # Suppress warning on non-X11 platforms
6383     if test -n "$MOZ_X11"; then
6384         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6385     fi
6386     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6389 dnl Do not build gnomevfs with libxul based apps
6390 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6391     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6394 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6395     # Suppress warning on non-X11 platforms
6396     if test -n "$MOZ_X11"; then
6397         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6398     fi
6399     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6402 dnl Do not build gio with libxul based apps
6403 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6404     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6407 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6408     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6409     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6412 dnl This might be temporary: build tridentprofile only on Windows
6413 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6414     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6415     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6418 dnl cookie must be built before tridentprofile. put it at list's end.
6419 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6420   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6421   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6424 dnl xforms requires xtf
6425 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6426     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6427     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6430 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6431     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6432     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6435 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6436     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6437     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6440 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6441     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6442     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6445 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6446     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6447     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6450 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6451     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6452     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6455 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6456     AC_MSG_WARN([spellcheck is no longer an extension.])
6457     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6460 dnl Remove dupes
6461 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6463 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6464 dnl when trying to build a nonexistent extension.
6465 for extension in $MOZ_EXTENSIONS; do
6466     if test ! -d "${srcdir}/extensions/${extension}"; then
6467         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6468     fi
6469 done
6471 dnl ========================================================
6472 dnl MathML on by default
6473 dnl ========================================================
6474 MOZ_ARG_DISABLE_BOOL(mathml,
6475 [  --disable-mathml        Disable MathML support],
6476     MOZ_MATHML=,
6477     MOZ_MATHML=1 )
6478 if test "$MOZ_MATHML"; then
6479   AC_DEFINE(MOZ_MATHML)
6482 dnl ========================================================
6483 dnl SVG
6484 dnl ========================================================
6485 MOZ_ARG_DISABLE_BOOL(svg,
6486 [  --disable-svg           Disable SVG support],
6487     MOZ_SVG=,
6488     MOZ_SVG=1 )
6489 if test -n "$MOZ_SVG"; then
6490   AC_DEFINE(MOZ_SVG)
6493 dnl ========================================================
6494 dnl SMIL
6495 dnl ========================================================
6496 MOZ_SMIL=1
6497 MOZ_ARG_DISABLE_BOOL(smil,
6498 [  --disable-smil          Disable SMIL animation support],
6499     MOZ_SMIL=,
6500     MOZ_SMIL=1 )
6501 # Automatically disable SMIL if SVG is disabled
6502 if test -z "$MOZ_SVG"; then
6503   MOZ_SMIL=
6505 if test -n "$MOZ_SMIL"; then
6506   AC_DEFINE(MOZ_SMIL)
6509 dnl ========================================================
6510 dnl Build Freetype in the tree
6511 dnl ========================================================
6512 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6513 [  --enable-tree-freetype  Enable Tree FreeType],
6514     MOZ_TREE_FREETYPE=1,
6515     MOZ_TREE_FREETYPE= )
6516 if test -n "$MOZ_TREE_FREETYPE"; then
6517    AC_DEFINE(MOZ_TREE_FREETYPE)
6518    AC_SUBST(MOZ_TREE_FREETYPE)
6519    MOZ_ENABLE_CAIRO_FT=1       
6520    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6521    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6522    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6523    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6524    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6525    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6526    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6527    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6528    AC_SUBST(CAIRO_FT_CFLAGS)
6532 dnl ========================================================
6533 dnl Installer
6534 dnl ========================================================
6535 case "$target_os" in
6536     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6537         MOZ_INSTALLER=1
6538         ;;
6539 esac
6541 MOZ_ARG_DISABLE_BOOL(installer,
6542 [  --disable-installer     Disable building of installer],
6543     MOZ_INSTALLER=,
6544     MOZ_INSTALLER=1)
6545 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6546     # Disable installer for Windows builds that use the new toolkit if the
6547     # required major version and minimum minor version of Unicode NSIS isn't in
6548     # the path.
6549     REQ_NSIS_MAJOR_VER=2
6550     MIN_NSIS_MINOR_VER=33
6551     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6552     if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6553         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.])
6554     fi
6555     changequote(,)
6556     MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6557     changequote([,])
6558     if test ! "$MAKENSISU_VER" == ""; then
6559         MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6560         MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6561     fi
6562     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6563     if test "$MAKENSISU_VER" == "" -o \
6564        ! "$MAKENSISU_MAJOR_VER" == "$REQ_NSIS_MAJOR_VER" -o \
6565        ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6566         AC_MSG_RESULT([no])
6567         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.])
6568     fi
6569     AC_MSG_RESULT([yes])
6570     MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6573 AC_SUBST(MOZ_INSTALLER)
6575 AC_MSG_CHECKING([for tar archiver])
6576 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6577 if test -z "$TAR"; then
6578     AC_MSG_ERROR([no tar archiver found in \$PATH])
6580 AC_MSG_RESULT([$TAR])
6581 AC_SUBST(TAR)
6583 AC_MSG_CHECKING([for wget])
6584 AC_CHECK_PROGS(WGET, wget, "")
6585 AC_MSG_RESULT([$WGET])
6586 AC_SUBST(WGET)
6588 dnl ========================================================
6589 dnl Updater
6590 dnl ========================================================
6592 MOZ_ARG_DISABLE_BOOL(updater,
6593 [  --disable-updater       Disable building of updater],
6594     MOZ_UPDATER=,
6595     MOZ_UPDATER=1 )
6597 if test -n "$MOZ_UPDATER"; then
6598     AC_DEFINE(MOZ_UPDATER)
6601 # app update channel is 'default' when not supplied.
6602 MOZ_ARG_ENABLE_STRING([update-channel],
6603 [  --enable-update-channel=CHANNEL
6604                           Select application update channel (default=default)],
6605     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6607 if test -z "$MOZ_UPDATE_CHANNEL"; then
6608     MOZ_UPDATE_CHANNEL=default
6610 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6611 AC_SUBST(MOZ_UPDATE_CHANNEL)
6613 # tools/update-packaging is not checked out by default.
6614 MOZ_ARG_ENABLE_BOOL(update-packaging,
6615 [  --enable-update-packaging
6616                           Enable tools/update-packaging],
6617     MOZ_UPDATE_PACKAGING=1,
6618     MOZ_UPDATE_PACKAGING= )
6619 AC_SUBST(MOZ_UPDATE_PACKAGING)
6621 dnl ========================================================
6622 dnl ActiveX
6623 dnl ========================================================
6625 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6626 [  --disable-xpconnect-idispatch
6627                           Disable building of xpconnect support for IDispatch
6628                           (win32 only)],
6629     XPC_IDISPATCH_SUPPORT=,
6630     XPC_IDISPATCH_SUPPORT=1)
6631 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6633 MOZ_ARG_DISABLE_BOOL(activex,
6634 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6635     MOZ_NO_ACTIVEX_SUPPORT=1,
6636     MOZ_NO_ACTIVEX_SUPPORT= )
6637 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6639 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6640 [  --enable-activex-scripting
6641                           Enable building of ActiveX scripting support (win32)],
6642     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6643     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6644 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6646 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6647 then
6648     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6651 if test "$COMPILE_ENVIRONMENT" = "1"; then
6652 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6653 case "$target" in
6654 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6655     if test "$ac_cv_header_atlbase_h" = "no"; then
6656         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.])
6657     fi
6658     ;;
6659 esac
6663 dnl ========================================================
6664 dnl leaky
6665 dnl ========================================================
6666 MOZ_ARG_ENABLE_BOOL(leaky,
6667 [  --enable-leaky          Build leaky memory tool],
6668     MOZ_LEAKY=1,
6669     MOZ_LEAKY=)
6672 dnl ========================================================
6673 dnl build the tests by default
6674 dnl ========================================================
6675 MOZ_ARG_DISABLE_BOOL(tests,
6676 [  --disable-tests         Do not build test libraries & programs],
6677     ENABLE_TESTS=,
6678     ENABLE_TESTS=1 )
6680 dnl ========================================================
6681 dnl parental controls (for Windows Vista)
6682 dnl ========================================================
6683 MOZ_ARG_DISABLE_BOOL(parental-controls,
6684 [  --disable-parental-controls
6685                           Do not build parental controls],
6686    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6687    MOZ_DISABLE_PARENTAL_CONTROLS=)
6688 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6689     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6692 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6694 dnl ========================================================
6695 dnl = Disable DOMCrypto
6696 dnl ========================================================
6697 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6698     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6701 dnl ========================================================
6702 dnl =
6703 dnl = Module specific options
6704 dnl =
6705 dnl ========================================================
6706 MOZ_ARG_HEADER(Individual module options)
6708 dnl ========================================================
6709 dnl = Disable feed handling components
6710 dnl ========================================================
6711 MOZ_ARG_DISABLE_BOOL(feeds,
6712 [  --disable-feeds         Disable feed handling and processing components],
6713     MOZ_FEEDS=,
6714     MOZ_FEEDS=1 )
6715 if test -n "$MOZ_FEEDS"; then
6716     AC_DEFINE(MOZ_FEEDS)
6717 else
6718     if test "$MOZ_BUILD_APP" = "browser"; then
6719         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6720     fi
6723 dnl ========================================================
6724 dnl = Enable mozStorage
6725 dnl ========================================================
6726 dnl Implicitly enabled by default if building calendar or places
6727 MOZ_ARG_ENABLE_BOOL(storage,
6728 [  --enable-storage        Enable mozStorage module and related components],
6729     MOZ_STORAGE=1,
6730     MOZ_STORAGE= )
6731 if test -n "$MOZ_STORAGE"; then
6732     AC_DEFINE(MOZ_STORAGE)
6735 dnl ========================================================
6736 dnl Check for sqlite
6737 dnl ========================================================
6739 MOZ_NATIVE_SQLITE=
6740 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6741 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6742 MOZ_NATIVE_SQLITE=1,
6743 MOZ_NATIVE_SQLITE= )
6745 if test -z "$MOZ_NATIVE_SQLITE"
6746 then
6747     SQLITE_CFLAGS=
6748     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6749 else
6750     dnl ============================
6751     dnl === SQLite Version check ===
6752     dnl ============================
6753     dnl Check to see if the system SQLite package is new enough.
6754     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6756     dnl ==================================
6757     dnl === SQLITE_SECURE_DELETE check ===
6758     dnl ==================================
6759     dnl Check to see if the system SQLite package is compiled with
6760     dnl SQLITE_SECURE_DELETE enabled.
6761     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6762     _SAVE_CFLAGS="$CFLAGS"
6763     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6764     _SAVE_LIBS="$LIBS"
6765     LIBS="$LIBS $SQLITE_LIBS"
6766     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6767         AC_TRY_RUN([
6768             #include "sqlite3.h"
6770             int main(int argc, char **argv){
6771               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6772             }],
6773             ac_cv_sqlite_secure_delete=yes,
6774             ac_cv_sqlite_secure_delete=no,
6775             ac_cv_sqlite_secure_delete=no
6776         )
6777     ])
6778     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6779     CFLAGS="$_SAVE_CFLAGS"
6780     LIBS="$_SAVE_LIBS"
6781     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6782         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6783     fi
6785     dnl ===============================
6786     dnl === SQLITE_THREADSAFE check ===
6787     dnl ===============================
6788     dnl Check to see if the system SQLite package is compiled with
6789     dnl SQLITE_THREADSAFE enabled.
6790     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6791     _SAVE_CFLAGS="$CFLAGS"
6792     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6793     _SAVE_LIBS="$LIBS"
6794     LIBS="$LIBS $SQLITE_LIBS"
6795     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6796         AC_TRY_RUN([
6797             #include "sqlite3.h"
6799             int main(int argc, char **argv){
6800               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6801             }],
6802             ac_cv_sqlite_threadsafe=yes,
6803             ac_cv_sqlite_threadsafe=no,
6804             ac_cv_sqlite_threadsafe=no
6805         )
6806     ])
6807     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6808     CFLAGS="$_SAVE_CFLAGS"
6809     LIBS="$_SAVE_LIBS"
6810     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6811         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6812     fi
6814     dnl ================================
6815     dnl === SQLITE_ENABLE_FTS3 check ===
6816     dnl ================================
6817     dnl check to see if the system SQLite package is compiled with
6818     dnl SQLITE_ENABLE_FTS3 enabled.
6819     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6820     _SAVE_CFLAGS="$CFLAGS"
6821     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6822     _SAVE_LIBS="$LIBS"
6823     LIBS="$LIBS $SQLITE_LIBS"
6824     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6825         AC_TRY_RUN([
6826             #include "sqlite3.h"
6828             int main(int argc, char **argv){
6829               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6830             }],
6831             ac_cv_sqlite_enable_fts3=yes,
6832             ac_cv_sqlite_enable_fts3=no,
6833             ac_cv_sqlite_enable_fts3=no
6834         )
6835     ])
6836     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6837     CFLAGS="$_SAVE_CFLAGS"
6838     LIBS="$_SAVE_LIBS"
6839     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6840         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6841     fi
6843     dnl =========================================
6844     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6845     dnl =========================================
6846     dnl check to see if the system SQLite package is compiled with
6847     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6848     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6849     _SAVE_CFLAGS="$CFLAGS"
6850     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6851     _SAVE_LIBS="$LIBS"
6852     LIBS="$LIBS $SQLITE_LIBS"
6853     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6854         AC_TRY_RUN([
6855             #include "sqlite3.h"
6857             int main(int argc, char **argv){
6858               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6859             }],
6860             ac_cv_sqlite_enable_unlock_notify=yes,
6861             ac_cv_sqlite_enable_unlock_notify=no,
6862             ac_cv_sqlite_enable_unlock_notify=no
6863         )
6864     ])
6865     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6866     CFLAGS="$_SAVE_CFLAGS"
6867     LIBS="$_SAVE_LIBS"
6868     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6869         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6870     fi
6873 AC_SUBST(MOZ_NATIVE_SQLITE)
6875 dnl ========================================================
6876 dnl = Enable help viewer (off by default)
6877 dnl ========================================================
6878 if test -n "$MOZ_HELP_VIEWER"; then
6879      dnl Do this if defined in confvars.sh
6880      AC_DEFINE(MOZ_HELP_VIEWER)
6883 dnl ========================================================
6884 dnl = Enable safe browsing (anti-phishing)
6885 dnl ========================================================
6886 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6887 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6888     MOZ_SAFE_BROWSING=1,
6889     MOZ_SAFE_BROWSING= )
6890 if test -n "$MOZ_SAFE_BROWSING"; then
6891     AC_DEFINE(MOZ_SAFE_BROWSING)
6893 AC_SUBST(MOZ_SAFE_BROWSING)
6895 dnl ========================================================
6896 dnl = Enable faststart component
6897 dnl ========================================================
6898 MOZ_ARG_ENABLE_BOOL(faststart,
6899 [  --enable-faststart      Enable the faststart component],
6900     MOZ_FASTSTART=1,
6901     MOZ_FASTSTART= )
6902 if test -n "$MOZ_FASTSTART"; then
6903     AC_DEFINE(MOZ_FASTSTART)
6905 AC_SUBST(MOZ_FASTSTART)
6907 dnl ========================================================
6908 dnl = Enable url-classifier
6909 dnl ========================================================
6910 dnl Implicitly enabled by default if building with safe-browsing
6911 if test -n "$MOZ_SAFE_BROWSING"; then
6912     MOZ_URL_CLASSIFIER=1
6914 MOZ_ARG_ENABLE_BOOL(url-classifier,
6915 [  --enable-url-classifier Enable url classifier module],
6916     MOZ_URL_CLASSIFIER=1,
6917     MOZ_URL_CLASSIFIER= )
6918 if test -n "$MOZ_URL_CLASSIFIER"; then
6919     AC_DEFINE(MOZ_URL_CLASSIFIER)
6921 AC_SUBST(MOZ_URL_CLASSIFIER)
6923 dnl ========================================================
6924 dnl = Disable zipwriter
6925 dnl ========================================================
6926 MOZ_ARG_DISABLE_BOOL(zipwriter,
6927 [  --disable-zipwriter     Disable zipwriter component],
6928     MOZ_ZIPWRITER=,
6929     MOZ_ZIPWRITER=1 )
6930 AC_SUBST(MOZ_ZIPWRITER)
6932 dnl ========================================================
6933 dnl = libconic
6934 dnl ========================================================
6935 dnl superseded by QtNetwork starting from 4.7
6936 MOZ_ENABLE_LIBCONIC=1
6938 if test -n "$MOZ_ENABLE_QT"; then
6939   if test "$MOZ_ENABLE_QTNETWORK"; then
6940     MOZ_ENABLE_LIBCONIC=
6941   fi
6944 MOZ_ARG_DISABLE_BOOL(libconic,
6945 [  --disable-libconic      Disable libconic],
6946     MOZ_ENABLE_LIBCONIC=,
6947     MOZ_ENABLE_LIBCONIC=1 )
6949 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6950     PKG_CHECK_MODULES(LIBCONIC, conic,
6951                       MOZ_ENABLE_LIBCONIC=1,
6952                       MOZ_ENABLE_LIBCONIC=)
6954 if test "$MOZ_ENABLE_LIBCONIC"; then
6955     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6958 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6959 AC_SUBST(LIBCONIC_CFLAGS)
6960 AC_SUBST(LIBCONIC_LIBS)
6962 dnl ========================================================
6963 dnl = Maemo checks
6964 dnl ========================================================
6966 MAEMO_SDK_TARGET_VER=-1
6968 MOZ_ARG_WITH_STRING(maemo-version,
6969 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6970                           Maemo SDK Version],
6971   MAEMO_SDK_TARGET_VER=$withval)
6973 case "$MAEMO_SDK_TARGET_VER" in
6975     MOZ_PLATFORM_MAEMO=5
6976     ;;
6979     MOZ_PLATFORM_MAEMO=6
6980     ;;
6983     dnl We aren't compiling for Maemo, move on.
6984     ;;
6986     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6987     ;;
6988 esac
6990 if test $MOZ_PLATFORM_MAEMO; then
6991    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6993    if test -z "$MOZ_ENABLE_DBUS"; then
6994        AC_MSG_ERROR([DBus is required when building for Maemo])
6995    fi
6997    MOZ_GFX_OPTIMIZE_MOBILE=1
6998    MOZ_WEBGL_GLX=
6999    MOZ_MAEMO_LIBLOCATION=
7001    if test $MOZ_PLATFORM_MAEMO = 5; then
7002       dnl if we have Xcomposite we should also have Xdamage and Xfixes
7003       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
7004                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
7005       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
7006                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
7008       AC_SUBST(XCOMPOSITE_LIBS)
7010       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
7011       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
7012       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
7013       if test -z "$_LIB_FOUND"; then
7014          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
7015       fi
7018       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
7019       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
7020       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
7021       if test -z "$_LIB_FOUND"; then
7022          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
7023       fi
7025       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
7026       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
7027       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
7028       if test -z "$_LIB_FOUND"; then
7029          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
7030       fi
7032    fi
7033    if test $MOZ_PLATFORM_MAEMO = 6; then
7034       PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
7035       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
7036       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
7037       if test -z "$_LIB_FOUND"; then
7038          AC_MSG_ERROR([libcontentaction is required when build for Maemo])
7039       fi
7040      
7041      MOZ_THUMB2=1
7042      PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore)
7043      MOZ_ENABLE_MEEGOTOUCH=1
7044      AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
7045      MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
7046      MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
7047    fi
7049    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
7050    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
7051    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
7052    if test "$_LIB_FOUND"; then
7053       MOZ_MAEMO_LIBLOCATION=1
7054       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
7055    else
7056       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
7057    fi
7058    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
7060    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
7061    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
7062    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
7063    if test "$_LIB_FOUND"; then
7064       MOZ_ENABLE_MEEGOTOUCHSHARE=1
7065       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
7066    else
7067       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
7068    fi
7069    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
7071    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
7072    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
7075 dnl ========================================================
7076 dnl = Enable building the Thumb2 instruction set
7077 dnl ========================================================
7078 MOZ_ARG_ENABLE_BOOL(thumb2,
7079  [  --enable-thumb2         Enable Thumb2 instruction set],
7080     MOZ_THUMB2=1,
7081     MOZ_THUMB2=)
7083 if test -n "$MOZ_THUMB2"; then
7084   case "$target_cpu" in
7085     arm*)
7086       if test "$GNU_CC"; then
7087         CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7088         CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7089         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
7090       else
7091         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
7092       fi
7093     ;;
7094     *)
7095       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
7096     ;;
7097   esac
7100 AC_SUBST(MOZ_THUMB2)
7102 dnl ========================================================
7103 dnl = faststripe theme
7104 dnl ========================================================
7105 MOZ_ARG_ENABLE_BOOL(faststripe,
7106 [  --enable-faststripe     Use faststripe theme],
7107     MOZ_THEME_FASTSTRIPE=1,
7108     MOZ_THEME_FASTSTRIPE= )
7109 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7111 dnl ========================================================
7112 dnl =
7113 dnl = Feature options that require extra sources to be pulled
7114 dnl =
7115 dnl ========================================================
7116 dnl MOZ_ARG_HEADER(Features that require extra sources)
7118 dnl ========================================================
7119 dnl =
7120 dnl = Debugging Options
7121 dnl = 
7122 dnl ========================================================
7123 MOZ_ARG_HEADER(Debugging and Optimizations)
7125 dnl ========================================================
7126 dnl = Disable building with debug info.
7127 dnl = Debugging is OFF by default
7128 dnl ========================================================
7129 if test -z "$MOZ_DEBUG_FLAGS"; then
7130   MOZ_DEBUG_FLAGS="-g"
7133 MOZ_ARG_ENABLE_STRING(debug,
7134 [  --enable-debug[=DBG]    Enable building with developer debug info
7135                            (using compiler flags DBG)],
7136 [ if test "$enableval" != "no"; then
7137     MOZ_DEBUG=1
7138     if test -n "$enableval" -a "$enableval" != "yes"; then
7139         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7140         _MOZ_DEBUG_FLAGS_SET=1
7141     fi
7142   else
7143     MOZ_DEBUG=
7144   fi ],
7145   MOZ_DEBUG=)
7147 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7148 MOZ_ARG_WITH_STRING(debug-label,
7149 [  --with-debug-label=LABELS
7150                           Define DEBUG_<value> for each comma-separated
7151                           value given.],
7152 [ for option in `echo $withval | sed 's/,/ /g'`; do
7153     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7154 done])
7156 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7158 if test -n "$MOZ_DEBUG"; then
7159     AC_MSG_CHECKING([for valid debug flags])
7160     _SAVE_CFLAGS=$CFLAGS
7161     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7162     AC_TRY_COMPILE([#include <stdio.h>], 
7163         [printf("Hello World\n");],
7164         _results=yes,
7165         _results=no)
7166     AC_MSG_RESULT([$_results])
7167     if test "$_results" = "no"; then
7168         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7169     fi
7170     CFLAGS=$_SAVE_CFLAGS
7173 dnl ========================================================
7174 dnl enable mobile optimizations
7175 dnl ========================================================
7176 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7177 [  --enable-mobile-optimize
7178                           Enable mobile optimizations],
7179     MOZ_GFX_OPTIMIZE_MOBILE=1)
7181 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7183 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7184     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7187 dnl ========================================================
7188 dnl = Enable code optimization. ON by default.
7189 dnl ========================================================
7190 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7191         MOZ_OPTIMIZE_FLAGS="-O"
7194 MOZ_ARG_ENABLE_STRING(optimize,
7195 [  --disable-optimize      Disable compiler optimization
7196   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7197 [ if test "$enableval" != "no"; then
7198     MOZ_OPTIMIZE=1
7199     if test -n "$enableval" -a "$enableval" != "yes"; then
7200         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7201         MOZ_OPTIMIZE=2
7202     fi
7203 else
7204     MOZ_OPTIMIZE=
7205 fi ], MOZ_OPTIMIZE=1)
7207 if test "$COMPILE_ENVIRONMENT"; then
7208 if test -n "$MOZ_OPTIMIZE"; then
7209     AC_MSG_CHECKING([for valid optimization flags])
7210     _SAVE_CFLAGS=$CFLAGS
7211     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7212     AC_TRY_COMPILE([#include <stdio.h>], 
7213         [printf("Hello World\n");],
7214         _results=yes,
7215         _results=no)
7216     AC_MSG_RESULT([$_results])
7217     if test "$_results" = "no"; then
7218         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7219     fi
7220     CFLAGS=$_SAVE_CFLAGS
7222 fi # COMPILE_ENVIRONMENT
7224 AC_SUBST(MOZ_OPTIMIZE)
7225 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7226 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7227 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7229 dnl ========================================================
7230 dnl = (Deprecated) generation of debugger info for specific modules
7231 dnl ========================================================
7232 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7233 [  --enable-debugger-info-modules
7234                           Enable/disable debugger info for specific modules],
7235 [ if test "$enableval" != "no"; then
7236     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7237     MOZ_DEBUG_SYMBOLS=1
7238   fi ])
7240 dnl ========================================================
7241 dnl = Enable generation of debug symbols
7242 dnl ========================================================
7243 MOZ_ARG_ENABLE_STRING(debug-symbols,
7244 [  --enable-debug-symbols[=DBG]
7245                           Enable debugging symbols (using compiler flags DBG)],
7246 [ if test "$enableval" != "no"; then
7247       MOZ_DEBUG_SYMBOLS=1
7248       if test -n "$enableval" -a "$enableval" != "yes"; then
7249           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7250               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7251           else
7252               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7253           fi
7254       fi
7255   fi ])
7257 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7258     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7259     export MOZ_DEBUG_SYMBOLS
7262 dnl ========================================================
7263 dnl = Disable any treating of compile warnings as errors
7264 dnl ========================================================
7265 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7266 [  --disable-warnings-as-errors
7267                           Disable treating of warnings as errors],
7268     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7269     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7270 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7271    WARNINGS_AS_ERRORS=''
7274 dnl ========================================================
7275 dnl = Disable runtime logging checks
7276 dnl ========================================================
7277 MOZ_ARG_DISABLE_BOOL(logging,
7278 [  --disable-logging       Disable logging facilities],
7279     NS_DISABLE_LOGGING=1,
7280     NS_DISABLE_LOGGING= )
7281 if test "$NS_DISABLE_LOGGING"; then
7282     AC_DEFINE(NS_DISABLE_LOGGING)
7283 else
7284     AC_DEFINE(MOZ_LOGGING)
7287 dnl ========================================================
7288 dnl = This will enable logging of addref, release, ctor, dtor.
7289 dnl ========================================================
7290 _ENABLE_LOGREFCNT=42
7291 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7292 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7293     _ENABLE_LOGREFCNT=1,
7294     _ENABLE_LOGREFCNT= )
7295 if test "$_ENABLE_LOGREFCNT" = "1"; then
7296     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7297 elif test -z "$_ENABLE_LOGREFCNT"; then
7298     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7301 dnl ========================================================
7302 dnl = Enable trace malloc
7303 dnl ========================================================
7304 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7305 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7306 [  --enable-trace-malloc   Enable malloc tracing],
7307     NS_TRACE_MALLOC=1,
7308     NS_TRACE_MALLOC= )
7309 if test "$NS_TRACE_MALLOC"; then
7310   # Please, Mr. Linker Man, don't take away our symbol names
7311   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7312   USE_ELF_DYNSTR_GC=
7313   AC_DEFINE(NS_TRACE_MALLOC)
7315 AC_SUBST(NS_TRACE_MALLOC)
7317 dnl ========================================================
7318 dnl = Enable jemalloc
7319 dnl ========================================================
7320 MOZ_ARG_ENABLE_BOOL(jemalloc,
7321 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7322     MOZ_MEMORY=1,
7323     MOZ_MEMORY=)
7325 if test "$NS_TRACE_MALLOC"; then
7326     MOZ_MEMORY=
7329 if test "$MOZ_MEMORY"; then
7331   dnl Don't try to run compiler tests on Windows  
7332   if test "$OS_ARCH" = "WINNT"; then
7333     if test -z "$HAVE_64BIT_OS"; then
7334       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7335     else
7336       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7337     fi
7338   else
7339     AC_CHECK_SIZEOF([int *], [4])
7340     case "${ac_cv_sizeof_int_p}" in
7341     4)
7342       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7343       ;;
7344     8)
7345       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7346       ;;
7347     *)
7348       AC_MSG_ERROR([Unexpected pointer size])
7349       ;;
7350     esac
7351   fi
7353   AC_DEFINE(MOZ_MEMORY)
7354   if test "x$MOZ_DEBUG" = "x1"; then
7355     AC_DEFINE(MOZ_MEMORY_DEBUG)
7356   fi
7357   dnl The generic feature tests that determine how to compute ncpus are long and
7358   dnl complicated.  Therefore, simply define special cpp variables for the
7359   dnl platforms we have special knowledge of.
7360   case "${target}" in
7361   *-darwin*)
7362     AC_DEFINE(MOZ_MEMORY_DARWIN)
7363     ;;
7364   *-*freebsd*)
7365     AC_DEFINE(MOZ_MEMORY_BSD)
7366     ;;
7367   *-*linux*)
7368     AC_DEFINE(MOZ_MEMORY_LINUX)
7369     ;;
7370   *-netbsd*)
7371     AC_DEFINE(MOZ_MEMORY_BSD)
7372     ;;
7373   *-solaris*)
7374     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7375     ;;
7376   *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7377     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7378     dnl This is sort of awful. Will revisit if we add support for more versions
7379     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7380         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7381     fi
7382     if test -z "$WIN32_CRT_SRC_DIR"; then
7383       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7384         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).])
7385       else
7386         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7387       fi
7388     fi
7389     dnl cpu check
7390     case "${target_cpu}" in
7391     i*86)
7392       MOZ_CRT_CPU_ARCH=intel
7393       ;;
7394     x86_64)
7395       MOZ_CRT_CPU_ARCH=amd64
7396       ;;
7397     *)
7398       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7399       ;;
7400     esac
7402     AC_SUBST(MOZ_CRT_CPU_ARCH)
7404     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7405       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7406     fi
7407     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7408     _objdir_win=`pwd -W`
7409     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7410     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7411     dnl Also pass this to NSPR/NSS
7412     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7413     export DLLFLAGS
7414     ;;
7415   *-*wince)
7416     AC_DEFINE(MOZ_MEMORY_WINCE)
7417     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7418     if test -z "$WINCE_WINDOWS_MOBILE"; then
7419       AC_DEFINE(MOZ_MEMORY_WINCE6)
7420     fi
7421     ;;
7422   *-*winmo)
7423     AC_DEFINE(MOZ_MEMORY_WINCE)
7424     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7425     ;;
7426   *-android*)
7427     AC_DEFINE(MOZ_MEMORY_LINUX)
7428     AC_DEFINE(MOZ_MEMORY_ANDROID)
7429     _WRAP_MALLOC=1
7430     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
7431     WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
7432     ;;
7433   *)
7434     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7435     ;;
7436   esac
7438   if test "$OS_ARCH" != "Darwin"; then
7439     dnl NB: this must be kept in sync with jemalloc.h
7440     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7441     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7442     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7443   fi
7445 AC_SUBST(MOZ_MEMORY)
7446 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7447 AC_SUBST(WIN32_CRT_SRC_DIR)
7448 dnl Need to set this for make because NSS doesn't have configure
7449 AC_SUBST(DLLFLAGS)
7451 dnl ========================================================
7452 dnl = Use malloc wrapper lib
7453 dnl ========================================================
7454 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7455 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7456     _WRAP_MALLOC=1,
7457     _WRAP_MALLOC= )
7459 if test -n "$_WRAP_MALLOC"; then
7460     if test "$GNU_CC"; then
7461     WRAP_MALLOC_CFLAGS="${LDFLAGS} ${WRAP_MALLOC_CFLAGS} -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"
7462     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7463     fi
7466 dnl ========================================================
7467 dnl = Location of malloc wrapper lib
7468 dnl ========================================================
7469 MOZ_ARG_WITH_STRING(wrap-malloc,
7470 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7471     WRAP_MALLOC_LIB=$withval)
7473 dnl ========================================================
7474 dnl = Use JS Call tracing
7475 dnl ========================================================
7476 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7477 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7478     MOZ_TRACE_JSCALLS=1,
7479     MOZ_TRACE_JSCALLS= )
7480 if test -n "$MOZ_TRACE_JSCALLS"; then
7481     AC_DEFINE(MOZ_TRACE_JSCALLS)
7484 dnl ========================================================
7485 dnl = Use TraceVis
7486 dnl ========================================================
7487 MOZ_ARG_ENABLE_BOOL(tracevis,
7488 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7489     MOZ_TRACEVIS=1,
7490     MOZ_TRACEVIS= )
7491 if test -n "$MOZ_TRACEVIS"; then
7492     AC_DEFINE(MOZ_TRACEVIS)
7495 dnl ========================================================
7496 dnl = Use GCTimer
7497 dnl ========================================================
7498 MOZ_ARG_ENABLE_BOOL(gctimer,
7499 [  --enable-gctimer        Enable GC timer (default=no)],
7500     MOZ_GCTIMER=1,
7501     MOZ_GCTIMER= )
7502 if test -n "$MOZ_GCTIMER"; then
7503     AC_DEFINE(MOZ_GCTIMER)
7506 dnl ========================================================
7507 dnl = Use Valgrind
7508 dnl ========================================================
7509 MOZ_ARG_ENABLE_BOOL(valgrind,
7510 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7511     MOZ_VALGRIND=1,
7512     MOZ_VALGRIND= )
7513 if test -n "$MOZ_VALGRIND"; then
7514     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7515         AC_MSG_ERROR(
7516             [--enable-valgrind specified but Valgrind is not installed]))
7517     AC_DEFINE(MOZ_VALGRIND)
7520 dnl ========================================================
7521 dnl jprof
7522 dnl ========================================================
7523 MOZ_ARG_ENABLE_BOOL(jprof,
7524 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
7525     MOZ_JPROF=1,
7526     MOZ_JPROF= )
7527 if test -n "$MOZ_JPROF"; then
7528     MOZ_PROFILING=1
7529     AC_DEFINE(MOZ_JPROF)
7532 dnl ========================================================
7533 dnl shark
7534 dnl ========================================================
7535 MOZ_ARG_ENABLE_BOOL(shark,
7536 [  --enable-shark          Enable shark remote profiling (needs CHUD framework). Implies --enable-profiling.],
7537     MOZ_SHARK=1,
7538     MOZ_SHARK= )
7539 if test -n "$MOZ_SHARK"; then
7540     MOZ_PROFILING=1
7541     AC_DEFINE(MOZ_SHARK)
7544 dnl ========================================================
7545 dnl callgrind
7546 dnl ========================================================
7547 MOZ_ARG_ENABLE_BOOL(callgrind,
7548 [  --enable-callgrind      Enable callgrind profiling],
7549     MOZ_CALLGRIND=1,
7550     MOZ_CALLGRIND= )
7551 if test -n "$MOZ_CALLGRIND"; then
7552     AC_DEFINE(MOZ_CALLGRIND)
7555 dnl ========================================================
7556 dnl vtune
7557 dnl ========================================================
7558 MOZ_ARG_ENABLE_BOOL(vtune,
7559 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
7560     MOZ_VTUNE=1,
7561     MOZ_VTUNE= )
7562 if test -n "$MOZ_VTUNE"; then
7563     MOZ_PROFILING=1
7564     AC_DEFINE(MOZ_VTUNE)
7567 dnl ========================================================
7568 dnl Zealous JavaScript GC
7569 dnl ========================================================
7570 MOZ_ARG_ENABLE_BOOL(gczeal,
7571 [  --enable-gczeal         Enable zealous JavaScript GCing],
7572     JS_GC_ZEAL=1,
7573     JS_GC_ZEAL= )
7574 if test -n "$JS_GC_ZEAL"; then
7575     AC_DEFINE(JS_GC_ZEAL)
7578 dnl ======================================================
7579 dnl = Enable compiling with ccache
7580 dnl ======================================================
7581 MOZ_ARG_WITH_STRING(ccache,
7582 [  --with-ccache[=path/to/ccache]
7583                           Enable compiling with ccache],
7584     CCACHE=$withval, CCACHE="no")
7586 if test "$CCACHE" != "no"; then
7587     if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7588         CCACHE=
7589     else
7590         if test ! -e "$CCACHE"; then
7591             AC_MSG_ERROR([$CCACHE not found])
7592         fi
7593     fi
7594     MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7595     if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7596         AC_MSG_ERROR([ccache not found])
7597     elif test -x "$CCACHE"; then
7598         CC="$CCACHE $CC"
7599         CXX="$CCACHE $CXX"
7600     else
7601         AC_MSG_ERROR([$CCACHE is not executable])
7602     fi
7605 dnl ========================================================
7606 dnl = Enable static checking using gcc-dehydra
7607 dnl ========================================================
7609 MOZ_ARG_WITH_STRING(static-checking,
7610 [  --with-static-checking=path/to/gcc_dehydra.so
7611                           Enable static checking of code using GCC-dehydra],
7612     DEHYDRA_PATH=$withval,
7613     DEHYDRA_PATH= )
7615 if test -n "$DEHYDRA_PATH"; then
7616     if test ! -f "$DEHYDRA_PATH"; then
7617         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7618     fi
7619     AC_DEFINE(NS_STATIC_CHECKING)
7621 AC_SUBST(DEHYDRA_PATH)
7623 dnl ========================================================
7624 dnl = Enable stripping of libs & executables
7625 dnl ========================================================
7626 MOZ_ARG_ENABLE_BOOL(strip,
7627 [  --enable-strip          Enable stripping of libs & executables ],
7628     ENABLE_STRIP=1,
7629     ENABLE_STRIP= )
7631 dnl ========================================================
7632 dnl = Enable stripping of libs & executables when packaging
7633 dnl ========================================================
7634 MOZ_ARG_ENABLE_BOOL(install-strip,
7635 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7636     PKG_SKIP_STRIP= ,
7637     PKG_SKIP_STRIP=1)
7639 dnl ========================================================
7640 dnl = --enable-elf-dynstr-gc
7641 dnl ========================================================
7642 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7643 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7644     USE_ELF_DYNSTR_GC=1,
7645     USE_ELF_DYNSTR_GC= )
7647 dnl ========================================================
7648 dnl = 
7649 dnl = Profiling and Instrumenting
7650 dnl = 
7651 dnl ========================================================
7652 MOZ_ARG_HEADER(Profiling and Instrumenting)
7654 dnl ========================================================
7655 dnl = Enable timeline service, which provides lightweight
7656 dnl = instrumentation of mozilla for performance measurement.
7657 dnl = Timeline is off by default.
7658 dnl ========================================================
7659 MOZ_ARG_ENABLE_BOOL(timeline,
7660 [  --enable-timeline       Enable timeline services ],
7661     MOZ_TIMELINE=1,
7662     MOZ_TIMELINE= )
7663 if test -n "$MOZ_TIMELINE"; then
7664     AC_DEFINE(MOZ_TIMELINE)
7667 dnl ========================================================
7668 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7669 dnl = timing for identifying code bottlenecks 
7670 dnl = NS_FUNCTION_TIMER is off by default.
7671 dnl ========================================================
7672 MOZ_ARG_ENABLE_BOOL(functiontimer,
7673 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7674     NS_FUNCTION_TIMER=1,
7675     NS_FUNCTION_TIMER= )
7676 if test -n "$NS_FUNCTION_TIMER"; then
7677     AC_DEFINE(NS_FUNCTION_TIMER)
7680 dnl ========================================================
7681 dnl Turn on reflow counting
7682 dnl ========================================================
7683 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7684 [  --enable-reflow-perf    Enable reflow performance tracing],
7685     MOZ_REFLOW_PERF=1,
7686     MOZ_REFLOW_PERF= )
7687 if test -n "$MOZ_REFLOW_PERF"; then
7688     AC_DEFINE(MOZ_REFLOW_PERF)
7691 dnl ========================================================
7692 dnl Enable code size metrics.
7693 dnl ========================================================
7694 MOZ_ARG_ENABLE_BOOL(codesighs,
7695 [  --enable-codesighs      Enable code size analysis tools],
7696     _ENABLE_CODESIGHS=1,
7697     _ENABLE_CODESIGHS= )
7698 if test -n "$_ENABLE_CODESIGHS"; then
7699     if test -d $srcdir/tools/codesighs; then 
7700         MOZ_MAPINFO=1
7701     else
7702         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7703     fi
7706 dnl ========================================================
7707 dnl = Support for Quantify (Windows)
7708 dnl ========================================================
7709 MOZ_ARG_ENABLE_BOOL(quantify,
7710 [  --enable-quantify       Enable Quantify support (Windows only) ],
7711     MOZ_QUANTIFY=1,
7712     MOZ_QUANTIFY= )
7714 dnl ========================================================
7715 dnl = Support for demangling undefined symbols
7716 dnl ========================================================
7717 if test -z "$SKIP_LIBRARY_CHECKS"; then
7718     AC_LANG_SAVE
7719     AC_LANG_CPLUSPLUS
7720     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7721     AC_LANG_RESTORE
7724 # Demangle only for debug or trace-malloc builds
7725 MOZ_DEMANGLE_SYMBOLS=
7726 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7727     MOZ_DEMANGLE_SYMBOLS=1
7728     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7730 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7732 dnl ========================================================
7733 dnl = Support for gcc stack unwinding (from gcc 3.3)
7734 dnl ========================================================
7735 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7736     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7739 dnl ========================================================
7740 dnl =
7741 dnl = Misc. Options
7742 dnl = 
7743 dnl ========================================================
7744 MOZ_ARG_HEADER(Misc. Options)
7746 dnl ========================================================
7747 dnl update xterm title
7748 dnl ========================================================
7749 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7750 [  --enable-xterm-updates  Update XTERM titles with current command.],
7751     MOZ_UPDATE_XTERM=1,
7752     MOZ_UPDATE_XTERM= )
7754 dnl =========================================================
7755 dnl = Chrome format
7756 dnl =========================================================
7757 MOZ_ARG_ENABLE_STRING([chrome-format],
7758 [  --enable-chrome-format=jar|flat|both|symlink|omni
7759                           Select FORMAT of chrome files (default=jar)],
7760     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7762 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7763     MOZ_CHROME_FILE_FORMAT=jar
7766 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7767     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7768     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7769     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7770     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7771     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7774 dnl =========================================================
7775 dnl Omnijar packaging (bug 552121)
7776 dnl =========================================================
7777 dnl Omnijar packaging is compatible with flat packaging.
7778 dnl In unpackaged builds, omnijar looks for files as if
7779 dnl things were flat packaged. After packaging, all files
7780 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7781 dnl is set to flat since putting files into jars is only
7782 dnl done during packaging with omnijar.
7783 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7784     MOZ_OMNIJAR=1
7785     AC_DEFINE(MOZ_OMNIJAR)
7786     MOZ_CHROME_FILE_FORMAT=flat
7787 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7788     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7791 AC_SUBST(MOZ_OMNIJAR)
7793 dnl ========================================================
7794 dnl = Define default location for MOZILLA_FIVE_HOME
7795 dnl ========================================================
7796 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7797 [  --with-default-mozilla-five-home
7798                           Set the default value for MOZILLA_FIVE_HOME],
7799 [ val=`echo $withval`
7800   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7802 dnl ========================================================
7803 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7804 dnl ========================================================
7805 MOZ_ARG_WITH_STRING(user-appdir,
7806 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7807 [ val=`echo $withval`
7808 if echo "$val" | grep "\/" >/dev/null; then
7809     AC_MSG_ERROR("Homedir must be single relative path.")
7810 else 
7811     MOZ_USER_DIR="$val"
7812 fi])
7814 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7816 dnl ========================================================
7817 dnl = Doxygen configuration
7818 dnl ========================================================
7819 dnl Use commas to specify multiple dirs to this arg
7820 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7821 MOZ_ARG_WITH_STRING(doc-input-dirs,
7822 [  --with-doc-input-dirs=DIRS
7823                           Header/idl dirs to create docs from],
7824 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7825 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7827 dnl Use commas to specify multiple dirs to this arg
7828 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7829 MOZ_ARG_WITH_STRING(doc-include-dirs,
7830 [  --with-doc-include-dirs=DIRS  
7831                           Include dirs to preprocess doc headers],
7832 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7833 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7835 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7836 MOZ_ARG_WITH_STRING(doc-output-dir,
7837 [  --with-doc-output-dir=DIR
7838                           Dir to generate docs into],
7839 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7840 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7842 if test -z "$SKIP_COMPILER_CHECKS"; then
7843 dnl ========================================================
7844 dnl =
7845 dnl = Compiler Options
7846 dnl = 
7847 dnl ========================================================
7848 MOZ_ARG_HEADER(Compiler Options)
7850 dnl ========================================================
7851 dnl Check for gcc -pipe support
7852 dnl ========================================================
7853 AC_MSG_CHECKING([for gcc -pipe support])
7854 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
7855     echo '#include <stdio.h>' > dummy-hello.c
7856     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7857     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7858     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7859     if test $? = 0; then
7860         _res_as_stdin="yes"
7861     else
7862         _res_as_stdin="no"
7863     fi
7864     if test "$_res_as_stdin" = "yes"; then
7865         _SAVE_CFLAGS=$CFLAGS
7866         CFLAGS="$CFLAGS -pipe"
7867         AC_TRY_COMPILE( [ #include <stdio.h> ],
7868             [printf("Hello World\n");],
7869             [_res_gcc_pipe="yes"],
7870             [_res_gcc_pipe="no"] )
7871         CFLAGS=$_SAVE_CFLAGS
7872     fi
7873     if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
7874         _res="yes";
7875         CFLAGS="$CFLAGS -pipe"
7876         CXXFLAGS="$CXXFLAGS -pipe"
7877     else
7878         _res="no"
7879     fi
7880     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7881     AC_MSG_RESULT([$_res])
7882 else
7883     AC_MSG_RESULT([no])
7886 dnl ========================================================
7887 dnl Profile guided optimization
7888 dnl ========================================================
7889 dnl Test for profiling options
7890 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7892 dnl Provide a switch to disable PGO even when called via profiledbuild.
7893 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7894 [  --disable-profile-guided-optimization
7895                           Don't build with PGO even if called via make profiledbuild],
7896 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7897 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7899 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7901 _SAVE_CFLAGS="$CFLAGS"
7902 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7904 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7905 AC_TRY_COMPILE([], [return 0;],
7906                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7907                  result="yes" ], result="no")
7908 AC_MSG_RESULT([$result])
7910 if test $result = "yes"; then
7911   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7912   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7913   PROFILE_USE_LDFLAGS="-fprofile-use"
7916 CFLAGS="$_SAVE_CFLAGS"
7918 if test -n "$INTEL_CC"; then
7919   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7920   PROFILE_GEN_LDFLAGS=
7921   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7922   PROFILE_USE_LDFLAGS=
7925 dnl Sun Studio on Solaris
7926 if test "$SOLARIS_SUNPRO_CC"; then
7927   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7928   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7929   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7930   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7933 AC_SUBST(PROFILE_GEN_CFLAGS)
7934 AC_SUBST(PROFILE_GEN_LDFLAGS)
7935 AC_SUBST(PROFILE_USE_CFLAGS)
7936 AC_SUBST(PROFILE_USE_LDFLAGS)
7938 AC_LANG_CPLUSPLUS
7940 dnl ========================================================
7941 dnl Test for -pedantic bustage
7942 dnl ========================================================
7943 MOZ_ARG_DISABLE_BOOL(pedantic,
7944 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7945 _PEDANTIC= )
7946 if test "$_PEDANTIC"; then
7947     _SAVE_CXXFLAGS=$CXXFLAGS
7948     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7949     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7950     AC_TRY_COMPILE([$configure_static_assert_macros],
7951                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7952                    result="no", result="yes" )
7953     AC_MSG_RESULT([$result])
7954     CXXFLAGS="$_SAVE_CXXFLAGS"
7956     case "$result" in
7957     no)
7958         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7959         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7960         ;;
7961     yes)
7962         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7963         ;;
7964     esac
7967 dnl ========================================================
7968 dnl Test for correct temporary object destruction order
7969 dnl ========================================================
7970 dnl We want to make sure the compiler follows the C++ spec here as 
7971 dnl xpcom and the string classes depend on it (bug 235381).
7972 AC_MSG_CHECKING([for correct temporary object destruction order])
7973 AC_TRY_RUN([ class A {
7974              public:  A(int& x) : mValue(x) {}
7975                       ~A() { mValue--; }
7976                       operator char**() { return 0; }
7977              private:  int& mValue;
7978              };
7979              void func(char **arg) {}
7980              int m=2;
7981              void test() {
7982                   func(A(m));
7983                   if (m==1) m = 0;
7984              }
7985              int main() {
7986                  test();
7987                  return(m);
7988              }
7989              ],
7990      result="yes", result="no", result="maybe")
7991 AC_MSG_RESULT([$result])
7993 if test "$result" = "no"; then
7994     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7997 dnl ========================================================
7998 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7999 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
8000 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
8001 dnl ========================================================
8002 _SAVE_CXXFLAGS=$CXXFLAGS
8003 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
8004 AC_CACHE_CHECK(for correct overload resolution with const and templates,
8005     ac_nscap_nonconst_opeq_bug,
8006     [AC_TRY_COMPILE([
8007                       template <class T>
8008                       class Pointer
8009                         {
8010                         public:
8011                           T* myPtr;
8012                         };
8013                       
8014                       template <class T, class U>
8015                       int operator==(const Pointer<T>& rhs, U* lhs)
8016                         {
8017                           return rhs.myPtr == lhs;
8018                         }
8019                       
8020                       template <class T, class U>
8021                       int operator==(const Pointer<T>& rhs, const U* lhs)
8022                         {
8023                           return rhs.myPtr == lhs;
8024                         }
8025                     ],
8026                     [
8027                       Pointer<int> foo;
8028                       const int* bar;
8029                       return foo == bar;
8030                     ],
8031                     ac_nscap_nonconst_opeq_bug="no",
8032                     ac_nscap_nonconst_opeq_bug="yes")])
8033 CXXFLAGS="$_SAVE_CXXFLAGS"
8035 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8036     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8038 fi # SKIP_COMPILER_CHECKS
8040 dnl ========================================================
8041 dnl C++ rtti
8042 dnl Should be smarter and check that the compiler does indeed have rtti
8043 dnl ========================================================
8045 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
8046 [  --enable-cpp-rtti       Enable C++ RTTI ],
8047 [ _MOZ_USE_RTTI=1 ],
8048 [ _MOZ_USE_RTTI= ])
8050 if test "$_MOZ_USE_RTTI"; then
8051    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
8052 else
8053    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
8056 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
8058 dnl ========================================================
8059 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
8060 dnl Should be smarter and check that the compiler does indeed have exceptions
8061 dnl ========================================================
8062 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
8063 [  --enable-cpp-exceptions Enable C++ exceptions ],
8064 [ _MOZ_CPP_EXCEPTIONS=1 ],
8065 [ _MOZ_CPP_EXCEPTIONS= ])
8067 if test "$_MOZ_CPP_EXCEPTIONS"; then
8068     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
8069     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
8070 else
8071     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
8074 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
8076 # Irix & OSF native compilers do not like exception declarations 
8077 # when exceptions are disabled
8078 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
8079     AC_DEFINE(CPP_THROW_NEW, [])
8080 else
8081     AC_DEFINE(CPP_THROW_NEW, [throw()])
8083 AC_LANG_C
8085 dnl ========================================================
8086 dnl =
8087 dnl = Build depencency options
8088 dnl =
8089 dnl ========================================================
8090 MOZ_ARG_HEADER(Build dependencies)
8092 dnl ========================================================
8093 dnl = Do not auto generate dependency info
8094 dnl ========================================================
8095 MOZ_AUTO_DEPS=1
8096 MOZ_ARG_DISABLE_BOOL(auto-deps,
8097 [  --disable-auto-deps     Do not automatically generate dependency info],
8098     MOZ_AUTO_DEPS=,
8099     MOZ_AUTO_DEPS=1)
8101 if test -n "$MOZ_AUTO_DEPS"; then
8102 dnl ========================================================
8103 dnl = Use mkdepend instead of $CC -MD for dependency generation
8104 dnl ========================================================
8105 _cpp_md_flag=
8106 MOZ_ARG_DISABLE_BOOL(md,
8107 [  --disable-md            Do not use compiler-based dependencies ],
8108   [_cpp_md_flag=],
8109   [_cpp_md_flag=1],
8110   [dnl Default is to turn on -MD if using GNU-compatible compilers
8111    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
8112      _cpp_md_flag=1
8113    fi
8114   dnl Default is to use -xM if using Sun Studio on Solaris
8115    if test "$SOLARIS_SUNPRO_CC"; then
8116      _cpp_md_flag=1
8117    fi])
8118 if test "$_cpp_md_flag"; then
8119   COMPILER_DEPEND=1
8120   if test "$OS_ARCH" = "OpenVMS"; then
8121     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
8122   else
8123     _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8124   fi
8125   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8126   if test "$SOLARIS_SUNPRO_CC"; then
8127     _DEPEND_CFLAGS=
8128   fi
8129 else
8130   COMPILER_DEPEND=
8131   dnl Don't override this for MSVC
8132   if test -z "$_WIN32_MSVC"; then
8133     _USE_CPP_INCLUDE_FLAG=
8134     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8135     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8136   else
8137     echo '#include <stdio.h>' > dummy-hello.c
8138     changequote(,)
8139     CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8140     changequote([,])
8141     if test -z "$CL_INCLUDES_PREFIX"; then
8142         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8143     fi
8144     AC_SUBST(CL_INCLUDES_PREFIX)
8145     rm -f dummy-hello.c
8146     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8147     dnl cl.py provides dependency generation for MSVC
8148     CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8149     CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8150     COMPILER_DEPEND=1
8151   fi
8153 fi # MOZ_AUTO_DEPS
8154 MDDEPDIR='.deps'
8155 AC_SUBST(MOZ_AUTO_DEPS)
8156 AC_SUBST(COMPILER_DEPEND)
8157 AC_SUBST(MDDEPDIR)
8158 AC_SUBST(CC_WRAPPER)
8159 AC_SUBST(CXX_WRAPPER)
8162 dnl ========================================================
8163 dnl =
8164 dnl = Static Build Options
8165 dnl =
8166 dnl ========================================================
8167 MOZ_ARG_HEADER(Static build options)
8169 MOZ_ARG_ENABLE_BOOL(static,
8170 [  --enable-static         Enable building of internal static libs],
8171     BUILD_STATIC_LIBS=1,
8172     BUILD_STATIC_LIBS=)
8174 MOZ_ARG_ENABLE_BOOL(libxul,
8175 [  --enable-libxul         Enable building of libxul],
8176     MOZ_ENABLE_LIBXUL=1,
8177     MOZ_ENABLE_LIBXUL=)
8179 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8180 if test "$OS_ARCH" = "WINNT"; then
8181   ENABLE_SHARED_JS=1
8184 MOZ_ARG_ENABLE_BOOL(shared-js,
8185 [  --enable-shared-js
8186                           Create a shared JavaScript library.],
8187     ENABLE_SHARED_JS=1,
8188     ENABLE_SHARED_JS=)
8190 if test -z "$MOZ_ENABLE_LIBXUL"; then
8191   dnl --disable-libxul implies shared js
8192   ENABLE_SHARED_JS=1
8195 if test -n "$ENABLE_SHARED_JS"; then
8196   JS_SHARED_LIBRARY=1
8197   MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
8198 else
8199   MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
8200   AC_DEFINE(MOZ_STATIC_JS)
8202 AC_SUBST(JS_SHARED_LIBRARY)
8204 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8205         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
8208 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8209         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8212 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
8213     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
8216 if test -z "$MOZ_ENABLE_LIBXUL" -a -n "$MOZ_OMNIJAR"; then
8217     AC_MSG_ERROR([Omnijar packaging is incompatible with --disable-libxul. Please either --enable-libxul or --enable-chrome-format=jar|flat|symlink]);
8220 AC_SUBST(LIBXUL_LIBS)
8222 if test -n "$MOZ_ENABLE_LIBXUL"; then
8223     XPCOM_LIBS="$LIBXUL_LIBS"
8224     AC_DEFINE(MOZ_ENABLE_LIBXUL)
8225 else
8226     if test -n "$BUILD_STATIC_LIBS"; then
8227         AC_DEFINE(MOZ_STATIC_BUILD)
8228     fi
8229     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
8232 dnl ========================================================
8233 dnl =
8234 dnl = Standalone module options
8235 dnl = 
8236 dnl ========================================================
8237 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8239 dnl Check for GLib and libIDL.
8240 dnl ========================================================
8241 SKIP_IDL_CHECK="no"
8243 if test -z "$COMPILE_ENVIRONMENT"; then
8244     SKIP_IDL_CHECK="yes"
8247 dnl = Allow users to disable libIDL checking for standalone modules
8248 MOZ_ARG_WITHOUT_BOOL(libIDL,
8249 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
8250         SKIP_IDL_CHECK="yes")
8252 if test -z "$CROSS_COMPILE"; then
8253     if test -z "$HOST_LIBIDL_CONFIG"; then
8254         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8255     fi
8256     if test -z "$HOST_LIBIDL_PREFIX"; then
8257         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8258     fi
8261 if test "$SKIP_IDL_CHECK" = "no"
8262 then
8263     _LIBIDL_FOUND=
8264     case "$host" in
8265     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8266         if test -n "$GLIB_PREFIX"; then
8267             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8268             if test "$?" = "0"; then
8269                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8270                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8271                 fi
8272                 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8273             else
8274                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8275             fi
8276         else
8277             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8278         fi
8279         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8280             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8281         fi
8282         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8283         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8284             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8285         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8286             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8287         else
8288             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8289         fi
8291         if test -n "$HOST_LIBIDL_PREFIX"; then
8292             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8293             if test "$?" = "0"; then
8294                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8295                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8296                 fi
8297                 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8298             else
8299                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8300             fi
8301         else
8302             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8303         fi        
8304         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8305             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8306         fi
8307         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8308         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8309             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8310             STATIC_LIBIDL=1
8311         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8312             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8313         else
8314             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8315         fi
8316         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8317         _LIBIDL_FOUND=1
8318         ;;
8319     esac
8321     if test -z "$_LIBIDL_FOUND"; then
8322         if test "$MACOS_SDK_DIR"; then 
8323             dnl xpidl, and therefore libIDL, is only needed on the build host.
8324             dnl Don't build it against the SDK, as that causes problems.
8325             _MACSAVE_CFLAGS="$CFLAGS"
8326             _MACSAVE_LIBS="$LIBS"
8327             _MACSAVE_LDFLAGS="$LDFLAGS"
8328             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8329           changequote(,)
8330           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"`
8331           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8332           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8333           changequote([,])
8334           unset NEXT_ROOT
8335         fi
8337         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8338     fi
8340     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8341     dnl to either libIDL1 or libIDL2.
8342     if test -z "$_LIBIDL_FOUND"; then
8343         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8344         if test -z "$_LIBIDL_FOUND"; then
8345             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8346         fi
8347     fi
8348     dnl
8349     dnl If we don't have a libIDL config program & not cross-compiling, 
8350     dnl     look for orbit-config instead.
8351     dnl
8352     if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8353         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8354         if test -n "$ORBIT_CONFIG"; then
8355             AC_MSG_CHECKING([for ORBit libIDL usability])
8356                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8357             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8358             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8359             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8360             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8361             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8362             HOST_LIBIDL_CONFIG=
8363             _SAVE_CFLAGS="$CFLAGS"
8364             _SAVE_LIBS="$LIBS"
8365             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8366             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8367             AC_TRY_RUN([
8368 #include <stdlib.h>
8369 #include <libIDL/IDL.h>
8370 int main() {
8371   char *s;
8372   s=strdup(IDL_get_libver_string());
8373   if(s==NULL) {
8374     exit(1);
8375   }
8376   exit(0);
8378             ], [_LIBIDL_FOUND=1
8379                 result="yes"],
8380                [HOST_LIBIDL_CFLAGS=
8381                 HOST_LIBIDL_LIBS=
8382                 result="no"],
8383                [_LIBIDL_FOUND=1
8384                 result="maybe"] )
8385             AC_MSG_RESULT($result)
8386             CFLAGS="$_SAVE_CFLAGS"
8387             LIBS="$_SAVE_LIBS"
8388         fi
8389     fi
8390     if test -z "$_LIBIDL_FOUND"; then
8391         AC_MSG_ERROR([libIDL not found.
8392         libIDL $LIBIDL_VERSION or higher is required.])
8393     fi
8394     if test "$MACOS_SDK_DIR"; then
8395       CFLAGS="$_MACSAVE_CFLAGS"
8396       LIBS="$_MACSAVE_LIBS"
8397       LDFLAGS="$_MACSAVE_LDFLAGS"
8398       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8399         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8400       fi
8401     fi
8404 if test -n "$CROSS_COMPILE"; then
8405     case "$target" in
8406     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8407         if test -n "$GLIB_PREFIX"; then
8408             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8409             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8410                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8411             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8412                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8413             else
8414                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8415             fi
8416         fi
8418         if test -n "$LIBIDL_PREFIX"; then
8419             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8420             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8421                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8422                 STATIC_LIBIDL=1
8423             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8424                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8425             else
8426                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8427             fi
8428         fi
8429         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8430         ;;
8431     *)
8432         if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8433             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8434             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8435         fi
8436         ;;
8437     esac
8438 else
8439     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8440     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8443 if test -z "$SKIP_PATH_CHECKS"; then
8444 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8445     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8446         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8447     else
8448         AM_PATH_GLIB(${GLIB_VERSION})
8449     fi
8453 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8454     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8457 AC_SUBST(LIBIDL_CFLAGS)
8458 AC_SUBST(LIBIDL_LIBS)
8459 AC_SUBST(STATIC_LIBIDL)
8460 AC_SUBST(GLIB_CFLAGS)
8461 AC_SUBST(GLIB_LIBS)
8462 AC_SUBST(GLIB_GMODULE_LIBS)
8463 AC_SUBST(HOST_LIBIDL_CONFIG)
8464 AC_SUBST(HOST_LIBIDL_CFLAGS)
8465 AC_SUBST(HOST_LIBIDL_LIBS)
8467 dnl ========================================================
8468 dnl Check for cairo
8469 dnl ========================================================
8470 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8472 MOZ_TREE_CAIRO=1
8473 MOZ_ARG_ENABLE_BOOL(system-cairo,
8474 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8475 MOZ_TREE_CAIRO=,
8476 MOZ_TREE_CAIRO=1 )
8478 MOZ_TREE_PIXMAN=1
8479 MOZ_ARG_ENABLE_BOOL(system-pixman,
8480 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8481 MOZ_TREE_PIXMAN=,
8482 MOZ_TREE_PIXMAN=1 )
8484 # Check for headers defining standard int types.
8485 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8487 if test "$MOZ_TREE_CAIRO"; then
8488     AC_DEFINE(MOZ_TREE_CAIRO)
8490     # For now we assume that we will have a uint64_t available through
8491     # one of the above headers or mozstdint.h.
8492     AC_DEFINE(HAVE_UINT64_T)
8494     # Define macros for cairo-features.h
8495     if test "$MOZ_X11"; then
8496         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8497         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8498         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8499         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8500         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8501         MOZ_ENABLE_CAIRO_FT=1
8502         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8503     fi
8504     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8505         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8506     fi
8507     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8508         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8509         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8510         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8511     fi
8512     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8513         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8514         if test -z "$WINCE"; then
8515             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8516             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8517                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8518                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8519                 MOZ_ENABLE_D2D_SURFACE=1
8520                 MOZ_ENABLE_DWRITE_FONT=1
8521             else
8522                 WIN32_DWRITE_FONT_FEATURE=
8523                 WIN32_D2D_SURFACE_FEATURE=
8524             fi
8525         else
8526             WIN32_FONT_FEATURE=
8527             WIN32_DWRITE_FONT_FEATURE=
8528             WIN32_D2D_SURFACE_FEATURE=
8529         fi
8531         AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8533         dnl D3D10 Layers depend on D2D Surfaces.
8534         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8535           AC_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8536         fi
8538         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8539     fi
8540     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8541         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8542         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8543         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8544         MOZ_ENABLE_CAIRO_FT=1
8545         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8546         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8547     fi
8548     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8549         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8550         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8551         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8552         MOZ_ENABLE_CAIRO_FT=1
8553     fi
8554     if test "$USE_FC_FREETYPE"; then
8555         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8556     fi
8557     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8558     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8559     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8560     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8561     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8562     AC_SUBST(CAIRO_FT_CFLAGS)
8563     AC_SUBST(HAS_OGLES)
8565     if test "$MOZ_DEBUG"; then
8566       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8567     else
8568       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8569     fi
8571     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8573     AC_SUBST(PS_SURFACE_FEATURE)
8574     AC_SUBST(PDF_SURFACE_FEATURE)
8575     AC_SUBST(SVG_SURFACE_FEATURE)
8576     AC_SUBST(XLIB_SURFACE_FEATURE)
8577     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8578     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8579     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8580     AC_SUBST(XCB_SURFACE_FEATURE)
8581     AC_SUBST(WIN32_SURFACE_FEATURE)
8582     AC_SUBST(OS2_SURFACE_FEATURE)
8583     AC_SUBST(BEOS_SURFACE_FEATURE)
8584     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8585     AC_SUBST(FT_FONT_FEATURE)
8586     AC_SUBST(FC_FONT_FEATURE)
8587     AC_SUBST(WIN32_FONT_FEATURE)
8588     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8589     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8590     AC_SUBST(QUARTZ_FONT_FEATURE)
8591     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8592     AC_SUBST(QT_SURFACE_FEATURE)
8594     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8596     if test "$MOZ_TREE_PIXMAN"; then
8597         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8598     else
8599         PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8600         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8601         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8602     fi
8604     if test "$MOZ_X11"; then
8605         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8606     fi
8608     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8609     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8611 else
8612    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8613    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8614    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8615    if test "$MOZ_X11"; then
8616         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8617         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8618         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8619    fi
8622 AC_SUBST(MOZ_TREE_CAIRO)
8623 AC_SUBST(MOZ_CAIRO_CFLAGS)
8624 AC_SUBST(MOZ_CAIRO_LIBS)
8625 AC_SUBST(MOZ_TREE_PIXMAN)
8627 dnl ========================================================
8628 dnl qcms
8629 dnl ========================================================
8631 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8632 AC_SUBST(QCMS_LIBS)
8634 dnl ========================================================
8635 dnl HarfBuzz
8636 dnl ========================================================
8637 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8638 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8640 dnl ========================================================
8641 dnl OTS
8642 dnl ========================================================
8643 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8644 AC_SUBST(MOZ_OTS_LIBS)
8646 dnl ========================================================
8647 dnl disable xul
8648 dnl ========================================================
8649 MOZ_ARG_DISABLE_BOOL(xul,
8650 [  --disable-xul           Disable XUL],
8651     MOZ_XUL= )
8652 if test "$MOZ_XUL"; then
8653   AC_DEFINE(MOZ_XUL)
8654 else
8655   dnl remove extensions that require XUL
8656   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8659 AC_SUBST(MOZ_XUL)
8661 dnl ========================================================
8662 dnl disable profile locking
8663 dnl   do no use this in applications that can have more than
8664 dnl   one process accessing the profile directory.
8665 dnl ========================================================
8666 MOZ_ARG_DISABLE_BOOL(profilelocking,
8667 [  --disable-profilelocking
8668                           Disable profile locking],
8669     MOZ_PROFILELOCKING=,
8670     MOZ_PROFILELOCKING=1 )
8671 if test "$MOZ_PROFILELOCKING"; then
8672   AC_DEFINE(MOZ_PROFILELOCKING)
8675 dnl ========================================================
8676 dnl disable rdf services
8677 dnl ========================================================
8678 MOZ_ARG_DISABLE_BOOL(rdf,
8679 [  --disable-rdf           Disable RDF],
8680     MOZ_RDF= )
8681 if test "$MOZ_RDF"; then
8682   AC_DEFINE(MOZ_RDF)
8685 AC_SUBST(MOZ_RDF)
8687 dnl ========================================================
8688 dnl necko configuration options
8689 dnl ========================================================
8692 dnl option to disable various necko protocols
8694 MOZ_ARG_ENABLE_STRING(necko-protocols,
8695 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8696                           Enable/disable specific protocol handlers],
8697 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8698     if test "$option" = "yes" -o "$option" = "all"; then
8699         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8700     elif test "$option" = "no" -o "$option" = "none"; then
8701         NECKO_PROTOCOLS=""
8702     elif test "$option" = "default"; then
8703         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8704     elif test `echo "$option" | grep -c \^-` != 0; then
8705         option=`echo $option | sed 's/^-//'`
8706         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8707     else
8708         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8709     fi
8710 done],
8711     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8712 dnl Remove dupes
8713 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8714 AC_SUBST(NECKO_PROTOCOLS)
8715 for p in $NECKO_PROTOCOLS; do
8716     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8717 done
8720 dnl option to disable necko's disk cache
8722 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8723 [  --disable-necko-disk-cache
8724                           Disable necko disk cache],
8725     NECKO_DISK_CACHE=,
8726     NECKO_DISK_CACHE=1)
8727 AC_SUBST(NECKO_DISK_CACHE)
8728 if test "$NECKO_DISK_CACHE"; then
8729     AC_DEFINE(NECKO_DISK_CACHE)
8733 dnl option to disable necko's wifi scanner
8735 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8736 [  --disable-necko-wifi    Disable necko wifi scanner],
8737     NECKO_WIFI=,
8738     NECKO_WIFI=1)
8740 if test "$OS_ARCH" = "OS2"; then
8741   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8742   NECKO_WIFI=
8744 if test "$NECKO_WIFI" -a \
8745         "$OS_ARCH" != "Linux" -a \
8746         "$OS_ARCH" != "Darwin" -a \
8747         "$OS_ARCH" != "SunOS" -a \
8748         "$OS_ARCH" != "WINNT" -a \
8749         "$OS_ARCH" != "WINCE"; then
8750   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8753 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8754 then
8755   AC_CHECK_HEADER([iwlib.h])
8756   if test "$ac_cv_header_iwlib_h" != "yes"; then
8757     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])
8758   fi
8761 if test "$NECKO_WIFI"; then
8762   AC_DEFINE(NECKO_WIFI)
8764 AC_SUBST(NECKO_WIFI)
8767 dnl option to disable cookies
8769 MOZ_ARG_DISABLE_BOOL(cookies,
8770 [  --disable-cookies       Disable cookie support],
8771     NECKO_COOKIES=,
8772     NECKO_COOKIES=1)
8773 AC_SUBST(NECKO_COOKIES)
8774 if test "$NECKO_COOKIES"; then
8775     AC_DEFINE(NECKO_COOKIES)
8779 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8781 MOZ_ARG_DISABLE_BOOL(ctypes,
8782 [  --disable-ctypes        Disable js-ctypes],
8783     BUILD_CTYPES=,
8784     BUILD_CTYPES=1)
8785 AC_SUBST(BUILD_CTYPES)
8786 if test "$BUILD_CTYPES"; then
8787   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8788     # Disable ctypes for arm/wince.
8789     BUILD_CTYPES=
8790   else
8791     AC_DEFINE(BUILD_CTYPES)
8792   fi
8795 dnl NECKO_ configuration options are not global
8796 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8798 dnl Only build Mork if it's required
8799 AC_SUBST(MOZ_MORK)
8800 if test "$MOZ_MORK"; then
8801   AC_DEFINE(MOZ_MORK)
8804 dnl Build the lightweight Mork reader if required
8805 AC_SUBST(MOZ_MORKREADER)
8806 if test "$MOZ_MORKREADER"; then
8807   AC_DEFINE(MOZ_MORKREADER)
8810 dnl Build Places if required
8811 if test "$MOZ_PLACES"; then
8812   AC_DEFINE(MOZ_PLACES)
8815 dnl Build Sync Services if required
8816 AC_SUBST(MOZ_SERVICES_SYNC)
8817 if test -n "$MOZ_SERVICES_SYNC"; then
8818   AC_DEFINE(MOZ_SERVICES_SYNC)
8821 dnl ========================================================
8822 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8823     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8826 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8827   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8830 dnl ========================================================
8831 dnl =
8832 dnl = Maintainer debug option (no --enable equivalent)
8833 dnl =
8834 dnl ========================================================
8836 AC_SUBST(AR)
8837 AC_SUBST(AR_FLAGS)
8838 AC_SUBST(AR_LIST)
8839 AC_SUBST(AR_EXTRACT)
8840 AC_SUBST(AR_DELETE)
8841 AC_SUBST(AS)
8842 AC_SUBST(ASFLAGS)
8843 AC_SUBST(AS_DASH_C_FLAG)
8844 AC_SUBST(LD)
8845 AC_SUBST(RC)
8846 AC_SUBST(RCFLAGS)
8847 AC_SUBST(WINDRES)
8848 AC_SUBST(IMPLIB)
8849 AC_SUBST(FILTER)
8850 AC_SUBST(BIN_FLAGS)
8851 AC_SUBST(NS_USE_NATIVE)
8852 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8853 AC_SUBST(MOZ_UPDATE_XTERM)
8854 AC_SUBST(MINIMO)
8855 AC_SUBST(MOZ_PLATFORM_MAEMO)
8856 AC_SUBST(MOZ_AUTH_EXTENSION)
8857 AC_SUBST(MOZ_MATHML)
8858 AC_SUBST(MOZ_PERMISSIONS)
8859 AC_SUBST(MOZ_XTF)
8860 AC_SUBST(MOZ_PREF_EXTENSIONS)
8861 AC_SUBST(MOZ_SVG)
8862 AC_SUBST(MOZ_SMIL)
8863 AC_SUBST(MOZ_XSLT_STANDALONE)
8864 AC_SUBST(MOZ_JS_LIBS)
8865 AC_SUBST(MOZ_PSM)
8866 AC_SUBST(MOZ_DEBUG)
8867 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8868 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8869 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8870 AC_SUBST(MOZ_DEBUG_FLAGS)
8871 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8872 AC_SUBST(WARNINGS_AS_ERRORS)
8873 AC_SUBST(MOZ_EXTENSIONS)
8874 AC_SUBST(MOZ_JSDEBUGGER)
8875 AC_SUBST(MOZ_PLUGINS)
8876 AC_SUBST(MOZ_LOG_REFCNT)
8877 AC_SUBST(MOZ_LEAKY)
8878 AC_SUBST(MOZ_JPROF)
8879 AC_SUBST(MOZ_SHARK)
8880 AC_SUBST(MOZ_CALLGRIND)
8881 AC_SUBST(MOZ_VTUNE)
8882 AC_SUBST(MOZ_PROFILING)
8883 AC_SUBST(MOZ_JSLOADER)
8884 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8885 AC_SUBST(MOZ_QUANTIFY)
8886 AC_SUBST(LIBICONV)
8887 AC_SUBST(MOZ_PLACES)
8888 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8889 AC_SUBST(MOZ_STORAGE)
8890 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8891 AC_SUBST(MOZ_FEEDS)
8892 AC_SUBST(NS_PRINTING)
8893 AC_SUBST(MOZ_WEBGL)
8894 AC_SUBST(MOZ_HELP_VIEWER)
8896 AC_SUBST(MOZ_JAVAXPCOM)
8897 AC_SUBST(JAVA_INCLUDE_PATH)
8898 AC_SUBST(JAVA)
8899 AC_SUBST(JAVAC)
8900 AC_SUBST(JAR)
8902 AC_SUBST(MOZ_PROFILELOCKING)
8904 AC_SUBST(HAVE_XIE)
8905 AC_SUBST(MOZ_XIE_LIBS)
8907 AC_SUBST(BUILD_STATIC_LIBS)
8908 AC_SUBST(MOZ_ENABLE_LIBXUL)
8909 AC_SUBST(ENABLE_TESTS)
8910 AC_SUBST(IBMBIDI)
8911 AC_SUBST(MOZ_UNIVERSALCHARDET)
8912 AC_SUBST(ACCESSIBILITY)
8913 AC_SUBST(MOZ_VIEW_SOURCE)
8914 AC_SUBST(MOZ_SPELLCHECK)
8915 AC_SUBST(MOZ_USER_DIR)
8916 AC_SUBST(MOZ_CRASHREPORTER)
8917 AC_SUBST(MOZ_UPDATER)
8919 AC_SUBST(ENABLE_STRIP)
8920 AC_SUBST(PKG_SKIP_STRIP)
8921 AC_SUBST(USE_ELF_DYNSTR_GC)
8922 AC_SUBST(INCREMENTAL_LINKER)
8923 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8924 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8926 AC_SUBST(MOZ_FIX_LINK_PATHS)
8927 AC_SUBST(XPCOM_LIBS)
8928 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8929 AC_SUBST(XPCOM_GLUE_LDOPTS)
8930 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8932 AC_SUBST(USE_DEPENDENT_LIBS)
8934 AC_SUBST(MOZ_BUILD_ROOT)
8935 AC_SUBST(MOZ_OS2_TOOLS)
8937 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8938 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8939 AC_SUBST(MOZ_TIMELINE)
8940 AC_SUBST(OGLES_SDK_DIR)
8942 AC_SUBST(MOZ_APP_NAME)
8943 AC_SUBST(MOZ_APP_DISPLAYNAME)
8944 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8945 AC_SUBST(MOZ_APP_UA_NAME)
8946 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8947 AC_SUBST(MOZ_APP_VERSION)
8948 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
8949 AC_SUBST(MOZ_UA_FIREFOX_VERSION)
8950 AC_SUBST(FIREFOX_VERSION)
8951 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8952 AC_SUBST(MOZ_UA_BUILDID)
8954 AC_SUBST(MOZ_PKG_SPECIAL)
8956 AC_SUBST(MOZILLA_OFFICIAL)
8958 dnl win32 options
8959 AC_SUBST(MOZ_MAPINFO)
8960 AC_SUBST(MOZ_BROWSE_INFO)
8961 AC_SUBST(MOZ_TOOLS_DIR)
8962 AC_SUBST(CYGWIN_WRAPPER)
8963 AC_SUBST(AS_PERL)
8964 AC_SUBST(WIN32_REDIST_DIR)
8965 AC_SUBST(PYTHON)
8966 AC_SUBST(MAKENSISU)
8968 AC_SUBST(WINCE)
8969 AC_SUBST(WINCE_SDK_DIR)
8970 AC_SUBST(WINCE_WINDOWS_MOBILE)
8972 dnl Echo the CFLAGS to remove extra whitespace.
8973 CFLAGS=`echo \
8974         $_WARNINGS_CFLAGS \
8975         $CFLAGS`
8977 CXXFLAGS=`echo \
8978         $_MOZ_RTTI_FLAGS \
8979         $_MOZ_EXCEPTIONS_FLAGS \
8980         $_WARNINGS_CXXFLAGS \
8981         $CXXFLAGS`
8983 COMPILE_CFLAGS=`echo \
8984     $_DEFINES_CFLAGS \
8985         $_DEPEND_CFLAGS \
8986     $COMPILE_CFLAGS`
8988 COMPILE_CXXFLAGS=`echo \
8989     $_DEFINES_CXXFLAGS \
8990         $_DEPEND_CFLAGS \
8991     $COMPILE_CXXFLAGS`
8993 AC_SUBST(SYSTEM_MAKEDEPEND)
8994 AC_SUBST(SYSTEM_LIBXUL)
8995 AC_SUBST(SYSTEM_JPEG)
8996 AC_SUBST(SYSTEM_PNG)
8997 AC_SUBST(SYSTEM_ZLIB)
8998 AC_SUBST(SYSTEM_BZ2)
9000 AC_SUBST(JPEG_CFLAGS)
9001 AC_SUBST(JPEG_LIBS)
9002 AC_SUBST(ZLIB_CFLAGS)
9003 AC_SUBST(ZLIB_LIBS)
9004 AC_SUBST(BZ2_CFLAGS)
9005 AC_SUBST(BZ2_LIBS)
9006 AC_SUBST(PNG_CFLAGS)
9007 AC_SUBST(PNG_LIBS)
9009 AC_SUBST(MOZ_JPEG_CFLAGS)
9010 AC_SUBST(MOZ_JPEG_LIBS)
9011 AC_SUBST(MOZ_ZLIB_CFLAGS)
9012 AC_SUBST(MOZ_ZLIB_LIBS)
9013 AC_SUBST(MOZ_BZ2_CFLAGS)
9014 AC_SUBST(MOZ_BZ2_LIBS)
9015 AC_SUBST(MOZ_PNG_CFLAGS)
9016 AC_SUBST(MOZ_PNG_LIBS)
9018 AC_SUBST(NSPR_CFLAGS)
9019 AC_SUBST(NSPR_LIBS)
9020 AC_SUBST(MOZ_NATIVE_NSPR)
9022 AC_SUBST(NSS_CFLAGS)
9023 AC_SUBST(NSS_LIBS)
9024 AC_SUBST(NSS_DEP_LIBS)
9025 AC_SUBST(MOZ_NATIVE_NSS)
9026 AC_SUBST(NSS_DISABLE_DBM)
9028 AC_SUBST(CFLAGS)
9029 AC_SUBST(CXXFLAGS)
9030 AC_SUBST(CPPFLAGS)
9031 AC_SUBST(COMPILE_CFLAGS)
9032 AC_SUBST(COMPILE_CXXFLAGS)
9033 AC_SUBST(LDFLAGS)
9034 AC_SUBST(LIBS)
9035 AC_SUBST(CROSS_COMPILE)
9036 AC_SUBST(WCHAR_CFLAGS)
9038 AC_SUBST(HOST_CC)
9039 AC_SUBST(HOST_CXX)
9040 AC_SUBST(HOST_CFLAGS)
9041 AC_SUBST(HOST_CXXFLAGS)
9042 AC_SUBST(HOST_OPTIMIZE_FLAGS)
9043 AC_SUBST(HOST_AR)
9044 AC_SUBST(HOST_AR_FLAGS)
9045 AC_SUBST(HOST_LD)
9046 AC_SUBST(HOST_RANLIB)
9047 AC_SUBST(HOST_NSPR_MDCPUCFG)
9048 AC_SUBST(HOST_BIN_SUFFIX)
9049 AC_SUBST(HOST_OS_ARCH)
9051 AC_SUBST(TARGET_CPU)
9052 AC_SUBST(TARGET_VENDOR)
9053 AC_SUBST(TARGET_OS)
9054 AC_SUBST(TARGET_NSPR_MDCPUCFG)
9055 AC_SUBST(TARGET_MD_ARCH)
9056 AC_SUBST(TARGET_XPCOM_ABI)
9057 AC_SUBST(OS_TARGET)
9058 AC_SUBST(OS_ARCH)
9059 AC_SUBST(OS_RELEASE)
9060 AC_SUBST(OS_TEST)
9062 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
9063 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
9065 AC_SUBST(WRAP_MALLOC_CFLAGS)
9066 AC_SUBST(WRAP_MALLOC_LIB)
9067 AC_SUBST(MKSHLIB)
9068 AC_SUBST(MKCSHLIB)
9069 AC_SUBST(MKSHLIB_FORCE_ALL)
9070 AC_SUBST(MKSHLIB_UNFORCE_ALL)
9071 AC_SUBST(DSO_CFLAGS)
9072 AC_SUBST(DSO_PIC_CFLAGS)
9073 AC_SUBST(DSO_LDOPTS)
9074 AC_SUBST(LIB_PREFIX)
9075 AC_SUBST(DLL_PREFIX)
9076 AC_SUBST(DLL_SUFFIX)
9077 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
9078 AC_SUBST(LIB_SUFFIX)
9079 AC_SUBST(OBJ_SUFFIX)
9080 AC_SUBST(BIN_SUFFIX)
9081 AC_SUBST(ASM_SUFFIX)
9082 AC_SUBST(IMPORT_LIB_SUFFIX)
9083 AC_SUBST(USE_N32)
9084 AC_SUBST(CC_VERSION)
9085 AC_SUBST(CXX_VERSION)
9086 AC_SUBST(MSMANIFEST_TOOL)
9087 AC_SUBST(NS_ENABLE_TSF)
9088 AC_SUBST(MOZ_NSS_PATCH)
9089 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9090 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9092 AC_SUBST(MOZ_MEDIA)
9093 AC_SUBST(MOZ_SYDNEYAUDIO)
9094 AC_SUBST(MOZ_WAVE)
9095 AC_SUBST(MOZ_VORBIS)
9096 AC_SUBST(MOZ_TREMOR)
9097 AC_SUBST(MOZ_WEBM)
9098 AC_SUBST(MOZ_OGG)
9099 AC_SUBST(MOZ_ALSA_LIBS)
9100 AC_SUBST(VPX_AS)
9101 AC_SUBST(VPX_ASFLAGS)
9102 AC_SUBST(VPX_DASH_C_FLAG)
9103 AC_SUBST(VPX_AS_CONVERSION)
9104 AC_SUBST(VPX_ASM_SUFFIX)
9105 AC_SUBST(VPX_X86_ASM)
9106 AC_SUBST(VPX_ARM_ASM)
9108 if test "$USING_HCC"; then
9109    CC='${topsrcdir}/build/hcc'
9110    CC="$CC '$_OLDCC'"
9111    CXX='${topsrcdir}/build/hcpp'
9112    CXX="$CXX '$_OLDCXX'"
9113    AC_SUBST(CC)
9114    AC_SUBST(CXX)
9117 AC_MSG_CHECKING([for posix_fallocate])       
9118 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9119   #include <fcntl.h>],
9120                  [posix_fallocate(0, 0, 0);],
9121                  [ac_cv___posix_fallocate=true],
9122                  [ac_cv___posix_fallocate=false])
9124 if test "$ac_cv___posix_fallocate" = true ; then
9125   AC_DEFINE(HAVE_POSIX_FALLOCATE)
9126   AC_MSG_RESULT(yes)
9127 else
9128   AC_MSG_RESULT(no)
9131 dnl Check for missing components
9132 if test "$COMPILE_ENVIRONMENT"; then
9133 if test "$MOZ_X11"; then
9134     dnl ====================================================
9135     dnl = Check if X headers exist
9136     dnl ====================================================
9137     _SAVE_CFLAGS=$CFLAGS
9138     CFLAGS="$CFLAGS $XCFLAGS"
9139     AC_TRY_COMPILE([
9140         #include <stdio.h>
9141         #include <stdlib.h>
9142         #include <X11/Xlib.h>
9143         #include <X11/Intrinsic.h>
9144     ],
9145     [
9146         Display *dpy = 0;
9147         if ((dpy = XOpenDisplay(NULL)) == NULL) {
9148             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9149             exit(1);
9150         }
9151     ], [], 
9152     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9153     CFLAGS="$_SAVE_CFLAGS"
9155     if test ! -z "$MISSING_X"; then
9156         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9157     fi
9159 fi # MOZ_X11
9161 dnl Check for headers, etc. needed by WebGL.
9162 if test -n "$MOZ_WEBGL_GLX"; then
9163     AC_CHECK_HEADER(GL/glx.h)
9164     if test "$ac_cv_header_GL_glx_h" != "yes"; then
9165         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
9166     fi
9167 fi # MOZ_WEBGL_GLX
9168 fi # COMPILE_ENVIRONMENT
9170 if test "$USE_FC_FREETYPE"; then
9171     if test "$COMPILE_ENVIRONMENT"; then
9172         _SAVE_CPPFLAGS="$CPPFLAGS"
9173         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
9174         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
9175             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
9176         CPPFLAGS="$_SAVE_CPPFLAGS"
9177     else
9178         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
9179     fi
9182 dnl Set various defines and substitutions
9183 dnl ========================================================
9185 if test "$OS_ARCH" = "BeOS"; then
9186   AC_DEFINE(XP_BEOS)
9187 elif test "$OS_ARCH" = "Darwin"; then
9188   AC_DEFINE(XP_UNIX)
9189   AC_DEFINE(UNIX_ASYNC_DNS)
9190 elif test "$OS_ARCH" = "OpenVMS"; then
9191   AC_DEFINE(XP_UNIX)
9192 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
9193   AC_DEFINE(XP_UNIX)
9194   AC_DEFINE(UNIX_ASYNC_DNS)
9197 if test "$MOZ_DEBUG"; then
9198     AC_DEFINE(MOZ_REFLOW_PERF)
9199     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9202 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9203     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9204     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9205     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9206     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9207     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9208     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9209     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9210     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9213 dnl ========================================================
9214 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
9215 dnl ========================================================
9216 case "$host_os" in
9217 mingw*)
9218     WIN_TOP_SRC=`cd $srcdir; pwd -W`
9219     ;;
9220 cygwin*|msvc*|mks*)
9221     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
9222     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
9223     CC="\$(CYGWIN_WRAPPER) $CC"
9224     CXX="\$(CYGWIN_WRAPPER) $CXX"
9225     CPP="\$(CYGWIN_WRAPPER) $CPP"
9226     LD="\$(CYGWIN_WRAPPER) $LD"
9227     AS="\$(CYGWIN_WRAPPER) $AS"
9228     RC="\$(CYGWIN_WRAPPER) $RC"
9229     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
9230     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
9231     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
9232     ;;
9233 esac
9235 AC_SUBST(CYGDRIVE_MOUNT)
9236 AC_SUBST(WIN_TOP_SRC)
9238 AC_SUBST(MOZILLA_VERSION)
9240 AC_SUBST(ac_configure_args)
9242 dnl Spit out some output
9243 dnl ========================================================
9245 dnl The following defines are used by xpcom
9246 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9247 CPP_THROW_NEW
9248 HAVE_CPP_2BYTE_WCHAR_T
9249 HAVE_CPP_ACCESS_CHANGING_USING
9250 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9251 HAVE_CPP_BOOL
9252 HAVE_CPP_CHAR16_T
9253 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9254 HAVE_CPP_EXPLICIT
9255 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9256 HAVE_CPP_NAMESPACE_STD
9257 HAVE_CPP_NEW_CASTS
9258 HAVE_CPP_PARTIAL_SPECIALIZATION
9259 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9260 HAVE_CPP_TYPENAME
9261 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9262 HAVE_STATVFS
9263 NEED_CPP_UNUSED_IMPLEMENTATIONS
9264 NEW_H
9265 HAVE_GETPAGESIZE
9266 HAVE_ICONV
9267 HAVE_ICONV_WITH_CONST_INPUT
9268 HAVE_MBRTOWC
9269 HAVE_SYS_MOUNT_H
9270 HAVE_SYS_VFS_H
9271 HAVE_WCRTOMB
9274 AC_CONFIG_HEADER(
9275 netwerk/necko-config.h
9276 xpcom/xpcom-config.h
9277 xpcom/xpcom-private.h
9280 # Save the defines header file before autoconf removes it.
9281 # (Do not add AC_DEFINE calls after this line.)
9282   _CONFIG_TMP=confdefs-tmp.h
9283   _CONFIG_DEFS_H=mozilla-config.h
9285   cat > $_CONFIG_TMP <<\EOF
9286 /* List of defines generated by configure. Included with preprocessor flag,
9287  * -include, to avoid long list of -D defines on the compile command-line.
9288  * Do not edit.
9289  */
9291 #ifndef _MOZILLA_CONFIG_H_
9292 #define _MOZILLA_CONFIG_H_
9295 _EGREP_PATTERN='^#define ('
9296 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9297     for f in $_NON_GLOBAL_ACDEFINES; do
9298         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9299     done
9301 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9303   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9305   cat >> $_CONFIG_TMP <<\EOF
9307 #endif /* _MOZILLA_CONFIG_H_ */
9311   # Only write mozilla-config.h when something changes (or it doesn't exist)
9312   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9313     rm $_CONFIG_TMP
9314   else
9315     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9316     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9318     echo ==== $_CONFIG_DEFS_H =================================
9319     cat $_CONFIG_DEFS_H
9320   fi
9322 dnl Probably shouldn't call this manually but we always want the output of DEFS
9323 rm -f confdefs.h.save
9324 mv confdefs.h confdefs.h.save
9325 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9326 AC_OUTPUT_MAKE_DEFS()
9327 MOZ_DEFINES=$DEFS
9328 AC_SUBST(MOZ_DEFINES)
9329 rm -f confdefs.h
9330 mv confdefs.h.save confdefs.h
9332 dnl Load the list of Makefiles to generate.
9333 dnl   To add new Makefiles, edit allmakefiles.sh.
9334 dnl   allmakefiles.sh sets the variable, MAKEFILES.
9335 . ${srcdir}/allmakefiles.sh
9336 dnl 
9337 dnl Run a perl script to quickly create the makefiles.
9338 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9339 dnl   for the files it cannot handle correctly. This way, config.status
9340 dnl   will handle these files.
9341 dnl If it fails, nothing is set and config.status will run as usual.
9343 dnl This does not change the $MAKEFILES variable.
9345 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9347 if test -z "${AS_PERL}"; then
9348 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9349 else
9350 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9352 . ./conftest.sh
9353 rm conftest.sh
9355 echo $MAKEFILES > unallmakefiles
9357 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9359 AC_OUTPUT($MAKEFILES)
9361 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9362 if test "$CAIRO_FEATURES_H"; then
9363   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9364     echo "$CAIRO_FEATURES_H is unchanged"
9365     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9366   else
9367     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9368   fi
9371 dnl ========================================================
9372 dnl = Setup a nice relatively clean build environment for
9373 dnl = sub-configures.
9374 dnl ========================================================
9375 CC="$_SUBDIR_CC" 
9376 CXX="$_SUBDIR_CXX" 
9377 CFLAGS="$_SUBDIR_CFLAGS" 
9378 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9379 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9380 LDFLAGS="$_SUBDIR_LDFLAGS"
9381 HOST_CC="$_SUBDIR_HOST_CC" 
9382 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9383 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9386 unset MAKEFILES
9387 unset CONFIG_FILES
9389 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9390 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9392 if test -n "$MOZ_THUMB2"; then
9393   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9395 if test -n "$_WRAP_MALLOC"; then
9396   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9399 if test -z "$MOZ_NATIVE_NSPR"; then
9400     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9401     if test -z "$MOZ_DEBUG"; then
9402         ac_configure_args="$ac_configure_args --disable-debug"
9403     fi
9404     if test "$MOZ_OPTIMIZE" = "1"; then
9405         ac_configure_args="$ac_configure_args --enable-optimize"
9406     fi
9407     if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9408        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9409     fi
9410     if test -n "$HAVE_64BIT_OS"; then
9411         ac_configure_args="$ac_configure_args --enable-64bit"
9412     fi
9413     if test -n "$USE_ARM_KUSER"; then
9414         ac_configure_args="$ac_configure_args --with-arm-kuser"
9415     fi
9416     AC_OUTPUT_SUBDIRS(nsprpub)
9417     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9420 if test -z "$MOZ_NATIVE_NSPR"; then
9421     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9422     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9423     if test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
9424        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9425        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9426        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9427        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9428     fi
9429     rm -f config/autoconf.mk.bak
9432 # Run the SpiderMonkey 'configure' script.
9433 dist=$MOZ_BUILD_ROOT/dist
9434 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9435 ac_configure_args="$ac_configure_args --enable-threadsafe"
9436 if test "$BUILD_CTYPES"; then
9437     # Build js-ctypes on the platforms we can.
9438     ac_configure_args="$ac_configure_args --enable-ctypes"
9440 if test -z "$JS_SHARED_LIBRARY" ; then
9441     ac_configure_args="$ac_configure_args --disable-shared-js"
9443 if test -z "$MOZ_NATIVE_NSPR"; then
9444     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9445     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9447 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9448 ac_configure_args="$ac_configure_args --prefix=$dist"
9449 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9450 if test "$MOZ_MEMORY"; then
9451    ac_configure_args="$ac_configure_args --enable-jemalloc"
9452    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9453      export MOZ_MEMORY_LDFLAGS
9454    fi
9456 AC_OUTPUT_SUBDIRS(js/src)
9457 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9459 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9461 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9462 dnl Needs to be at the end to respect possible changes from NSPR configure
9463 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9464   echo "config/autoconf.mk is unchanged"
9465   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9466 else
9467   rm -f config/autoconf.mk.orig 2> /dev/null