Merge tracemonkey to mozilla-central. (a=blockers)
[mozilla-central.git] / configure.in
blobfe9f6c8e7d451cbd876e8d94041ed3afa8b0fd4b
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.3
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 if test "$target" = "arm-android-eabi" ; then
268     if test -z "$android_ndk" ; then
269         AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
270     fi
272     if test -z "$android_sdk" ; then
273         AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
274     fi
276     android_platform_tools="$android_sdk"/../../platform-tools
277     if test ! -d "$android_platform_tools" ; then
278         android_platform_tools="$android_sdk"/tools # SDK Tools < r8
279     fi
281     if test -z "$android_toolchain" ; then
282         android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
283     fi
285     if test -z "$android_platform" ; then
286        android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
287     fi
289     dnl set up compilers
290     AS="$android_toolchain"/bin/arm-eabi-as
291     CC="$android_toolchain"/bin/arm-eabi-gcc
292     CXX="$android_toolchain"/bin/arm-eabi-g++
293     CPP="$android_toolchain"/bin/arm-eabi-cpp
294     LD="$android_toolchain"/bin/arm-eabi-ld
295     AR="$android_toolchain"/bin/arm-eabi-ar
296     RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
297     STRIP="$android_toolchain"/bin/arm-eabi-strip
299     CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
300     CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS"
301     CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CXXFLAGS"
303     dnl Add -llog by default, since we use it all over the place.
304     dnl Add --allow-shlib-undefined, because libGLESv2 links to an
305     dnl undefined symbol (present on the hardware, just not in the
306     dnl NDK.)
307     LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
309     dnl prevent cross compile section from using these flags as host flags
310     if test -z "$HOST_CPPFLAGS" ; then
311         HOST_CPPFLAGS=" "
312     fi
313     if test -z "$HOST_CFLAGS" ; then
314         HOST_CFLAGS=" "
315     fi
316     if test -z "$HOST_CXXFLAGS" ; then
317         HOST_CXXFLAGS=" "
318     fi
319     if test -z "$HOST_LDFLAGS" ; then
320         HOST_LDFLAGS=" "
321     fi
323     ANDROID_NDK="${android_ndk}"
324     ANDROID_TOOLCHAIN="{android_toolchain}"
325     ANDROID_PLATFORM="{android_platform}"
326     ANDROID_SDK="${android_sdk}"
327     ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
328     ANDROID_VERSION="${android_version}"
329     if test -z "$ANDROID_PACKAGE_NAME" ; then
330         ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
331     fi
333     AC_DEFINE(ANDROID)
334     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
335     AC_SUBST(ANDROID_VERSION)
336     CROSS_COMPILE=1
337     MOZ_CHROME_FILE_FORMAT=omni
338     ZLIB_DIR=yes
341 AC_SUBST(ANDROID_NDK)
342 AC_SUBST(ANDROID_TOOLCHAIN)
343 AC_SUBST(ANDROID_PLATFORM)
344 AC_SUBST(ANDROID_SDK)
345 AC_SUBST(ANDROID_PLATFORM_TOOLS)
346 AC_SUBST(ANDROID_PACKAGE_NAME)
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
656         if test "$_CC_MAJOR_VERSION" = "14"; then
657             dnl Require VC8SP1 or newer.
658             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
659             if test "$_CC_RELEASE" -lt 50727 -o \
660                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
661               AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
662             fi
664             _CC_SUITE=8
665             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
666             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
667             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
668         elif test "$_CC_MAJOR_VERSION" = "15"; then
669             _CC_SUITE=9
670             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
671             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
672             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
673         elif test "$_CC_MAJOR_VERSION" = "16"; then
674             _CC_SUITE=10
675             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
676             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
677             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
678         else
679             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
680         fi
682         _MOZ_RTTI_FLAGS_ON='-GR'
683         _MOZ_RTTI_FLAGS_OFF='-GR-'
684         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
685         _MOZ_EXCEPTIONS_FLAGS_OFF=''
686         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
688         if test -n "$WIN32_REDIST_DIR"; then
689             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
690         fi
692         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
693         dnl not something else like "magnetic tape manipulation utility".
694         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
695         if test -z "$MSMT_TOOL"; then
696           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
697         fi
699         changequote(,)
700         _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
701         changequote([,])
702         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
703         if test -z "$MSMANIFEST_TOOL_VERSION"; then
704           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
705         fi
707         MSMANIFEST_TOOL=1
708         unset MSMT_TOOL
710         # Check linker version
711         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
712         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
713         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
714             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
715         fi
717         INCREMENTAL_LINKER=1
719         # Check midl version
720         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
721         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
722         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
723         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
724         # Add flags if necessary
725         AC_MSG_CHECKING([for midl flags])
726         case "$target" in
727         i*86-*)
728             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
729                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
730                 # MIDL version 7.00.0500 or later has no problem.
731                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
732                 AC_MSG_RESULT([need -env win32])
733             else
734                 AC_MSG_RESULT([none needed])
735             fi
736             ;;
737         x86_64-*)
738             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
739             ;;
740         *)
741             AC_MSG_RESULT([none needed])
742             ;;
743         esac
745         # Identify which version of the SDK we're building with
746         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
747         # from there
748         AC_CHECK_HEADERS([winsdkver.h])
749         if test "$ac_cv_header_winsdkver_h" = "yes"; then
750             # Get the highest _WIN32_WINNT and NTDDI versions supported
751             # Take the higher of the two
752             # This is done because the Windows 7 beta SDK reports its
753             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
754             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
755                            ac_cv_winsdk_maxver,
756                            [cat > conftest.h <<EOF
757 #include <winsdkver.h>
758 #include <sdkddkver.h>
760 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
761 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
762 #else
763 #define WINSDK_MAXVER NTDDI_MAXVER
764 #endif
766 WINSDK_MAXVER
768                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
769                             rm -f conftest.h
770                            ])
771             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
772         else
773             # The Vista SDK is the only one to have sdkddkver.h but not
774             # WinSDKVer.h
775             AC_CHECK_HEADERS([sdkddkver.h])
776             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
777                 MOZ_WINSDK_MAXVER=0x06000000
778             else
779                 # Assume the Server 2003 Platform SDK
780                 MOZ_WINSDK_MAXVER=0x05020000
781             fi
782         fi
784         unset _MSVC_VER_FILTER
786         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
787             [
788                 AC_LANG_SAVE
789                 AC_LANG_CPLUSPLUS
790                 _SAVE_CXXFLAGS="$CXXFLAGS"
791                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
792                 AC_TRY_COMPILE([#include <exception>],
793                             [std::_Throw(std::exception()); return 0;],
794                             ac_cv_have_std__Throw="yes",
795                             ac_cv_have_std__Throw="no")
796                 CXXFLAGS="$_SAVE_CXXFLAGS"
797                 AC_LANG_RESTORE
798             ])
800         if test "$ac_cv_have_std__Throw" = "yes"; then
801             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
802                            ac_cv_have_dllimport_exception_bug,
803                 [
804                     AC_LANG_SAVE
805                     AC_LANG_CPLUSPLUS
806                     _SAVE_CXXFLAGS="$CXXFLAGS"
807                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
808                     AC_TRY_LINK([#include <vector>],
809                                 [std::vector<int> v; return v.at(1);],
810                                 ac_cv_have_dllimport_exception_bug="no",
811                                 ac_cv_have_dllimport_exception_bug="yes")
812                     CXXFLAGS="$_SAVE_CXXFLAGS"
813                     AC_LANG_RESTORE
814                 ])
815             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
816                 WRAP_STL_INCLUDES=1
817                 MOZ_MSVC_STL_WRAP__Throw=1
818                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
819             fi
820         else
821             AC_CACHE_CHECK(for overridable _RAISE,
822                            ac_cv_have__RAISE,
823                 [
824                     AC_LANG_SAVE
825                     AC_LANG_CPLUSPLUS
826                     _SAVE_CXXFLAGS="$CXXFLAGS"
827                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
828                     AC_TRY_COMPILE([#include <xstddef>
829                                     #undef _RAISE
830                                     #define _RAISE(x) externallyDefinedFunction((x).what())
831                                     #include <vector>
832                                    ],
833                                    [std::vector<int> v; return v.at(1);],
834                                    ac_cv_have__RAISE="no",
835                                    ac_cv_have__RAISE="yes")
836                     CXXFLAGS="$_SAVE_CXXFLAGS"
837                     AC_LANG_RESTORE
838                 ])
839             if test "$ac_cv_have__RAISE" = "yes"; then
840                 WRAP_STL_INCLUDES=1
841                 MOZ_MSVC_STL_WRAP__RAISE=1
842                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
843             else
844                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
845             fi
846         fi
848         if test "$WRAP_STL_INCLUDES" = "1"; then
849             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
850         fi
851     else
852         # Check w32api version
853         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
854         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
855         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
856         AC_TRY_COMPILE([#include <w32api.h>],
857             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
858                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
859                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
860                 #error "test failed."
861             #endif
862             , [ res=yes ], [ res=no ])
863         AC_MSG_RESULT([$res])
864         if test "$res" != "yes"; then
865             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
866         fi
867         # Check windres version
868         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
869         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
870         AC_MSG_RESULT([$_WINDRES_VERSION])
871         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
872         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
873         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
874         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
875         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
876         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
877         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
878                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
879                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
880                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
881                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
882                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
883         then
884             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
885         fi
887         # Server 2003 is the highest version supported
888         MOZ_WINSDK_MAXVER=0x05020000
889     fi # !GNU_CC
891     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
892     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
893     # Require OS features provided by IE 5.0
894     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
896     # If the maximum version supported by this SDK is lower than the target
897     # version, error out
898     AC_MSG_CHECKING([for Windows SDK being recent enough])
899     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
900         AC_MSG_RESULT("yes")
901     else
902         AC_MSG_RESULT("no")
903         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.])
904     fi
906     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
907     # Definitions matching sdkddkver.h
908     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
909     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
910     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
911     ;;
912 esac
914 dnl Test breaks icc on OS/2 && MSVC
915 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
916     AC_PROG_CC_C_O
917     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
918         USING_HCC=1
919         _OLDCC=$CC
920         _OLDCXX=$CXX
921         CC="${srcdir}/build/hcc '$CC'"
922         CXX="${srcdir}/build/hcpp '$CXX'"
923     fi
926 AC_PROG_CPP
927 AC_PROG_CXXCPP
929 if test -n "$_WIN32_MSVC"; then
930     SKIP_PATH_CHECKS=1
931     SKIP_COMPILER_CHECKS=1
932     SKIP_LIBRARY_CHECKS=1
934     # Since we're skipping compiler and library checks, hard-code
935     # some facts here.
936     case "$target" in
937     *-wince|*-winmo)
938         ;;
939     *)
940         AC_DEFINE(HAVE_IO_H)
941         AC_DEFINE(HAVE_SETBUF)
942         AC_DEFINE(HAVE_ISATTY)
943         ;;
944     esac
947 fi # COMPILE_ENVIRONMENT
949 AC_SUBST(MIDL_FLAGS)
950 AC_SUBST(_MSC_VER)
952 AC_SUBST(GNU_AS)
953 AC_SUBST(GNU_LD)
954 AC_SUBST(GNU_CC)
955 AC_SUBST(GNU_CXX)
956 AC_SUBST(INTEL_CC)
957 AC_SUBST(INTEL_CXX)
959 AC_SUBST(STL_FLAGS)
960 AC_SUBST(WRAP_STL_INCLUDES)
961 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
962 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
964 dnl ========================================================
965 dnl Checks for programs.
966 dnl ========================================================
967 AC_PROG_INSTALL
968 AC_PROG_LN_S
970 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
971 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
972 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
973 _perl_res=$?
974 AC_MSG_RESULT([$_perl_version])
976 if test "$_perl_res" != 0; then
977     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
981 AC_MSG_CHECKING([for full perl installation])
982 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
983 _perl_res=$?
984 if test "$_perl_res" != 0; then
985     AC_MSG_RESULT([no])
986     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
987 else
988     AC_MSG_RESULT([yes])    
991 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
992 if test -z "$PYTHON"; then
993     AC_MSG_ERROR([python was not found in \$PATH])
996 if test -z "$COMPILE_ENVIRONMENT"; then
997     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
999 AC_SUBST(NSINSTALL_BIN)
1001 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1002 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1003 MOZ_PATH_PROG(UNZIP, unzip, :)
1004 MOZ_PATH_PROGS(ZIP, zip)
1005 if test -z "$ZIP" -o "$ZIP" = ":"; then
1006     AC_MSG_ERROR([zip not found in \$PATH])
1008 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1009 MOZ_PATH_PROG(XARGS, xargs)
1010 if test -z "$XARGS" -o "$XARGS" = ":"; then
1011     AC_MSG_ERROR([xargs not found in \$PATH .])
1014 if test "$COMPILE_ENVIRONMENT"; then
1016 dnl ========================================================
1017 dnl = Mac OS X toolchain support
1018 dnl ========================================================
1020 case "$target_os" in
1021 darwin*)
1022     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1023     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1024     dnl the environment and includedir purposes (when using an SDK, below),
1025     dnl but remember the full version number for the libdir (SDK).
1026     changequote(,)
1027     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1028     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1029     changequote([,])
1030     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1031         dnl Bug 280479, but this keeps popping up in bug 292530 too because
1032         dnl 4.0.0/4061 is the default compiler in Tiger.
1033         changequote(,)
1034         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1035         changequote([,])
1036         if test "$GCC_BUILD" = "4061" ; then
1037             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1038 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1039 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1040         fi
1041     fi
1043     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1044     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
1045     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1046     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1048     case "$PBBUILD" in
1049       *xcodebuild*)
1050         changequote(,)
1051         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1052         changequote([,])
1053         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
1054           HAS_XCODE_2_1=1;
1055         fi
1056       ;;
1057     esac
1059     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
1060     dnl it has moved into /usr/bin.
1061     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1062     ;;
1063 esac
1065 AC_SUBST(GCC_VERSION)
1066 AC_SUBST(XCODEBUILD_VERSION)
1067 AC_SUBST(HAS_XCODE_2_1)
1069 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1070 dnl that a universal binary is being produced.
1071 AC_SUBST(UNIVERSAL_BINARY)
1073 dnl ========================================================
1074 dnl Check for MacOS deployment target version
1075 dnl ========================================================
1077 MOZ_ARG_ENABLE_STRING(macos-target,
1078                       [  --enable-macos-target=VER (default=10.5)
1079                           Set the minimum MacOS version needed at runtime],
1080                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1082 case "$target" in
1083 *-darwin*)
1084     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1085         dnl Use the specified value
1086         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1087         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1088     else
1089         dnl No value specified on the command line or in the environment,
1090         dnl use architecture minimum.
1091         case "${target_cpu}" in
1092           ppc*)
1093             export MACOSX_DEPLOYMENT_TARGET=10.5
1094             ;;
1095           i*86)
1096             export MACOSX_DEPLOYMENT_TARGET=10.5
1097             ;;
1098           x86_64)
1099             export MACOSX_DEPLOYMENT_TARGET=10.6
1100             ;;
1101         esac
1102     fi
1103     ;;
1104 esac
1106 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1108 dnl ========================================================
1109 dnl = Mac OS X SDK support
1110 dnl ========================================================
1111 MACOS_SDK_DIR=
1112 NEXT_ROOT=
1113 MOZ_ARG_WITH_STRING(macos-sdk,
1114 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
1115     MACOS_SDK_DIR=$withval)
1117 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1118 dnl NEXT_ROOT will be set and exported only if it's needed.
1119 AC_SUBST(MACOS_SDK_DIR)
1120 AC_SUBST(NEXT_ROOT)
1122 if test "$MACOS_SDK_DIR"; then
1123   dnl Sync this section with the ones in NSPR and NSS.
1124   dnl Changes to the cross environment here need to be accounted for in
1125   dnl the libIDL checks (below) and xpidl build.
1127   if test ! -d "$MACOS_SDK_DIR"; then
1128     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1129 specify a valid SDK.  SDKs are installed when the optional cross-development
1130 tools are selected during the Xcode/Developer Tools installation.])
1131   fi
1133   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1134   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1135     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1136   else
1137     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1138     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1140     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1141     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1142     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1144     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1145       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1146       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1147       dnl be ignored and cause warnings when -syslibroot is specified.
1148       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1149       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1150       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1151     fi
1152   fi
1154   AC_LANG_SAVE
1155   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1156   AC_LANG_CPLUSPLUS
1157   AC_TRY_COMPILE([#include <new>
1158                  int main() { return 0; }],
1159    result=yes,
1160    result=no)
1161   AC_LANG_RESTORE
1162   AC_MSG_RESULT($result)
1164   if test "$result" = "no" ; then
1165     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1166   fi
1169 fi # COMPILE_ENVIRONMENT
1171 if test -n "$MAKE"; then
1172   if test `echo $MAKE | grep -c make.py` != 1; then
1173      NOT_PYMAKE=$MAKE
1174   fi
1177 case "$host_os" in
1178 cygwin*|mingw*|mks*|msvc*)
1179     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1180     ;;
1182     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1183     ;;
1184 esac
1185 if test "$GMAKE" = ":"; then
1186    AC_MSG_ERROR([GNU make not found])
1188 AC_SUBST(GMAKE)
1190 if test "$COMPILE_ENVIRONMENT"; then
1192 AC_PATH_XTRA
1194 XCFLAGS="$X_CFLAGS"
1196 fi # COMPILE_ENVIRONMENT
1198 dnl ========================================================
1199 dnl set the defaults first
1200 dnl ========================================================
1201 AS_BIN=$AS
1202 AR_LIST='$(AR) t'
1203 AR_EXTRACT='$(AR) x'
1204 AR_DELETE='$(AR) d'
1205 AS='$(CC)'
1206 AS_DASH_C_FLAG='-c'
1207 DLL_PREFIX=lib
1208 LIB_PREFIX=lib
1209 DLL_SUFFIX=.so
1210 OBJ_SUFFIX=o
1211 LIB_SUFFIX=a
1212 ASM_SUFFIX=s
1213 IMPORT_LIB_SUFFIX=
1214 TARGET_MD_ARCH=unix
1215 DIRENT_INO=d_ino
1216 CYGWIN_WRAPPER=
1217 WIN_TOP_SRC=
1218 MOZ_USER_DIR=".mozilla"
1220 MOZ_JPEG_CFLAGS=
1221 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1222 MOZ_ZLIB_CFLAGS=
1223 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1224 MOZ_BZ2_CFLAGS=
1225 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1226 MOZ_PNG_CFLAGS=
1227 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1229 MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
1230 MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1231 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1232 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1233 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1234 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1235 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1236 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1238 MOZ_FS_LAYOUT=unix
1240 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1242 USE_DEPENDENT_LIBS=1
1244 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1246 if test -n "$CROSS_COMPILE"; then
1247     OS_TARGET="${target_os}"
1248     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1249     OS_RELEASE=
1250     case "${target_os}" in
1251         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1252         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1253         gnu*)         OS_ARCH=GNU ;;
1254         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1255         mingw*)       OS_ARCH=WINNT ;;
1256         wince*)       OS_ARCH=WINCE ;;
1257         winmo*)       OS_ARCH=WINCE ;;
1258         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1259     esac
1260     case "${target}" in
1261         arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1262     esac
1263 else
1264     OS_TARGET=`uname -s`
1265     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1266     OS_RELEASE=`uname -r`
1269 # Before this used `uname -m` when not cross compiling
1270 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1271 OS_TEST="${target_cpu}"
1273 _COMPILER_PREFIX=
1275 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1277 #######################################################################
1278 # Master "Core Components" macros for getting the OS target           #
1279 #######################################################################
1282 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1283 # cross-compilation.
1287 # Define and override various archtecture-specific variables, including
1288 # HOST_OS_ARCH
1289 # OS_ARCH
1290 # OS_TEST
1291 # OS_TARGET
1292 # OS_RELEASE
1293 # OS_MINOR_RELEASE
1296 case "$HOST_OS_ARCH" in
1297 cygwin*|mingw*|mks*|msvc*)
1298     HOST_OS_ARCH=WINNT
1299     ;;
1300 darwin*)
1301     HOST_OS_ARCH=Darwin
1302     ;;
1303 linux*)
1304     HOST_OS_ARCH=Linux
1305     ;;
1306 solaris*)
1307     HOST_OS_ARCH=SunOS
1308     SOLARIS_SUNPRO_CC=
1309     SOLARIS_SUNPRO_CXX=
1310     if test -z "$GNU_CC"; then
1311         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1312             SOLARIS_SUNPRO_CC=1
1313        fi
1314     fi
1316     if test -z "$GNU_CXX"; then
1317        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1318            SOLARIS_SUNPRO_CXX=1
1319        fi
1320     fi
1321     AC_SUBST(SOLARIS_SUNPRO_CC)
1322     AC_SUBST(SOLARIS_SUNPRO_CXX)
1323     ;;
1324 BSD_386)
1325     HOST_OS_ARCH=BSD
1326     ;;
1327 dgux)
1328     HOST_OS_ARCH=DGUX
1329     ;;
1330 IRIX64)
1331     HOST_OS_ARCH=IRIX
1332     ;;
1333 UNIX_SV)
1334     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1335         HOST_OS_ARCH=NCR
1336     else
1337         HOST_OS_ARCH=UNIXWARE
1338     fi
1339     ;;
1340 ncr)
1341     HOST_OS_ARCH=NCR
1342     ;;
1343 UNIX_SYSTEM_V)
1344     HOST_OS_ARCH=NEC
1345     ;;
1346 OSF1)
1347     ;;
1348 *OpenVMS*)
1349     HOST_OS_ARCH=OpenVMS
1350     ;;
1351 OS_2)
1352     HOST_OS_ARCH=OS2
1353     ;;
1354 QNX)
1355     ;;
1356 SCO_SV)
1357     HOST_OS_ARCH=SCOOS
1358     ;;
1359 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1360     HOST_OS_ARCH=SINIX
1361     ;;
1362 UnixWare)
1363     HOST_OS_ARCH=UNIXWARE
1364     ;;
1365 esac
1367 case "$OS_ARCH" in
1368 WINNT)
1369     if test -z "$CROSS_COMPILE" ; then
1370         OS_TEST=`uname -p`
1371     fi
1372     ;;
1373 Windows_NT)
1375 # If uname -s returns "Windows_NT", we assume that we are using
1376 # the uname.exe in MKS toolkit.
1378 # The -r option of MKS uname only returns the major version number.
1379 # So we need to use its -v option to get the minor version number.
1380 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1382     OS_ARCH=WINNT
1383     OS_TARGET=WINNT
1384     OS_MINOR_RELEASE=`uname -v`
1385     if test "$OS_MINOR_RELEASE" = "00"; then
1386         OS_MINOR_RELEASE=0
1387     fi
1388     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1389     ;;
1390 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1392 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1393 # the uname.exe in the Cygwin tools.
1394 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1395 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1396 # the uname.exe in the GNU-Win32 tools.
1397 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1398 # the uname.exe in the MSYS tools.
1400     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1401     OS_ARCH=WINNT
1402     OS_TARGET=WINNT
1403     ;;
1404 AIX)
1405     OS_RELEASE=`uname -v`.`uname -r`
1406     OS_TEST=${target_cpu}
1407     ;;
1408 BSD_386)
1409     OS_ARCH=BSD
1410     ;;
1411 dgux)
1412     OS_ARCH=DGUX
1413     ;;
1414 IRIX64)
1415     OS_ARCH=IRIX
1416     ;;
1417 UNIX_SV)
1418     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1419         OS_ARCH=NCR
1420     else
1421         OS_ARCH=UNIXWARE
1422         OS_RELEASE=`uname -v`
1423     fi
1424     ;;
1425 ncr)
1426     OS_ARCH=NCR
1427     ;;
1428 UNIX_SYSTEM_V)
1429     OS_ARCH=NEC
1430     ;;
1431 OSF1)
1432     case `uname -v` in
1433     148)
1434         OS_RELEASE=V3.2C
1435         ;;
1436     564)
1437         OS_RELEASE=V4.0B
1438         ;;
1439     878)
1440         OS_RELEASE=V4.0D
1441         ;;
1442     esac
1443     ;;
1444 *OpenVMS*)
1445     OS_ARCH=OpenVMS
1446     OS_RELEASE=`uname -v`
1447     OS_TEST=`uname -p`
1448     ;;
1449 OS_2)
1450     OS_ARCH=OS2
1451     OS_TARGET=OS2
1452     OS_RELEASE=`uname -v`
1453     ;;
1454 QNX)
1455     if test "$OS_TARGET" != "NTO"; then
1456         changequote(,)
1457         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1458         changequote([,])
1459     fi
1460     OS_TEST=x86
1461     ;;
1462 SCO_SV)
1463     OS_ARCH=SCOOS
1464     OS_RELEASE=5.0
1465     ;;
1466 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1467     OS_ARCH=SINIX
1468     OS_TEST=`uname -p`
1469     ;;
1470 UnixWare)
1471     OS_ARCH=UNIXWARE
1472     OS_RELEASE=`uname -v`
1473     ;;
1474 WINCE)
1475     OS_ARCH=WINCE
1476     case "${target_os}" in
1477     *winmo)
1478         OS_TARGET=WINMO
1479         WINCE_WINDOWS_MOBILE=1
1480         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1481         ;;
1482     *)
1483         OS_TARGET=WINCE
1484         ;;
1485     esac
1486     ;;
1487 Darwin)
1488     case "${target_cpu}" in
1489     powerpc*)
1490         OS_TEST=ppc
1491         ;;
1492     i*86*)
1493         OS_TEST=i386 
1494         ;;
1495     x86_64)
1496         OS_TEST=x86_64
1497         ;;
1498     *)
1499         if test -z "$CROSS_COMPILE" ; then
1500             OS_TEST=`uname -p`
1501         fi
1502         ;;
1503     esac
1504     ;;
1505 esac
1507 if test "$OS_ARCH" = "NCR"; then
1508     changequote(,)
1509     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1510     changequote([,])
1513 # Only set CPU_ARCH if we recognize the value of OS_TEST
1515 case "$OS_TEST" in
1516 *86 | i86pc)
1517     CPU_ARCH=x86
1518     ;;
1520 powerpc64 | ppc64)
1521     CPU_ARCH=ppc64
1522     ;;
1524 powerpc | ppc | rs6000)
1525     CPU_ARCH=ppc
1526     ;;
1528 Alpha | alpha | ALPHA)
1529     CPU_ARCH=Alpha
1530     ;;
1532 s390)
1533     CPU_ARCH=s390
1534     ;;
1536 s390x)
1537     CPU_ARCH=s390x
1538     ;;
1540 hppa* | parisc)
1541     CPU_ARCH=hppa
1542     ;;
1544 sun4u | sparc*)
1545     CPU_ARCH=sparc
1546     ;;
1548 x86_64 | ia64)
1549     CPU_ARCH="$OS_TEST"
1550     ;;
1552 arm*)
1553     CPU_ARCH=arm
1554     ;;
1556 mips|mipsel)
1557     CPU_ARCH="mips"
1558     ;;
1559 esac
1561 if test -z "$OS_TARGET"; then
1562     OS_TARGET=$OS_ARCH
1564 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1566 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1567 dnl ===============================================================
1568 INTEL_ARCHITECTURE=
1569 case "$OS_TEST" in
1570     x86_64|i?86)
1571       INTEL_ARCHITECTURE=1
1572 esac
1574 dnl ========================================================
1575 dnl GNU specific defaults
1576 dnl ========================================================
1577 if test "$GNU_CC"; then
1578     # FIXME: Let us build with strict aliasing. bug 414641.
1579     CFLAGS="$CFLAGS -fno-strict-aliasing"
1580     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1581     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1582     DSO_LDOPTS='-shared'
1583     if test "$GCC_USE_GNU_LD"; then
1584         # Don't allow undefined symbols in libraries
1585         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1586     fi
1587     WARNINGS_AS_ERRORS='-Werror'
1588     DSO_CFLAGS=''
1589     DSO_PIC_CFLAGS='-fPIC'
1590     ASFLAGS="$ASFLAGS -fPIC"
1591     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1592     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1593     _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1594     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1596     # Turn on GNU specific features
1597     # -Wall - turn on all warnings
1598     # -pedantic - make compiler warn about non-ANSI stuff, and
1599     #             be a little bit stricter
1600     # Warnings slamm took out for now (these were giving more noise than help):
1601     # -Wbad-function-cast - warns when casting a function to a new return type
1602     # -Wshadow - removed because it generates more noise than help --pete
1603     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1604     if test -z "$INTEL_CC"; then
1605        # Don't use -Wcast-align with ICC
1606        case "$CPU_ARCH" in
1607            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1608            hppa | ia64 | sparc | arm)
1609            ;;
1610            *)
1611         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1612            ;;
1613        esac
1614     fi
1616     dnl Turn pedantic on but disable the warnings for long long
1617     _PEDANTIC=1
1619     if test -z "$INTEL_CC"; then
1620       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1621     fi
1623     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1624     _USE_CPP_INCLUDE_FLAG=1
1625 elif test "$SOLARIS_SUNPRO_CC"; then
1626     DSO_CFLAGS=''
1627     if test "$CPU_ARCH" = "sparc"; then
1628         # for Sun Studio on Solaris/SPARC
1629         DSO_PIC_CFLAGS='-xcode=pic32'
1630     else
1631         DSO_PIC_CFLAGS='-KPIC'
1632     fi
1633     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1634 else
1635     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1636     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1638     DSO_LDOPTS='-shared'
1639     if test "$GNU_LD"; then
1640         # Don't allow undefined symbols in libraries
1641         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1642     fi
1644     DSO_CFLAGS=''
1645     DSO_PIC_CFLAGS='-KPIC'
1646     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1649 if test "$GNU_CXX"; then
1650     # FIXME: Let us build with strict aliasing. bug 414641.
1651     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1652     # Turn on GNU specific features
1653     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1654     if test -z "$INTEL_CC"; then
1655        # Don't use -Wcast-align with ICC
1656        case "$CPU_ARCH" in
1657            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1658            hppa | ia64 | sparc | arm)
1659            ;;
1660            *)
1661         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1662            ;;
1663        esac
1664     fi
1666     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1667     _USE_CPP_INCLUDE_FLAG=1
1669     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1670                    ac_has_wno_invalid_offsetof,
1671         [
1672             AC_LANG_SAVE
1673             AC_LANG_CPLUSPLUS
1674             _SAVE_CXXFLAGS="$CXXFLAGS"
1675             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1676             AC_TRY_COMPILE([],
1677                            [return(0);],
1678                            ac_has_wno_invalid_offsetof="yes",
1679                            ac_has_wno_invalid_offsetof="no")
1680             CXXFLAGS="$_SAVE_CXXFLAGS"
1681             AC_LANG_RESTORE
1682         ])
1683     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1684         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1685     fi
1687     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1688                    ac_has_wno_variadic_macros,
1689         [
1690             AC_LANG_SAVE
1691             AC_LANG_CPLUSPLUS
1692             _SAVE_CXXFLAGS="$CXXFLAGS"
1693             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1694             AC_TRY_COMPILE([],
1695                            [return(0);],
1696                            ac_has_wno_variadic_macros="yes",
1697                            ac_has_wno_variadic_macros="no")
1698             CXXFLAGS="$_SAVE_CXXFLAGS"
1699             AC_LANG_RESTORE
1700         ])
1701     if test "$ac_has_wno_variadic_macros" = "yes"; then
1702         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1703     fi
1705     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1706                    ac_has_werror_return_type,
1707         [
1708             AC_LANG_SAVE
1709             AC_LANG_CPLUSPLUS
1710             _SAVE_CXXFLAGS="$CXXFLAGS"
1711             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1712             AC_TRY_COMPILE([],
1713                            [return(0);],
1714                            ac_has_werror_return_type="yes",
1715                            ac_has_werror_return_type="no")
1716             CXXFLAGS="$_SAVE_CXXFLAGS"
1717             AC_LANG_RESTORE
1718         ])
1719     if test "$ac_has_werror_return_type" = "yes"; then
1720         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1721     fi
1723 else
1724     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1727 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1728 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1729 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1730 dnl normal behavior.
1731 dnl ========================================================
1732 MKSHLIB_FORCE_ALL=
1733 MKSHLIB_UNFORCE_ALL=
1735 if test "$COMPILE_ENVIRONMENT"; then
1736 if test "$GNU_CC"; then
1737   AC_MSG_CHECKING(whether ld has archive extraction flags)
1738   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1739    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1740     ac_cv_mkshlib_force_and_unforce="no"
1741     exec 3<&0 <<LOOP_INPUT
1742         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1743         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1744         force="-Wl,-all";              unforce="-Wl,-none"
1745 LOOP_INPUT
1746     while read line
1747     do
1748       eval $line
1749       LDFLAGS=$force
1750       LIBS=$unforce
1751       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1752     done
1753     exec 0<&3 3<&-
1754     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1755    ])
1756   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1757     AC_MSG_RESULT(no)
1758   else
1759     AC_MSG_RESULT(yes)
1760     eval $ac_cv_mkshlib_force_and_unforce
1761     MKSHLIB_FORCE_ALL=$force
1762     MKSHLIB_UNFORCE_ALL=$unforce
1763   fi
1764 fi # GNU_CC
1765 fi # COMPILE_ENVIRONMENT
1767 dnl =================================================================
1768 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1769 dnl which is bad when cross compiling.
1770 dnl =================================================================
1771 if test "$COMPILE_ENVIRONMENT"; then
1772 configure_static_assert_macros='
1773 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1774 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1775 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1778 dnl test that the macros actually work:
1779 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1780 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1781  [AC_LANG_SAVE
1782   AC_LANG_C
1783   ac_cv_static_assertion_macros_work="yes"
1784   AC_TRY_COMPILE([$configure_static_assert_macros],
1785                  [CONFIGURE_STATIC_ASSERT(1)],
1786                  ,
1787                  ac_cv_static_assertion_macros_work="no")
1788   AC_TRY_COMPILE([$configure_static_assert_macros],
1789                  [CONFIGURE_STATIC_ASSERT(0)],
1790                  ac_cv_static_assertion_macros_work="no",
1791                  )
1792   AC_LANG_CPLUSPLUS
1793   AC_TRY_COMPILE([$configure_static_assert_macros],
1794                  [CONFIGURE_STATIC_ASSERT(1)],
1795                  ,
1796                  ac_cv_static_assertion_macros_work="no")
1797   AC_TRY_COMPILE([$configure_static_assert_macros],
1798                  [CONFIGURE_STATIC_ASSERT(0)],
1799                  ac_cv_static_assertion_macros_work="no",
1800                  )
1801   AC_LANG_RESTORE
1802  ])
1803 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1804 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1805     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1807 fi # COMPILE_ENVIRONMENT
1809 dnl ========================================================
1810 dnl Checking for 64-bit OS
1811 dnl ========================================================
1812 if test "$COMPILE_ENVIRONMENT"; then
1813 AC_LANG_SAVE
1814 AC_LANG_C
1815 AC_MSG_CHECKING(for 64-bit OS)
1816 AC_TRY_COMPILE([$configure_static_assert_macros],
1817                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1818                result="yes", result="no")
1819 AC_MSG_RESULT("$result")
1820 if test "$result" = "yes"; then
1821     AC_DEFINE(HAVE_64BIT_OS)
1822     HAVE_64BIT_OS=1
1824 AC_SUBST(HAVE_64BIT_OS)
1825 AC_LANG_RESTORE
1826 fi # COMPILE_ENVIRONMENT
1828 dnl ========================================================
1829 dnl Enable high-memory support on OS/2 by default.
1830 dnl ========================================================
1831 MOZ_OS2_HIGH_MEMORY=1
1832 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1833 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1834     MOZ_OS2_HIGH_MEMORY=,
1835     MOZ_OS2_HIGH_MEMORY=1 )
1836 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1838 dnl ========================================================
1839 dnl = Use profiling compile flags
1840 dnl ========================================================
1841 MOZ_ARG_ENABLE_BOOL(profiling,
1842 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1843     MOZ_PROFILING=1,
1844     MOZ_PROFILING= )
1846 dnl ========================================================
1847 dnl System overrides of the defaults for host
1848 dnl ========================================================
1849 case "$host" in
1850 *-beos*)
1851     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1852     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1853     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1854     ;;
1856 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1857     if test -n "$_WIN32_MSVC"; then
1858         HOST_AR=lib
1859         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1860         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1861         HOST_RANLIB='echo ranlib'
1862     else
1863         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1864     fi
1865     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1866     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1867     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1868     HOST_BIN_SUFFIX=.exe
1869     case "$host" in
1870     *mingw*)
1871     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1872         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1873         ;;
1874     *)
1875         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1876         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1877             _pwd=`pwd`
1878             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1879         fi
1880         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1881             AS_PERL=1
1882             PERL="${CYGWIN_WRAPPER} $PERL"
1883         fi
1885         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1886             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1887         fi
1888         ;;
1889     esac
1891     case "${host_cpu}" in
1892     x86_64)
1893         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1894         ;;
1895     esac
1896     ;;
1898 *-darwin*)
1899     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1900     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1901     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1902     ;;
1904 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1905     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1906     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1907     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1908     ;;
1910 *os2*)
1911     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1912     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1913     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1914     HOST_BIN_SUFFIX=.exe
1915     MOZ_FIX_LINK_PATHS=
1916     ;;
1918 *-osf*)
1919     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1920     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1921     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1922     ;;
1925     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1926     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1927     ;;
1928 esac
1930 dnl We require version 2.5 or newer of Python to build.
1931 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1932 changequote(,)
1933 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1934 _python_res=$?
1935 changequote([,])
1936 if test "$_python_res" != 0; then
1937     AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1939 AC_MSG_RESULT([yes])
1941 dnl Get mozilla version from central milestone file
1942 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1944 dnl Get version of various core apps from the version files.
1945 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1947 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1948 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1950 dnl ========================================================
1951 dnl System overrides of the defaults for target
1952 dnl ========================================================
1954 case "$target" in
1955 *-aix*)
1956     AC_DEFINE(AIX)
1957     if test ! "$GNU_CC"; then
1958         if test ! "$HAVE_64BIT_OS"; then
1959             # Compiling with Visual Age C++ object model compat is the
1960             # default. To compile with object model ibm, add 
1961             # AIX_OBJMODEL=ibm to .mozconfig.
1962             if test "$AIX_OBJMODEL" = "ibm"; then
1963                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1964             else
1965                 AIX_OBJMODEL=compat
1966             fi
1967         else
1968             AIX_OBJMODEL=compat
1969         fi
1970         AC_SUBST(AIX_OBJMODEL)
1971         DSO_LDOPTS='-qmkshrobj=1'
1972         DSO_CFLAGS='-qflag=w:w'
1973         DSO_PIC_CFLAGS=
1974         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1975         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1976         MOZ_FIX_LINK_PATHS=
1977         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1978         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1979         if test "$COMPILE_ENVIRONMENT"; then
1980             AC_LANG_SAVE
1981             AC_LANG_CPLUSPLUS
1982             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1983             AC_TRY_COMPILE([],
1984                 [#if (__IBMCPP__ < 600)
1985                  #error "Bad compiler"
1986                  #endif],
1987                 _BAD_COMPILER=,_BAD_COMPILER=1)
1988             if test -n "$_BAD_COMPILER"; then
1989                 AC_MSG_RESULT([no])    
1990                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1991             else
1992                 AC_MSG_RESULT([yes])    
1993             fi
1994             AC_LANG_RESTORE
1995             TARGET_COMPILER_ABI="ibmc"
1996             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1997             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1998         fi
1999     fi
2000     case "${target_os}" in
2001     aix4.1*)
2002         DLL_SUFFIX='_shr.a'
2003         ;;
2004     esac
2005     if test "$COMPILE_ENVIRONMENT"; then
2006         AC_CHECK_HEADERS(sys/inttypes.h)
2007     fi
2008     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2009     ;;
2011 *-beos*)
2012     no_x=yes
2013     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
2014     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
2015     DSO_LDOPTS='-nostart'
2016     TK_LIBS='-lbe -lroot'
2017     LIBS="$LIBS -lbe"
2018     if test "$COMPILE_ENVIRONMENT"; then
2019         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
2020         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
2021     fi
2022     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
2023     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
2024     _MOZ_USE_RTTI=1
2025     USE_DEPENDENT_LIBS=
2026     MOZ_USER_DIR="Mozilla"
2027     ;;
2029 *-bsdi*)
2030     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2031     _PEDANTIC=
2032     case $OS_RELEASE in
2033         4.*|5.*)
2034             STRIP="$STRIP -d"
2035             ;;
2036         *)
2037             DSO_CFLAGS=''
2038             DSO_LDOPTS='-r'
2039             _WARNINGS_CFLAGS="-Wall"
2040             _WARNINGS_CXXFLAGS="-Wall"
2041             # The test above doesn't work properly, at least on 3.1.
2042             MKSHLIB_FORCE_ALL=''
2043             MKSHLIB_UNFORCE_ALL=''
2044         ;;
2045     esac
2046     ;;
2048 *-darwin*) 
2049     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2050     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2051     # If we're building with --enable-profiling, we need a frame pointer.
2052     if test -z "$MOZ_PROFILING"; then
2053         MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
2054     else
2055         MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
2056     fi
2057     _PEDANTIC=
2058     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2059     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2060     DLL_SUFFIX=".dylib"
2061     DSO_LDOPTS=''
2062     STRIP="$STRIP -x -S"
2063     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2064     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2065     # The ExceptionHandling framework is needed for Objective-C exception
2066     # logging code in nsObjCExceptions.h. Currently we only use that in debug
2067     # builds.
2068     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2070     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2071     dnl ===================================================================
2072     if test "x$enable_dtrace" = "xyes"; then
2073         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2074     else
2075         dnl check for the presence of the -dead_strip linker flag
2076         AC_MSG_CHECKING([for -dead_strip option to ld])
2077         _SAVE_LDFLAGS=$LDFLAGS
2078         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2079         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2080         if test -n "$_HAVE_DEAD_STRIP" ; then
2081             AC_MSG_RESULT([yes])
2082             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2083         else
2084             AC_MSG_RESULT([no])
2085         fi
2086         
2087         LDFLAGS=$_SAVE_LDFLAGS
2088     fi
2089     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2090     ;;
2092 *-freebsd*)
2093     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2094         DLL_SUFFIX=".so.1.0"
2095         DSO_LDOPTS="-shared"
2096     fi
2097     if test ! "$GNU_CC"; then
2098         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2099     fi
2100     ;; 
2102 ia64*-hpux*)
2103     DLL_SUFFIX=".so"
2104     if test ! "$GNU_CC"; then
2105        DSO_LDOPTS='-b'
2106        DSO_CFLAGS=""
2107        DSO_PIC_CFLAGS=
2108        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2109        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2110        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2111     else
2112        DSO_LDOPTS='-b -E'
2113        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2114        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2115     fi
2116     MOZ_FIX_LINK_PATHS=
2117     SYSTEM_MAKEDEPEND=
2118     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2119     AC_DEFINE(_LARGEFILE64_SOURCE)
2120     ;;
2122 *-hpux*)
2123     DLL_SUFFIX=".sl"
2124     if test ! "$GNU_CC"; then
2125         DSO_LDOPTS='-b -Wl,+s'
2126         DSO_CFLAGS=""
2127         DSO_PIC_CFLAGS="+Z"
2128         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2129         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2130         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2131     else
2132         DSO_LDOPTS='-b -E +s'
2133         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2134         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2135     fi
2136     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2137     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2138     ;;
2140 *-irix5*)
2141     AC_DEFINE(IRIX)
2142     DSO_LDOPTS='-elf -shared'
2144     if test "$GNU_CC"; then
2145        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2146        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2147        MKSHLIB_FORCE_ALL='-Wl,-all'
2148        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2149        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2150     else
2151        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2152        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2153        MKSHLIB_FORCE_ALL='-all'
2154        MKSHLIB_UNFORCE_ALL='-none'
2155     fi
2156     ;;
2158 *-irix6*)
2159     AC_DEFINE(IRIX)
2160     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2161     dnl compile and link using -n32
2162     USE_N32=1
2163     TARGET_COMPILER_ABI=n32
2164     DSO_LDOPTS='-elf -shared'
2165     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2166     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2167     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2168     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2169     if test "$GNU_CC"; then
2170        MKSHLIB_FORCE_ALL='-Wl,-all'
2171        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2172        _WARNINGS_CFLAGS="-Wall"
2173        _WARNINGS_CXXFLAGS="-Wall"
2174        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2175     else
2176        MKSHLIB_FORCE_ALL='-all'
2177        MKSHLIB_UNFORCE_ALL='-none'
2178            AR_LIST="$AR t"
2179            AR_EXTRACT="$AR x"
2180            AR_DELETE="$AR d"
2181            AR='$(CXX) -ar'
2182            AR_FLAGS='-o $@'
2183        CFLAGS="$CFLAGS -woff 3262 -G 4"
2184        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2185        if test -n "$USE_N32"; then
2186            ASFLAGS="$ASFLAGS -n32"
2187            CFLAGS="$CFLAGS -n32"
2188            CXXFLAGS="$CXXFLAGS -n32"
2189            LDFLAGS="$LDFLAGS -n32"
2190        fi
2191        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2192        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2193        MOZ_FIX_LINK_PATHS=
2194     fi
2195     if test -z "$GNU_CXX"; then
2196       MIPSPRO_CXX=1
2197     fi
2198     ;;
2200 *-*linux*)
2201     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2202     # Similarly for GNU_CXX and INTEL_CXX.
2203     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2204         # -Os has been broken on Intel's C/C++ compilers for quite a
2205         # while; Intel recommends against using it.
2206         MOZ_OPTIMIZE_FLAGS="-O2"
2207         MOZ_DEBUG_FLAGS="-g"
2208     elif test "$GNU_CC" -o "$GNU_CXX"; then
2209         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2210         case $GCC_VERSION in
2211         4.1.*|4.2.*|4.5.*)
2212             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2213             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2214         esac
2215         # If we're building with --enable-profiling, we need a frame pointer.
2216         if test -z "$MOZ_PROFILING"; then
2217             MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2218         else
2219             MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-omit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2220         fi
2221         MOZ_DEBUG_FLAGS="-g"
2222     fi
2224     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2226     MOZ_MEMORY=1
2228     case "${target_cpu}" in
2229     alpha*)
2230         CFLAGS="$CFLAGS -mieee"
2231         CXXFLAGS="$CXXFLAGS -mieee"
2232     ;;
2233     i*86)
2234         USE_ELF_DYNSTR_GC=1
2235     ;;
2236     mips*)
2237         MOZ_DEBUG_FLAGS="-g" # We want inlining
2238     ;;
2239     esac
2240     ;;
2242 *-wince*|*-winmo*)
2243     TARGET_COMPILER_ABI=msvc
2244     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2245     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2246     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2247     AR_LIST="$AR -list"
2248     AR_EXTRACT="$AR -extract"
2249     AR_DELETE="$AR d"
2250     AR_FLAGS='-OUT:"$@"'
2251     MOZ_MEMORY=1
2252     NSS_DISABLE_DBM=1
2253     MOZ_OGG=
2254     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2256     if test "$AS_BIN"; then
2257         AS="$AS_BIN"
2258     fi
2259     DSO_CFLAGS=
2260     DSO_PIC_CFLAGS=
2261     DLL_SUFFIX=.dll
2262     BIN_SUFFIX='.exe'
2263     if test -z "$RC"; then 
2264         RC=rc.exe  
2265     fi
2266     # certain versions of cygwin's makedepend barf on the 
2267     # #include <string> vs -I./dist/include/string issue so don't use it
2268     SYSTEM_MAKEDEPEND=
2270     HOST_CC=cl
2271     HOST_CXX=cl
2272     HOST_LD=link
2273     HOST_AR='lib -OUT:$@'
2274     HOST_RANLIB='echo ranlib'
2275     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2276         
2277         
2278     WARNINGS_AS_ERRORS='-WX'
2279     MOZ_OPTIMIZE_FLAGS='-Ox'
2280     AR_FLAGS='-NOLOGO -OUT:"$@"'
2281     ASM_SUFFIX=asm
2282     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2283     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2284     DLL_PREFIX=
2285     DOXYGEN=:
2286     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2287     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2288     GARBAGE=
2289     IMPORT_LIB_SUFFIX=lib
2290     dnl Need to force-link against mozalloc because it's used in the shunt
2291     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2292     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2293     LIB_PREFIX=
2294     LIB_SUFFIX=lib 
2295     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2296     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2297     MKSHLIB_FORCE_ALL=
2298     MKSHLIB_UNFORCE_ALL=
2299     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2300     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2301     MOZ_DEBUG_FLAGS='-Zi'
2302     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2303     MOZ_FIX_LINK_PATHS=
2304     MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2305     MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2306     OBJ_SUFFIX=obj
2307     RANLIB='echo not_ranlib'
2308     STRIP='echo not_strip'
2309     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2310     UNZIP=unzip
2311     XARGS=xargs
2312     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2313     ZIP=zip
2314     MOZ_TREE_FREETYPE=1
2316     AC_DEFINE(HAVE_SNPRINTF)
2317     AC_DEFINE(_WINDOWS)
2318     AC_DEFINE(WIN32)
2319     AC_DEFINE(XP_WIN)
2320     AC_DEFINE(XP_WIN32)
2321     AC_DEFINE(HW_THREADS)
2322     AC_DEFINE(STDC_HEADERS)
2323     AC_DEFINE(NEW_H, <new>)
2324     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2325     AC_DEFINE(HAVE_LOCALTIME_R)
2327     TARGET_MD_ARCH=win32
2328     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2329     BIN_SUFFIX='.exe'
2330     MOZ_USER_DIR="Mozilla"
2332     MOZ_GFX_OPTIMIZE_MOBILE=1
2334     # Sanity check for WINCE_WINDOWS_MOBILE
2335     # XXX disabled until we can fix the mobile tinderbox
2336     ##if test "$WINCE_WINDOWS_MOBILE"; then
2337     ##   AC_CHECK_HEADER(tpcshell.h, [],
2338     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2339     ##fi
2343 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2344     DSO_CFLAGS=
2345     DSO_PIC_CFLAGS=
2346     DLL_SUFFIX=.dll
2347     RC=rc.exe
2348     # certain versions of cygwin's makedepend barf on the 
2349     # #include <string> vs -I./dist/include/string issue so don't use it
2350     SYSTEM_MAKEDEPEND=
2351     if test -n "$GNU_CC"; then
2352         CC="$CC -mno-cygwin"
2353         CXX="$CXX -mno-cygwin"
2354         CPP="$CPP -mno-cygwin"
2355         CFLAGS="$CFLAGS -mms-bitfields"
2356         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2357         DSO_LDOPTS='-shared'
2358         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2359         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2360         RC='$(WINDRES)'
2361         # Use temp file for windres (bug 213281)
2362         RCFLAGS='-O coff --use-temp-file'
2363         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2364         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2365         MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
2366         MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
2367         MOZ_FIX_LINK_PATHS=
2368         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2369         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2370         DLL_PREFIX=
2371         IMPORT_LIB_SUFFIX=dll.a
2372         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2373     else
2374         TARGET_COMPILER_ABI=msvc
2375         HOST_CC='$(CC)'
2376         HOST_CXX='$(CXX)'
2377         HOST_LD='$(LD)'
2378         if test "$AS_BIN"; then
2379             AS="$(basename "$AS_BIN")"
2380         fi
2381         AR='lib -NOLOGO -OUT:"$@"'
2382         AR_FLAGS=
2383         RANLIB='echo not_ranlib'
2384         STRIP='echo not_strip'
2385         PKG_SKIP_STRIP=1
2386         XARGS=xargs
2387         ZIP=zip
2388         UNZIP=unzip
2389         DOXYGEN=:
2390         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2391         ASM_SUFFIX=asm
2392         OBJ_SUFFIX=obj
2393         LIB_SUFFIX=lib
2394         DLL_PREFIX=
2395         LIB_PREFIX=
2396         IMPORT_LIB_SUFFIX=lib
2397         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2398         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2399         MKSHLIB_FORCE_ALL=
2400         MKSHLIB_UNFORCE_ALL=
2401         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2402         _USE_CPP_INCLUDE_FLAG=1
2403         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2404         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2405         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2406         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2407         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2408         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2409         MOZ_DEBUG_FLAGS='-Zi'
2410         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2411         WARNINGS_AS_ERRORS='-WX'
2412         # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
2413         if test -z "$MOZ_PROFILING"; then
2414             MOZ_OPTIMIZE_FLAGS='-O1'
2415         else
2416             MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
2417         fi
2418         MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2419         MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2420         MOZ_FIX_LINK_PATHS=
2421         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2422         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2423         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2424         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2425         if test $_MSC_VER -ge 1400; then
2426             LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2427             dnl For profile-guided optimization
2428             PROFILE_GEN_CFLAGS="-GL"
2429             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2430             dnl XXX: PGO builds can fail with warnings treated as errors,
2431             dnl specifically "no profile data available" appears to be
2432             dnl treated as an error sometimes. This might be a consequence
2433             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2434             dnl with the linker doing most of the work in the whole-program
2435             dnl optimization/PGO case. I think it's probably a compiler bug,
2436             dnl but we work around it here.
2437             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2438             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2439             dnl Probably also a compiler bug, but what can you do?
2440             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2441             LDFLAGS="$LDFLAGS -DYNAMICBASE"
2442         fi
2443     fi
2444     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2445     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2446     AC_DEFINE(HAVE_SNPRINTF)
2447     AC_DEFINE(_WINDOWS)
2448     AC_DEFINE(WIN32)
2449     AC_DEFINE(XP_WIN)
2450     AC_DEFINE(XP_WIN32)
2451     AC_DEFINE(HW_THREADS)
2452     AC_DEFINE(STDC_HEADERS)
2453     AC_DEFINE(NEW_H, <new>)
2454     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2455     TARGET_MD_ARCH=win32
2456     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2457     BIN_SUFFIX='.exe'
2458     MOZ_USER_DIR="Mozilla"
2460     dnl Hardcode to win95 for now - cls
2461     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2463     dnl set NO_X11 defines here as the general check is skipped on win32
2464     no_x=yes
2465     AC_DEFINE(NO_X11)
2467     dnl MinGW/MSYS doesn't provide or need cygpath
2468     case "$host" in
2469     *-mingw*)
2470         CYGPATH_W=echo
2471         CYGPATH_S=cat
2472         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2473         ;;
2474     *-cygwin*|*-msvc*|*-mks*)
2475         CYGPATH_W="cygpath -a -w"
2476         CYGPATH_S="sed -e s|\\\\|/|g"
2477         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2478         ;;
2479     esac
2480     case "$host" in
2481     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2483     if test -z "$MOZ_TOOLS"; then
2484         AC_MSG_ERROR([MOZ_TOOLS is not set])
2485     fi
2487     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2488     if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2489         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2490     fi
2491     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2492     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2493         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2494     fi
2495     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2496     ;;
2497     esac 
2500     case "$host_os" in
2501     cygwin*|msvc*|mks*)
2502         AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
2503         ;;
2505     *)
2506         AC_CHECK_HEADERS(oleacc.idl)
2508         AC_LANG_SAVE
2509         AC_LANG_CPLUSPLUS
2510         AC_CHECK_HEADERS(atlbase.h)
2511         AC_LANG_RESTORE
2512         ;;
2513     esac
2515     case "$target" in
2516     i*86-*)
2517         if test "$HAVE_64BIT_OS"; then
2518             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2519         fi
2521         if test $_MSC_VER -ge 1400; then
2522             LDFLAGS="$LDFLAGS -SAFESEH"
2523         fi
2524         AC_CHECK_HEADERS(mmintrin.h)
2525         AC_DEFINE(_X86_)
2526         ;;
2527     alpha-*)
2528         AC_DEFINE(_ALPHA_)
2529         ;;
2530     mips-*)
2531         AC_DEFINE(_MIPS_)
2532         ;;
2533     x86_64-*)
2534         AC_DEFINE(_AMD64_)
2535         ;;
2536     *)
2537         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2538         ;;
2539     esac
2541     if test "$HAVE_64BIT_OS"; then
2542         AC_DEFINE(_WIN64)
2543     fi
2544     ;;
2546 *-netbsd*)
2547     DSO_CFLAGS=''
2548     CFLAGS="$CFLAGS -Dunix"
2549     CXXFLAGS="$CXXFLAGS -Dunix"
2550     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2551         DLL_SUFFIX=".so"
2552         DSO_PIC_CFLAGS='-fPIC -DPIC'
2553         DSO_LDOPTS='-shared'
2554         BIN_FLAGS='-Wl,--export-dynamic'
2555     else
2556         DSO_PIC_CFLAGS='-fPIC -DPIC'
2557         DLL_SUFFIX=".so.1.0"
2558         DSO_LDOPTS='-shared'
2559     fi
2560     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2561     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2562     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2563     if test "$LIBRUNPATH"; then
2564         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2565     fi
2566     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2567     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2568     ;;
2570 *-nto*) 
2571         AC_DEFINE(NTO)  
2572         AC_DEFINE(_QNX_SOURCE)
2573         AC_DEFINE(_i386)
2574         OS_TARGET=NTO
2575         WARNINGS_AS_ERRORS=''
2576         MOZ_OPTIMIZE_FLAGS="-O"
2577         MOZ_DEBUG_FLAGS="-gstabs"
2578         USE_PTHREADS=1
2579         _PEDANTIC=
2580         LIBS="$LIBS -lsocket -lstdc++"
2581         _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2582         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2583         if test "$with_x" != "yes"
2584         then
2585                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2586             TK_CFLAGS='-I/usr/include/photon'
2587                 TK_LIBS='-lph'
2588         fi
2589         case "${target_cpu}" in
2590         ppc*)
2591         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2592         ;;
2593         esac
2594         case "${host_cpu}" in
2595         i*86)
2596         USE_ELF_DYNSTR_GC=1
2597         ;;
2598         esac
2599         ;;
2601 *-openbsd*)
2602     DLL_SUFFIX=".so.1.0"
2603     DSO_CFLAGS=''
2604     DSO_PIC_CFLAGS='-fPIC'
2605     DSO_LDOPTS='-shared -fPIC'
2606     if test "$LIBRUNPATH"; then
2607         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2608     fi
2609     ;;
2611 *-openvms*) 
2612     AC_DEFINE(NO_PW_GECOS)
2613     AC_DEFINE(NO_UDSOCK)
2614     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2615     USE_PTHREADS=1
2616     MKSHLIB_FORCE_ALL='-all'
2617     MKSHLIB_UNFORCE_ALL='-none'
2618     AS='as'
2619     AS_DASH_C_FLAG='-Wc/names=as_is'
2620     AR_FLAGS='c $@'
2621     DSO_LDOPTS='-shared -auto_symvec'
2622     DSO_PIC_CFLAGS=
2623     MOZ_DEBUG_LDFLAGS='-g'
2624     COMPAQ_CXX=1
2625     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2626     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2627     ;;
2630 *-os2*)
2631     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2632     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2633     AC_DEFINE(OS2)
2634     AC_DEFINE(XP_OS2)
2635     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2636     AC_DEFINE(TCPV40HDRS)
2637     DLL_PREFIX=
2638     LIB_PREFIX=
2639     LIB_SUFFIX=lib
2640     BIN_SUFFIX=".exe"
2641     DLL_SUFFIX=".dll"
2642     IMPORT_LIB_SUFFIX=lib
2643     DSO_PIC_CFLAGS=
2644     AR=emxomfar
2645     AR_FLAGS='r $@'
2646     CFLAGS="$CFLAGS -Zomf"
2647     CXXFLAGS="$CXXFLAGS -Zomf"
2648     DSO_LDOPTS='-Zdll'
2649     BIN_FLAGS='-Zlinker /ST:0x100000'
2650     IMPLIB='emximp -o'
2651     FILTER='true'
2652     LDFLAGS='-Zmap'
2653     WARNINGS_AS_ERRORS='-Werror'
2654     MOZ_DEBUG_FLAGS="-g -fno-inline"
2655     MOZ_OPTIMIZE_FLAGS="-O2"
2656     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2657     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2658     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2659     TARGET_MD_ARCH=os2
2660     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2661     RC=rc.exe
2662     RCFLAGS='-n'
2663     MOZ_USER_DIR="Mozilla"
2665     if test "$MOZTOOLS"; then
2666         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2667     else
2668         AC_MSG_ERROR([MOZTOOLS is not set])
2669     fi
2670     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2671         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2672         LDFLAGS="$LDFLAGS -Zhigh-mem"
2673         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2674         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2675     fi
2677     # GCC for OS/2 currently predefines these, but we don't want them
2678     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2679     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2681     AC_CACHE_CHECK(for __declspec(dllexport),
2682         ac_os2_declspec,
2683         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2684                         [return 0;],
2685                         ac_os2_declspec="yes",
2686                         ac_os2_declspec="no")])
2687     if test "$ac_os2_declspec" != "yes"; then
2688         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2689     fi
2690     ;;
2692 alpha*-*-osf*)
2693     if test "$GNU_CC"; then
2694       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2695       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2697     else
2698         MOZ_DEBUG_FLAGS='-g'
2699         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2700         CFLAGS="$CFLAGS -ieee"
2701         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2702         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2703         DSO_CFLAGS=
2704         DSO_PIC_CFLAGS=
2705         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2706         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2707         MKSHLIB_FORCE_ALL='-all'
2708         MKSHLIB_UNFORCE_ALL='-none'
2709         dnl Might fix the libxpcom.so breakage on this platform as well....
2710         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2711         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2712     fi
2713     if test -z "$GNU_CXX"; then
2714       COMPAQ_CXX=1
2715     fi
2716     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2717     ;;
2719 *-qnx*) 
2720     DIRENT_INO=d_stat.st_ino
2721     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2722     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2723     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2724     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2725     AC_DEFINE(STDC_HEADERS)
2726     if test "$no_x" = "yes"; then
2727             _PLATFORM_DEFAULT_TOOLKIT='photon'
2728             TK_CFLAGS='-I/usr/nto/include/photon'
2729             TK_LIBS='-lphoton -lphrender'
2730     fi
2731     ;;
2733 *-sco*) 
2734     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2735     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2736     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2737     if test ! "$GNU_CC"; then
2738        DSO_LDOPTS='-G'
2739     fi
2740     ;;
2742 *-solaris*) 
2743     AC_DEFINE(SOLARIS)
2744     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2745     SYSTEM_MAKEDEPEND=
2746     MOZ_FIX_LINK_PATHS=
2747     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2748     # libraries one level up (e.g. libnspr4.so)
2749     if test "$SOLARIS_SUNPRO_CC"; then
2750        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2751        LIBS="-lCrun -lCstd -lc $LIBS"
2752        NS_USE_NATIVE=1
2753        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2754        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2755        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2756        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2757        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2758        LDFLAGS="-xildoff $LDFLAGS"
2759        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2760            _SAVE_LDFLAGS=$LDFLAGS
2761            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2762            AC_TRY_LINK([#include <stdio.h>],
2763                        [printf("Hello World\n");],
2764                        ,
2765                        [LDFLAGS=$_SAVE_LDFLAGS])
2766        fi
2767        WARNINGS_AS_ERRORS='-Werror'
2768        MOZ_OPTIMIZE_FLAGS="-xO4"
2769        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2770        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2771        MKSHLIB_FORCE_ALL='-z allextract'
2772        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2773        DSO_LDOPTS='-G'
2774        AR_LIST="$AR t"
2775        AR_EXTRACT="$AR x"
2776        AR_DELETE="$AR d"
2777        AR='$(CXX) -xar'
2778        AR_FLAGS='-o $@'
2779        AS='/usr/ccs/bin/as'
2780        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2781        AS_DASH_C_FLAG=''
2782        TARGET_COMPILER_ABI="sunc"
2783        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2784        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2785        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2786        AC_LANG_SAVE
2787        AC_LANG_CPLUSPLUS
2788        AC_TRY_COMPILE([],
2789            [#if (__SUNPRO_CC < 0x590)
2790            #error "Denied"
2791            #endif],
2792            _BAD_COMPILER=,_BAD_COMPILER=1)
2793        if test -n "$_BAD_COMPILER"; then
2794            _res="no"
2795            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2796        else
2797            _res="yes"
2798        fi
2799        AC_TRY_COMPILE([],
2800            [#if (__SUNPRO_CC >= 0x5100)
2801            #error "Sun C++ 5.10 or above"
2802            #endif],
2803            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2804        if test "$_ABOVE_SS12U1"; then
2805            # disable xannotate
2806            CXXFLAGS="$CXXFLAGS -xannotate=no"
2807        fi
2808        AC_MSG_RESULT([$_res])
2809        AC_LANG_RESTORE
2810     else
2811        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2812        LIBS="-lc $LIBS"
2813        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2814        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2815        ASFLAGS="$ASFLAGS -fPIC"
2816        DSO_LDOPTS='-shared'
2817        _WARNINGS_CFLAGS=''
2818        _WARNINGS_CXXFLAGS=''
2819        if test "$OS_RELEASE" = "5.3"; then
2820            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2821        fi
2822     fi
2823     if test "$OS_RELEASE" = "5.5.1"; then
2824         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2825     fi
2826     ;;
2828 *-sunos*) 
2829     DSO_LDOPTS='-Bdynamic'
2830     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2831     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2832     AC_DEFINE(SUNOS4)
2833     AC_DEFINE(SPRINTF_RETURNS_STRING)
2834     case "$(target_os)" in
2835     sunos4.1*)
2836         DLL_SUFFIX='.so.1.0'
2837         ;;
2838     esac
2839     ;;
2841 *-sysv4.2uw7*) 
2842         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2843     ;;
2845 *-os2*)
2846     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2847     ;;
2849 *-android*)
2850     AC_DEFINE(NO_PW_GECOS)
2851     no_x=yes
2852     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2853     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2855     MOZ_GFX_OPTIMIZE_MOBILE=1
2856     # If we're building with --enable-profiling, we need a frame pointer.
2857     if test -z "$MOZ_PROFILING"; then
2858         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2859     else
2860         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
2861     fi
2862     ;;
2864 esac
2866 dnl Only one oddball right now (QNX), but this gives us flexibility
2867 dnl if any other platforms need to override this in the future.
2868 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2870 dnl ========================================================
2871 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2872 dnl by now will not have any way to link most binaries (tests
2873 dnl as well as viewer, apprunner, etc.), because some symbols
2874 dnl will be left out of the "composite" .so's by ld as unneeded.
2875 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2876 dnl they can link in the static libs that provide the missing
2877 dnl symbols.
2878 dnl ========================================================
2879 NO_LD_ARCHIVE_FLAGS=
2880 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2881     NO_LD_ARCHIVE_FLAGS=1
2883 case "$target" in
2884 *-os2*)
2885     NO_LD_ARCHIVE_FLAGS=
2886     ;;
2887 *-aix4.3*|*-aix5*)
2888     NO_LD_ARCHIVE_FLAGS=
2889     ;;
2890 *-openvms*)
2891     NO_LD_ARCHIVE_FLAGS=
2892     ;;
2893 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2894     if test -z "$GNU_CC"; then
2895         NO_LD_ARCHIVE_FLAGS=
2896     fi
2897     ;;
2898 esac
2899 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2901 dnl ========================================================
2902 dnl = Flags to strip unused symbols from .so components and
2903 dnl = to export jemalloc symbols when linking a program
2904 dnl ========================================================
2905 case "$target" in
2906     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2907         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2908         MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS='-rdynamic -Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/jemalloc-standalone-linkage-version-script'
2909         ;;
2910     *-solaris*)
2911         if test -z "$GNU_CC"; then
2912          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2913         else
2914          if test -z "$GCC_USE_GNU_LD"; then
2915           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2916          else
2917           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2918          fi
2919         fi
2920         ;;
2921     *-nto*) 
2922         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2923         ;;
2924     *-darwin*)
2925         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2926         ;;
2927     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2928         if test -n "$GNU_CC"; then
2929            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2930         fi
2931         ;;
2932 esac
2934 if test -z "$COMPILE_ENVIRONMENT"; then
2935     SKIP_COMPILER_CHECKS=1
2936     SKIP_LIBRARY_CHECKS=1
2939 if test -z "$SKIP_COMPILER_CHECKS"; then
2940 dnl Checks for typedefs, structures, and compiler characteristics.
2941 dnl ========================================================
2942 AC_HEADER_STDC
2943 AC_C_CONST
2944 AC_TYPE_MODE_T
2945 AC_TYPE_OFF_T
2946 AC_TYPE_PID_T
2947 AC_TYPE_SIZE_T
2948 AC_LANG_CPLUSPLUS
2949 AC_MSG_CHECKING(for __stdcall)
2950 AC_CACHE_VAL(ac_cv___stdcall,
2951  [AC_TRY_COMPILE([template <typename Method> struct foo;
2952                   template <> struct foo<void (*)()> {};
2953                   template <> struct foo<void (__stdcall*)()> {};],
2954                  [],
2955                  [ac_cv___stdcall=true],
2956                  [ac_cv___stdcall=false])])
2957 if test "$ac_cv___stdcall" = true ; then
2958   AC_DEFINE(HAVE_STDCALL)
2959   AC_MSG_RESULT(yes)
2960 else
2961   AC_MSG_RESULT(no)
2963 AC_LANG_C
2964 AC_MSG_CHECKING(for ssize_t)
2965 AC_CACHE_VAL(ac_cv_type_ssize_t,
2966  [AC_TRY_COMPILE([#include <stdio.h>
2967                   #include <sys/types.h>],
2968                  [ssize_t foo = 0;],
2969                  [ac_cv_type_ssize_t=true],
2970                  [ac_cv_type_ssize_t=false])])
2971 if test "$ac_cv_type_ssize_t" = true ; then
2972   AC_DEFINE(HAVE_SSIZE_T)
2973   AC_MSG_RESULT(yes)
2974 else
2975   AC_MSG_RESULT(no)
2977 AC_STRUCT_ST_BLKSIZE
2978 AC_MSG_CHECKING(for siginfo_t)
2979 AC_CACHE_VAL(ac_cv_siginfo_t,
2980  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2981                   #include <signal.h>],
2982                  [siginfo_t* info;],
2983                  [ac_cv_siginfo_t=true],
2984                  [ac_cv_siginfo_t=false])])
2985 if test "$ac_cv_siginfo_t" = true ; then
2986   AC_DEFINE(HAVE_SIGINFO_T)
2987   AC_MSG_RESULT(yes)
2988 else
2989   AC_MSG_RESULT(no)
2992 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2993 dnl ========================================================
2994 AC_MSG_CHECKING(for int16_t)
2995 AC_CACHE_VAL(ac_cv_int16_t,
2996  [AC_TRY_COMPILE([#include <stdio.h>
2997                   #include <sys/types.h>],
2998                  [int16_t foo = 0;],
2999                  [ac_cv_int16_t=true],
3000                  [ac_cv_int16_t=false])])
3001 if test "$ac_cv_int16_t" = true ; then
3002   AC_DEFINE(HAVE_INT16_T)
3003   AC_MSG_RESULT(yes)
3004 else
3005   AC_MSG_RESULT(no)
3007 AC_MSG_CHECKING(for int32_t)
3008 AC_CACHE_VAL(ac_cv_int32_t,
3009  [AC_TRY_COMPILE([#include <stdio.h>
3010                   #include <sys/types.h>],
3011                  [int32_t foo = 0;],
3012                  [ac_cv_int32_t=true],
3013                  [ac_cv_int32_t=false])])
3014 if test "$ac_cv_int32_t" = true ; then
3015   AC_DEFINE(HAVE_INT32_T)
3016   AC_MSG_RESULT(yes)
3017 else
3018   AC_MSG_RESULT(no)
3020 AC_MSG_CHECKING(for int64_t)
3021 AC_CACHE_VAL(ac_cv_int64_t,
3022  [AC_TRY_COMPILE([#include <stdio.h>
3023                   #include <sys/types.h>],
3024                  [int64_t foo = 0;],
3025                  [ac_cv_int64_t=true],
3026                  [ac_cv_int64_t=false])])
3027 if test "$ac_cv_int64_t" = true ; then
3028   AC_DEFINE(HAVE_INT64_T)
3029   AC_MSG_RESULT(yes)
3030 else
3031   AC_MSG_RESULT(no)
3033 AC_MSG_CHECKING(for int64)
3034 AC_CACHE_VAL(ac_cv_int64,
3035  [AC_TRY_COMPILE([#include <stdio.h>
3036                   #include <sys/types.h>],
3037                  [int64 foo = 0;],
3038                  [ac_cv_int64=true],
3039                  [ac_cv_int64=false])])
3040 if test "$ac_cv_int64" = true ; then
3041   AC_DEFINE(HAVE_INT64)
3042   AC_MSG_RESULT(yes)
3043 else
3044   AC_MSG_RESULT(no)
3046 AC_MSG_CHECKING(for uint)
3047 AC_CACHE_VAL(ac_cv_uint,
3048  [AC_TRY_COMPILE([#include <stdio.h>
3049                   #include <sys/types.h>],
3050                  [uint foo = 0;],
3051                  [ac_cv_uint=true],
3052                  [ac_cv_uint=false])])
3053 if test "$ac_cv_uint" = true ; then
3054   AC_DEFINE(HAVE_UINT)
3055   AC_MSG_RESULT(yes)
3056 else
3057   AC_MSG_RESULT(no)
3059 AC_MSG_CHECKING(for uint_t)
3060 AC_CACHE_VAL(ac_cv_uint_t,
3061  [AC_TRY_COMPILE([#include <stdio.h>
3062                   #include <sys/types.h>],
3063                  [uint_t foo = 0;],
3064                  [ac_cv_uint_t=true],
3065                  [ac_cv_uint_t=false])])
3066 if test "$ac_cv_uint_t" = true ; then
3067   AC_DEFINE(HAVE_UINT_T)
3068   AC_MSG_RESULT(yes)
3069 else
3070   AC_MSG_RESULT(no)
3072 AC_MSG_CHECKING(for uint16_t)
3073 AC_CACHE_VAL(ac_cv_uint16_t,
3074  [AC_TRY_COMPILE([#include <stdio.h>
3075                   #include <sys/types.h>],
3076                  [uint16_t foo = 0;],
3077                  [ac_cv_uint16_t=true],
3078                  [ac_cv_uint16_t=false])])
3079 if test "$ac_cv_uint16_t" = true ; then
3080   AC_DEFINE(HAVE_UINT16_T)
3081   AC_MSG_RESULT(yes)
3082 else
3083   AC_MSG_RESULT(no)
3086 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3087 dnl are defined when compiling C++ but not C.  Since the result of this
3088 dnl test is used only in C++, do it in C++.
3089 AC_LANG_CPLUSPLUS
3091 AC_MSG_CHECKING(for uname.domainname)
3092 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3093     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3094         [ struct utsname *res; char *domain; 
3095             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3096         [ac_cv_have_uname_domainname_field=true],
3097         [ac_cv_have_uname_domainname_field=false])])
3099 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3100     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3101     AC_MSG_RESULT(yes)
3102 else
3103     AC_MSG_RESULT(no)
3106 AC_MSG_CHECKING(for uname.__domainname)
3107 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3108     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3109         [ struct utsname *res; char *domain; 
3110             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3111         [ac_cv_have_uname_us_domainname_field=true],
3112         [ac_cv_have_uname_us_domainname_field=false])])
3114 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3115     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3116     AC_MSG_RESULT(yes)
3117 else
3118     AC_MSG_RESULT(no)
3121 AC_LANG_CPLUSPLUS
3123 dnl Check for usable char16_t (2 bytes, unsigned)
3124 dnl (we might not need the unsignedness check anymore)
3125 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3126     ac_cv_have_usable_char16_t,
3127     [AC_TRY_COMPILE([$configure_static_assert_macros],
3128                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3129                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3130                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3131                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3132                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3133                     ac_cv_have_usable_char16_t="yes",
3134                     ac_cv_have_usable_char16_t="no")])
3135 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3136     AC_DEFINE(HAVE_CPP_CHAR16_T)
3137     HAVE_CPP_CHAR16_T=1
3140 dnl Check for usable wchar_t (2 bytes, unsigned)
3141 dnl (we really don't need the unsignedness check anymore)
3142 dnl ========================================================
3144 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3145     ac_cv_have_usable_wchar_v2,
3146     [AC_TRY_COMPILE([#include <stddef.h>
3147                      $configure_static_assert_macros],
3148                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3149                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3150                     ac_cv_have_usable_wchar_v2="yes",
3151                     ac_cv_have_usable_wchar_v2="no")])
3152 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3153     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3154     HAVE_CPP_2BYTE_WCHAR_T=1
3155 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3156 dnl This is really gcc-only
3157 dnl Do this test using CXX only since some versions of gcc
3158 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3159 dnl only have short-wchar support for c++.
3160 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3162     _SAVE_CXXFLAGS=$CXXFLAGS
3163     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3165     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3166         ac_cv_have_usable_wchar_option_v2,
3167         [AC_TRY_LINK([#include <stddef.h>
3168                       $configure_static_assert_macros],
3169                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3170                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3171                      ac_cv_have_usable_wchar_option_v2="yes",
3172                      ac_cv_have_usable_wchar_option_v2="no")])
3174     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3175         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3176         HAVE_CPP_2BYTE_WCHAR_T=1
3177         if test "$OS_TARGET" = Android; then
3178             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3179             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3180             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3181             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3182         else
3183             WCHAR_CFLAGS="-fshort-wchar"
3184         fi
3185     else    
3186         CXXFLAGS=$_SAVE_CXXFLAGS
3187     fi
3190 AC_LANG_C
3192 dnl Check for .hidden assembler directive and visibility attribute.
3193 dnl Borrowed from glibc configure.in
3194 dnl ===============================================================
3195 if test "$GNU_CC"; then
3196   AC_CACHE_CHECK(for visibility(hidden) attribute,
3197                  ac_cv_visibility_hidden,
3198                  [cat > conftest.c <<EOF
3199                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3201                   ac_cv_visibility_hidden=no
3202                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3203                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3204                       ac_cv_visibility_hidden=yes
3205                     fi
3206                   fi
3207                   rm -f conftest.[cs]
3208                  ])
3209   if test "$ac_cv_visibility_hidden" = "yes"; then
3210     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3212     AC_CACHE_CHECK(for visibility(default) attribute,
3213                    ac_cv_visibility_default,
3214                    [cat > conftest.c <<EOF
3215                     int foo __attribute__ ((visibility ("default"))) = 1;
3217                     ac_cv_visibility_default=no
3218                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3219                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3220                         ac_cv_visibility_default=yes
3221                       fi
3222                     fi
3223                     rm -f conftest.[cs]
3224                    ])
3225     if test "$ac_cv_visibility_default" = "yes"; then
3226       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3228       AC_CACHE_CHECK(for visibility pragma support,
3229                      ac_cv_visibility_pragma,
3230                      [cat > conftest.c <<EOF
3231 #pragma GCC visibility push(hidden)
3232                       int foo_hidden = 1;
3233 #pragma GCC visibility push(default)
3234                       int foo_default = 1;
3236                       ac_cv_visibility_pragma=no
3237                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3238                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3239                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3240                             ac_cv_visibility_pragma=yes
3241                           fi
3242                         fi
3243                       fi
3244                       rm -f conftest.[cs]
3245                     ])
3246       if test "$ac_cv_visibility_pragma" = "yes"; then
3247         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3248                        ac_cv_have_visibility_class_bug,
3249                        [cat > conftest.c <<EOF
3250 #pragma GCC visibility push(hidden)
3251 struct __attribute__ ((visibility ("default"))) TestStruct {
3252   static void Init();
3254 __attribute__ ((visibility ("default"))) void TestFunc() {
3255   TestStruct::Init();
3258                        ac_cv_have_visibility_class_bug=no
3259                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3260                          ac_cv_have_visibility_class_bug=yes
3261                        else
3262                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3263                            ac_cv_have_visibility_class_bug=yes
3264                          fi
3265                        fi
3266                        rm -rf conftest.{c,S}
3267                        ])
3269         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3270                        ac_cv_have_visibility_builtin_bug,
3271                        [cat > conftest.c <<EOF
3272 #pragma GCC visibility push(hidden)
3273 #pragma GCC visibility push(default)
3274 #include <string.h>
3275 #pragma GCC visibility pop
3277 __attribute__ ((visibility ("default"))) void Func() {
3278   char c[[100]];
3279   memset(c, 0, sizeof(c));
3282                        ac_cv_have_visibility_builtin_bug=no
3283                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3284                          ac_cv_have_visibility_builtin_bug=yes
3285                        else
3286                          if test `grep -c "@PLT" conftest.S` = 0; then
3287                            ac_cv_visibility_builtin_bug=yes
3288                          fi
3289                        fi
3290                        rm -f conftest.{c,S}
3291                        ])
3292         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3293                 "$ac_cv_have_visibility_class_bug" = "no"; then
3294           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3295           WRAP_SYSTEM_INCLUDES=1
3296           STL_FLAGS='-I$(DIST)/stl_wrappers'
3297           WRAP_STL_INCLUDES=1
3298         else
3299           VISIBILITY_FLAGS='-fvisibility=hidden'
3300         fi # have visibility pragma bug
3301       fi   # have visibility pragma
3302     fi     # have visibility(default) attribute
3303   fi       # have visibility(hidden) attribute
3304 fi         # GNU_CC
3306 # visibility hidden flag for Sun Studio on Solaris
3307 if test "$SOLARIS_SUNPRO_CC"; then
3308 VISIBILITY_FLAGS='-xldscope=hidden'
3309 fi         # Sun Studio on Solaris
3311 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3312 AC_SUBST(VISIBILITY_FLAGS)
3314 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3315 dnl ========================================================
3316 if test "$GNU_CC"; then
3317   CFLAGS_save="${CFLAGS}"
3318   CFLAGS="${CFLAGS} -Werror"
3319   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3320                  ac_cv_force_align_arg_pointer,
3321                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3322                                  [],
3323                                  ac_cv_force_align_arg_pointer="yes",
3324                                  ac_cv_force_align_arg_pointer="no")])
3325   CFLAGS="${CFLAGS_save}"
3326   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3327     HAVE_GCC_ALIGN_ARG_POINTER=1
3328   else
3329     HAVE_GCC_ALIGN_ARG_POINTER=
3330   fi
3332 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3334 dnl Checks for header files.
3335 dnl ========================================================
3336 AC_HEADER_DIRENT
3337 case "$target_os" in
3338 freebsd*)
3339 # for stuff like -lXshm
3340     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3341     ;;
3342 esac
3343 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3344 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3345 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3346 AC_CHECK_HEADERS(malloc.h)
3347 AC_CHECK_HEADERS(X11/XKBlib.h)
3348 AC_CHECK_HEADERS(io.h)
3350 dnl These are all the places some variant of statfs can be hiding.
3351 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3353 dnl Quota support
3354 AC_CHECK_HEADERS(sys/quota.h)
3355 AC_CHECK_HEADERS(linux/quota.h)
3357 dnl Try for MMX support
3358 dnl NB - later gcc versions require -mmmx for this header to be successfully
3359 dnl included (or another option which implies it, such as -march=pentium-mmx)
3360 AC_CHECK_HEADERS(mmintrin.h)
3362 dnl Check whether the compiler supports the new-style C++ standard
3363 dnl library headers (i.e. <new>) or needs the old "new.h"
3364 AC_LANG_CPLUSPLUS
3365 NEW_H=new.h
3366 AC_CHECK_HEADER(new, [NEW_H=new])
3367 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3368 AC_LANG_C
3370 AC_ARG_ENABLE(dtrace,
3371               [  --enable-dtrace         build with dtrace support if available (default=no)],
3372               [enable_dtrace="yes"],)
3373 if test "x$enable_dtrace" = "xyes"; then
3374   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3375   if test -n "$HAVE_DTRACE"; then
3376       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3377   else
3378       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3379   fi
3381 AC_SUBST(HAVE_DTRACE)
3383 case $target in
3384 *-aix4.3*|*-aix5*)
3385         ;;
3387         AC_CHECK_HEADERS(sys/cdefs.h)
3388         ;;
3389 esac
3391 dnl Checks for libraries.
3392 dnl ========================================================
3393 case $target in
3394 *-hpux11.*)
3395         ;;
3397         AC_CHECK_LIB(c_r, gethostbyname_r)
3398         ;;
3399 esac
3401 dnl We don't want to link with libdl even if it's present on OS X, since
3402 dnl it's not used and not part of the default installation.
3403 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3404 dnl We don't want to link against libm or libpthread on Darwin since
3405 dnl they both are just symlinks to libSystem and explicitly linking
3406 dnl against libSystem causes issues when debugging (see bug 299601).
3407 case $target in
3408 *-darwin*)
3409     ;;
3410 *-beos*)
3411     ;;
3412 *-os2*)
3413     ;;
3415     AC_SEARCH_LIBS(dlopen, dl, 
3416         AC_CHECK_HEADER(dlfcn.h, 
3417         AC_DEFINE(HAVE_DLOPEN)))
3418     ;;
3419 esac
3421 _SAVE_CFLAGS="$CFLAGS"
3422 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3423 AC_CHECK_FUNCS(dladdr)
3424 CFLAGS="$_SAVE_CFLAGS"
3426 if test ! "$GNU_CXX"; then
3428     case $target in
3429     *-aix*)
3430         AC_CHECK_LIB(C_r, demangle)
3431         ;;
3432      *)
3433         AC_CHECK_LIB(C, demangle)
3434         ;;
3435      esac
3438 dnl OS/2 has socket in libc.
3439 case $target in
3440 *-os2*)
3441     ;;
3443     AC_CHECK_LIB(socket, socket)
3444 esac
3446 dnl ========================================================
3447 dnl Check whether we can compile code for Core Text
3448 dnl (available on Mac OS X 10.5 or later)
3449 dnl ========================================================
3450 case "$target" in
3451 *-darwin*)
3452   AC_MSG_CHECKING([for Core Text])
3453   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3454                  [CTLineRef lineRef;],
3455                   ac_cv_have_core_text="yes",
3456                   ac_cv_have_core_text="no")
3457   AC_MSG_RESULT([$ac_cv_have_core_text])
3459   if test "$ac_cv_have_core_text" = "no"; then
3460     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3461   fi
3462   ;;
3463 esac
3465 XLDFLAGS="$X_LIBS"
3466 XLIBS="$X_EXTRA_LIBS"
3468 dnl ========================================================
3469 dnl Checks for X libraries.
3470 dnl Ordering is important.
3471 dnl Xt is dependent upon SM as of X11R6
3472 dnl ========================================================
3473 if test "$no_x" = "yes"; then
3474     AC_DEFINE(NO_X11)
3475 else
3476     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3477         XLIBS="-lX11 $XLIBS"
3478         _SAVE_LDFLAGS="$LDFLAGS"
3479         LDFLAGS="$XLDFLAGS $LDFLAGS"
3480         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3481                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3482         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3483                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3484      
3485         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3486         unset ac_cv_lib_Xt_XtFree
3487             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3488             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3489         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3490                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3491         ])
3493     # AIX needs the motif library linked before libXt to prevent
3494     # crashes in plugins linked against Motif - Bug #98892
3495     case "${target_os}" in
3496     aix*)
3497         XT_LIBS="-lXm $XT_LIBS"
3498         ;;
3499     esac
3501     dnl ========================================================
3502     dnl = Check for XShm
3503     dnl ========================================================
3504     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3505         $XLIBS $XEXT_LIBS)
3506     AC_CHECK_HEADER(X11/extensions/XShm.h)
3507     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3508         test -n "$_HAVE_XSHM_XEXT"; then
3509         AC_DEFINE(HAVE_XSHM)
3510     fi
3512     dnl ========================================================
3513     dnl = Check for Xss
3514     dnl ========================================================
3515     AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
3516         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3517             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3518              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3520     dnl ========================================================
3521     dnl = Check for XIE
3522     dnl ========================================================
3523     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3524         $XLIBS $XEXT_LIBS)
3525     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3527     if test "$MOZ_XIE_LIBS"; then
3528         dnl ====================================================
3529         dnl = If XIE is present and is desired, turn it on
3530         dnl ====================================================
3531         case $target in
3532             *-hpux*)
3533                 ;;
3534             *)
3535                 HAVE_XIE=1
3536                 ;;
3537         esac
3538     fi
3540         LDFLAGS="$_SAVE_LDFLAGS"
3542     dnl ========================================================
3543     dnl = Check for freetype2 and its functionality
3544     dnl ========================================================
3545     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3547     if test "$_HAVE_FREETYPE2"; then
3548         _SAVE_LIBS="$LIBS"
3549         _SAVE_CFLAGS="$CFLAGS"
3550         LIBS="$LIBS $FT2_LIBS"
3551         CFLAGS="$CFLAGS $FT2_CFLAGS"
3553         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3554             ac_cv_member_FT_Bitmap_Size_y_ppem,
3555             [AC_TRY_COMPILE([#include <ft2build.h>
3556                              #include FT_FREETYPE_H],
3557                             [FT_Bitmap_Size s;
3558                              if (sizeof s.y_ppem) return 0;
3559                              return 1],
3560                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3561                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3562         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3563             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3564         else
3565             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3566         fi
3567         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3568                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3569                            [FT_Bitmap_Size structure includes y_ppem field])
3571         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3573         LIBS="$_SAVE_LIBS"
3574         CFLAGS="$_SAVE_CFLAGS"
3575     fi
3577 fi # $no_x
3579 AC_SUBST(XCFLAGS)
3580 AC_SUBST(XLDFLAGS)
3581 AC_SUBST(XLIBS)
3582 AC_SUBST(XEXT_LIBS)
3583 AC_SUBST(XT_LIBS)
3584 AC_SUBST(XSS_LIBS)
3586 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3587 AC_TRY_COMPILE([],
3588                [asm("uqadd8 r1, r1, r2");],
3589                result="yes", result="no")
3590 AC_MSG_RESULT("$result")
3591 if test "$result" = "yes"; then
3592     AC_DEFINE(HAVE_ARM_SIMD)
3593     HAVE_ARM_SIMD=1
3595 AC_SUBST(HAVE_ARM_SIMD)
3597 AC_MSG_CHECKING(for ARM NEON support in compiler)
3598 _SAVE_CFLAGS="$CFLAGS"
3599 if test "$GNU_CC"; then
3600   # gcc needs -mfpu=neon to recognize NEON instructions
3601   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3603 AC_TRY_COMPILE([],
3604                [asm("vadd.i8 d0, d0, d0");],
3605                result="yes", result="no")
3606 AC_MSG_RESULT("$result")
3607 if test "$result" = "yes"; then
3608     AC_DEFINE(HAVE_ARM_NEON)
3609     HAVE_ARM_NEON=1
3611 CFLAGS="$_SAVE_CFLAGS"
3612 AC_SUBST(HAVE_ARM_NEON)
3614 dnl ========================================================
3615 dnl = pthread support
3616 dnl = Start by checking whether the system support pthreads
3617 dnl ========================================================
3618 case "$target_os" in
3619 darwin*)
3620     USE_PTHREADS=1
3621     ;;
3623     MOZ_CHECK_PTHREADS(pthreads,
3624         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3625         MOZ_CHECK_PTHREADS(pthread,
3626             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3627             MOZ_CHECK_PTHREADS(c_r,
3628                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3629                 MOZ_CHECK_PTHREADS(c,
3630                     USE_PTHREADS=1
3631                 )
3632             )
3633         )
3634     )
3635     ;;
3636 esac
3638 dnl ========================================================
3639 dnl Check the command line for --with-pthreads 
3640 dnl ========================================================
3641 MOZ_ARG_WITH_BOOL(pthreads,
3642 [  --with-pthreads         Force use of system pthread library with NSPR ],
3643 [ if test "$USE_PTHREADS"x = x; then
3644     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3645 fi],
3646     USE_PTHREADS=
3647     _PTHREAD_LDFLAGS=
3650 dnl ========================================================
3651 dnl Do the platform specific pthread hackery
3652 dnl ========================================================
3653 if test "$USE_PTHREADS"x != x
3654 then
3655         dnl
3656         dnl See if -pthread is supported.
3657         dnl
3658         rm -f conftest*
3659         ac_cv_have_dash_pthread=no
3660         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3661         echo 'int main() { return 0; }' | cat > conftest.c
3662         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3663         if test $? -eq 0; then
3664                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3665                         ac_cv_have_dash_pthread=yes
3666                 case "$target_os" in
3667                 freebsd*)
3668 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3669                 ;;
3670                 *)
3671                             CFLAGS="$CFLAGS -pthread"
3672                             CXXFLAGS="$CXXFLAGS -pthread"
3673                 ;;
3674                 esac
3675                 fi
3676         fi
3677         rm -f conftest*
3678     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3680         dnl
3681         dnl See if -pthreads is supported.
3682         dnl
3683     ac_cv_have_dash_pthreads=no
3684     if test "$ac_cv_have_dash_pthread" = "no"; then
3685             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3686         echo 'int main() { return 0; }' | cat > conftest.c
3687             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3688         if test $? -eq 0; then
3689                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3690                             ac_cv_have_dash_pthreads=yes
3691                             CFLAGS="$CFLAGS -pthreads"
3692                             CXXFLAGS="$CXXFLAGS -pthreads"
3693                     fi
3694             fi
3695             rm -f conftest*
3696         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3697     fi
3699         case "$target" in
3700             *-*-freebsd*)
3701                         AC_DEFINE(_REENTRANT)
3702                         AC_DEFINE(_THREAD_SAFE)
3703                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3704                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3705                                 _PTHREAD_LDFLAGS="-pthread"
3706                         else
3707                                 _PTHREAD_LDFLAGS="-lc_r"
3708                         fi
3709                         ;;
3711             *-*-openbsd*|*-*-bsdi*)
3712                         AC_DEFINE(_REENTRANT)
3713                         AC_DEFINE(_THREAD_SAFE)
3714                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3715                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3716                 _PTHREAD_LDFLAGS="-pthread"
3717                         fi
3718                         ;;
3720             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3721                         AC_DEFINE(_REENTRANT) 
3722                         ;;
3724             *-*-nto*) 
3725                         AC_DEFINE(_REENTRANT) 
3726                         ;;
3728             *-aix4.3*|*-aix5*)
3729                         AC_DEFINE(_REENTRANT) 
3730                         ;;
3732             *-hpux11.*)
3733                         AC_DEFINE(_REENTRANT) 
3734                         ;;
3736             alpha*-*-osf*)
3737                         AC_DEFINE(_REENTRANT)
3738                         ;;
3740             *-*-solaris*) 
3741                         AC_DEFINE(_REENTRANT)
3742                         if test "$SOLARIS_SUNPRO_CC"; then
3743                                 CFLAGS="$CFLAGS -mt" 
3744                                 CXXFLAGS="$CXXFLAGS -mt" 
3745                         fi
3746                         ;;
3747         esac
3748     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3751 dnl ========================================================
3752 dnl See if mmap sees writes
3753 dnl For cross compiling, just define it as no, which is a safe default
3754 dnl ========================================================
3755 AC_MSG_CHECKING(whether mmap() sees write()s)
3757 changequote(,)
3758 mmap_test_prog='
3759     #include <stdlib.h>
3760     #include <unistd.h>
3761     #include <sys/mman.h>
3762     #include <sys/types.h>
3763     #include <sys/stat.h>
3764     #include <fcntl.h>
3766     char fname[] = "conftest.file";
3767     char zbuff[1024]; /* Fractional page is probably worst case */
3769     int main() {
3770         char *map;
3771         int fd;
3772         int i;
3773         unlink(fname);
3774         fd = open(fname, O_RDWR | O_CREAT, 0660);
3775         if(fd<0) return 1;
3776         unlink(fname);
3777         write(fd, zbuff, sizeof(zbuff));
3778         lseek(fd, 0, SEEK_SET);
3779         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3780         if(map==(char*)-1) return 2;
3781         for(i=0; fname[i]; i++) {
3782             int rc = write(fd, &fname[i], 1);
3783             if(map[i]!=fname[i]) return 4;
3784         }
3785         return 0;
3786     }
3788 changequote([,])
3790 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3792 AC_MSG_RESULT("$result")
3794 if test "$result" = "no"; then
3795     AC_DEFINE(MMAP_MISSES_WRITES)
3799 dnl Checks for library functions.
3800 dnl ========================================================
3801 AC_PROG_GCC_TRADITIONAL
3802 AC_FUNC_MEMCMP
3803 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3804 AC_CHECK_FUNCS(flockfile getpagesize)
3805 AC_CHECK_FUNCS(localtime_r strtok_r)
3807 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3808 _SAVE_LDFLAGS=$LDFLAGS
3809 LDFLAGS="$LDFLAGS -lrt"
3810 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3811                ac_cv_have_clock_monotonic,
3812                [AC_TRY_LINK([#include <time.h>],
3813                             [ struct timespec ts;
3814                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3815                             ac_cv_have_clock_monotonic=yes,
3816                             ac_cv_have_clock_monotonic=no)])
3817 LDFLAGS=$_SAVE_LDFLAGS
3818 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3819     HAVE_CLOCK_MONOTONIC=1
3820     REALTIME_LIBS=-lrt
3821     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3822     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3823     AC_SUBST(REALTIME_LIBS)
3826 dnl check for wcrtomb/mbrtowc
3827 dnl =======================================================================
3828 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3829 AC_LANG_SAVE
3830 AC_LANG_CPLUSPLUS
3831 AC_CACHE_CHECK(for wcrtomb,
3832     ac_cv_have_wcrtomb,
3833     [AC_TRY_LINK([#include <wchar.h>],
3834                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3835                  ac_cv_have_wcrtomb="yes",
3836                  ac_cv_have_wcrtomb="no")])
3837 if test "$ac_cv_have_wcrtomb" = "yes"; then
3838     AC_DEFINE(HAVE_WCRTOMB)
3840 AC_CACHE_CHECK(for mbrtowc,
3841     ac_cv_have_mbrtowc,
3842     [AC_TRY_LINK([#include <wchar.h>],
3843                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3844                  ac_cv_have_mbrtowc="yes",
3845                  ac_cv_have_mbrtowc="no")])
3846 if test "$ac_cv_have_mbrtowc" = "yes"; then
3847     AC_DEFINE(HAVE_MBRTOWC)
3849 AC_LANG_RESTORE
3852 AC_CACHE_CHECK(
3853     [for res_ninit()],
3854     ac_cv_func_res_ninit,
3855     [AC_TRY_LINK([
3856         #ifdef linux
3857         #define _BSD_SOURCE 1
3858         #endif
3859         #include <resolv.h>
3860         ],
3861         [int foo = res_ninit(&_res);],
3862         [ac_cv_func_res_ninit=yes],
3863         [ac_cv_func_res_ninit=no])
3864     ])
3866 if test "$ac_cv_func_res_ninit" = "yes"; then
3867     AC_DEFINE(HAVE_RES_NINIT)
3868 dnl must add the link line we do something as foolish as this... dougt
3869 dnl else
3870 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3871 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3874 AC_LANG_CPLUSPLUS
3875 AC_CACHE_CHECK(
3876     [for gnu_get_libc_version()],
3877     ac_cv_func_gnu_get_libc_version,
3878     [AC_TRY_LINK([
3879         #ifdef HAVE_GNU_LIBC_VERSION_H
3880         #include <gnu/libc-version.h>
3881         #endif
3882         ],
3883         [const char *glibc_version = gnu_get_libc_version();],
3884         [ac_cv_func_gnu_get_libc_version=yes],
3885         [ac_cv_func_gnu_get_libc_version=no] 
3886         )]
3887     )
3889 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3890     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3893 case $target_os in
3894     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3895         ;;
3896     *)
3897     
3898 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3899     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3900         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3901 _SAVE_LIBS=$LIBS
3902 LIBS="$LIBS $_ICONV_LIBS"
3903 AC_CACHE_CHECK(
3904     [for iconv()],
3905     ac_cv_func_iconv,
3906     [AC_TRY_LINK([
3907         #include <stdlib.h>
3908         #include <iconv.h>
3909         ],
3910         [
3911             iconv_t h = iconv_open("", "");
3912             iconv(h, NULL, NULL, NULL, NULL);
3913             iconv_close(h);
3914         ],
3915         [ac_cv_func_iconv=yes],
3916         [ac_cv_func_iconv=no] 
3917         )]
3918     )
3919 if test "$ac_cv_func_iconv" = "yes"; then
3920     AC_DEFINE(HAVE_ICONV)
3921     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3922     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3923     LIBICONV="$_ICONV_LIBS"
3924     AC_CACHE_CHECK(
3925         [for iconv() with const input],
3926         ac_cv_func_const_iconv,
3927         [AC_TRY_COMPILE([
3928             #include <stdlib.h>
3929             #include <iconv.h>
3930             ],
3931             [
3932                 const char *input = "testing";
3933                 iconv_t h = iconv_open("", "");
3934                 iconv(h, &input, NULL, NULL, NULL);
3935                 iconv_close(h);
3936             ],
3937             [ac_cv_func_const_iconv=yes],
3938             [ac_cv_func_const_iconv=no] 
3939             )]
3940         )
3941     if test "$ac_cv_func_const_iconv" = "yes"; then
3942         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3943     fi
3945 LIBS=$_SAVE_LIBS
3947     ;;
3948 esac
3950 AM_LANGINFO_CODESET
3952 AC_LANG_C
3954 dnl **********************
3955 dnl *** va_copy checks ***
3956 dnl **********************
3957 dnl we currently check for all three va_copy possibilities, so we get
3958 dnl all results in config.log for bug reports.
3959 AC_MSG_CHECKING(for an implementation of va_copy())
3960 AC_CACHE_VAL(ac_cv_va_copy,[
3961     AC_TRY_RUN([
3962         #include <stdarg.h>
3963         void f (int i, ...) {
3964             va_list args1, args2;
3965             va_start (args1, i);
3966             va_copy (args2, args1);
3967             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3968                 exit (1);
3969             va_end (args1); va_end (args2);
3970         }
3971         int main() { f (0, 42); return 0; }],
3972         ac_cv_va_copy=yes,
3973         ac_cv_va_copy=no,
3974         ac_cv_va_copy=no
3975     )
3977 AC_MSG_RESULT($ac_cv_va_copy)
3978 AC_MSG_CHECKING(for an implementation of __va_copy())
3979 AC_CACHE_VAL(ac_cv___va_copy,[
3980     AC_TRY_RUN([
3981         #include <stdarg.h>
3982         void f (int i, ...) {
3983             va_list args1, args2;
3984             va_start (args1, i);
3985             __va_copy (args2, args1);
3986             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3987                 exit (1);
3988             va_end (args1); va_end (args2);
3989         }
3990         int main() { f (0, 42); return 0; }],
3991         ac_cv___va_copy=yes,
3992         ac_cv___va_copy=no,
3993         ac_cv___va_copy=no
3994     )
3996 AC_MSG_RESULT($ac_cv___va_copy)
3997 AC_MSG_CHECKING(whether va_lists can be copied by value)
3998 AC_CACHE_VAL(ac_cv_va_val_copy,[
3999     AC_TRY_RUN([
4000         #include <stdarg.h>
4001         void f (int i, ...) {
4002             va_list args1, args2;
4003             va_start (args1, i);
4004             args2 = args1;
4005             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
4006                 exit (1);
4007             va_end (args1); va_end (args2);
4008         }
4009         int main() { f (0, 42); return 0; }],
4010         ac_cv_va_val_copy=yes,
4011         ac_cv_va_val_copy=no,
4012         ac_cv_va_val_copy=yes
4013     )
4015 if test "x$ac_cv_va_copy" = "xyes"; then
4016     AC_DEFINE(VA_COPY, va_copy)
4017     AC_DEFINE(HAVE_VA_COPY)
4018 elif test "x$ac_cv___va_copy" = "xyes"; then
4019     AC_DEFINE(VA_COPY, __va_copy)
4020     AC_DEFINE(HAVE_VA_COPY)
4023 if test "x$ac_cv_va_val_copy" = "xno"; then
4024    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
4026 AC_MSG_RESULT($ac_cv_va_val_copy)
4028 dnl Check for dll-challenged libc's.
4029 dnl This check is apparently only needed for Linux.
4030 case "$target" in
4031         *-linux*)
4032             dnl ===================================================================
4033             _curdir=`pwd`
4034             export _curdir
4035             rm -rf conftest* _conftest
4036             mkdir _conftest
4037             cat >> conftest.C <<\EOF
4038 #include <stdio.h>
4039 #include <link.h>
4040 #include <dlfcn.h>
4041 #ifdef _dl_loaded
4042 void __dump_link_map(void) {
4043   struct link_map *map = _dl_loaded;
4044   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
4046 int main() {
4047   dlopen("./conftest1.so",RTLD_LAZY);
4048   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
4049   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
4050   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
4051   __dump_link_map();
4053 #else
4054 /* _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).*/
4055 int main() { printf("./conftest1.so\n"); }
4056 #endif
4059             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4061             cat >> conftest1.C <<\EOF
4062 #include <stdio.h>
4063 void foo(void) {printf("foo in dll called\n");}
4065             ${CXX-g++} -fPIC -c -g conftest1.C
4066             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4067             ${CXX-g++} -g conftest.C -o conftest -ldl
4068             cp -f conftest1.so conftest _conftest
4069             cd _conftest
4070             if test `./conftest | grep conftest1.so | wc -l` -gt 1
4071             then
4072                 echo
4073                 echo "*** Your libc has a bug that can result in loading the same dynamic"
4074                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
4075                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
4076                 echo "*** will be excessive memory usage at runtime."
4077                 echo
4078             fi
4079             cd ${_curdir}
4080             rm -rf conftest* _conftest
4081             dnl ===================================================================
4082             ;;
4083 esac
4085 dnl ===================================================================
4086 dnl ========================================================
4087 dnl Put your C++ language/feature checks below
4088 dnl ========================================================
4089 AC_LANG_CPLUSPLUS
4091 ARM_ABI_PREFIX=
4092 HAVE_GCC3_ABI=
4093 if test "$GNU_CC"; then
4094   if test "$CPU_ARCH" = "arm" ; then
4095     AC_CACHE_CHECK(for ARM EABI,
4096         ac_cv_gcc_arm_eabi,
4097         [AC_TRY_COMPILE([],
4098                         [
4099 #if defined(__ARM_EABI__)
4100   return 0;
4101 #else
4102 #error Not ARM EABI.
4103 #endif
4104                         ],
4105                         ac_cv_gcc_arm_eabi="yes",
4106                         ac_cv_gcc_arm_eabi="no")])
4107     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4108         HAVE_ARM_EABI=1
4109         ARM_ABI_PREFIX=eabi-
4110     else
4111         ARM_ABI_PREFIX=oabi-
4112     fi
4113   fi
4115   AC_CACHE_CHECK(for gcc 3.0 ABI,
4116       ac_cv_gcc_three_abi,
4117       [AC_TRY_COMPILE([],
4118                       [
4119 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4120   return 0;
4121 #else
4122 #error Not gcc3.
4123 #endif
4124                       ],
4125                       ac_cv_gcc_three_abi="yes",
4126                       ac_cv_gcc_three_abi="no")])
4127   if test "$ac_cv_gcc_three_abi" = "yes"; then
4128       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4129       HAVE_GCC3_ABI=1
4130   else
4131       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4132   fi
4134 AC_SUBST(HAVE_GCC3_ABI)
4137 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4138                ac_cv_cpp_explicit,
4139                [AC_TRY_COMPILE(class X {
4140                                public: explicit X(int i) : i_(i) {}
4141                                private: int i_;
4142                                };,
4143                                X x(3);,
4144                                ac_cv_cpp_explicit=yes,
4145                                ac_cv_cpp_explicit=no)])
4146 if test "$ac_cv_cpp_explicit" = yes ; then
4147    AC_DEFINE(HAVE_CPP_EXPLICIT)
4150 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4151                ac_cv_cpp_typename,
4152                [AC_TRY_COMPILE(class param {
4153                                public:
4154                                    typedef unsigned long num_type;
4155                                };
4157                                template <class T> class tplt {
4158                                public:
4159                                    typedef typename T::num_type t_num_type;
4160                                    t_num_type foo(typename T::num_type num) {
4161                                        return num;
4162                                    }
4163                                };,
4164                                tplt<param> A;
4165                                A.foo(0);,
4166                                ac_cv_cpp_typename=yes,
4167                                ac_cv_cpp_typename=no)])
4168 if test "$ac_cv_cpp_typename" = yes ; then
4169    AC_DEFINE(HAVE_CPP_TYPENAME)
4172 dnl Check for support of modern template specialization syntax
4173 dnl Test code and requirement from scc@netscape.com.
4174 dnl Autoconf cut-and-paste job by waterson@netscape.com
4175 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4176                ac_cv_cpp_modern_specialize_template_syntax,
4177                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4178                                class Y {};
4179                                template <> struct X<Y> { double a; };,
4180                                X<int> int_x;
4181                                X<Y> y_x;,
4182                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4183                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4184 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4185   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4189 dnl Some compilers support only full specialization, and some don't.
4190 AC_CACHE_CHECK(whether partial template specialization works,
4191                ac_cv_cpp_partial_specialization,
4192                [AC_TRY_COMPILE(template <class T> class Foo {};
4193                                template <class T> class Foo<T*> {};,
4194                                return 0;,
4195                                ac_cv_cpp_partial_specialization=yes,
4196                                ac_cv_cpp_partial_specialization=no)])
4197 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4198   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4201 dnl Some compilers have limited support for operators with templates;
4202 dnl specifically, it is necessary to define derived operators when a base
4203 dnl class's operator declaration should suffice.
4204 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4205                ac_cv_need_derived_template_operators,
4206                [AC_TRY_COMPILE([template <class T> class Base { };
4207                                 template <class T>
4208                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4209                                 template <class T> class Derived : public Base<T> { };],
4210                                [Derived<char> a, b;
4211                                 Base<char> c = a + b;
4212                                 return 0;],
4213                                ac_cv_need_derived_template_operators=no,
4214                                ac_cv_need_derived_template_operators=yes)])
4215 if test "$ac_cv_need_derived_template_operators" = yes ; then
4216   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4220 dnl Some compilers have trouble detecting that a template class
4221 dnl that derives from another template is actually an instance
4222 dnl of the base class. This test checks for that.
4223 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4224                ac_cv_need_cpp_template_cast_to_base,
4225                [AC_TRY_COMPILE([template <class T> class Base { };
4226                                 template <class T> class Derived : public Base<T> { };
4227                                 template <class T> int foo(const Base<T>&) { return 0; }],
4228                                [Derived<char> bar; return foo(bar);],
4229                                ac_cv_need_cpp_template_cast_to_base=no,
4230                                ac_cv_need_cpp_template_cast_to_base=yes)])
4231 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4232   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4235 dnl Some compilers have trouble resolving the ambiguity between two
4236 dnl functions whose arguments differ only by cv-qualifications.
4237 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4238                ac_cv_can_resolve_const_ambiguity,
4239                [AC_TRY_COMPILE([
4240                                 template <class T> class ptrClass {
4241                                   public: T* ptr;
4242                                 };
4244                                 template <class T> T* a(ptrClass<T> *arg) {
4245                                   return arg->ptr;
4246                                 }
4248                                 template <class T>
4249                                 const T* a(const ptrClass<T> *arg) {
4250                                   return arg->ptr;
4251                                 }
4252                                ],
4253                                [ ptrClass<int> i;
4254                                  a(&i); ],
4255                                ac_cv_can_resolve_const_ambiguity=yes,
4256                                ac_cv_can_resolve_const_ambiguity=no)])
4257 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4258   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4262 dnl We don't do exceptions on unix.  The only reason this used to be here
4263 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4264 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4265 dnl So im commenting this out until someone writes some artificial 
4266 dnl intelligence to detect not only if the compiler has exceptions, but if 
4267 dnl they are enabled as well.
4268 dnl 
4269 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4270 dnl                ac_cv_cpp_exceptions,
4271 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4272 dnl                                static void F() { throw X(); },
4273 dnl                                try { F(); } catch(X & e) { },
4274 dnl                                ac_cv_cpp_exceptions=yes,
4275 dnl                                ac_cv_cpp_exceptions=no)])
4276 dnl if test $ac_cv_cpp_exceptions = yes ; then
4277 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4278 dnl fi
4280 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4281 dnl supports it well enough to allow us to use it to change access, but not
4282 dnl to resolve ambiguity. The next two tests determine how well the |using|
4283 dnl keyword is supported.
4285 dnl Check to see if we can change access with |using|.  Test both a
4286 dnl legal and an illegal example.
4287 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4288                ac_cv_cpp_access_changing_using2,
4289                [AC_TRY_COMPILE(
4290                    class A { protected: int foo() { return 0; } };
4291                    class B : public A { public: using A::foo; };,
4292                    B b; return b.foo();,
4293                    [AC_TRY_COMPILE(
4294                        class A { public: int foo() { return 1; } };
4295                        class B : public A { private: using A::foo; };,
4296                        B b; return b.foo();,
4297                        ac_cv_cpp_access_changing_using2=no,
4298                        ac_cv_cpp_access_changing_using2=yes)],
4299                    ac_cv_cpp_access_changing_using2=no)])
4300 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4301    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4304 dnl Check to see if we can resolve ambiguity with |using|.
4305 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4306                ac_cv_cpp_ambiguity_resolving_using,
4307                [AC_TRY_COMPILE(class X { 
4308                                  public: int go(const X&) {return 3;}
4309                                          int jo(const X&) {return 3;}
4310                                };
4311                                class Y : public X {
4312                                  public:  int go(int) {return 2;}
4313                                           int jo(int) {return 2;}
4314                                           using X::jo;
4315                                  private: using X::go;
4316                                };,
4317                                X x; Y y; y.jo(x);,
4318                                ac_cv_cpp_ambiguity_resolving_using=yes,
4319                                ac_cv_cpp_ambiguity_resolving_using=no)])
4320 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4321    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4324 dnl Check to see if the |std| namespace is supported. If so, we'll want
4325 dnl to qualify any standard library calls with "std::" to ensure that
4326 dnl those functions can be resolved.
4327 AC_CACHE_CHECK(for \"std::\" namespace,
4328                ac_cv_cpp_namespace_std,
4329                [AC_TRY_COMPILE([#include <algorithm>],
4330                                [return std::min(0, 1);],
4331                                ac_cv_cpp_namespace_std=yes,
4332                                ac_cv_cpp_namespace_std=no)])
4333 if test "$ac_cv_cpp_namespace_std" = yes ; then
4334    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4337 dnl Older compilers are overly ambitious with respect to using the standard
4338 dnl template library's |operator!=()| when |operator==()| is defined. In
4339 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4340 dnl ambiguity at compile-time. This test checks for that case.
4341 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4342                ac_cv_cpp_unambiguous_std_notequal,
4343                [AC_TRY_COMPILE([#include <algorithm>
4344                                 struct T1 {};
4345                                 int operator==(const T1&, const T1&) { return 0; }
4346                                 int operator!=(const T1&, const T1&) { return 0; }],
4347                                [T1 a,b; return a != b;],
4348                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4349                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4350 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4351   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4355 AC_CACHE_CHECK(for C++ reinterpret_cast,
4356                ac_cv_cpp_reinterpret_cast,
4357                [AC_TRY_COMPILE(struct X { int i; };
4358                                struct Y { int i; };,
4359                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4360                                ac_cv_cpp_reinterpret_cast=yes,
4361                                ac_cv_cpp_reinterpret_cast=no)])
4362 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4363    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4366 dnl See if a dynamic_cast to void* gives the most derived object.
4367 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4368                ac_cv_cpp_dynamic_cast_void_ptr,
4369                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4370                             class Y { int j; public: virtual ~Y() { } };
4371                             class Z : public X, public Y { int k; };
4373                             int main() {
4374                                  Z mdo;
4375                                  X *subx = (X*)&mdo;
4376                                  Y *suby = (Y*)&mdo;
4377                                  return !((((void*)&mdo != (void*)subx) &&
4378                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4379                                           (((void*)&mdo != (void*)suby) &&
4380                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4381                             }],
4382                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4383                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4384                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4385 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4386    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4390 dnl note that this one is reversed - if the test fails, then
4391 dnl we require implementations of unused virtual methods. Which
4392 dnl really blows because it means we'll have useless vtable
4393 dnl bloat.
4394 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4395                ac_cv_cpp_unused_required,
4396                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4397                                X x;,
4398                                ac_cv_cpp_unused_required=no,
4399                                ac_cv_cpp_unused_required=yes)])
4400 if test "$ac_cv_cpp_unused_required" = yes ; then
4401    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4405 dnl Some compilers have trouble comparing a constant reference to a templatized
4406 dnl class to zero, and require an explicit operator==() to be defined that takes
4407 dnl an int. This test separates the strong from the weak.
4409 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4410                ac_cv_trouble_comparing_to_zero,
4411                [AC_TRY_COMPILE([#include <algorithm>
4412                                 template <class T> class Foo {};
4413                                 class T2;
4414                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4415                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4416                                [Foo<int> f; return (0 != f);],
4417                                ac_cv_trouble_comparing_to_zero=no,
4418                                ac_cv_trouble_comparing_to_zero=yes)])
4419 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4420   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4423 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4424 _SAVE_LDFLAGS=$LDFLAGS
4425 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4426 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4427                ac_cv_thread_keyword,
4428                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4429                             [return tlsIsMainThread;],
4430                             ac_cv_thread_keyword=yes,
4431                             ac_cv_thread_keyword=no)])
4432 LDFLAGS=$_SAVE_LDFLAGS
4433 if test "$ac_cv_thread_keyword" = yes; then
4434   # mips builds fail with TLS variables because of a binutils bug.
4435   # See bug 528687
4436   case "${target}" in
4437     mips*-*)
4438       :
4439       ;;
4440     *-android*)
4441       :
4442       ;;
4443     *)
4444       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4445       ;;
4446   esac
4449 dnl Check for the existence of various allocation headers/functions
4451 MALLOC_H=
4452 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4453 if test "$MALLOC_H" = ""; then
4454   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4455   if test "$MALLOC_H" = ""; then
4456     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4457   fi
4459 if test "$MALLOC_H" != ""; then
4460    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4463 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4464 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4466 dnl See if compiler supports some gcc-style attributes
4468 AC_CACHE_CHECK(for __attribute__((always_inline)),
4469                ac_cv_attribute_always_inline,
4470                [AC_TRY_COMPILE([],
4471                                [inline void f(void) __attribute__((always_inline));],
4472                                ac_cv_attribute_always_inline=yes,
4473                                ac_cv_attribute_always_inline=no)])
4475 AC_CACHE_CHECK(for __attribute__((malloc)),
4476                ac_cv_attribute_malloc,
4477                [AC_TRY_COMPILE([],
4478                                [void* f(int) __attribute__((malloc));],
4479                                ac_cv_attribute_malloc=yes,
4480                                ac_cv_attribute_malloc=no)])
4482 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4483                ac_cv_attribute_warn_unused,
4484                [AC_TRY_COMPILE([],
4485                                [int f(void) __attribute__((warn_unused_result));],
4486                                ac_cv_attribute_warn_unused=yes,
4487                                ac_cv_attribute_warn_unused=no)])
4489 AC_CACHE_CHECK(for __attribute__((noreturn)),
4490                ac_cv_attribute_noreturn,
4491                [AC_TRY_COMPILE([],
4492                                [void f(void) __attribute__((noreturn));],
4493                                ac_cv_attribute_noreturn=yes,
4494                                ac_cv_attribute_noreturn=no)])
4496 dnl End of C++ language/feature checks
4497 AC_LANG_C
4499 dnl ========================================================
4500 dnl =  Internationalization checks
4501 dnl ========================================================
4503 dnl Internationalization and Locale support is different
4504 dnl on various UNIX platforms.  Checks for specific i18n
4505 dnl features go here.
4507 dnl check for LC_MESSAGES
4508 AC_CACHE_CHECK(for LC_MESSAGES,
4509                 ac_cv_i18n_lc_messages,
4510                 [AC_TRY_COMPILE([#include <locale.h>],
4511                                 [int category = LC_MESSAGES;],
4512                                 ac_cv_i18n_lc_messages=yes,
4513                                 ac_cv_i18n_lc_messages=no)])
4514 if test "$ac_cv_i18n_lc_messages" = yes; then
4515    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4518 AC_HAVE_FUNCS(localeconv)
4520 fi # SKIP_COMPILER_CHECKS
4522 TARGET_XPCOM_ABI=
4523 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4524     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4527 dnl Mozilla specific options
4528 dnl ========================================================
4529 dnl The macros used for command line options
4530 dnl are defined in build/autoconf/altoptions.m4.
4532 dnl If the compiler supports these attributes, define them as
4533 dnl convenience macros.
4534 if test "$ac_cv_attribute_always_inline" = yes ; then
4535   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4536 else
4537   AC_DEFINE(NS_ALWAYS_INLINE,)
4540 if test "$ac_cv_attribute_malloc" = yes ; then
4541   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4542 else
4543   AC_DEFINE(NS_ATTR_MALLOC,)
4546 if test "$ac_cv_attribute_warn_unused" = yes ; then
4547   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4548 else
4549   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4552 if test "$ac_cv_attribute_noreturn" = yes ; then
4553   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4554 else
4555   AC_DEFINE(NS_NORETURN,)
4558 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4559 dnl features that Windows actually does support.
4561 if test -n "$SKIP_COMPILER_CHECKS"; then
4562    dnl Windows has malloc.h
4563    AC_DEFINE(MALLOC_H, [<malloc.h>])
4564    AC_DEFINE(HAVE_FORCEINLINE)
4565    AC_DEFINE(HAVE_LOCALECONV)
4566 fi # SKIP_COMPILER_CHECKS
4568 dnl ========================================================
4569 dnl =
4570 dnl = Check for external package dependencies
4571 dnl =
4572 dnl ========================================================
4573 MOZ_ARG_HEADER(External Packages)
4575 MOZ_ENABLE_LIBXUL=1
4577 MOZ_ARG_WITH_STRING(libxul-sdk,
4578 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4579   LIBXUL_SDK_DIR=$withval)
4581 if test "$LIBXUL_SDK_DIR" = "yes"; then
4582     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4583 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4584     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4586     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4587         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4588     fi
4590     MOZ_ENABLE_LIBXUL=1
4592 AC_SUBST(LIBXUL_SDK)
4594 if test -n "$LIBXUL_SDK"; then
4595     LIBXUL_DIST="$LIBXUL_SDK"
4596 else
4597     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4599 AC_SUBST(LIBXUL_DIST)
4601 SYSTEM_LIBXUL=
4603 MOZ_ARG_WITH_BOOL(system-libxul,
4604 [  --with-system-libxul    Use system installed libxul SDK],
4605     SYSTEM_LIBXUL=1)
4607 if test -n "$SYSTEM_LIBXUL" -a -z "$MOZ_ENABLE_LIBXUL"; then
4608     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4611 dnl ========================================================
4612 dnl = If NSPR was not detected in the system, 
4613 dnl = use the one in the source tree (mozilla/nsprpub)
4614 dnl ========================================================
4615 MOZ_ARG_WITH_BOOL(system-nspr,
4616 [  --with-system-nspr      Use system installed NSPR],
4617     _USE_SYSTEM_NSPR=1 )
4619 if test -n "$_USE_SYSTEM_NSPR"; then
4620     AM_PATH_NSPR(4.8.7, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4623 if test -n "$MOZ_NATIVE_NSPR"; then
4624     _SAVE_CFLAGS=$CFLAGS
4625     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4626     AC_TRY_COMPILE([#include "prtypes.h"],
4627                 [#ifndef PR_STATIC_ASSERT
4628                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4629                  #endif],
4630                 [MOZ_NATIVE_NSPR=1],
4631                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4632     CFLAGS=$_SAVE_CFLAGS
4633 else
4634     if test "$OS_ARCH" = "WINCE"; then
4635         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4636         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4637     elif test "$OS_ARCH" = "WINNT"; then
4638         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4639         if test -n "$GNU_CC"; then
4640             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4641         else
4642             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4643         fi
4644     else
4645         NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4646         NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4647     fi
4650 dnl system libevent Support
4651 dnl ========================================================
4652 MOZ_ARG_WITH_STRING(system-libevent,
4653 [  --with-system-libevent=[PFX]
4654                           Use system libevent [installed at prefix PFX]],
4655     LIBEVENT_DIR=$withval)
4657 _SAVE_CFLAGS=$CFLAGS
4658 _SAVE_LDFLAGS=$LDFLAGS
4659 _SAVE_LIBS=$LIBS
4660 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4661     MOZ_NATIVE_LIBEVENT=
4662 else
4663     if test "${LIBEVENT_DIR}" = "yes"; then
4664         LIBEVENT_DIR=/usr
4665     fi
4666     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4667     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4668     AC_CHECK_HEADER(event.h,
4669                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4670                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4671                      fi],
4672                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4673     AC_CHECK_LIB(event, event_init,
4674                  [MOZ_NATIVE_LIBEVENT=1
4675                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4676                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4677                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4679 CFLAGS=$_SAVE_CFLAGS
4680 LDFLAGS=$_SAVE_LDFLAGS
4681 LIBS=$_SAVE_LIBS
4683 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4684 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4685 AC_SUBST(MOZ_LIBEVENT_LIBS)
4687 dnl ========================================================
4688 dnl = If NSS was not detected in the system, 
4689 dnl = use the one in the source tree (mozilla/security/nss)
4690 dnl ========================================================
4692 MOZ_ARG_WITH_BOOL(system-nss,
4693 [  --with-system-nss       Use system installed NSS],
4694     _USE_SYSTEM_NSS=1 )
4696 if test -n "$_USE_SYSTEM_NSS"; then
4697     AM_PATH_NSS(3.12.9, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4700 if test -n "$MOZ_NATIVE_NSS"; then
4701    NSS_LIBS="$NSS_LIBS -lcrmf"
4702 else
4703    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4704    NSS_DEP_LIBS="\
4705         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4706         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4707         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4708         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4709         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4711    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4712        NSS_LIBS="\
4713         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4714         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4715         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4716         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4717         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4718    else
4719        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4720    fi
4723 dnl ======================
4724 dnl Detect yasm
4725 dnl ======================
4727 AC_MSG_CHECKING([for YASM assembler])
4728 AC_CHECK_PROGS(YASM, yasm, "")
4730 if test -n "$YASM"; then
4731   dnl Pull out yasm's version string
4732   changequote(,)
4733   _YASM_VER_FILTER='s|.* \([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\).*|\1|p'
4734   changequote([,])
4736   YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4737   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4738   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4739   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4740   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4743 if test -z "$SKIP_LIBRARY_CHECKS"; then
4744 dnl system JPEG support
4745 dnl ========================================================
4746 MOZ_ARG_WITH_STRING(system-jpeg,
4747 [  --with-system-jpeg[=PFX]
4748                           Use system libjpeg [installed at prefix PFX]],
4749     JPEG_DIR=$withval)
4751 _SAVE_CFLAGS=$CFLAGS
4752 _SAVE_LDFLAGS=$LDFLAGS
4753 _SAVE_LIBS=$LIBS
4754 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4755     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4756     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4758 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4759     SYSTEM_JPEG=
4760 else
4761     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4764 if test "$SYSTEM_JPEG" = 1; then
4765     LIBS="$JPEG_LIBS $LIBS"
4766     AC_TRY_COMPILE([ #include <stdio.h>
4767                      #include <sys/types.h>
4768                      #include <jpeglib.h> ],
4769                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4770                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4771                      #endif ],
4772                    SYSTEM_JPEG=1,
4773                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4774 fi 
4775 CFLAGS=$_SAVE_CFLAGS
4776 LDFLAGS=$_SAVE_LDFLAGS
4777 LIBS=$_SAVE_LIBS
4779 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4780     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4781     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4784 dnl system ZLIB support
4785 dnl ========================================================
4786 MOZ_ARG_WITH_STRING(system-zlib,
4787 [  --with-system-zlib[=PFX]
4788                           Use system libz [installed at prefix PFX]],
4789     ZLIB_DIR=$withval)
4791 _SAVE_CFLAGS=$CFLAGS
4792 _SAVE_LDFLAGS=$LDFLAGS
4793 _SAVE_LIBS=$LIBS
4794 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4795     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4796     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4798 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4799     SYSTEM_ZLIB=
4800 else
4801     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4802         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4804 if test "$SYSTEM_ZLIB" = 1; then
4805     LIBS="$ZLIB_LIBS $LIBS"
4806     AC_TRY_COMPILE([ #include <stdio.h>
4807                      #include <string.h>
4808                      #include <zlib.h> ],
4809                    [ #if ZLIB_VERNUM < $MOZZLIB 
4810                      #error "Insufficient zlib version ($MOZZLIB required)."
4811                      #endif ],
4812                    SYSTEM_ZLIB=1,
4813                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4815 CFLAGS=$_SAVE_CFLAGS
4816 LDFLAGS=$_SAVE_LDFLAGS
4817 LIBS=$_SAVE_LIBS
4819 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4820     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4821     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4824 dnl system BZIP2 Support
4825 dnl ========================================================
4826 MOZ_ARG_WITH_STRING(system-bz2,
4827 [  --with-system-bz2[=PFX]
4828                           Use system libbz2 [installed at prefix PFX]],
4829     BZ2_DIR=$withval)
4831 _SAVE_CFLAGS=$CFLAGS
4832 _SAVE_LDFLAGS=$LDFLAGS
4833 _SAVE_LIBS=$LIBS
4834 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4835     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4836     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4838 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4839     SYSTEM_BZ2=
4840 else
4841     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4842         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4844 CFLAGS=$_SAVE_CFLAGS
4845 LDFLAGS=$_SAVE_LDFLAGS
4846 LIBS=$_SAVE_LIBS
4848 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4849     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4850     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4853 dnl system PNG Support
4854 dnl ========================================================
4855 MOZ_ARG_WITH_STRING(system-png, 
4856 [  --with-system-png[=PFX]
4857                           Use system libpng [installed at prefix PFX]],
4858     PNG_DIR=$withval)
4860 _SAVE_CFLAGS=$CFLAGS
4861 _SAVE_LDFLAGS=$LDFLAGS
4862 _SAVE_LIBS=$LIBS
4863 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4864 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4865 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4866     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4867     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4869 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4870     SYSTEM_PNG=
4871 else
4872     _SAVE_PNG_LIBS=$PNG_LIBS
4873     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4874                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4875                  $PNG_LIBS)
4876     AC_CHECK_LIB(png, png_get_acTL, ,
4877                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4878                  $_SAVE_PNG_LIBS)
4880 if test "$SYSTEM_PNG" = 1; then
4881     LIBS="$PNG_LIBS $LIBS"
4882     AC_TRY_COMPILE([ #include <stdio.h>
4883                      #include <sys/types.h>
4884                      #include <png.h> ],
4885                    [ #if PNG_LIBPNG_VER < $MOZPNG
4886                      #error "Insufficient libpng version ($MOZPNG required)."
4887                      #endif
4888                      #ifndef PNG_UINT_31_MAX
4889                      #error "Insufficient libpng version."
4890                      #endif ],
4891                    SYSTEM_PNG=1,
4892                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4894 CFLAGS=$_SAVE_CFLAGS
4895 LDFLAGS=$_SAVE_LDFLAGS
4896 LIBS=$_SAVE_LIBS
4898 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4899     PNG_CFLAGS="-I${PNG_DIR}/include"
4900     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4903 fi # SKIP_LIBRARY_CHECKS
4905 dnl system HunSpell Support
4906 dnl ========================================================
4907 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4908 [  --enable-system-hunspell
4909                           Use system hunspell (located with pkgconfig)],
4910     SYSTEM_HUNSPELL=1 )
4912 if test -n "$SYSTEM_HUNSPELL"; then
4913     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4916 AC_SUBST(SYSTEM_HUNSPELL)
4918 dnl ========================================================
4919 dnl Java SDK support
4920 dnl ========================================================
4921 JAVA_INCLUDE_PATH=
4922 MOZ_ARG_WITH_STRING(java-include-path,
4923 [  --with-java-include-path=dir
4924                           Location of Java SDK headers],
4925     JAVA_INCLUDE_PATH=$withval)
4927 JAVA_BIN_PATH=
4928 MOZ_ARG_WITH_STRING(java-bin-path,
4929 [  --with-java-bin-path=dir
4930                           Location of Java binaries (java, javac, jar)],
4931     JAVA_BIN_PATH=$withval)
4933 dnl ========================================================
4934 dnl =
4935 dnl = Application
4936 dnl =
4937 dnl ========================================================
4939 MOZ_ARG_HEADER(Application)
4941 BUILD_STATIC_LIBS=
4942 ENABLE_TESTS=1
4943 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4944 MOZ_BRANDING_DIRECTORY=
4945 MOZ_OFFICIAL_BRANDING=
4946 MOZ_FEEDS=1
4947 MOZ_INSTALLER=1
4948 MOZ_IPC=1
4949 MOZ_JAVAXPCOM=
4950 MOZ_JSDEBUGGER=1
4951 MOZ_JSLOADER=1
4952 MOZ_MATHML=1
4953 MOZ_MORK=
4954 MOZ_MORKREADER=1
4955 MOZ_AUTH_EXTENSION=1
4956 MOZ_NO_ACTIVEX_SUPPORT=1
4957 MOZ_NO_FAST_LOAD=
4958 MOZ_OGG=1
4959 MOZ_RAW=
4960 MOZ_SYDNEYAUDIO=
4961 MOZ_VORBIS=
4962 MOZ_TREMOR=
4963 MOZ_WAVE=1
4964 MOZ_MEDIA=
4965 MOZ_WEBM=1
4966 VPX_AS=
4967 VPX_ASFLAGS=
4968 VPX_AS_DASH_C_FLAG=
4969 VPX_AS_CONVERSION=
4970 VPX_ASM_SUFFIX=
4971 VPX_X86_ASM=
4972 VPX_ARM_ASM=
4973 MOZ_PANGO=1
4974 MOZ_PERMISSIONS=1
4975 MOZ_PLACES=1
4976 MOZ_PLAINTEXT_EDITOR_ONLY=
4977 MOZ_PLUGINS=1
4978 MOZ_PREF_EXTENSIONS=1
4979 MOZ_PROFILELOCKING=1
4980 MOZ_PSM=1
4981 MOZ_RDF=1
4982 MOZ_REFLOW_PERF=
4983 MOZ_SAFE_BROWSING=
4984 MOZ_FASTSTART=
4985 MOZ_HELP_VIEWER=
4986 MOZ_SPELLCHECK=1
4987 MOZ_SPLASHSCREEN=
4988 MOZ_STORAGE=1
4989 MOZ_SVG=1
4990 MOZ_THUMB2=
4991 MOZ_TIMELINE=
4992 MOZ_TOOLKIT_SEARCH=1
4993 MOZ_UI_LOCALE=en-US
4994 MOZ_UNIVERSALCHARDET=1
4995 MOZ_URL_CLASSIFIER=
4996 MOZ_USE_NATIVE_UCONV=
4997 MOZ_VIEW_SOURCE=1
4998 MOZ_XSLT_STANDALONE=
4999 MOZ_XTF=1
5000 MOZ_XUL=1
5001 MOZ_ZIPWRITER=1
5002 NS_PRINTING=1
5003 MOZ_PDF_PRINTING=
5004 MOZ_DISABLE_DOMCRYPTO=
5005 NSS_DISABLE_DBM=
5006 NECKO_WIFI=1
5007 NECKO_COOKIES=1
5008 NECKO_DISK_CACHE=1
5009 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource wyciwyg"
5010 USE_ARM_KUSER=
5011 BUILD_CTYPES=1
5012 XPC_IDISPATCH_SUPPORT=
5015 case "${target}" in
5016 *android*|*darwin*|*wince*|*winmo*)
5017     ACCESSIBILITY=
5018     ;;
5020     ACCESSIBILITY=1
5021     ;;
5022 esac
5024 case "$target_os" in
5025     msvc*|mks*|cygwin*|mingw*)
5026         NS_ENABLE_TSF=1
5027         if test -z "$GNU_CC"; then 
5028             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
5029                 NS_ENABLE_TSF=
5030             fi
5031         fi
5032         if test -n "$NS_ENABLE_TSF"; then
5033             AC_DEFINE(NS_ENABLE_TSF)
5034         fi
5035         ;;
5036 esac
5038 case "${target}" in
5039     arm-android-eabi)
5040         NSS_DISABLE_DBM=1
5041         USE_ARM_KUSER=1
5042         MOZ_INSTALLER=
5043         NECKO_WIFI=
5044         MOZ_THUMB2=1
5045         MOZ_THEME_FASTSTRIPE=1
5046         MOZ_TREE_FREETYPE=1
5047         MOZ_MEMORY=1
5048         ;;
5049 esac
5051 MOZ_ARG_ENABLE_STRING(application,
5052 [  --enable-application=APP
5053                           Options include:
5054                             browser (Firefox)
5055                             xulrunner
5056                             content/xslt (Standalone Transformiix XSLT)
5057                             netwerk (Standalone Necko)
5058                             tools/update-packaging (AUS-related packaging tools)
5059                             standalone (use this for standalone
5060                               xpcom/xpconnect or to manually drive a build)],
5061 [ MOZ_BUILD_APP=$enableval ] )
5063 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5064 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
5065   XULRUNNER_STUB_NAME=$withval)
5067 if test -z "$XULRUNNER_STUB_NAME"; then
5068   case "$target_os" in
5069   darwin*)
5070     XULRUNNER_STUB_NAME=xulrunner
5071     ;;
5072   *)
5073     XULRUNNER_STUB_NAME=xulrunner-stub
5074   esac
5076 AC_SUBST(XULRUNNER_STUB_NAME)
5078 if test -z "$MOZ_BUILD_APP"; then
5079   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5080 else
5081   # We have a valid application only if it has a build.mk file in its top
5082   # directory.
5083   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5084     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5085   fi
5088 # Allow the application to influence configure with a confvars.sh script.
5090 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5091 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5092   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5093   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5094 else
5095   AC_MSG_RESULT([no])
5098 # Now is a good time to test for logic errors, define mismatches, etc.
5099 case "$MOZ_BUILD_APP" in
5100 xulrunner)
5101   if test "$LIBXUL_SDK"; then
5102     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5103   fi
5104   ;;
5105 esac
5107 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5108 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5109 # MOZ_BUILD_APP.
5110 case "$MOZ_BUILD_APP" in
5111 browser)
5112   AC_DEFINE(MOZ_PHOENIX)
5113   ;;
5115 xulrunner)
5116   AC_DEFINE(MOZ_XULRUNNER)
5117   ;;
5119 content/xslt)
5120   AC_DEFINE(TX_EXE)
5121   ;;
5123 standalone) 
5124   MOZ_APP_NAME=mozilla
5125   MOZ_APP_DISPLAYNAME=Mozilla
5126   MOZ_APP_VERSION=$MOZILLA_VERSION
5127   ;;
5129 esac
5131 AC_SUBST(MOZ_BUILD_APP)
5132 AC_SUBST(MOZ_PHOENIX)
5133 AC_SUBST(MOZ_XULRUNNER)
5135 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5137 dnl ========================================================
5138 dnl = 
5139 dnl = Toolkit Options
5140 dnl = 
5141 dnl ========================================================
5142 MOZ_ARG_HEADER(Toolkit Options)
5144     dnl ========================================================
5145     dnl = Select the default toolkit
5146     dnl ========================================================
5147         MOZ_ARG_ENABLE_STRING(default-toolkit,
5148         [  --enable-default-toolkit=TK
5149                           Select default toolkit
5150                           Platform specific defaults:
5151                             BeOS - cairo-beos
5152                             Mac OS X - cairo-cocoa
5153                             Neutrino/QNX - photon
5154                             OS/2 - cairo-os2
5155                             Win32/WinCE - cairo-windows
5156                             Gtk2 with DirectFB - cairo-gtk2-dfb
5157                             * - cairo-gtk2
5158                             * - cairo-qt],
5159     [ _DEFAULT_TOOLKIT=$enableval ],
5160     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5162     if test "$_DEFAULT_TOOLKIT" = "photon" \
5163         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5164         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5165         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5166         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5167         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5168         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5169         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5170         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5171         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5172     then
5173         dnl nglayout only supports building with one toolkit,
5174         dnl so ignore everything after the first comma (",").
5175         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5176     else
5177         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5178     fi
5180 dnl ========================================================
5181 dnl = Enable the toolkit as needed                         =
5182 dnl ========================================================
5184 case "$MOZ_WIDGET_TOOLKIT" in
5185 photon)
5186         MOZ_ENABLE_PHOTON=1
5187         AC_DEFINE(MOZ_WIDGET_PHOTON)
5188     ;;
5190 cairo-windows)
5191     MOZ_WIDGET_TOOLKIT=windows
5192     MOZ_WEBGL=1
5193     case "${target}" in
5194     *-wince*)
5195         NS_PRINTING=
5196         ;;
5197     esac
5198     MOZ_PDF_PRINTING=1
5199     ;;
5201 cairo-gtk2|cairo-gtk2-x11)
5202     MOZ_WIDGET_TOOLKIT=gtk2
5203     MOZ_ENABLE_GTK2=1
5204     MOZ_ENABLE_XREMOTE=1
5205     MOZ_WEBGL=1
5206     MOZ_WEBGL_GLX=1
5208     AC_DEFINE(MOZ_X11)
5209     MOZ_X11=1
5210     USE_FC_FREETYPE=1
5212     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5213     TK_LIBS='$(MOZ_GTK2_LIBS)'
5214     AC_DEFINE(MOZ_WIDGET_GTK2)
5215     MOZ_PDF_PRINTING=1
5216     ;;
5218 cairo-gtk2-dfb)
5219     MOZ_WIDGET_TOOLKIT=gtk2
5220     MOZ_ENABLE_GTK2=1
5221     MOZ_WEBGL=
5223     AC_DEFINE(MOZ_DFB)
5224     MOZ_DFB=1
5226     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5227     TK_LIBS='$(MOZ_GTK2_LIBS)'
5228     AC_DEFINE(MOZ_WIDGET_GTK2)
5229     if test "$no_x" != "yes"; then
5230         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5231         no_x=yes
5232     fi
5233     MOZ_PDF_PRINTING=1
5234     ;;
5236 cairo-qt)
5237     MOZ_WIDGET_TOOLKIT=qt
5238     MOZ_ENABLE_QT=1
5239     MOZ_ENABLE_XREMOTE=1
5240     MOZ_WEBGL=1
5241     MOZ_WEBGL_GLX=1
5242     USE_ELF_DYNSTR_GC=
5244     AC_DEFINE(MOZ_X11)
5245     MOZ_X11=1
5246     USE_FC_FREETYPE=1
5248     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5249     TK_LIBS='$(MOZ_QT_LIBS)'
5250     AC_DEFINE(MOZ_WIDGET_QT)
5251     MOZ_PDF_PRINTING=1
5252     ;;
5254 cairo-beos)
5255     MOZ_WIDGET_TOOLKIT=beos
5256     USE_FC_FREETYPE=1
5257     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5258     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5259     ;;
5261 cairo-os2)
5262     MOZ_WIDGET_TOOLKIT=os2
5263     USE_FC_FREETYPE=1
5264     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5265     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5266     MOZ_PDF_PRINTING=1
5267     ;;
5269 cairo-cocoa)
5270     MOZ_WIDGET_TOOLKIT=cocoa
5271     AC_DEFINE(MOZ_WIDGET_COCOA)
5272     MOZ_USER_DIR="Mozilla"
5273     AC_DEFINE(XP_MACOSX)
5274     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5275     TK_CFLAGS="-DNO_X11"
5276     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5277     CFLAGS="$CFLAGS $TK_CFLAGS"
5278     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5279     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5280     MOZ_FS_LAYOUT=bundle
5281     MOZ_WEBGL=1
5282     ;;
5284 cairo-android)
5285     AC_DEFINE(MOZ_WIDGET_ANDROID)
5286     MOZ_WIDGET_TOOLKIT=android
5287     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5288     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5289     MOZ_WEBGL=1
5290     MOZ_PDF_PRINTING=1
5291     ;;
5293 esac
5295 AC_SUBST(MOZ_PDF_PRINTING)
5296 if test "$MOZ_PDF_PRINTING"; then
5297    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
5298    AC_DEFINE(MOZ_PDF_PRINTING)
5301 if test "$MOZ_ENABLE_XREMOTE"; then
5302     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5305 if test "$COMPILE_ENVIRONMENT"; then
5306   if test "$MOZ_ENABLE_GTK2"; then
5307     if test "$MOZ_X11"; then
5308       GDK_PACKAGES=gdk-x11-2.0
5309     elif test "$MOZ_DFB"; then
5310       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5311       GDK_PACKAGES=directfb
5312     fi
5314     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5315   fi
5317 fi # COMPILE_ENVIRONMENT
5319 AC_SUBST(MOZ_FS_LAYOUT)
5321 dnl ========================================================
5322 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5323 dnl their usage and use them in spidermonkey.
5324 dnl ========================================================
5325 MOZ_ARG_WITH_BOOL(arm-kuser,
5326 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5327     USE_ARM_KUSER=1,)
5328 if test -n "$USE_ARM_KUSER"; then
5329    AC_DEFINE(USE_ARM_KUSER)
5332 dnl ========================================================
5333 dnl = startup-notification support module
5334 dnl ========================================================
5336 if test "$MOZ_ENABLE_GTK2"
5337 then
5338     MOZ_ENABLE_STARTUP_NOTIFICATION=
5340     MOZ_ARG_ENABLE_BOOL(startup-notification,
5341     [  --enable-startup-notification
5342                           Enable startup-notification support (default: disabled) ],
5343         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5344         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5345     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5346     then
5347         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5348                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5349         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5350             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5351             then
5352                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5353             fi
5354             MOZ_ENABLE_STARTUP_NOTIFICATION=
5355         ])
5356     fi
5358     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5359         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5360     fi
5362     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5364 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5365 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5366 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5368 dnl ========================================================
5369 dnl = QT support
5370 dnl ========================================================
5371 if test "$MOZ_ENABLE_QT"
5372 then
5373     MOZ_ARG_WITH_STRING(qtdir,
5374     [  --with-qtdir=\$dir       Specify Qt directory ],
5375     [ QTDIR=$withval])
5377     if test -z "$QTDIR"; then
5378         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5379         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5380     else
5381         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5383         MOZ_QT_CFLAGS="-DQT_SHARED"
5384         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5385         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5386         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5387         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5388         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5389         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5390         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5391         HOST_MOC="$QTDIR/bin/moc"
5392     fi
5393     if test -z "$HOST_MOC"; then
5394         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5395 incorrect])
5396     fi
5397     MOC=$HOST_MOC
5399     MOZ_ENABLE_QTNETWORK=
5400     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5401                       MOZ_ENABLE_QTNETWORK=1,
5402                       MOZ_ENABLE_QTNETWORK=)
5404     if test "$MOZ_ENABLE_QTNETWORK"; then
5405       MOZ_ENABLE_QTNETWORK=1
5406       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5407     fi
5410 AC_SUBST(GTK_CONFIG)
5411 AC_SUBST(TK_CFLAGS)
5412 AC_SUBST(TK_LIBS)
5414 AC_SUBST(MOZ_ENABLE_GTK2)
5415 AC_SUBST(MOZ_ENABLE_PHOTON)
5416 AC_SUBST(MOZ_ENABLE_QT)
5417 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5418 AC_SUBST(MOZ_ENABLE_XREMOTE)
5419 AC_SUBST(MOZ_GTK2_CFLAGS)
5420 AC_SUBST(MOZ_GTK2_LIBS)
5421 AC_SUBST(MOZ_QT_CFLAGS)
5422 AC_SUBST(MOZ_QT_LIBS)
5423 AC_SUBST(MOZ_ENABLE_MEEGOTOUCH)
5425 AC_SUBST(MOC)
5427 AC_SUBST(MOZ_DFB)
5428 AC_SUBST(MOZ_X11)
5430 dnl ========================================================
5431 dnl =
5432 dnl = Components & Features
5433 dnl = 
5434 dnl ========================================================
5435 MOZ_ARG_HEADER(Components and Features)
5437 dnl ========================================================
5438 dnl = Localization
5439 dnl ========================================================
5440 MOZ_ARG_ENABLE_STRING(ui-locale,
5441 [  --enable-ui-locale=ab-CD
5442                           Select the user interface locale (default: en-US)],
5443     MOZ_UI_LOCALE=$enableval )
5444 AC_SUBST(MOZ_UI_LOCALE)
5446 dnl ========================================================
5447 dnl = Trademarked Branding 
5448 dnl ========================================================
5449 MOZ_ARG_ENABLE_BOOL(official-branding,
5450 [  --enable-official-branding
5451                           Enable Official mozilla.org Branding
5452                           Do not distribute builds with
5453                           --enable-official-branding unless you have
5454                           permission to use trademarks per
5455                           http://www.mozilla.org/foundation/trademarks/ .],
5457   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5458     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5459   else
5460     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5461     MOZ_OFFICIAL_BRANDING=1
5462   fi
5463 ], MOZ_OFFICIAL_BRANDING=)
5465 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5466 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5467   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5470 MOZ_ARG_WITH_STRING(branding,
5471 [  --with-branding=dir     Use branding from the specified directory.],
5472     MOZ_BRANDING_DIRECTORY=$withval)
5474 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5475 if test -z "$REAL_BRANDING_DIRECTORY"; then
5476   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5479 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5480   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5483 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5485 dnl ========================================================
5486 dnl = Distribution ID
5487 dnl ========================================================
5488 MOZ_ARG_WITH_STRING(distribution-id,
5489 [  --with-distribution-id=ID
5490                           Set distribution-specific id (default=org.mozilla)],
5491 [ val=`echo $withval`
5492     MOZ_DISTRIBUTION_ID="$val"])
5494 if test -z "$MOZ_DISTRIBUTION_ID"; then
5495    MOZ_DISTRIBUTION_ID="org.mozilla"
5498 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5499 AC_SUBST(MOZ_DISTRIBUTION_ID)
5502 dnl ========================================================
5503 dnl complex text support off by default
5504 dnl ========================================================
5505 MOZ_ARG_DISABLE_BOOL(pango,
5506 [  --disable-pango         Disable usage of Pango ],
5507     MOZ_PANGO=,
5508     MOZ_PANGO=1)
5510 dnl ========================================================
5511 dnl = Pango
5512 dnl ========================================================
5513 if test "$MOZ_ENABLE_GTK2"
5514 then
5515     AC_SUBST(MOZ_PANGO)
5517     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5519     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5520     AC_SUBST(MOZ_PANGO_CFLAGS)
5521     AC_SUBST(MOZ_PANGO_LIBS)
5522     if test "$MOZ_PANGO"
5523     then
5524         AC_DEFINE(MOZ_PANGO)
5525     else
5526         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5527         AC_SUBST(FT2_CFLAGS)
5528         AC_SUBST(FT2_LIBS)
5529     fi
5532 if test "$MOZ_ENABLE_QT"
5533 then
5534     if test "$MOZ_PANGO"
5535     then
5536         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5537         [
5538             AC_SUBST(MOZ_PANGO_CFLAGS)
5539             AC_SUBST(MOZ_PANGO_LIBS)
5540             AC_DEFINE(MOZ_PANGO)
5541         ],
5542         [
5543             echo "Pango library not found, will use FT2 font engine"
5544             MOZ_PANGO=
5545         ])
5546     fi
5547     AC_SUBST(MOZ_PANGO)
5550 dnl ========================================================
5551 dnl = GnomeVFS, GIO and GConf support module
5552 dnl ========================================================
5554 if test "$MOZ_X11"
5555 then
5556     dnl build the gnomevfs extension by default only when the
5557     dnl GTK2 toolkit is in use.
5558     if test "$MOZ_ENABLE_GTK2"
5559     then
5560         MOZ_ENABLE_GNOMEVFS=1
5561         MOZ_ENABLE_GCONF=1
5562     fi
5564     dnl ========================================================
5565     dnl = GnomeVFS support module
5566     dnl ========================================================
5567     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5568     [  --disable-gnomevfs      Disable GnomeVFS support ],
5569         MOZ_ENABLE_GNOMEVFS=,
5570         MOZ_ENABLE_GNOMEVFS=force)
5572     if test "$MOZ_ENABLE_GNOMEVFS"
5573     then
5574         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5575             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5576             MOZ_ENABLE_GNOMEVFS=1
5577             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5578         ],[
5579             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5580             then
5581                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5582             fi
5583             MOZ_ENABLE_GNOMEVFS=
5584         ])
5585     else
5586         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5587             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5588               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5589             ])
5590         fi
5591     fi
5593     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5594     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5595     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5597     dnl ========================================================
5598     dnl = GIO support module
5599     dnl ========================================================
5600     MOZ_ARG_ENABLE_BOOL(gio,
5601     [  --enable-gio            Enable GIO support (default: disabled)],
5602         MOZ_ENABLE_GIO=force,
5603         MOZ_ENABLE_GIO=)
5605     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5606     then
5607         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5608             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5609             MOZ_ENABLE_GIO=1
5610             AC_DEFINE(MOZ_ENABLE_GIO)
5611         ],[
5612             if test "$MOZ_ENABLE_GIO" = "force"
5613             then
5614                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5615             fi
5616             MOZ_ENABLE_GIO=
5617         ])
5618     fi
5620     AC_SUBST(MOZ_ENABLE_GIO)
5621     AC_SUBST(MOZ_GIO_CFLAGS)
5622     AC_SUBST(MOZ_GIO_LIBS)
5623    
5624     dnl ========================================================
5625     dnl = GConf support module
5626     dnl ========================================================
5627     if test "$MOZ_ENABLE_GCONF"
5628     then
5629         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5630             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5631             MOZ_ENABLE_GCONF=1
5632         ],[
5633             if test "$MOZ_ENABLE_GCONF" = "force"
5634             then
5635                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5636             fi
5637             MOZ_ENABLE_GCONF=
5638         ])
5639     fi
5641     if test "$MOZ_ENABLE_GCONF"; then
5642         AC_DEFINE(MOZ_ENABLE_GCONF)
5643     fi
5645     AC_SUBST(MOZ_ENABLE_GCONF)
5646     AC_SUBST(MOZ_GCONF_CFLAGS)
5647     AC_SUBST(MOZ_GCONF_LIBS)
5650 dnl ========================================================
5651 dnl = libproxy support
5652 dnl ========================================================
5654 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5655 then
5656     MOZ_ENABLE_LIBPROXY=
5658     MOZ_ARG_ENABLE_BOOL(libproxy,
5659     [  --enable-libproxy         Enable libproxy support ],
5660     MOZ_ENABLE_LIBPROXY=1,
5661     MOZ_ENABLE_LIBPROXY=)
5663     if test "$MOZ_ENABLE_LIBPROXY"
5664     then
5665         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5666         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5667     fi
5669 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5670 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5671 AC_SUBST(MOZ_LIBPROXY_LIBS)
5673 dnl ========================================================
5674 dnl = libnotify support
5675 dnl ========================================================
5677 if test "$MOZ_ENABLE_GTK2"
5678 then
5679     MOZ_ENABLE_LIBNOTIFY=1
5681     MOZ_ARG_DISABLE_BOOL(libnotify,
5682     [  --disable-libnotify     Disable libnotify support ],
5683     MOZ_ENABLE_LIBNOTIFY=,
5684     MOZ_ENABLE_LIBNOTIFY=1)
5686     if test "$MOZ_ENABLE_LIBNOTIFY"
5687     then
5688         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5689     fi
5692 if test -z "$SKIP_LIBRARY_CHECKS"
5693 then
5694     if test "$MOZ_ENABLE_GTK2"
5695     then
5696         if test "$MOZ_ENABLE_LIBNOTIFY"
5697         then
5698             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5699         fi
5700     fi
5702 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5703 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5704 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5706 dnl ========================================================
5707 dnl = GNOME component (mozgnome)
5708 dnl ========================================================
5710 # The GNOME component is built if one of 
5711 # gnome-vfs, gio, gconf or libnotify is available.
5712 if test "$MOZ_ENABLE_GCONF" -o \
5713    "$MOZ_ENABLE_GNOMEVFS" -o \
5714    "$MOZ_ENABLE_GIO" -o \
5715    "$MOZ_ENABLE_LIBNOTIFY"; then
5716     MOZ_ENABLE_GNOME_COMPONENT=1
5717 else
5718     MOZ_ENABLE_GNOME_COMPONENT=
5720 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5722 dnl ========================================================
5723 dnl = libgnomeui support module
5724 dnl ========================================================
5726 if test "$MOZ_ENABLE_GTK2"
5727 then
5728     MOZ_ENABLE_GNOMEUI=1
5730     MOZ_ARG_DISABLE_BOOL(gnomeui,
5731     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5732         MOZ_ENABLE_GNOMEUI=,
5733         MOZ_ENABLE_GNOMEUI=force)
5735     if test "$MOZ_ENABLE_GNOMEUI"
5736     then
5737         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5738         [
5739             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5740             MOZ_ENABLE_GNOMEUI=1
5741         ],[
5742             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5743             then
5744                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5745             fi
5746             MOZ_ENABLE_GNOMEUI=
5747         ])
5748     fi
5750     if test "$MOZ_ENABLE_GNOMEUI"; then
5751         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5752     fi
5755 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5756 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5757 AC_SUBST(MOZ_GNOMEUI_LIBS)
5759 dnl ========================================================
5760 dnl = dbus support
5761 dnl ========================================================
5763 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5764 then
5765     MOZ_ENABLE_DBUS=1
5767     MOZ_ARG_DISABLE_BOOL(dbus,
5768     [  --disable-dbus          Disable dbus support ],
5769         MOZ_ENABLE_DBUS=,
5770         MOZ_ENABLE_DBUS=1)
5772     if test "$MOZ_ENABLE_DBUS"
5773     then
5774         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5775         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5776         AC_DEFINE(MOZ_ENABLE_DBUS)
5777     fi
5779 AC_SUBST(MOZ_ENABLE_DBUS)
5780 AC_SUBST(MOZ_DBUS_CFLAGS)
5781 AC_SUBST(MOZ_DBUS_LIBS)
5782 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5783 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5785 dnl ========================================================
5786 dnl = Build Personal Security Manager
5787 dnl ========================================================
5788 MOZ_ARG_DISABLE_BOOL(crypto,
5789 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5790     MOZ_PSM=,
5791     MOZ_PSM=1 )
5793 dnl ========================================================
5794 dnl = JS Debugger XPCOM component (js/jsd)
5795 dnl ========================================================
5796 MOZ_ARG_DISABLE_BOOL(jsd,
5797 [  --disable-jsd           Disable JavaScript debug library],
5798     MOZ_JSDEBUGGER=,
5799     MOZ_JSDEBUGGER=1)
5802 dnl ========================================================
5803 dnl = Disable IPC support for tabs and plugins
5804 dnl ========================================================
5805 MOZ_ARG_DISABLE_BOOL(ipc,
5806 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5807     MOZ_IPC=,
5808     MOZ_IPC=1)
5810 if test -n "$MOZ_IPC"; then
5811     AC_DEFINE(MOZ_IPC)
5814 AC_SUBST(MOZ_IPC)
5816 dnl ========================================================
5817 dnl = Enable IPDL's "expensive" unit tests
5818 dnl ========================================================
5819 MOZ_IPDL_TESTS=
5821 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5822 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5823     MOZ_IPDL_TESTS=1,
5824     MOZ_IPDL_TESTS=)
5826 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5827     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5830 if test -n "$MOZ_IPDL_TESTS"; then
5831     AC_DEFINE(MOZ_IPDL_TESTS)
5834 AC_SUBST(MOZ_IPDL_TESTS)
5836 dnl ========================================================
5837 dnl = Disable plugin support
5838 dnl ========================================================
5839 MOZ_ARG_DISABLE_BOOL(plugins,
5840 [  --disable-plugins       Disable plugins support],
5841     MOZ_PLUGINS=,
5842     MOZ_PLUGINS=1)
5844 dnl ========================================================
5845 dnl = Disable building dbm
5846 dnl ========================================================
5847 MOZ_ARG_DISABLE_BOOL(dbm,
5848 [  --disable-dbm           Disable building dbm],
5849     NSS_DISABLE_DBM=1,
5850     NSS_DISABLE_DBM=)
5852 dnl bi-directional support always on
5853 IBMBIDI=1
5854 AC_DEFINE(IBMBIDI)
5856 dnl ========================================================
5857 dnl view source support on by default
5858 dnl ========================================================
5859 if test "$MOZ_VIEW_SOURCE"; then
5860     AC_DEFINE(MOZ_VIEW_SOURCE)
5863 dnl ========================================================
5864 dnl accessibility support on by default on all platforms 
5865 dnl except OS X.
5866 dnl ========================================================
5867 MOZ_ARG_DISABLE_BOOL(accessibility,
5868 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5869     ACCESSIBILITY=,
5870     ACCESSIBILITY=1 )
5871 if test "$ACCESSIBILITY"; then
5872     AC_DEFINE(ACCESSIBILITY)
5875 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5876 case "$target" in
5877 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5878     if test "$ac_cv_header_atlbase_h" = "no"; then
5879         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.])
5880     fi
5881     if test "$ac_cv_header_oleacc_idl" = "no"; then
5882         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.])
5883     fi
5884     ;;
5885 esac
5888 dnl ========================================================
5889 dnl xpcom js loader support on by default
5890 dnl ========================================================
5891 if test "$MOZ_JSLOADER"; then
5892     AC_DEFINE(MOZ_JSLOADER)
5895 dnl ========================================================
5896 dnl Disable printing
5897 dnl ========================================================
5898 MOZ_ARG_DISABLE_BOOL(printing,
5899 [  --disable-printing      Disable printing support],
5900     NS_PRINTING=,
5901     NS_PRINTING=1)
5903 if test "$NS_PRINTING"; then
5904     AC_DEFINE(NS_PRINTING)
5905     AC_DEFINE(NS_PRINT_PREVIEW)
5907 dnl ========================================================
5908 dnl use native unicode converters
5909 dnl ========================================================
5910 MOZ_ARG_ENABLE_BOOL(native-uconv,
5911 [  --enable-native-uconv   Enable iconv support],
5912     MOZ_USE_NATIVE_UCONV=1,
5913     MOZ_USE_NATIVE_UCONV= )
5914 if test "$MOZ_USE_NATIVE_UCONV"; then
5915     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5917 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5918     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5922 dnl ========================================================
5923 dnl Libeditor can be build as plaintext-only,
5924 dnl or as a full html and text editing component.
5925 dnl We build both by default.
5926 dnl ========================================================
5927 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5928 [  --enable-plaintext-editor-only
5929                           Allow only plaintext editing],
5930     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5931     MOZ_PLAINTEXT_EDITOR_ONLY= )
5932 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5933 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5935 dnl ========================================================
5936 dnl = Disable Fast Load
5937 dnl ========================================================
5938 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5939 [  --disable-xpcom-fastload
5940                           Disable XPCOM fastload support],
5941     MOZ_NO_FAST_LOAD=1,
5942     MOZ_NO_FAST_LOAD=)
5944 AC_SUBST(MOZ_NO_FAST_LOAD)
5946 if test -n "$MOZ_NO_FAST_LOAD"; then
5947     AC_DEFINE(MOZ_NO_FAST_LOAD)
5950 dnl ========================================================
5951 dnl = Enable Raw Codecs
5952 dnl ========================================================
5953 MOZ_ARG_ENABLE_BOOL(raw,
5954 [  --enable-raw           Enable support for RAW media],
5955     MOZ_RAW=1,
5956     MOZ_RAW=)
5958 if test -n "$MOZ_RAW"; then
5959     AC_DEFINE(MOZ_RAW)
5960     MOZ_MEDIA=1
5963 AC_SUBST(MOZ_RAW)
5965 dnl ========================================================
5966 dnl = Disable Ogg Codecs
5967 dnl ========================================================
5968 MOZ_ARG_DISABLE_BOOL(ogg,
5969 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5970     MOZ_OGG=,
5971     MOZ_OGG=1)
5973 if test -n "$MOZ_OGG"; then
5974     AC_DEFINE(MOZ_OGG)
5975     MOZ_SYDNEYAUDIO=1
5976     MOZ_MEDIA=1
5977     case "$target_cpu" in
5978     arm*)
5979         MOZ_TREMOR=1
5980     ;;
5981     *)
5982         MOZ_VORBIS=1
5983     ;;
5984     esac
5986     dnl Checks for __attribute__(aligned()) directive
5987     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5988         [ac_cv_c_attribute_aligned],
5989         [ac_cv_c_attribute_aligned=0
5990          CFLAGS_save="${CFLAGS}"
5991          CFLAGS="${CFLAGS} -Werror"
5992          for ac_cv_c_attr_align_try in 64 32 16 8; do
5993            echo "trying $ac_cv_c_attr_align_try"
5994            AC_TRY_COMPILE([],
5995                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5996                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5997            if test "$ac_cv_c_attribute_aligned" != 0; then
5998              break;
5999            fi
6000          done
6001            CFLAGS="${CFLAGS_save}"])
6002     if test "${ac_cv_c_attribute_aligned}" != "0"; then
6003       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
6004                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
6005     fi
6008 dnl ========================================================
6009 dnl = Disable VP8 decoder support
6010 dnl ========================================================
6011 MOZ_ARG_DISABLE_BOOL(webm,
6012 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
6013     MOZ_WEBM=,
6014     MOZ_WEBM=1)
6016 dnl system libvpx Support
6017 dnl ========================================================
6018 MOZ_ARG_WITH_STRING(system-libvpx,
6019 [  --with-system-libvpx=[PFX]
6020                           Use system libvpx [installed at prefix PFX]],
6021     LIBVPX_DIR=$withval)
6023 MOZ_NATIVE_LIBVPX=
6024 MOZ_LIBVPX_INCLUDES=
6025 MOZ_LIBVPX_LIBS=
6027 if test -n "$MOZ_WEBM"; then
6028     AC_DEFINE(MOZ_WEBM)
6030     if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
6031         _SAVE_CFLAGS=$CFLAGS
6032         _SAVE_LDFLAGS=$LDFLAGS
6033         _SAVE_LIBS=$LIBS
6034         if test "${LIBVPX_DIR}" = "yes"; then
6035             LIBVPX_DIR=/usr
6036         fi
6037         CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
6038         LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
6039         AC_CHECK_HEADER(vpx/vpx_decoder.h,
6040                         [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
6041                              AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
6042                          fi],
6043                         AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
6044         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
6045                      [MOZ_NATIVE_LIBVPX=1
6046                       MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
6047                       MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
6048                      ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
6049         CFLAGS=$_SAVE_CFLAGS
6050         LDFLAGS=$_SAVE_LDFLAGS
6051         LIBS=$_SAVE_LIBS
6052     fi
6055 AC_SUBST(MOZ_NATIVE_LIBVPX)
6056 AC_SUBST(MOZ_LIBVPX_INCLUDES)
6057 AC_SUBST(MOZ_LIBVPX_LIBS)
6059 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
6060     MOZ_SYDNEYAUDIO=1
6061     MOZ_MEDIA=1
6062     case "$target_cpu" in
6063     arm*)
6064         MOZ_TREMOR=1
6065     ;;
6066     *)
6067         MOZ_VORBIS=1
6068     ;;
6069     esac
6072     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
6073     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
6074     dnl We currently require gcc on all arm platforms.
6075     VPX_AS=$YASM
6076     VPX_ASM_SUFFIX=asm
6078     dnl See if we have assembly on this platform.  
6079     case "$OS_ARCH:$CPU_ARCH" in
6080     Linux:x86)
6081       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6082       VPX_X86_ASM=1
6083     ;;
6084     Linux:x86_64)
6085       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6086       VPX_X86_ASM=1
6087     ;;
6088     SunOS:x86)
6089       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6090       VPX_X86_ASM=1
6091     ;;
6092     SunOS:x86_64)
6093       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6094       VPX_X86_ASM=1
6095     ;;
6096     Darwin:x86)
6097       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
6098       VPX_X86_ASM=1
6099     ;;
6100     Darwin:x86_64)
6101       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
6102       VPX_X86_ASM=1
6103     ;;
6104     WINNT:x86_64)
6105       if test -z "$GNU_CC"; then
6106         VPX_ASFLAGS="-f x64 -rnasm -pnasm"
6107         VPX_X86_ASM=1
6108       fi
6109     ;;
6110     WINNT:x86)
6111       if test -z "$GNU_CC"; then
6112         dnl Check for yasm 1.1 or greater.
6113         if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
6114           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.])
6115         elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6116           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.])
6117         else
6118           VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
6119           VPX_X86_ASM=1
6120         fi
6121       fi
6122     ;;
6123     *:arm*)
6124       if test -n "$GNU_AS" ; then
6125         VPX_AS=$AS
6126         dnl These flags are a lie; they're just used to enable the requisite
6127         dnl opcodes; actual arch detection is done at runtime.
6128         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
6129         VPX_DASH_C_FLAG="-c"
6130         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
6131         VPX_ASM_SUFFIX="$ASM_SUFFIX"
6132         VPX_ARM_ASM=1
6133       fi
6134     esac
6136     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
6137       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.])
6138     fi
6140     if test -n "$VPX_X86_ASM"; then
6141       AC_DEFINE(VPX_X86_ASM)
6142     elif test -n "$VPX_ARM_ASM"; then
6143       AC_DEFINE(VPX_ARM_ASM)
6144     else
6145       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
6146     fi
6149 dnl ========================================================
6150 dnl = Disable Wave decoder support
6151 dnl ========================================================
6152 MOZ_ARG_DISABLE_BOOL(wave,
6153 [  --disable-wave          Disable Wave decoder support],
6154     MOZ_WAVE=,
6155     MOZ_WAVE=1)
6157 if test -n "$MOZ_WAVE"; then
6158     AC_DEFINE(MOZ_WAVE)
6159     MOZ_SYDNEYAUDIO=1
6160     MOZ_MEDIA=1
6163 dnl ========================================================
6164 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
6165 dnl ========================================================
6167 if test -n "$MOZ_SYDNEYAUDIO"; then
6168     AC_DEFINE(MOZ_SYDNEYAUDIO)
6171 if test -n "$MOZ_MEDIA"; then
6172     AC_DEFINE(MOZ_MEDIA)
6175 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
6176     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/])
6179 if test -n "$MOZ_VORBIS"; then
6180     AC_DEFINE(MOZ_VORBIS)
6183 if test -n "$MOZ_TREMOR"; then
6184     AC_DEFINE(MOZ_TREMOR)
6187 dnl ========================================================
6188 dnl = Check alsa availability on Linux if using sydneyaudio
6189 dnl ========================================================
6191 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6192 if test -n "$MOZ_SYDNEYAUDIO"; then
6193    case "$target_os" in
6194 linux*)
6195       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6196          [echo "$MOZ_ALSA_PKG_ERRORS"
6197           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.)])])
6198       ;;
6199    esac
6202 dnl ========================================================
6203 dnl Splashscreen
6204 dnl ========================================================
6205 AC_ARG_ENABLE(splashscreen,
6206               [  --enable-splashscreen   display splashscreen while loading (default=no)],
6207               [enable_splash="yes"],[enable_splash=""])
6208 if test "x$enable_splash" = "xyes"; then
6209   MOZ_SPLASHSCREEN=1
6210   AC_DEFINE(MOZ_SPLASHSCREEN)
6212 AC_SUBST(MOZ_SPLASHSCREEN)
6214 dnl ========================================================
6215 dnl Permissions System
6216 dnl ========================================================
6217 MOZ_ARG_DISABLE_BOOL(permissions,
6218 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
6219     MOZ_PERMISSIONS=,
6220     MOZ_PERMISSIONS=1
6223 dnl ========================================================
6224 dnl NegotiateAuth
6225 dnl ========================================================
6226 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6227 [  --disable-negotiateauth Disable GSS-API negotiation ],
6228     MOZ_AUTH_EXTENSION=,
6229     MOZ_AUTH_EXTENSION=1 )
6231 dnl ========================================================
6232 dnl XTF
6233 dnl ========================================================
6234 MOZ_ARG_DISABLE_BOOL(xtf,
6235 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
6236     MOZ_XTF=,
6237     MOZ_XTF=1 )
6238 if test "$MOZ_XTF"; then
6239   AC_DEFINE(MOZ_XTF)
6242 dnl ========================================================
6243 dnl Pref extensions (autoconfig and system-pref)
6244 dnl ========================================================
6245 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6246 [  --disable-pref-extensions
6247                           Disable pref extensions such as autoconfig and
6248                           system-pref],
6249   MOZ_PREF_EXTENSIONS=,
6250   MOZ_PREF_EXTENSIONS=1 )
6252 dnl ========================================================
6253 dnl = Universalchardet
6254 dnl ========================================================
6255 MOZ_ARG_DISABLE_BOOL(universalchardet,
6256 [  --disable-universalchardet
6257                           Disable universal encoding detection],
6258   MOZ_UNIVERSALCHARDET=,
6259   MOZ_UNIVERSALCHARDET=1 )
6261 dnl ========================================================
6262 dnl JavaXPCOM
6263 dnl ========================================================
6264 case "${target}" in
6265 *-wince*)
6266     MOZ_JAVAXPCOM=
6267     ;;
6268 esac
6270 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6271 [  --enable-javaxpcom
6272                           Enable Java-XPCOM bridge],
6273     MOZ_JAVAXPCOM=1,
6274     MOZ_JAVAXPCOM=)
6276 case "$host_os" in
6277   cygwin*|msvc*|mks*)
6278     if test -n "$JAVA_HOME"; then
6279       JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6280     fi
6281     ;;
6282   *mingw*)
6283     if test -n "$JAVA_HOME"; then
6284       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6285     fi
6286     ;;
6287 esac
6289 if test -n "${JAVA_BIN_PATH}"; then
6290   dnl Look for javac and jar in the specified path.
6291   JAVA_PATH="$JAVA_BIN_PATH"
6292 else
6293   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6294   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6297 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6298 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6299 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6301 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6302   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6303     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}])
6304   fi
6307 if test -n "${MOZ_JAVAXPCOM}"; then
6308   if test -n "${JAVA_INCLUDE_PATH}"; then
6309     dnl Make sure jni.h exists in the given include path.
6310     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6311       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6312     fi
6313   else
6314     case "$target_os" in
6315       darwin*)
6316         dnl Default to java system location
6317         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6318         ;;
6319       *)
6320         dnl Try $JAVA_HOME
6321         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6322         ;;
6323     esac
6324     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6325       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.])
6326     fi
6327   fi
6330 dnl ========================================================
6331 dnl = ANGLE OpenGL->D3D translator for WebGL
6332 dnl = * only applies to win32
6333 dnl = * enabled by default (shipping build); requires explicit --disable to disable
6334 dnl ========================================================
6335 MOZ_ANGLE=
6336 MOZ_DIRECTX_SDK_PATH=
6337 case "$target_os" in
6338     *msvc*|*mks*|*cygwin*|*mingw*)
6339         MOZ_ANGLE=1
6340         ;;
6341 esac
6343 if test -n "$MOZ_ANGLE"; then
6344 MOZ_ARG_DISABLE_BOOL(angle,
6345 [  --disable-angle     Disable building of ANGLE for WebGL->D3D translation],
6346     MOZ_ANGLE=,
6347     MOZ_ANGLE=1)
6349 if test -n "$MOZ_ANGLE"; then
6350   if test -z "$_WIN32_MSVC"; then
6351     AC_MSG_ERROR([Building ANGLE requires MSVC.  To build without ANGLE, reconfigure with --disable-angle.])
6352   fi
6354   AC_CHECK_HEADER(d3dx9.h, [], [MOZ_ANGLE=])
6356   if test -z "$MOZ_ANGLE"; then
6357     # Try again, but try to get the SDK path from the registry.  We're going to hardcode
6358     # the February 2010 SDK, since that's the one that's installed on the tinderboxen.
6359     MOZ_DIRECTX_SDK_PATH=`reg query 'HKLM\Software\Microsoft\DirectX\Microsoft DirectX SDK (February 2010)' //v InstallPath | grep REG_SZ | sed 's,  *, ,g' | cut -d' ' -f4-`
6360     if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
6361       if test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h && test -f "$MOZ_DIRECTX_SDK_PATH"/lib/x86/dxguid.lib ; then
6362         AC_MSG_WARN([Found DirectX SDK in registry, using $MOZ_DIRECTX_SDK_PATH])
6363         MOZ_ANGLE=1
6364       fi
6365     fi
6366   fi
6368   if test -z "$MOZ_ANGLE"; then
6369     AC_MSG_WARN([Couldn't find d3dx9.h in your INCLUDE path, needed for ANGLE.  Please install the February 2010 DirectX SDK, or make another version available in your LIB and INCLUDE path env variables.  To explicitly build without ANGLE, reconfigure with --disable-angle.])
6370     AC_MSG_WARN([This will become an error in the future.])
6371   fi
6375 dnl ========================================================
6376 dnl = Breakpad crash reporting (on by default on supported platforms)
6377 dnl ========================================================
6379 case $target in
6380 i?86-*-mingw*|x86_64-*-mingw*)
6381   MOZ_CRASHREPORTER=1
6382   ;;
6383 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6384   MOZ_CRASHREPORTER=1
6385   ;;
6386 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6387   MOZ_CRASHREPORTER=1
6388   ;;
6389 arm-android-eabi)
6390   MOZ_CRASHREPORTER=1
6391   ;;
6392 *solaris*)
6393   MOZ_CRASHREPORTER=1
6394   ;;
6395 esac
6397 MOZ_ARG_DISABLE_BOOL(crashreporter,
6398 [  --disable-crashreporter Disable breakpad crash reporting],
6399     MOZ_CRASHREPORTER=,
6400     MOZ_CRASHREPORTER=1)
6402 if test -n "$MOZ_CRASHREPORTER"; then
6403    AC_DEFINE(MOZ_CRASHREPORTER)
6405   if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6406     test -z "$SKIP_LIBRARY_CHECKS"; then
6407     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6408     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6409     AC_SUBST(MOZ_GTHREAD_LIBS)
6411     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.])])
6412   fi
6415 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6416 [  --with-crashreporter-enable-percent=NN
6417                           Enable sending crash reports by default on NN% of users. (default=100)],
6418 [ val=`echo $withval | sed 's/[^0-9]//g'`
6419     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6421 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6422    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6424 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6426 dnl ========================================================
6427 dnl = Enable compilation of specific extension modules
6428 dnl ========================================================
6430 MOZ_ARG_ENABLE_STRING(extensions,
6431 [  --enable-extensions     Enable extensions],
6432 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6433     if test "$option" = "yes" -o "$option" = "all"; then
6434         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6435     elif test "$option" = "no" -o "$option" = "none"; then
6436         MOZ_EXTENSIONS=""
6437     elif test "$option" = "default"; then
6438         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6439     elif test `echo "$option" | grep -c \^-` != 0; then
6440         option=`echo $option | sed 's/^-//'`
6441         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6442     else
6443         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6444     fi
6445 done],
6446     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6448 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6449     # Suppress warning on non-X11 platforms
6450     if test -n "$MOZ_X11"; then
6451         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6452     fi
6453     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6456 dnl Do not build gnomevfs with libxul based apps
6457 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6458     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6461 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6462     # Suppress warning on non-X11 platforms
6463     if test -n "$MOZ_X11"; then
6464         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6465     fi
6466     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6469 dnl Do not build gio with libxul based apps
6470 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6471     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6474 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6475     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6476     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6479 dnl This might be temporary: build tridentprofile only on Windows
6480 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6481     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6482     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6485 dnl cookie must be built before tridentprofile. put it at list's end.
6486 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6487   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6488   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6491 dnl xforms requires xtf
6492 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6493     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6494     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6497 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6498     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6499     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6502 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6503     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6504     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6507 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6508     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6509     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6512 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6513     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6514     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6517 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6518     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6519     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6522 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6523     AC_MSG_WARN([spellcheck is no longer an extension.])
6524     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6527 dnl Remove dupes
6528 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6530 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6531 dnl when trying to build a nonexistent extension.
6532 for extension in $MOZ_EXTENSIONS; do
6533     if test ! -d "${srcdir}/extensions/${extension}"; then
6534         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6535     fi
6536 done
6538 dnl ========================================================
6539 dnl MathML on by default
6540 dnl ========================================================
6541 MOZ_ARG_DISABLE_BOOL(mathml,
6542 [  --disable-mathml        Disable MathML support],
6543     MOZ_MATHML=,
6544     MOZ_MATHML=1 )
6545 if test "$MOZ_MATHML"; then
6546   AC_DEFINE(MOZ_MATHML)
6549 dnl ========================================================
6550 dnl Keeping AC_DEFINE(MOZ_SVG) for the moment in case of something needs it.
6551 dnl ========================================================
6552 AC_DEFINE(MOZ_SVG)
6554 dnl ========================================================
6555 dnl SMIL
6556 dnl ========================================================
6557 MOZ_SMIL=1
6558 MOZ_ARG_DISABLE_BOOL(smil,
6559 [  --disable-smil          Disable SMIL animation support],
6560     MOZ_SMIL=,
6561     MOZ_SMIL=1 )
6562 if test -n "$MOZ_SMIL"; then
6563   AC_DEFINE(MOZ_SMIL)
6566 dnl ========================================================
6567 dnl Build Freetype in the tree
6568 dnl ========================================================
6569 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6570 [  --enable-tree-freetype  Enable Tree FreeType],
6571     MOZ_TREE_FREETYPE=1,
6572     MOZ_TREE_FREETYPE= )
6573 if test -n "$MOZ_TREE_FREETYPE"; then
6574    if test -n "$_WIN32_MSVC"; then
6575       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6576    fi
6577    AC_DEFINE(MOZ_TREE_FREETYPE)
6578    AC_SUBST(MOZ_TREE_FREETYPE)
6579    MOZ_ENABLE_CAIRO_FT=1       
6580    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6581    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6582    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6583    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6584    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6585    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6586    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6587    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6588    AC_SUBST(CAIRO_FT_CFLAGS)
6592 dnl ========================================================
6593 dnl Installer
6594 dnl ========================================================
6595 case "$target_os" in
6596     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6597         MOZ_INSTALLER=1
6598         ;;
6599 esac
6601 MOZ_ARG_DISABLE_BOOL(installer,
6602 [  --disable-installer     Disable building of installer],
6603     MOZ_INSTALLER=,
6604     MOZ_INSTALLER=1)
6605 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6606     # Disable installer for Windows builds that use the new toolkit if the
6607     # required major version and minimum minor version of Unicode NSIS isn't in
6608     # the path.
6609     REQ_NSIS_MAJOR_VER=2
6610     MIN_NSIS_MINOR_VER=33
6611     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6612     if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6613         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.])
6614     fi
6615     changequote(,)
6616     MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6617     changequote([,])
6618     if test ! "$MAKENSISU_VER" = ""; then
6619         MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6620         MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6621     fi
6622     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6623     if test "$MAKENSISU_VER" = "" ||
6624        test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6625             ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6626         AC_MSG_RESULT([no])
6627         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.])
6628     fi
6629     AC_MSG_RESULT([yes])
6630     MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6633 AC_SUBST(MOZ_INSTALLER)
6635 AC_MSG_CHECKING([for tar archiver])
6636 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6637 if test -z "$TAR"; then
6638     AC_MSG_ERROR([no tar archiver found in \$PATH])
6640 AC_MSG_RESULT([$TAR])
6641 AC_SUBST(TAR)
6643 AC_MSG_CHECKING([for wget])
6644 AC_CHECK_PROGS(WGET, wget, "")
6645 AC_MSG_RESULT([$WGET])
6646 AC_SUBST(WGET)
6648 dnl ========================================================
6649 dnl Updater
6650 dnl ========================================================
6652 MOZ_ARG_DISABLE_BOOL(updater,
6653 [  --disable-updater       Disable building of updater],
6654     MOZ_UPDATER=,
6655     MOZ_UPDATER=1 )
6657 if test -n "$MOZ_UPDATER"; then
6658     AC_DEFINE(MOZ_UPDATER)
6661 # app update channel is 'default' when not supplied.
6662 MOZ_ARG_ENABLE_STRING([update-channel],
6663 [  --enable-update-channel=CHANNEL
6664                           Select application update channel (default=default)],
6665     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6667 if test -z "$MOZ_UPDATE_CHANNEL"; then
6668     MOZ_UPDATE_CHANNEL=default
6670 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6671 AC_SUBST(MOZ_UPDATE_CHANNEL)
6673 # tools/update-packaging is not checked out by default.
6674 MOZ_ARG_ENABLE_BOOL(update-packaging,
6675 [  --enable-update-packaging
6676                           Enable tools/update-packaging],
6677     MOZ_UPDATE_PACKAGING=1,
6678     MOZ_UPDATE_PACKAGING= )
6679 AC_SUBST(MOZ_UPDATE_PACKAGING)
6681 dnl ========================================================
6682 dnl ActiveX
6683 dnl ========================================================
6685 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6686 [  --disable-xpconnect-idispatch
6687                           Disable building of xpconnect support for IDispatch
6688                           (win32 only)],
6689     XPC_IDISPATCH_SUPPORT=,
6690     XPC_IDISPATCH_SUPPORT=1)
6691 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6693 MOZ_ARG_DISABLE_BOOL(activex,
6694 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6695     MOZ_NO_ACTIVEX_SUPPORT=1,
6696     MOZ_NO_ACTIVEX_SUPPORT= )
6697 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6699 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6700 [  --enable-activex-scripting
6701                           Enable building of ActiveX scripting support (win32)],
6702     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6703     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6704 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6706 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6707 then
6708     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6711 if test "$COMPILE_ENVIRONMENT" = "1"; then
6712 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6713 case "$target" in
6714 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6715     if test "$ac_cv_header_atlbase_h" = "no"; then
6716         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.])
6717     fi
6718     ;;
6719 esac
6723 dnl ========================================================
6724 dnl leaky
6725 dnl ========================================================
6726 MOZ_ARG_ENABLE_BOOL(leaky,
6727 [  --enable-leaky          Build leaky memory tool],
6728     MOZ_LEAKY=1,
6729     MOZ_LEAKY=)
6732 dnl ========================================================
6733 dnl build the tests by default
6734 dnl ========================================================
6735 MOZ_ARG_DISABLE_BOOL(tests,
6736 [  --disable-tests         Do not build test libraries & programs],
6737     ENABLE_TESTS=,
6738     ENABLE_TESTS=1 )
6740 dnl ========================================================
6741 dnl parental controls (for Windows Vista)
6742 dnl ========================================================
6743 MOZ_ARG_DISABLE_BOOL(parental-controls,
6744 [  --disable-parental-controls
6745                           Do not build parental controls],
6746    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6747    MOZ_DISABLE_PARENTAL_CONTROLS=)
6748 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6749     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6752 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6754 dnl ========================================================
6755 dnl = Disable DOMCrypto
6756 dnl ========================================================
6757 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6758     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6761 dnl ========================================================
6762 dnl =
6763 dnl = Module specific options
6764 dnl =
6765 dnl ========================================================
6766 MOZ_ARG_HEADER(Individual module options)
6768 dnl ========================================================
6769 dnl = Disable feed handling components
6770 dnl ========================================================
6771 MOZ_ARG_DISABLE_BOOL(feeds,
6772 [  --disable-feeds         Disable feed handling and processing components],
6773     MOZ_FEEDS=,
6774     MOZ_FEEDS=1 )
6775 if test -n "$MOZ_FEEDS"; then
6776     AC_DEFINE(MOZ_FEEDS)
6777 else
6778     if test "$MOZ_BUILD_APP" = "browser"; then
6779         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6780     fi
6783 dnl ========================================================
6784 dnl = Enable mozStorage
6785 dnl ========================================================
6786 dnl Implicitly enabled by default if building calendar or places
6787 MOZ_ARG_ENABLE_BOOL(storage,
6788 [  --enable-storage        Enable mozStorage module and related components],
6789     MOZ_STORAGE=1,
6790     MOZ_STORAGE= )
6791 if test -n "$MOZ_STORAGE"; then
6792     AC_DEFINE(MOZ_STORAGE)
6795 dnl ========================================================
6796 dnl Check for sqlite
6797 dnl ========================================================
6799 MOZ_NATIVE_SQLITE=
6800 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6801 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6802 MOZ_NATIVE_SQLITE=1,
6803 MOZ_NATIVE_SQLITE= )
6805 if test -z "$MOZ_NATIVE_SQLITE"
6806 then
6807     SQLITE_CFLAGS=
6808     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6809 else
6810     dnl ============================
6811     dnl === SQLite Version check ===
6812     dnl ============================
6813     dnl Check to see if the system SQLite package is new enough.
6814     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6816     dnl ==================================
6817     dnl === SQLITE_SECURE_DELETE check ===
6818     dnl ==================================
6819     dnl Check to see if the system SQLite package is compiled with
6820     dnl SQLITE_SECURE_DELETE enabled.
6821     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6822     _SAVE_CFLAGS="$CFLAGS"
6823     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6824     _SAVE_LIBS="$LIBS"
6825     LIBS="$LIBS $SQLITE_LIBS"
6826     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6827         AC_TRY_RUN([
6828             #include "sqlite3.h"
6830             int main(int argc, char **argv){
6831               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6832             }],
6833             ac_cv_sqlite_secure_delete=yes,
6834             ac_cv_sqlite_secure_delete=no,
6835             ac_cv_sqlite_secure_delete=no
6836         )
6837     ])
6838     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6839     CFLAGS="$_SAVE_CFLAGS"
6840     LIBS="$_SAVE_LIBS"
6841     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6842         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6843     fi
6845     dnl ===============================
6846     dnl === SQLITE_THREADSAFE check ===
6847     dnl ===============================
6848     dnl Check to see if the system SQLite package is compiled with
6849     dnl SQLITE_THREADSAFE enabled.
6850     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6851     _SAVE_CFLAGS="$CFLAGS"
6852     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6853     _SAVE_LIBS="$LIBS"
6854     LIBS="$LIBS $SQLITE_LIBS"
6855     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6856         AC_TRY_RUN([
6857             #include "sqlite3.h"
6859             int main(int argc, char **argv){
6860               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6861             }],
6862             ac_cv_sqlite_threadsafe=yes,
6863             ac_cv_sqlite_threadsafe=no,
6864             ac_cv_sqlite_threadsafe=no
6865         )
6866     ])
6867     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6868     CFLAGS="$_SAVE_CFLAGS"
6869     LIBS="$_SAVE_LIBS"
6870     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6871         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6872     fi
6874     dnl ================================
6875     dnl === SQLITE_ENABLE_FTS3 check ===
6876     dnl ================================
6877     dnl check to see if the system SQLite package is compiled with
6878     dnl SQLITE_ENABLE_FTS3 enabled.
6879     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6880     _SAVE_CFLAGS="$CFLAGS"
6881     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6882     _SAVE_LIBS="$LIBS"
6883     LIBS="$LIBS $SQLITE_LIBS"
6884     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6885         AC_TRY_RUN([
6886             #include "sqlite3.h"
6888             int main(int argc, char **argv){
6889               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6890             }],
6891             ac_cv_sqlite_enable_fts3=yes,
6892             ac_cv_sqlite_enable_fts3=no,
6893             ac_cv_sqlite_enable_fts3=no
6894         )
6895     ])
6896     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6897     CFLAGS="$_SAVE_CFLAGS"
6898     LIBS="$_SAVE_LIBS"
6899     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6900         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6901     fi
6903     dnl =========================================
6904     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6905     dnl =========================================
6906     dnl check to see if the system SQLite package is compiled with
6907     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6908     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6909     _SAVE_CFLAGS="$CFLAGS"
6910     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6911     _SAVE_LIBS="$LIBS"
6912     LIBS="$LIBS $SQLITE_LIBS"
6913     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6914         AC_TRY_RUN([
6915             #include "sqlite3.h"
6917             int main(int argc, char **argv){
6918               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6919             }],
6920             ac_cv_sqlite_enable_unlock_notify=yes,
6921             ac_cv_sqlite_enable_unlock_notify=no,
6922             ac_cv_sqlite_enable_unlock_notify=no
6923         )
6924     ])
6925     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6926     CFLAGS="$_SAVE_CFLAGS"
6927     LIBS="$_SAVE_LIBS"
6928     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6929         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6930     fi
6933 AC_SUBST(MOZ_NATIVE_SQLITE)
6935 dnl ========================================================
6936 dnl = Enable help viewer (off by default)
6937 dnl ========================================================
6938 if test -n "$MOZ_HELP_VIEWER"; then
6939      dnl Do this if defined in confvars.sh
6940      AC_DEFINE(MOZ_HELP_VIEWER)
6943 dnl ========================================================
6944 dnl = Enable safe browsing (anti-phishing)
6945 dnl ========================================================
6946 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6947 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6948     MOZ_SAFE_BROWSING=1,
6949     MOZ_SAFE_BROWSING= )
6950 if test -n "$MOZ_SAFE_BROWSING"; then
6951     AC_DEFINE(MOZ_SAFE_BROWSING)
6953 AC_SUBST(MOZ_SAFE_BROWSING)
6955 dnl ========================================================
6956 dnl = Enable faststart component
6957 dnl ========================================================
6958 MOZ_ARG_ENABLE_BOOL(faststart,
6959 [  --enable-faststart      Enable the faststart component],
6960     MOZ_FASTSTART=1,
6961     MOZ_FASTSTART= )
6962 if test -n "$MOZ_FASTSTART"; then
6963     AC_DEFINE(MOZ_FASTSTART)
6965 AC_SUBST(MOZ_FASTSTART)
6967 dnl ========================================================
6968 dnl = Enable url-classifier
6969 dnl ========================================================
6970 dnl Implicitly enabled by default if building with safe-browsing
6971 if test -n "$MOZ_SAFE_BROWSING"; then
6972     MOZ_URL_CLASSIFIER=1
6974 MOZ_ARG_ENABLE_BOOL(url-classifier,
6975 [  --enable-url-classifier Enable url classifier module],
6976     MOZ_URL_CLASSIFIER=1,
6977     MOZ_URL_CLASSIFIER= )
6978 if test -n "$MOZ_URL_CLASSIFIER"; then
6979     AC_DEFINE(MOZ_URL_CLASSIFIER)
6981 AC_SUBST(MOZ_URL_CLASSIFIER)
6983 dnl ========================================================
6984 dnl = Disable zipwriter
6985 dnl ========================================================
6986 MOZ_ARG_DISABLE_BOOL(zipwriter,
6987 [  --disable-zipwriter     Disable zipwriter component],
6988     MOZ_ZIPWRITER=,
6989     MOZ_ZIPWRITER=1 )
6990 AC_SUBST(MOZ_ZIPWRITER)
6992 dnl ========================================================
6993 dnl = libconic
6994 dnl ========================================================
6995 dnl superseded by QtNetwork starting from 4.7
6996 MOZ_ENABLE_LIBCONIC=1
6998 if test -n "$MOZ_ENABLE_QT"; then
6999   if test "$MOZ_ENABLE_QTNETWORK"; then
7000     MOZ_ENABLE_LIBCONIC=
7001   fi
7004 MOZ_ARG_DISABLE_BOOL(libconic,
7005 [  --disable-libconic      Disable libconic],
7006     MOZ_ENABLE_LIBCONIC=,
7007     MOZ_ENABLE_LIBCONIC=1 )
7009 if test -n "$MOZ_ENABLE_LIBCONIC"; then
7010     PKG_CHECK_MODULES(LIBCONIC, conic,
7011                       MOZ_ENABLE_LIBCONIC=1,
7012                       MOZ_ENABLE_LIBCONIC=)
7014 if test "$MOZ_ENABLE_LIBCONIC"; then
7015     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
7018 AC_SUBST(MOZ_ENABLE_LIBCONIC)
7019 AC_SUBST(LIBCONIC_CFLAGS)
7020 AC_SUBST(LIBCONIC_LIBS)
7022 dnl ========================================================
7023 dnl = Maemo checks
7024 dnl ========================================================
7026 MAEMO_SDK_TARGET_VER=-1
7028 MOZ_ARG_WITH_STRING(maemo-version,
7029 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
7030                           Maemo SDK Version],
7031   MAEMO_SDK_TARGET_VER=$withval)
7033 case "$MAEMO_SDK_TARGET_VER" in
7035     MOZ_PLATFORM_MAEMO=5
7036     ;;
7039     MOZ_PLATFORM_MAEMO=6
7040     ;;
7043     dnl We aren't compiling for Maemo, move on.
7044     ;;
7046     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
7047     ;;
7048 esac
7050 if test $MOZ_PLATFORM_MAEMO; then
7051    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
7053    if test -z "$MOZ_ENABLE_DBUS"; then
7054        AC_MSG_ERROR([DBus is required when building for Maemo])
7055    fi
7057    MOZ_GFX_OPTIMIZE_MOBILE=1
7058    MOZ_WEBGL_GLX=
7059    MOZ_MAEMO_LIBLOCATION=
7061    if test $MOZ_PLATFORM_MAEMO = 5; then
7062       dnl if we have Xcomposite we should also have Xdamage and Xfixes
7063       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
7064                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
7065       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
7066                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
7068       AC_SUBST(XCOMPOSITE_LIBS)
7070       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
7071       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
7072       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
7073       if test -z "$_LIB_FOUND"; then
7074          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
7075       fi
7078       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
7079       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
7080       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
7081       if test -z "$_LIB_FOUND"; then
7082          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
7083       fi
7085       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
7086       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
7087       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
7088       if test -z "$_LIB_FOUND"; then
7089          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
7090       fi
7092    fi
7093    if test $MOZ_PLATFORM_MAEMO = 6; then
7094       PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
7095       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
7096       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
7097       if test -z "$_LIB_FOUND"; then
7098          AC_MSG_ERROR([libcontentaction is required when build for Maemo])
7099       fi
7100      
7101      MOZ_THUMB2=1
7102      PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore)
7103      MOZ_ENABLE_MEEGOTOUCH=1
7104      AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
7105      MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
7106      MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
7107    fi
7109    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
7110    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
7111    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
7112    if test "$_LIB_FOUND"; then
7113       MOZ_MAEMO_LIBLOCATION=1
7114       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
7115    else
7116       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
7117    fi
7118    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
7120    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
7121    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
7122    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
7123    if test "$_LIB_FOUND"; then
7124       MOZ_ENABLE_MEEGOTOUCHSHARE=1
7125       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
7126    else
7127       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
7128    fi
7129    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
7131    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
7132    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
7135 dnl Setup default CPU arch for arm target
7136 case "$target_cpu" in
7137   arm*)
7138     MOZ_ARM_ARCH=armv7
7139   ;;
7140 esac
7141 dnl ========================================================
7142 dnl = Enable building the Thumb2 instruction set
7143 dnl ========================================================
7144 MOZ_ARG_ENABLE_BOOL(thumb2,
7145  [  --enable-thumb2         Enable Thumb2 instruction set (implies ARMv7)],
7146     MOZ_THUMB2=1,
7147     MOZ_THUMB2=)
7148 if test -n "$MOZ_THUMB2"; then
7149   MOZ_ARM_ARCH=armv7
7152 dnl ========================================================
7153 dnl = Enable building for ARM specific CPU features
7154 dnl ========================================================
7155 MOZ_ARG_WITH_STRING(cpu-arch,
7156 [  --with-cpu-arch=arch      Use specific arm architecture CPU features, default armv7],
7157     MOZ_ARM_ARCH=$withval)
7159 if test -n "$MOZ_THUMB2"; then
7160   case "$target_cpu" in
7161     arm*)
7162       if test "$MOZ_ARM_ARCH" != "armv7"; then
7163         AC_MSG_ERROR([--enable-thumb2 is not compatible with cpu-arch=$MOZ_ARM_ARCH])
7164       fi
7165       if test "$GNU_CC"; then
7166         AC_DEFINE(MOZ_THUMB2)
7167         AC_DEFINE(MOZ_ARM_ARCH)
7168         CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7169         CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7170         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
7171       else
7172         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
7173       fi
7174     ;;
7175     *)
7176       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
7177     ;;
7178   esac
7179 elif test "$MOZ_ARM_ARCH" = "armv7"; then
7180   case "$target_cpu" in
7181     arm*)
7182       if test "$GNU_CC"; then
7183         AC_DEFINE(MOZ_ARM_ARCH)
7184         CFLAGS="$CFLAGS -march=armv7-a -marm -Wa, -march=armv7-a -Wa, -marm"
7185         CXXFLAGS="$CXXFLAGS -march=armv7-a -marm -Wa, -march=armv7-a -Wa, -marm"
7186         ASFLAGS="$ASFLAGS -march=armv7-a -marm"
7187       else
7188         AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-GNU toolchains])
7189       fi
7190     ;;
7191     *)
7192       AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-ARM CPU architectures])
7193     ;;
7194   esac
7195 else
7196   case "$target_cpu" in
7197     arm*)
7198       if test "$GNU_CC"; then
7199         CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
7200         CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
7201         ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork"
7202       fi
7203       ;;
7204   esac
7207 AC_SUBST(MOZ_THUMB2)
7208 AC_SUBST(MOZ_ARM_ARCH)
7210 dnl ========================================================
7211 dnl = faststripe theme
7212 dnl ========================================================
7213 MOZ_ARG_ENABLE_BOOL(faststripe,
7214 [  --enable-faststripe     Use faststripe theme],
7215     MOZ_THEME_FASTSTRIPE=1,
7216     MOZ_THEME_FASTSTRIPE= )
7217 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7219 dnl ========================================================
7220 dnl =
7221 dnl = Feature options that require extra sources to be pulled
7222 dnl =
7223 dnl ========================================================
7224 dnl MOZ_ARG_HEADER(Features that require extra sources)
7226 dnl ========================================================
7227 dnl =
7228 dnl = Debugging Options
7229 dnl = 
7230 dnl ========================================================
7231 MOZ_ARG_HEADER(Debugging and Optimizations)
7233 dnl ========================================================
7234 dnl = Disable building with debug info.
7235 dnl = Debugging is OFF by default
7236 dnl ========================================================
7237 if test -z "$MOZ_DEBUG_FLAGS"; then
7238   MOZ_DEBUG_FLAGS="-g"
7241 MOZ_ARG_ENABLE_STRING(debug,
7242 [  --enable-debug[=DBG]    Enable building with developer debug info
7243                            (using compiler flags DBG)],
7244 [ if test "$enableval" != "no"; then
7245     MOZ_DEBUG=1
7246     if test -n "$enableval" -a "$enableval" != "yes"; then
7247         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7248         _MOZ_DEBUG_FLAGS_SET=1
7249     fi
7250   else
7251     MOZ_DEBUG=
7252   fi ],
7253   MOZ_DEBUG=)
7255 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7256 MOZ_ARG_WITH_STRING(debug-label,
7257 [  --with-debug-label=LABELS
7258                           Define DEBUG_<value> for each comma-separated
7259                           value given.],
7260 [ for option in `echo $withval | sed 's/,/ /g'`; do
7261     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7262 done])
7264 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7266 if test -n "$MOZ_DEBUG"; then
7267     AC_MSG_CHECKING([for valid debug flags])
7268     _SAVE_CFLAGS=$CFLAGS
7269     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7270     AC_TRY_COMPILE([#include <stdio.h>], 
7271         [printf("Hello World\n");],
7272         _results=yes,
7273         _results=no)
7274     AC_MSG_RESULT([$_results])
7275     if test "$_results" = "no"; then
7276         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7277     fi
7278     CFLAGS=$_SAVE_CFLAGS
7281 dnl ========================================================
7282 dnl enable mobile optimizations
7283 dnl ========================================================
7284 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7285 [  --enable-mobile-optimize
7286                           Enable mobile optimizations],
7287     MOZ_GFX_OPTIMIZE_MOBILE=1)
7289 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7291 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7292     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7295 dnl ========================================================
7296 dnl = Enable code optimization. ON by default.
7297 dnl ========================================================
7298 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7299         MOZ_OPTIMIZE_FLAGS="-O"
7302 MOZ_ARG_ENABLE_STRING(optimize,
7303 [  --disable-optimize      Disable compiler optimization
7304   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7305 [ if test "$enableval" != "no"; then
7306     MOZ_OPTIMIZE=1
7307     if test -n "$enableval" -a "$enableval" != "yes"; then
7308         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7309         MOZ_OPTIMIZE=2
7310     fi
7311 else
7312     MOZ_OPTIMIZE=
7313 fi ], MOZ_OPTIMIZE=1)
7315 if test "$COMPILE_ENVIRONMENT"; then
7316 if test -n "$MOZ_OPTIMIZE"; then
7317     AC_MSG_CHECKING([for valid optimization flags])
7318     _SAVE_CFLAGS=$CFLAGS
7319     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7320     AC_TRY_COMPILE([#include <stdio.h>], 
7321         [printf("Hello World\n");],
7322         _results=yes,
7323         _results=no)
7324     AC_MSG_RESULT([$_results])
7325     if test "$_results" = "no"; then
7326         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7327     fi
7328     CFLAGS=$_SAVE_CFLAGS
7330 fi # COMPILE_ENVIRONMENT
7332 AC_SUBST(MOZ_OPTIMIZE)
7333 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7334 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7335 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7337 dnl ========================================================
7338 dnl = (Deprecated) generation of debugger info for specific modules
7339 dnl ========================================================
7340 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7341 [  --enable-debugger-info-modules
7342                           Enable/disable debugger info for specific modules],
7343 [ if test "$enableval" != "no"; then
7344     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7345     MOZ_DEBUG_SYMBOLS=1
7346   fi ])
7348 dnl ========================================================
7349 dnl = Enable generation of debug symbols
7350 dnl ========================================================
7351 MOZ_ARG_ENABLE_STRING(debug-symbols,
7352 [  --enable-debug-symbols[=DBG]
7353                           Enable debugging symbols (using compiler flags DBG)],
7354 [ if test "$enableval" != "no"; then
7355       MOZ_DEBUG_SYMBOLS=1
7356       if test -n "$enableval" -a "$enableval" != "yes"; then
7357           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7358               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7359           else
7360               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7361           fi
7362       fi
7363   fi ])
7365 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7366     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7367     export MOZ_DEBUG_SYMBOLS
7370 dnl ========================================================
7371 dnl = Disable any treating of compile warnings as errors
7372 dnl ========================================================
7373 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7374 [  --disable-warnings-as-errors
7375                           Disable treating of warnings as errors],
7376     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7377     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7378 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7379    WARNINGS_AS_ERRORS=''
7382 dnl ========================================================
7383 dnl = Disable runtime logging checks
7384 dnl ========================================================
7385 MOZ_ARG_DISABLE_BOOL(logging,
7386 [  --disable-logging       Disable logging facilities],
7387     NS_DISABLE_LOGGING=1,
7388     NS_DISABLE_LOGGING= )
7389 if test "$NS_DISABLE_LOGGING"; then
7390     AC_DEFINE(NS_DISABLE_LOGGING)
7391 else
7392     AC_DEFINE(MOZ_LOGGING)
7395 dnl ========================================================
7396 dnl = This will enable logging of addref, release, ctor, dtor.
7397 dnl ========================================================
7398 _ENABLE_LOGREFCNT=42
7399 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7400 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7401     _ENABLE_LOGREFCNT=1,
7402     _ENABLE_LOGREFCNT= )
7403 if test "$_ENABLE_LOGREFCNT" = "1"; then
7404     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7405 elif test -z "$_ENABLE_LOGREFCNT"; then
7406     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7409 dnl ========================================================
7410 dnl = Enable trace malloc
7411 dnl ========================================================
7412 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7413 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7414 [  --enable-trace-malloc   Enable malloc tracing],
7415     NS_TRACE_MALLOC=1,
7416     NS_TRACE_MALLOC= )
7417 if test "$NS_TRACE_MALLOC"; then
7418   # Please, Mr. Linker Man, don't take away our symbol names
7419   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7420   USE_ELF_DYNSTR_GC=
7421   AC_DEFINE(NS_TRACE_MALLOC)
7423 AC_SUBST(NS_TRACE_MALLOC)
7425 dnl ========================================================
7426 dnl = Enable jemalloc
7427 dnl ========================================================
7428 MOZ_ARG_ENABLE_BOOL(jemalloc,
7429 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7430     MOZ_MEMORY=1,
7431     MOZ_MEMORY=)
7433 if test "$NS_TRACE_MALLOC"; then
7434     MOZ_MEMORY=
7437 if test "$MOZ_MEMORY"; then
7439   dnl Don't try to run compiler tests on Windows  
7440   if test "$OS_ARCH" = "WINNT"; then
7441     if test -z "$HAVE_64BIT_OS"; then
7442       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7443     else
7444       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7445     fi
7446   else
7447     AC_CHECK_SIZEOF([int *], [4])
7448     case "${ac_cv_sizeof_int_p}" in
7449     4)
7450       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7451       ;;
7452     8)
7453       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7454       ;;
7455     *)
7456       AC_MSG_ERROR([Unexpected pointer size])
7457       ;;
7458     esac
7459   fi
7461   AC_DEFINE(MOZ_MEMORY)
7462   if test "x$MOZ_DEBUG" = "x1"; then
7463     AC_DEFINE(MOZ_MEMORY_DEBUG)
7464   fi
7465   dnl The generic feature tests that determine how to compute ncpus are long and
7466   dnl complicated.  Therefore, simply define special cpp variables for the
7467   dnl platforms we have special knowledge of.
7468   case "${target}" in
7469   *-darwin*)
7470     AC_DEFINE(MOZ_MEMORY_DARWIN)
7471     ;;
7472   *-*freebsd*)
7473     AC_DEFINE(MOZ_MEMORY_BSD)
7474     ;;
7475   *-*linux*)
7476     AC_DEFINE(MOZ_MEMORY_LINUX)
7477     ;;
7478   *-netbsd*)
7479     AC_DEFINE(MOZ_MEMORY_BSD)
7480     ;;
7481   *-solaris*)
7482     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7483     ;;
7484   *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7485     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7486     dnl This is sort of awful. Will revisit if we add support for more versions
7487     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7488         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7489     fi
7490     if test -z "$WIN32_CRT_SRC_DIR"; then
7491       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7492         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).])
7493       else
7494         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7495       fi
7496     fi
7497     dnl cpu check
7498     case "${target_cpu}" in
7499     i*86)
7500       MOZ_CRT_CPU_ARCH=intel
7501       ;;
7502     x86_64)
7503       MOZ_CRT_CPU_ARCH=amd64
7504       ;;
7505     *)
7506       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7507       ;;
7508     esac
7510     AC_SUBST(MOZ_CRT_CPU_ARCH)
7512     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7513       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7514     fi
7515     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7516     _objdir_win=`pwd -W`
7517     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7518     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7519     dnl Also pass this to NSPR/NSS
7520     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7521     export DLLFLAGS
7522     ;;
7523   *-*wince)
7524     AC_DEFINE(MOZ_MEMORY_WINCE)
7525     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7526     if test -z "$WINCE_WINDOWS_MOBILE"; then
7527       AC_DEFINE(MOZ_MEMORY_WINCE6)
7528     fi
7529     ;;
7530   *-*winmo)
7531     AC_DEFINE(MOZ_MEMORY_WINCE)
7532     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7533     ;;
7534   *-android*)
7535     AC_DEFINE(MOZ_MEMORY_LINUX)
7536     AC_DEFINE(MOZ_MEMORY_ANDROID)
7537     _WRAP_MALLOC=1
7538     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
7539     WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
7540     ;;
7541   *)
7542     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7543     ;;
7544   esac
7546   if test "$OS_ARCH" != "Darwin"; then
7547     dnl NB: this must be kept in sync with jemalloc.h
7548     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7549     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7550     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7551   fi
7553 AC_SUBST(MOZ_MEMORY)
7554 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7555 AC_SUBST(WIN32_CRT_SRC_DIR)
7556 dnl Need to set this for make because NSS doesn't have configure
7557 AC_SUBST(DLLFLAGS)
7559 dnl ========================================================
7560 dnl = Use malloc wrapper lib
7561 dnl ========================================================
7562 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7563 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7564     _WRAP_MALLOC=1,
7565     _WRAP_MALLOC= )
7567 if test -n "$_WRAP_MALLOC"; then
7568     if test "$GNU_CC"; then
7569     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"
7570     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7571     MKCSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7572     fi
7575 dnl ========================================================
7576 dnl = Location of malloc wrapper lib
7577 dnl ========================================================
7578 MOZ_ARG_WITH_STRING(wrap-malloc,
7579 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7580     WRAP_MALLOC_LIB=$withval)
7582 dnl ========================================================
7583 dnl = Use JS Call tracing
7584 dnl ========================================================
7585 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7586 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7587     MOZ_TRACE_JSCALLS=1,
7588     MOZ_TRACE_JSCALLS= )
7589 if test -n "$MOZ_TRACE_JSCALLS"; then
7590     AC_DEFINE(MOZ_TRACE_JSCALLS)
7593 dnl ========================================================
7594 dnl = Use TraceVis
7595 dnl ========================================================
7596 MOZ_ARG_ENABLE_BOOL(tracevis,
7597 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7598     MOZ_TRACEVIS=1,
7599     MOZ_TRACEVIS= )
7600 if test -n "$MOZ_TRACEVIS"; then
7601     AC_DEFINE(MOZ_TRACEVIS)
7604 dnl ========================================================
7605 dnl = Use GCTimer
7606 dnl ========================================================
7607 MOZ_ARG_ENABLE_BOOL(gctimer,
7608 [  --enable-gctimer        Enable GC timer (default=no)],
7609     MOZ_GCTIMER=1,
7610     MOZ_GCTIMER= )
7611 if test -n "$MOZ_GCTIMER"; then
7612     AC_DEFINE(MOZ_GCTIMER)
7615 dnl ========================================================
7616 dnl = Use Valgrind
7617 dnl ========================================================
7618 MOZ_ARG_ENABLE_BOOL(valgrind,
7619 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7620     MOZ_VALGRIND=1,
7621     MOZ_VALGRIND= )
7622 if test -n "$MOZ_VALGRIND"; then
7623     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7624         AC_MSG_ERROR(
7625             [--enable-valgrind specified but Valgrind is not installed]))
7626     AC_DEFINE(MOZ_VALGRIND)
7629 dnl ========================================================
7630 dnl jprof
7631 dnl ========================================================
7632 MOZ_ARG_ENABLE_BOOL(jprof,
7633 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
7634     MOZ_JPROF=1,
7635     MOZ_JPROF= )
7636 if test -n "$MOZ_JPROF"; then
7637     MOZ_PROFILING=1
7638     AC_DEFINE(MOZ_JPROF)
7641 dnl ========================================================
7642 dnl shark
7643 dnl ========================================================
7644 MOZ_ARG_ENABLE_BOOL(shark,
7645 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
7646     MOZ_SHARK=1,
7647     MOZ_SHARK= )
7648 if test -n "$MOZ_SHARK"; then
7649     MOZ_PROFILING=1
7650     AC_DEFINE(MOZ_SHARK)
7653 dnl ========================================================
7654 dnl callgrind
7655 dnl ========================================================
7656 MOZ_ARG_ENABLE_BOOL(callgrind,
7657 [  --enable-callgrind      Enable callgrind profiling],
7658     MOZ_CALLGRIND=1,
7659     MOZ_CALLGRIND= )
7660 if test -n "$MOZ_CALLGRIND"; then
7661     AC_DEFINE(MOZ_CALLGRIND)
7664 dnl ========================================================
7665 dnl vtune
7666 dnl ========================================================
7667 MOZ_ARG_ENABLE_BOOL(vtune,
7668 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
7669     MOZ_VTUNE=1,
7670     MOZ_VTUNE= )
7671 if test -n "$MOZ_VTUNE"; then
7672     MOZ_PROFILING=1
7673     AC_DEFINE(MOZ_VTUNE)
7676 dnl ========================================================
7677 dnl Profiling
7678 dnl ========================================================
7679 if test -n "$MOZ_PROFILING"; then
7680     AC_DEFINE(MOZ_PROFILING)
7683 dnl ========================================================
7684 dnl Zealous JavaScript GC
7685 dnl ========================================================
7686 MOZ_ARG_ENABLE_BOOL(gczeal,
7687 [  --enable-gczeal         Enable zealous JavaScript GCing],
7688     JS_GC_ZEAL=1,
7689     JS_GC_ZEAL= )
7690 if test -n "$JS_GC_ZEAL"; then
7691     AC_DEFINE(JS_GC_ZEAL)
7694 dnl ======================================================
7695 dnl = Enable compiling with ccache
7696 dnl ======================================================
7697 MOZ_ARG_WITH_STRING(ccache,
7698 [  --with-ccache[=path/to/ccache]
7699                           Enable compiling with ccache],
7700     CCACHE=$withval, CCACHE="no")
7702 if test "$CCACHE" != "no"; then
7703     if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7704         CCACHE=
7705     else
7706         if test ! -e "$CCACHE"; then
7707             AC_MSG_ERROR([$CCACHE not found])
7708         fi
7709     fi
7710     MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7711     if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7712         AC_MSG_ERROR([ccache not found])
7713     elif test -x "$CCACHE"; then
7714         CC="$CCACHE $CC"
7715         CXX="$CCACHE $CXX"
7716     else
7717         AC_MSG_ERROR([$CCACHE is not executable])
7718     fi
7721 dnl ========================================================
7722 dnl = Enable static checking using gcc-dehydra
7723 dnl ========================================================
7725 MOZ_ARG_WITH_STRING(static-checking,
7726 [  --with-static-checking=path/to/gcc_dehydra.so
7727                           Enable static checking of code using GCC-dehydra],
7728     DEHYDRA_PATH=$withval,
7729     DEHYDRA_PATH= )
7731 if test -n "$DEHYDRA_PATH"; then
7732     if test ! -f "$DEHYDRA_PATH"; then
7733         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7734     fi
7735     AC_DEFINE(NS_STATIC_CHECKING)
7737 AC_SUBST(DEHYDRA_PATH)
7739 dnl ========================================================
7740 dnl = Enable stripping of libs & executables
7741 dnl ========================================================
7742 MOZ_ARG_ENABLE_BOOL(strip,
7743 [  --enable-strip          Enable stripping of libs & executables ],
7744     ENABLE_STRIP=1,
7745     ENABLE_STRIP= )
7747 dnl ========================================================
7748 dnl = Enable stripping of libs & executables when packaging
7749 dnl ========================================================
7750 MOZ_ARG_ENABLE_BOOL(install-strip,
7751 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7752     PKG_SKIP_STRIP= ,
7753     PKG_SKIP_STRIP=1)
7755 dnl ========================================================
7756 dnl = --enable-elf-dynstr-gc
7757 dnl ========================================================
7758 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7759 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7760     USE_ELF_DYNSTR_GC=1,
7761     USE_ELF_DYNSTR_GC= )
7763 dnl ========================================================
7764 dnl = 
7765 dnl = Profiling and Instrumenting
7766 dnl = 
7767 dnl ========================================================
7768 MOZ_ARG_HEADER(Profiling and Instrumenting)
7770 dnl ========================================================
7771 dnl = Enable timeline service, which provides lightweight
7772 dnl = instrumentation of mozilla for performance measurement.
7773 dnl = Timeline is off by default.
7774 dnl ========================================================
7775 MOZ_ARG_ENABLE_BOOL(timeline,
7776 [  --enable-timeline       Enable timeline services ],
7777     MOZ_TIMELINE=1,
7778     MOZ_TIMELINE= )
7779 if test -n "$MOZ_TIMELINE"; then
7780     AC_DEFINE(MOZ_TIMELINE)
7783 dnl ========================================================
7784 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7785 dnl = timing for identifying code bottlenecks 
7786 dnl = NS_FUNCTION_TIMER is off by default.
7787 dnl ========================================================
7788 MOZ_ARG_ENABLE_BOOL(functiontimer,
7789 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7790     NS_FUNCTION_TIMER=1,
7791     NS_FUNCTION_TIMER= )
7792 if test -n "$NS_FUNCTION_TIMER"; then
7793     AC_DEFINE(NS_FUNCTION_TIMER)
7796 dnl ========================================================
7797 dnl Turn on reflow counting
7798 dnl ========================================================
7799 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7800 [  --enable-reflow-perf    Enable reflow performance tracing],
7801     MOZ_REFLOW_PERF=1,
7802     MOZ_REFLOW_PERF= )
7803 if test -n "$MOZ_REFLOW_PERF"; then
7804     AC_DEFINE(MOZ_REFLOW_PERF)
7807 dnl ========================================================
7808 dnl Enable code size metrics.
7809 dnl ========================================================
7810 MOZ_ARG_ENABLE_BOOL(codesighs,
7811 [  --enable-codesighs      Enable code size analysis tools],
7812     _ENABLE_CODESIGHS=1,
7813     _ENABLE_CODESIGHS= )
7814 if test -n "$_ENABLE_CODESIGHS"; then
7815     if test -d $srcdir/tools/codesighs; then 
7816         MOZ_MAPINFO=1
7817     else
7818         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7819     fi
7822 dnl ========================================================
7823 dnl = Support for Quantify (Windows)
7824 dnl ========================================================
7825 MOZ_ARG_ENABLE_BOOL(quantify,
7826 [  --enable-quantify       Enable Quantify support (Windows only) ],
7827     MOZ_QUANTIFY=1,
7828     MOZ_QUANTIFY= )
7830 dnl ========================================================
7831 dnl = Support for demangling undefined symbols
7832 dnl ========================================================
7833 if test -z "$SKIP_LIBRARY_CHECKS"; then
7834     AC_LANG_SAVE
7835     AC_LANG_CPLUSPLUS
7836     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7837     AC_LANG_RESTORE
7840 # Demangle only for debug or trace-malloc builds
7841 MOZ_DEMANGLE_SYMBOLS=
7842 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7843     MOZ_DEMANGLE_SYMBOLS=1
7844     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7846 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7848 dnl ========================================================
7849 dnl = Support for gcc stack unwinding (from gcc 3.3)
7850 dnl ========================================================
7851 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7852     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7855 dnl ========================================================
7856 dnl =
7857 dnl = Misc. Options
7858 dnl = 
7859 dnl ========================================================
7860 MOZ_ARG_HEADER(Misc. Options)
7862 dnl ========================================================
7863 dnl update xterm title
7864 dnl ========================================================
7865 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7866 [  --enable-xterm-updates  Update XTERM titles with current command.],
7867     MOZ_UPDATE_XTERM=1,
7868     MOZ_UPDATE_XTERM= )
7870 dnl =========================================================
7871 dnl = Chrome format
7872 dnl =========================================================
7873 MOZ_ARG_ENABLE_STRING([chrome-format],
7874 [  --enable-chrome-format=jar|flat|both|symlink|omni
7875                           Select FORMAT of chrome files (default=jar)],
7876     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7878 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7879     MOZ_CHROME_FILE_FORMAT=jar
7882 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7883     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7884     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7885     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7886     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7887     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7890 dnl =========================================================
7891 dnl Omnijar packaging (bug 552121)
7892 dnl =========================================================
7893 dnl Omnijar packaging is compatible with flat packaging.
7894 dnl In unpackaged builds, omnijar looks for files as if
7895 dnl things were flat packaged. After packaging, all files
7896 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7897 dnl is set to flat since putting files into jars is only
7898 dnl done during packaging with omnijar.
7899 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7900     MOZ_OMNIJAR=1
7901     AC_DEFINE(MOZ_OMNIJAR)
7902     MOZ_CHROME_FILE_FORMAT=flat
7903 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7904     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7907 AC_SUBST(MOZ_OMNIJAR)
7909 dnl ========================================================
7910 dnl = Define default location for MOZILLA_FIVE_HOME
7911 dnl ========================================================
7912 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7913 [  --with-default-mozilla-five-home
7914                           Set the default value for MOZILLA_FIVE_HOME],
7915 [ val=`echo $withval`
7916   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7918 dnl ========================================================
7919 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7920 dnl ========================================================
7921 MOZ_ARG_WITH_STRING(user-appdir,
7922 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7923 [ val=`echo $withval`
7924 if echo "$val" | grep "\/" >/dev/null; then
7925     AC_MSG_ERROR("Homedir must be single relative path.")
7926 else 
7927     MOZ_USER_DIR="$val"
7928 fi])
7930 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7932 dnl ========================================================
7933 dnl = Doxygen configuration
7934 dnl ========================================================
7935 dnl Use commas to specify multiple dirs to this arg
7936 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7937 MOZ_ARG_WITH_STRING(doc-input-dirs,
7938 [  --with-doc-input-dirs=DIRS
7939                           Header/idl dirs to create docs from],
7940 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7941 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7943 dnl Use commas to specify multiple dirs to this arg
7944 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7945 MOZ_ARG_WITH_STRING(doc-include-dirs,
7946 [  --with-doc-include-dirs=DIRS  
7947                           Include dirs to preprocess doc headers],
7948 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7949 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7951 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7952 MOZ_ARG_WITH_STRING(doc-output-dir,
7953 [  --with-doc-output-dir=DIR
7954                           Dir to generate docs into],
7955 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7956 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7958 if test -z "$SKIP_COMPILER_CHECKS"; then
7959 dnl ========================================================
7960 dnl =
7961 dnl = Compiler Options
7962 dnl = 
7963 dnl ========================================================
7964 MOZ_ARG_HEADER(Compiler Options)
7966 dnl ========================================================
7967 dnl Check for gcc -pipe support
7968 dnl ========================================================
7969 AC_MSG_CHECKING([for gcc -pipe support])
7970 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
7971     echo '#include <stdio.h>' > dummy-hello.c
7972     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7973     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7974     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7975     if test $? = 0; then
7976         _res_as_stdin="yes"
7977     else
7978         _res_as_stdin="no"
7979     fi
7980     if test "$_res_as_stdin" = "yes"; then
7981         _SAVE_CFLAGS=$CFLAGS
7982         CFLAGS="$CFLAGS -pipe"
7983         AC_TRY_COMPILE( [ #include <stdio.h> ],
7984             [printf("Hello World\n");],
7985             [_res_gcc_pipe="yes"],
7986             [_res_gcc_pipe="no"] )
7987         CFLAGS=$_SAVE_CFLAGS
7988     fi
7989     if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
7990         _res="yes";
7991         CFLAGS="$CFLAGS -pipe"
7992         CXXFLAGS="$CXXFLAGS -pipe"
7993     else
7994         _res="no"
7995     fi
7996     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7997     AC_MSG_RESULT([$_res])
7998 else
7999     AC_MSG_RESULT([no])
8002 dnl ========================================================
8003 dnl Profile guided optimization
8004 dnl ========================================================
8005 dnl Test for profiling options
8006 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
8008 dnl Provide a switch to disable PGO even when called via profiledbuild.
8009 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
8010 [  --disable-profile-guided-optimization
8011                           Don't build with PGO even if called via make profiledbuild],
8012 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
8013 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
8015 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
8017 _SAVE_CFLAGS="$CFLAGS"
8018 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
8020 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
8021 AC_TRY_COMPILE([], [return 0;],
8022                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
8023                  result="yes" ], result="no")
8024 AC_MSG_RESULT([$result])
8026 if test $result = "yes"; then
8027   PROFILE_GEN_LDFLAGS="-fprofile-generate"
8028   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
8029   PROFILE_USE_LDFLAGS="-fprofile-use"
8032 CFLAGS="$_SAVE_CFLAGS"
8034 if test -n "$INTEL_CC"; then
8035   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
8036   PROFILE_GEN_LDFLAGS=
8037   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
8038   PROFILE_USE_LDFLAGS=
8041 dnl Sun Studio on Solaris
8042 if test "$SOLARIS_SUNPRO_CC"; then
8043   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
8044   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
8045   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
8046   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
8049 AC_SUBST(PROFILE_GEN_CFLAGS)
8050 AC_SUBST(PROFILE_GEN_LDFLAGS)
8051 AC_SUBST(PROFILE_USE_CFLAGS)
8052 AC_SUBST(PROFILE_USE_LDFLAGS)
8054 AC_LANG_CPLUSPLUS
8056 dnl ========================================================
8057 dnl Test for -pedantic bustage
8058 dnl ========================================================
8059 MOZ_ARG_DISABLE_BOOL(pedantic,
8060 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
8061 _PEDANTIC= )
8062 if test "$_PEDANTIC"; then
8063     _SAVE_CXXFLAGS=$CXXFLAGS
8064     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8065     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
8066     AC_TRY_COMPILE([$configure_static_assert_macros],
8067                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
8068                    result="no", result="yes" )
8069     AC_MSG_RESULT([$result])
8070     CXXFLAGS="$_SAVE_CXXFLAGS"
8072     case "$result" in
8073     no)
8074         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8075         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8076         ;;
8077     yes)
8078         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
8079         ;;
8080     esac
8083 dnl ========================================================
8084 dnl Test for correct temporary object destruction order
8085 dnl ========================================================
8086 dnl We want to make sure the compiler follows the C++ spec here as 
8087 dnl xpcom and the string classes depend on it (bug 235381).
8088 AC_MSG_CHECKING([for correct temporary object destruction order])
8089 AC_TRY_RUN([ class A {
8090              public:  A(int& x) : mValue(x) {}
8091                       ~A() { mValue--; }
8092                       operator char**() { return 0; }
8093              private:  int& mValue;
8094              };
8095              void func(char **arg) {}
8096              int m=2;
8097              void test() {
8098                   func(A(m));
8099                   if (m==1) m = 0;
8100              }
8101              int main() {
8102                  test();
8103                  return(m);
8104              }
8105              ],
8106      result="yes", result="no", result="maybe")
8107 AC_MSG_RESULT([$result])
8109 if test "$result" = "no"; then
8110     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
8113 dnl ========================================================
8114 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
8115 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
8116 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
8117 dnl ========================================================
8118 _SAVE_CXXFLAGS=$CXXFLAGS
8119 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
8120 AC_CACHE_CHECK(for correct overload resolution with const and templates,
8121     ac_nscap_nonconst_opeq_bug,
8122     [AC_TRY_COMPILE([
8123                       template <class T>
8124                       class Pointer
8125                         {
8126                         public:
8127                           T* myPtr;
8128                         };
8129                       
8130                       template <class T, class U>
8131                       int operator==(const Pointer<T>& rhs, U* lhs)
8132                         {
8133                           return rhs.myPtr == lhs;
8134                         }
8135                       
8136                       template <class T, class U>
8137                       int operator==(const Pointer<T>& rhs, const U* lhs)
8138                         {
8139                           return rhs.myPtr == lhs;
8140                         }
8141                     ],
8142                     [
8143                       Pointer<int> foo;
8144                       const int* bar;
8145                       return foo == bar;
8146                     ],
8147                     ac_nscap_nonconst_opeq_bug="no",
8148                     ac_nscap_nonconst_opeq_bug="yes")])
8149 CXXFLAGS="$_SAVE_CXXFLAGS"
8151 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8152     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8154 fi # SKIP_COMPILER_CHECKS
8156 dnl ========================================================
8157 dnl C++ rtti
8158 dnl Should be smarter and check that the compiler does indeed have rtti
8159 dnl ========================================================
8161 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
8162 [  --enable-cpp-rtti       Enable C++ RTTI ],
8163 [ _MOZ_USE_RTTI=1 ],
8164 [ _MOZ_USE_RTTI= ])
8166 if test "$_MOZ_USE_RTTI"; then
8167    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
8168 else
8169    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
8172 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
8174 dnl ========================================================
8175 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
8176 dnl Should be smarter and check that the compiler does indeed have exceptions
8177 dnl ========================================================
8178 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
8179 [  --enable-cpp-exceptions Enable C++ exceptions ],
8180 [ _MOZ_CPP_EXCEPTIONS=1 ],
8181 [ _MOZ_CPP_EXCEPTIONS= ])
8183 if test "$_MOZ_CPP_EXCEPTIONS"; then
8184     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
8185     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
8186 else
8187     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
8190 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
8192 # Irix & OSF native compilers do not like exception declarations 
8193 # when exceptions are disabled
8194 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
8195     AC_DEFINE(CPP_THROW_NEW, [])
8196 else
8197     AC_DEFINE(CPP_THROW_NEW, [throw()])
8199 AC_LANG_C
8201 dnl ========================================================
8202 dnl =
8203 dnl = Build depencency options
8204 dnl =
8205 dnl ========================================================
8206 MOZ_ARG_HEADER(Build dependencies)
8208 dnl ========================================================
8209 dnl = Do not auto generate dependency info
8210 dnl ========================================================
8211 MOZ_AUTO_DEPS=1
8212 MOZ_ARG_DISABLE_BOOL(auto-deps,
8213 [  --disable-auto-deps     Do not automatically generate dependency info],
8214     MOZ_AUTO_DEPS=,
8215     MOZ_AUTO_DEPS=1)
8217 if test -n "$MOZ_AUTO_DEPS"; then
8218 dnl ========================================================
8219 dnl = Use mkdepend instead of $CC -MD for dependency generation
8220 dnl ========================================================
8221 _cpp_md_flag=
8222 MOZ_ARG_DISABLE_BOOL(md,
8223 [  --disable-md            Do not use compiler-based dependencies ],
8224   [_cpp_md_flag=],
8225   [_cpp_md_flag=1],
8226   [dnl Default is to turn on -MD if using GNU-compatible compilers
8227    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
8228      _cpp_md_flag=1
8229    fi
8230   dnl Default is to use -xM if using Sun Studio on Solaris
8231    if test "$SOLARIS_SUNPRO_CC"; then
8232      _cpp_md_flag=1
8233    fi])
8234 if test "$_cpp_md_flag"; then
8235   COMPILER_DEPEND=1
8236   if test "$OS_ARCH" = "OpenVMS"; then
8237     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
8238   else
8239     _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8240   fi
8241   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8242   if test "$SOLARIS_SUNPRO_CC"; then
8243     _DEPEND_CFLAGS=
8244   fi
8245 else
8246   COMPILER_DEPEND=
8247   dnl Don't override this for MSVC
8248   if test -z "$_WIN32_MSVC"; then
8249     _USE_CPP_INCLUDE_FLAG=
8250     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8251     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8252   else
8253     echo '#include <stdio.h>' > dummy-hello.c
8254     changequote(,)
8255     CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8256     changequote([,])
8257     if test -z "$CL_INCLUDES_PREFIX"; then
8258         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8259     fi
8260     AC_SUBST(CL_INCLUDES_PREFIX)
8261     rm -f dummy-hello.c
8262     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8263     dnl cl.py provides dependency generation for MSVC
8264     CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8265     CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8266     COMPILER_DEPEND=1
8267   fi
8269 fi # MOZ_AUTO_DEPS
8270 MDDEPDIR='.deps'
8271 AC_SUBST(MOZ_AUTO_DEPS)
8272 AC_SUBST(COMPILER_DEPEND)
8273 AC_SUBST(MDDEPDIR)
8274 AC_SUBST(CC_WRAPPER)
8275 AC_SUBST(CXX_WRAPPER)
8278 dnl ========================================================
8279 dnl =
8280 dnl = Static Build Options
8281 dnl =
8282 dnl ========================================================
8283 MOZ_ARG_HEADER(Static build options)
8285 MOZ_ARG_ENABLE_BOOL(static,
8286 [  --enable-static         Enable building of internal static libs],
8287     BUILD_STATIC_LIBS=1,
8288     BUILD_STATIC_LIBS=)
8290 MOZ_ARG_ENABLE_BOOL(libxul,
8291 [  --enable-libxul         Enable building of libxul],
8292     MOZ_ENABLE_LIBXUL=1,
8293     MOZ_ENABLE_LIBXUL=)
8295 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8296 if test "$OS_ARCH" = "WINNT"; then
8297   ENABLE_SHARED_JS=1
8300 MOZ_ARG_ENABLE_BOOL(shared-js,
8301 [  --enable-shared-js
8302                           Create a shared JavaScript library.],
8303     ENABLE_SHARED_JS=1,
8304     ENABLE_SHARED_JS=)
8306 if test -z "$MOZ_ENABLE_LIBXUL"; then
8307   dnl --disable-libxul implies shared js
8308   ENABLE_SHARED_JS=1
8311 if test -n "$ENABLE_SHARED_JS"; then
8312   JS_SHARED_LIBRARY=1
8313   MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
8314 else
8315   MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
8316   AC_DEFINE(MOZ_STATIC_JS)
8318 AC_SUBST(JS_SHARED_LIBRARY)
8320 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8321         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
8324 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8325         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8328 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
8329     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
8332 if test -z "$MOZ_ENABLE_LIBXUL" -a -n "$MOZ_OMNIJAR"; then
8333     AC_MSG_ERROR([Omnijar packaging is incompatible with --disable-libxul. Please either --enable-libxul or --enable-chrome-format=jar|flat|symlink]);
8336 AC_SUBST(LIBXUL_LIBS)
8338 if test -n "$MOZ_ENABLE_LIBXUL"; then
8339     XPCOM_LIBS="$LIBXUL_LIBS"
8340     AC_DEFINE(MOZ_ENABLE_LIBXUL)
8341 else
8342     if test -n "$BUILD_STATIC_LIBS"; then
8343         AC_DEFINE(MOZ_STATIC_BUILD)
8344     fi
8345     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
8348 dnl ========================================================
8349 dnl =
8350 dnl = Standalone module options
8351 dnl = 
8352 dnl ========================================================
8353 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8355 dnl Check for GLib and libIDL.
8356 dnl ========================================================
8357 SKIP_IDL_CHECK="no"
8359 if test -z "$COMPILE_ENVIRONMENT"; then
8360     SKIP_IDL_CHECK="yes"
8363 dnl = Allow users to disable libIDL checking for standalone modules
8364 MOZ_ARG_WITHOUT_BOOL(libIDL,
8365 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
8366         SKIP_IDL_CHECK="yes")
8368 if test -z "$CROSS_COMPILE"; then
8369     if test -z "$HOST_LIBIDL_CONFIG"; then
8370         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8371     fi
8372     if test -z "$HOST_LIBIDL_PREFIX"; then
8373         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8374     fi
8377 if test "$SKIP_IDL_CHECK" = "no"
8378 then
8379     _LIBIDL_FOUND=
8380     case "$host" in
8381     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8382         if test -n "$GLIB_PREFIX"; then
8383             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8384             if test "$?" = "0"; then
8385                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8386                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8387                 fi
8388                 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8389             else
8390                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8391             fi
8392         else
8393             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8394         fi
8395         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8396             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8397         fi
8398         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8399         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8400             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8401         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8402             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8403         else
8404             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8405         fi
8407         if test -n "$HOST_LIBIDL_PREFIX"; then
8408             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8409             if test "$?" = "0"; then
8410                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8411                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8412                 fi
8413                 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8414             else
8415                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8416             fi
8417         else
8418             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8419         fi        
8420         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8421             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8422         fi
8423         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8424         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8425             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8426             STATIC_LIBIDL=1
8427         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8428             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8429         else
8430             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8431         fi
8432         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8433         _LIBIDL_FOUND=1
8434         ;;
8435     esac
8437     if test -z "$_LIBIDL_FOUND"; then
8438         if test "$MACOS_SDK_DIR"; then 
8439             dnl xpidl, and therefore libIDL, is only needed on the build host.
8440             dnl Don't build it against the SDK, as that causes problems.
8441             _MACSAVE_CFLAGS="$CFLAGS"
8442             _MACSAVE_LIBS="$LIBS"
8443             _MACSAVE_LDFLAGS="$LDFLAGS"
8444             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8445           changequote(,)
8446           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"`
8447           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8448           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8449           changequote([,])
8450           unset NEXT_ROOT
8451         fi
8453         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8454     fi
8456     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8457     dnl to either libIDL1 or libIDL2.
8458     if test -z "$_LIBIDL_FOUND"; then
8459         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8460         if test -z "$_LIBIDL_FOUND"; then
8461             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8462         fi
8463     fi
8464     dnl
8465     dnl If we don't have a libIDL config program & not cross-compiling, 
8466     dnl     look for orbit-config instead.
8467     dnl
8468     if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8469         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8470         if test -n "$ORBIT_CONFIG"; then
8471             AC_MSG_CHECKING([for ORBit libIDL usability])
8472                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8473             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8474             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8475             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8476             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8477             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8478             HOST_LIBIDL_CONFIG=
8479             _SAVE_CFLAGS="$CFLAGS"
8480             _SAVE_LIBS="$LIBS"
8481             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8482             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8483             AC_TRY_RUN([
8484 #include <stdlib.h>
8485 #include <libIDL/IDL.h>
8486 int main() {
8487   char *s;
8488   s=strdup(IDL_get_libver_string());
8489   if(s==NULL) {
8490     exit(1);
8491   }
8492   exit(0);
8494             ], [_LIBIDL_FOUND=1
8495                 result="yes"],
8496                [HOST_LIBIDL_CFLAGS=
8497                 HOST_LIBIDL_LIBS=
8498                 result="no"],
8499                [_LIBIDL_FOUND=1
8500                 result="maybe"] )
8501             AC_MSG_RESULT($result)
8502             CFLAGS="$_SAVE_CFLAGS"
8503             LIBS="$_SAVE_LIBS"
8504         fi
8505     fi
8506     if test -z "$_LIBIDL_FOUND"; then
8507         AC_MSG_ERROR([libIDL not found.
8508         libIDL $LIBIDL_VERSION or higher is required.])
8509     fi
8510     if test "$MACOS_SDK_DIR"; then
8511       CFLAGS="$_MACSAVE_CFLAGS"
8512       LIBS="$_MACSAVE_LIBS"
8513       LDFLAGS="$_MACSAVE_LDFLAGS"
8514       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8515         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8516       fi
8517     fi
8520 if test -n "$CROSS_COMPILE"; then
8521     case "$target" in
8522     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8523         if test -n "$GLIB_PREFIX"; then
8524             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8525             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8526                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8527             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8528                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8529             else
8530                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8531             fi
8532         fi
8534         if test -n "$LIBIDL_PREFIX"; then
8535             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8536             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8537                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8538                 STATIC_LIBIDL=1
8539             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8540                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8541             else
8542                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8543             fi
8544         fi
8545         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8546         ;;
8547     *)
8548         if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8549             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8550             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8551         fi
8552         ;;
8553     esac
8554 else
8555     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8556     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8559 if test -z "$SKIP_PATH_CHECKS"; then
8560 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8561     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8562         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8563     else
8564         AM_PATH_GLIB(${GLIB_VERSION})
8565     fi
8569 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8570     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8573 AC_SUBST(LIBIDL_CFLAGS)
8574 AC_SUBST(LIBIDL_LIBS)
8575 AC_SUBST(STATIC_LIBIDL)
8576 AC_SUBST(GLIB_CFLAGS)
8577 AC_SUBST(GLIB_LIBS)
8578 AC_SUBST(GLIB_GMODULE_LIBS)
8579 AC_SUBST(HOST_LIBIDL_CONFIG)
8580 AC_SUBST(HOST_LIBIDL_CFLAGS)
8581 AC_SUBST(HOST_LIBIDL_LIBS)
8583 dnl ========================================================
8584 dnl Check for cairo
8585 dnl ========================================================
8586 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8588 MOZ_TREE_CAIRO=1
8589 MOZ_ARG_ENABLE_BOOL(system-cairo,
8590 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8591 MOZ_TREE_CAIRO=,
8592 MOZ_TREE_CAIRO=1 )
8594 MOZ_TREE_PIXMAN=1
8595 MOZ_ARG_ENABLE_BOOL(system-pixman,
8596 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8597 MOZ_TREE_PIXMAN=,
8598 MOZ_TREE_PIXMAN=1 )
8600 # Check for headers defining standard int types.
8601 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8603 if test "$MOZ_TREE_CAIRO"; then
8604     AC_DEFINE(MOZ_TREE_CAIRO)
8606     # For now we assume that we will have a uint64_t available through
8607     # one of the above headers or mozstdint.h.
8608     AC_DEFINE(HAVE_UINT64_T)
8610     # Define macros for cairo-features.h
8611     if test "$MOZ_X11"; then
8612         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8613         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8614         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8615         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8616         MOZ_ENABLE_CAIRO_FT=1
8617         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8618     fi
8619     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8620         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8621     fi
8622     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8623         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8624         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8625         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8626     fi
8627     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8628         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8629         if test -z "$WINCE"; then
8630             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8631             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8632                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8633                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8634                 MOZ_ENABLE_D2D_SURFACE=1
8635                 MOZ_ENABLE_DWRITE_FONT=1
8636             else
8637                 WIN32_DWRITE_FONT_FEATURE=
8638                 WIN32_D2D_SURFACE_FEATURE=
8639             fi
8640         else
8641             WIN32_FONT_FEATURE=
8642             WIN32_DWRITE_FONT_FEATURE=
8643             WIN32_D2D_SURFACE_FEATURE=
8644         fi
8646         AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8648         dnl D3D10 Layers depend on D2D Surfaces.
8649         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8650           AC_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8651         fi
8653     fi
8654     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8655         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8656         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8657         MOZ_ENABLE_CAIRO_FT=1
8658         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8659         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8660     fi
8661     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8662         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8663         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8664         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8665         MOZ_ENABLE_CAIRO_FT=1
8666     fi
8667     if test "$USE_FC_FREETYPE"; then
8668         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8669     fi
8670     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8671     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8672     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8673     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8674     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8675     AC_SUBST(CAIRO_FT_CFLAGS)
8676     AC_SUBST(HAS_OGLES)
8678     if test "$MOZ_DEBUG"; then
8679       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8680     else
8681       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8682     fi
8684     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8686     AC_SUBST(PS_SURFACE_FEATURE)
8687     AC_SUBST(PDF_SURFACE_FEATURE)
8688     AC_SUBST(SVG_SURFACE_FEATURE)
8689     AC_SUBST(XLIB_SURFACE_FEATURE)
8690     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8691     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8692     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8693     AC_SUBST(XCB_SURFACE_FEATURE)
8694     AC_SUBST(WIN32_SURFACE_FEATURE)
8695     AC_SUBST(OS2_SURFACE_FEATURE)
8696     AC_SUBST(BEOS_SURFACE_FEATURE)
8697     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8698     AC_SUBST(FT_FONT_FEATURE)
8699     AC_SUBST(FC_FONT_FEATURE)
8700     AC_SUBST(WIN32_FONT_FEATURE)
8701     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8702     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8703     AC_SUBST(QUARTZ_FONT_FEATURE)
8704     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8705     AC_SUBST(QT_SURFACE_FEATURE)
8707     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8709     if test "$MOZ_TREE_PIXMAN"; then
8710         AC_DEFINE(MOZ_TREE_PIXMAN)
8711         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8712     else
8713         PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8714         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8715         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8716     fi
8718     if test "$MOZ_X11"; then
8719         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8720     fi
8722     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8723     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8725 else
8726    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8727    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8728    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8729    if test "$MOZ_X11"; then
8730         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8731         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8732         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8733    fi
8736 AC_SUBST(MOZ_TREE_CAIRO)
8737 AC_SUBST(MOZ_CAIRO_CFLAGS)
8738 AC_SUBST(MOZ_CAIRO_LIBS)
8739 AC_SUBST(MOZ_TREE_PIXMAN)
8741 dnl ========================================================
8742 dnl qcms
8743 dnl ========================================================
8745 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8746 AC_SUBST(QCMS_LIBS)
8748 dnl ========================================================
8749 dnl HarfBuzz
8750 dnl ========================================================
8751 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8752 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8754 dnl ========================================================
8755 dnl OTS
8756 dnl ========================================================
8757 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8758 AC_SUBST(MOZ_OTS_LIBS)
8760 dnl ========================================================
8761 dnl disable xul
8762 dnl ========================================================
8763 MOZ_ARG_DISABLE_BOOL(xul,
8764 [  --disable-xul           Disable XUL],
8765     MOZ_XUL= )
8766 if test "$MOZ_XUL"; then
8767   AC_DEFINE(MOZ_XUL)
8768 else
8769   dnl remove extensions that require XUL
8770   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8773 AC_SUBST(MOZ_XUL)
8775 dnl ========================================================
8776 dnl disable profile locking
8777 dnl   do no use this in applications that can have more than
8778 dnl   one process accessing the profile directory.
8779 dnl ========================================================
8780 MOZ_ARG_DISABLE_BOOL(profilelocking,
8781 [  --disable-profilelocking
8782                           Disable profile locking],
8783     MOZ_PROFILELOCKING=,
8784     MOZ_PROFILELOCKING=1 )
8785 if test "$MOZ_PROFILELOCKING"; then
8786   AC_DEFINE(MOZ_PROFILELOCKING)
8789 dnl ========================================================
8790 dnl disable rdf services
8791 dnl ========================================================
8792 MOZ_ARG_DISABLE_BOOL(rdf,
8793 [  --disable-rdf           Disable RDF],
8794     MOZ_RDF= )
8795 if test "$MOZ_RDF"; then
8796   AC_DEFINE(MOZ_RDF)
8799 AC_SUBST(MOZ_RDF)
8801 dnl ========================================================
8802 dnl necko configuration options
8803 dnl ========================================================
8806 dnl option to disable various necko protocols
8808 MOZ_ARG_ENABLE_STRING(necko-protocols,
8809 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8810                           Enable/disable specific protocol handlers],
8811 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8812     if test "$option" = "yes" -o "$option" = "all"; then
8813         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8814     elif test "$option" = "no" -o "$option" = "none"; then
8815         NECKO_PROTOCOLS=""
8816     elif test "$option" = "default"; then
8817         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8818     elif test `echo "$option" | grep -c \^-` != 0; then
8819         option=`echo $option | sed 's/^-//'`
8820         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8821     else
8822         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8823     fi
8824 done],
8825     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8826 dnl Remove dupes
8827 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8828 AC_SUBST(NECKO_PROTOCOLS)
8829 for p in $NECKO_PROTOCOLS; do
8830     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8831 done
8834 dnl option to disable necko's disk cache
8836 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8837 [  --disable-necko-disk-cache
8838                           Disable necko disk cache],
8839     NECKO_DISK_CACHE=,
8840     NECKO_DISK_CACHE=1)
8841 AC_SUBST(NECKO_DISK_CACHE)
8842 if test "$NECKO_DISK_CACHE"; then
8843     AC_DEFINE(NECKO_DISK_CACHE)
8847 dnl option to disable necko's wifi scanner
8849 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8850 [  --disable-necko-wifi    Disable necko wifi scanner],
8851     NECKO_WIFI=,
8852     NECKO_WIFI=1)
8854 if test "$OS_ARCH" = "OS2"; then
8855   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8856   NECKO_WIFI=
8858 if test "$NECKO_WIFI" -a \
8859         "$OS_ARCH" != "Linux" -a \
8860         "$OS_ARCH" != "Darwin" -a \
8861         "$OS_ARCH" != "SunOS" -a \
8862         "$OS_ARCH" != "WINNT" -a \
8863         "$OS_ARCH" != "WINCE"; then
8864   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8867 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8868 then
8869   AC_CHECK_HEADER([iwlib.h])
8870   if test "$ac_cv_header_iwlib_h" != "yes"; then
8871     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])
8872   fi
8875 if test "$NECKO_WIFI"; then
8876   AC_DEFINE(NECKO_WIFI)
8878 AC_SUBST(NECKO_WIFI)
8881 dnl option to disable cookies
8883 MOZ_ARG_DISABLE_BOOL(cookies,
8884 [  --disable-cookies       Disable cookie support],
8885     NECKO_COOKIES=,
8886     NECKO_COOKIES=1)
8887 AC_SUBST(NECKO_COOKIES)
8888 if test "$NECKO_COOKIES"; then
8889     AC_DEFINE(NECKO_COOKIES)
8893 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8895 MOZ_ARG_DISABLE_BOOL(ctypes,
8896 [  --disable-ctypes        Disable js-ctypes],
8897     BUILD_CTYPES=,
8898     BUILD_CTYPES=1)
8899 AC_SUBST(BUILD_CTYPES)
8900 if test "$BUILD_CTYPES"; then
8901   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8902     # Disable ctypes for arm/wince.
8903     BUILD_CTYPES=
8904   else
8905     AC_DEFINE(BUILD_CTYPES)
8906   fi
8909 dnl NECKO_ configuration options are not global
8910 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8912 dnl Only build Mork if it's required
8913 AC_SUBST(MOZ_MORK)
8914 if test "$MOZ_MORK"; then
8915   AC_DEFINE(MOZ_MORK)
8918 dnl Build the lightweight Mork reader if required
8919 AC_SUBST(MOZ_MORKREADER)
8920 if test "$MOZ_MORKREADER"; then
8921   AC_DEFINE(MOZ_MORKREADER)
8924 dnl Build Places if required
8925 if test "$MOZ_PLACES"; then
8926   AC_DEFINE(MOZ_PLACES)
8929 dnl Build Sync Services if required
8930 AC_SUBST(MOZ_SERVICES_SYNC)
8931 if test -n "$MOZ_SERVICES_SYNC"; then
8932   AC_DEFINE(MOZ_SERVICES_SYNC)
8935 dnl ========================================================
8936 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8937     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8940 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8941   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8944 dnl ========================================================
8945 dnl =
8946 dnl = Maintainer debug option (no --enable equivalent)
8947 dnl =
8948 dnl ========================================================
8950 AC_SUBST(AR)
8951 AC_SUBST(AR_FLAGS)
8952 AC_SUBST(AR_LIST)
8953 AC_SUBST(AR_EXTRACT)
8954 AC_SUBST(AR_DELETE)
8955 AC_SUBST(AS)
8956 AC_SUBST(ASFLAGS)
8957 AC_SUBST(AS_DASH_C_FLAG)
8958 AC_SUBST(LD)
8959 AC_SUBST(RC)
8960 AC_SUBST(RCFLAGS)
8961 AC_SUBST(WINDRES)
8962 AC_SUBST(IMPLIB)
8963 AC_SUBST(FILTER)
8964 AC_SUBST(BIN_FLAGS)
8965 AC_SUBST(NS_USE_NATIVE)
8966 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8967 AC_SUBST(MOZ_UPDATE_XTERM)
8968 AC_SUBST(MINIMO)
8969 AC_SUBST(MOZ_PLATFORM_MAEMO)
8970 AC_SUBST(MOZ_AUTH_EXTENSION)
8971 AC_SUBST(MOZ_MATHML)
8972 AC_SUBST(MOZ_PERMISSIONS)
8973 AC_SUBST(MOZ_XTF)
8974 AC_SUBST(MOZ_PREF_EXTENSIONS)
8975 AC_SUBST(MOZ_SVG)
8976 AC_SUBST(MOZ_SMIL)
8977 AC_SUBST(MOZ_XSLT_STANDALONE)
8978 AC_SUBST(MOZ_JS_LIBS)
8979 AC_SUBST(MOZ_PSM)
8980 AC_SUBST(MOZ_DEBUG)
8981 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8982 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8983 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8984 AC_SUBST(MOZ_DEBUG_FLAGS)
8985 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8986 AC_SUBST(WARNINGS_AS_ERRORS)
8987 AC_SUBST(MOZ_EXTENSIONS)
8988 AC_SUBST(MOZ_JSDEBUGGER)
8989 AC_SUBST(MOZ_PLUGINS)
8990 AC_SUBST(MOZ_LOG_REFCNT)
8991 AC_SUBST(MOZ_LEAKY)
8992 AC_SUBST(MOZ_JPROF)
8993 AC_SUBST(MOZ_SHARK)
8994 AC_SUBST(MOZ_CALLGRIND)
8995 AC_SUBST(MOZ_VTUNE)
8996 AC_SUBST(MOZ_PROFILING)
8997 AC_SUBST(MOZ_JSLOADER)
8998 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8999 AC_SUBST(MOZ_QUANTIFY)
9000 AC_SUBST(LIBICONV)
9001 AC_SUBST(MOZ_PLACES)
9002 AC_SUBST(MOZ_PLACES_BOOKMARKS)
9003 AC_SUBST(MOZ_STORAGE)
9004 AC_SUBST(MOZ_TOOLKIT_SEARCH)
9005 AC_SUBST(MOZ_FEEDS)
9006 AC_SUBST(NS_PRINTING)
9007 AC_SUBST(MOZ_WEBGL)
9008 AC_SUBST(MOZ_HELP_VIEWER)
9010 AC_SUBST(MOZ_JAVAXPCOM)
9011 AC_SUBST(JAVA_INCLUDE_PATH)
9012 AC_SUBST(JAVA)
9013 AC_SUBST(JAVAC)
9014 AC_SUBST(JAR)
9016 AC_SUBST(MOZ_PROFILELOCKING)
9018 AC_SUBST(HAVE_XIE)
9019 AC_SUBST(MOZ_XIE_LIBS)
9021 AC_SUBST(BUILD_STATIC_LIBS)
9022 AC_SUBST(MOZ_ENABLE_LIBXUL)
9023 AC_SUBST(ENABLE_TESTS)
9024 AC_SUBST(IBMBIDI)
9025 AC_SUBST(MOZ_UNIVERSALCHARDET)
9026 AC_SUBST(ACCESSIBILITY)
9027 AC_SUBST(MOZ_VIEW_SOURCE)
9028 AC_SUBST(MOZ_SPELLCHECK)
9029 AC_SUBST(MOZ_USER_DIR)
9030 AC_SUBST(MOZ_CRASHREPORTER)
9031 AC_SUBST(MOZ_UPDATER)
9032 AC_SUBST(MOZ_ANGLE)
9033 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
9035 AC_SUBST(ENABLE_STRIP)
9036 AC_SUBST(PKG_SKIP_STRIP)
9037 AC_SUBST(USE_ELF_DYNSTR_GC)
9038 AC_SUBST(INCREMENTAL_LINKER)
9039 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
9040 AC_SUBST(MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS)
9041 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
9043 AC_SUBST(MOZ_FIX_LINK_PATHS)
9044 AC_SUBST(XPCOM_LIBS)
9045 AC_SUBST(XPCOM_FROZEN_LDOPTS)
9046 AC_SUBST(XPCOM_GLUE_LDOPTS)
9047 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
9049 AC_SUBST(USE_DEPENDENT_LIBS)
9051 AC_SUBST(MOZ_BUILD_ROOT)
9052 AC_SUBST(MOZ_OS2_TOOLS)
9054 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
9055 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
9056 AC_SUBST(MOZ_TIMELINE)
9057 AC_SUBST(OGLES_SDK_DIR)
9059 AC_SUBST(MOZ_APP_NAME)
9060 AC_SUBST(MOZ_APP_DISPLAYNAME)
9061 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
9062 AC_SUBST(MOZ_APP_UA_NAME)
9063 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
9064 AC_SUBST(MOZ_APP_VERSION)
9065 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
9066 AC_SUBST(MOZ_UA_FIREFOX_VERSION)
9067 AC_SUBST(FIREFOX_VERSION)
9068 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
9069 AC_SUBST(MOZ_UA_BUILDID)
9071 AC_SUBST(MOZ_PKG_SPECIAL)
9073 AC_SUBST(MOZILLA_OFFICIAL)
9075 dnl win32 options
9076 AC_SUBST(MOZ_MAPINFO)
9077 AC_SUBST(MOZ_BROWSE_INFO)
9078 AC_SUBST(MOZ_TOOLS_DIR)
9079 AC_SUBST(CYGWIN_WRAPPER)
9080 AC_SUBST(AS_PERL)
9081 AC_SUBST(WIN32_REDIST_DIR)
9082 AC_SUBST(PYTHON)
9083 AC_SUBST(MAKENSISU)
9085 AC_SUBST(WINCE)
9086 AC_SUBST(WINCE_SDK_DIR)
9087 AC_SUBST(WINCE_WINDOWS_MOBILE)
9089 dnl Echo the CFLAGS to remove extra whitespace.
9090 CFLAGS=`echo \
9091         $_WARNINGS_CFLAGS \
9092         $CFLAGS`
9094 CXXFLAGS=`echo \
9095         $_MOZ_RTTI_FLAGS \
9096         $_MOZ_EXCEPTIONS_FLAGS \
9097         $_WARNINGS_CXXFLAGS \
9098         $CXXFLAGS`
9100 COMPILE_CFLAGS=`echo \
9101     $_DEFINES_CFLAGS \
9102         $_DEPEND_CFLAGS \
9103     $COMPILE_CFLAGS`
9105 COMPILE_CXXFLAGS=`echo \
9106     $_DEFINES_CXXFLAGS \
9107         $_DEPEND_CFLAGS \
9108     $COMPILE_CXXFLAGS`
9110 AC_SUBST(SYSTEM_MAKEDEPEND)
9111 AC_SUBST(SYSTEM_LIBXUL)
9112 AC_SUBST(SYSTEM_JPEG)
9113 AC_SUBST(SYSTEM_PNG)
9114 AC_SUBST(SYSTEM_ZLIB)
9115 AC_SUBST(SYSTEM_BZ2)
9117 AC_SUBST(JPEG_CFLAGS)
9118 AC_SUBST(JPEG_LIBS)
9119 AC_SUBST(ZLIB_CFLAGS)
9120 AC_SUBST(ZLIB_LIBS)
9121 AC_SUBST(BZ2_CFLAGS)
9122 AC_SUBST(BZ2_LIBS)
9123 AC_SUBST(PNG_CFLAGS)
9124 AC_SUBST(PNG_LIBS)
9126 AC_SUBST(MOZ_JPEG_CFLAGS)
9127 AC_SUBST(MOZ_JPEG_LIBS)
9128 AC_SUBST(MOZ_ZLIB_CFLAGS)
9129 AC_SUBST(MOZ_ZLIB_LIBS)
9130 AC_SUBST(MOZ_BZ2_CFLAGS)
9131 AC_SUBST(MOZ_BZ2_LIBS)
9132 AC_SUBST(MOZ_PNG_CFLAGS)
9133 AC_SUBST(MOZ_PNG_LIBS)
9135 AC_SUBST(NSPR_CFLAGS)
9136 AC_SUBST(NSPR_LIBS)
9137 AC_SUBST(MOZ_NATIVE_NSPR)
9139 AC_SUBST(NSS_CFLAGS)
9140 AC_SUBST(NSS_LIBS)
9141 AC_SUBST(NSS_DEP_LIBS)
9142 AC_SUBST(MOZ_NATIVE_NSS)
9143 AC_SUBST(NSS_DISABLE_DBM)
9145 AC_SUBST(CFLAGS)
9146 AC_SUBST(CXXFLAGS)
9147 AC_SUBST(CPPFLAGS)
9148 AC_SUBST(COMPILE_CFLAGS)
9149 AC_SUBST(COMPILE_CXXFLAGS)
9150 AC_SUBST(LDFLAGS)
9151 AC_SUBST(LIBS)
9152 AC_SUBST(CROSS_COMPILE)
9153 AC_SUBST(WCHAR_CFLAGS)
9155 AC_SUBST(HOST_CC)
9156 AC_SUBST(HOST_CXX)
9157 AC_SUBST(HOST_CFLAGS)
9158 AC_SUBST(HOST_CXXFLAGS)
9159 AC_SUBST(HOST_OPTIMIZE_FLAGS)
9160 AC_SUBST(HOST_AR)
9161 AC_SUBST(HOST_AR_FLAGS)
9162 AC_SUBST(HOST_LD)
9163 AC_SUBST(HOST_RANLIB)
9164 AC_SUBST(HOST_NSPR_MDCPUCFG)
9165 AC_SUBST(HOST_BIN_SUFFIX)
9166 AC_SUBST(HOST_OS_ARCH)
9168 AC_SUBST(TARGET_CPU)
9169 AC_SUBST(TARGET_VENDOR)
9170 AC_SUBST(TARGET_OS)
9171 AC_SUBST(TARGET_NSPR_MDCPUCFG)
9172 AC_SUBST(TARGET_MD_ARCH)
9173 AC_SUBST(TARGET_XPCOM_ABI)
9174 AC_SUBST(OS_TARGET)
9175 AC_SUBST(OS_ARCH)
9176 AC_SUBST(OS_RELEASE)
9177 AC_SUBST(OS_TEST)
9178 AC_SUBST(CPU_ARCH)
9179 AC_SUBST(INTEL_ARCHITECTURE)
9181 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
9182 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
9184 AC_SUBST(WRAP_MALLOC_CFLAGS)
9185 AC_SUBST(WRAP_MALLOC_LIB)
9186 AC_SUBST(MKSHLIB)
9187 AC_SUBST(MKCSHLIB)
9188 AC_SUBST(MKSHLIB_FORCE_ALL)
9189 AC_SUBST(MKSHLIB_UNFORCE_ALL)
9190 AC_SUBST(DSO_CFLAGS)
9191 AC_SUBST(DSO_PIC_CFLAGS)
9192 AC_SUBST(DSO_LDOPTS)
9193 AC_SUBST(LIB_PREFIX)
9194 AC_SUBST(DLL_PREFIX)
9195 AC_SUBST(DLL_SUFFIX)
9196 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
9197 AC_SUBST(LIB_SUFFIX)
9198 AC_SUBST(OBJ_SUFFIX)
9199 AC_SUBST(BIN_SUFFIX)
9200 AC_SUBST(ASM_SUFFIX)
9201 AC_SUBST(IMPORT_LIB_SUFFIX)
9202 AC_SUBST(USE_N32)
9203 AC_SUBST(CC_VERSION)
9204 AC_SUBST(CXX_VERSION)
9205 AC_SUBST(MSMANIFEST_TOOL)
9206 AC_SUBST(NS_ENABLE_TSF)
9207 AC_SUBST(MOZ_NSS_PATCH)
9208 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9209 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9211 AC_SUBST(MOZ_MEDIA)
9212 AC_SUBST(MOZ_SYDNEYAUDIO)
9213 AC_SUBST(MOZ_WAVE)
9214 AC_SUBST(MOZ_VORBIS)
9215 AC_SUBST(MOZ_TREMOR)
9216 AC_SUBST(MOZ_WEBM)
9217 AC_SUBST(MOZ_OGG)
9218 AC_SUBST(MOZ_ALSA_LIBS)
9219 AC_SUBST(VPX_AS)
9220 AC_SUBST(VPX_ASFLAGS)
9221 AC_SUBST(VPX_DASH_C_FLAG)
9222 AC_SUBST(VPX_AS_CONVERSION)
9223 AC_SUBST(VPX_ASM_SUFFIX)
9224 AC_SUBST(VPX_X86_ASM)
9225 AC_SUBST(VPX_ARM_ASM)
9227 if test "$USING_HCC"; then
9228    CC='${topsrcdir}/build/hcc'
9229    CC="$CC '$_OLDCC'"
9230    CXX='${topsrcdir}/build/hcpp'
9231    CXX="$CXX '$_OLDCXX'"
9232    AC_SUBST(CC)
9233    AC_SUBST(CXX)
9236 AC_MSG_CHECKING([for posix_fallocate])       
9237 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9238   #include <fcntl.h>],
9239                  [posix_fallocate(0, 0, 0);],
9240                  [ac_cv___posix_fallocate=true],
9241                  [ac_cv___posix_fallocate=false])
9243 if test "$ac_cv___posix_fallocate" = true ; then
9244   AC_DEFINE(HAVE_POSIX_FALLOCATE)
9245   AC_MSG_RESULT(yes)
9246 else
9247   AC_MSG_RESULT(no)
9250 dnl Check for missing components
9251 if test "$COMPILE_ENVIRONMENT"; then
9252 if test "$MOZ_X11"; then
9253     dnl ====================================================
9254     dnl = Check if X headers exist
9255     dnl ====================================================
9256     _SAVE_CFLAGS=$CFLAGS
9257     CFLAGS="$CFLAGS $XCFLAGS"
9258     AC_TRY_COMPILE([
9259         #include <stdio.h>
9260         #include <stdlib.h>
9261         #include <X11/Xlib.h>
9262         #include <X11/Intrinsic.h>
9263     ],
9264     [
9265         Display *dpy = 0;
9266         if ((dpy = XOpenDisplay(NULL)) == NULL) {
9267             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9268             exit(1);
9269         }
9270     ], [], 
9271     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9272     CFLAGS="$_SAVE_CFLAGS"
9274     if test ! -z "$MISSING_X"; then
9275         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9276     fi
9278 fi # MOZ_X11
9280 dnl Check for headers, etc. needed by WebGL.
9281 if test -n "$MOZ_WEBGL_GLX"; then
9282     AC_CHECK_HEADER(GL/glx.h)
9283     if test "$ac_cv_header_GL_glx_h" != "yes"; then
9284         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
9285     fi
9286 fi # MOZ_WEBGL_GLX
9287 fi # COMPILE_ENVIRONMENT
9289 if test "$USE_FC_FREETYPE"; then
9290     if test "$COMPILE_ENVIRONMENT"; then
9291         _SAVE_CPPFLAGS="$CPPFLAGS"
9292         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
9293         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
9294             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
9295         CPPFLAGS="$_SAVE_CPPFLAGS"
9296     else
9297         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
9298     fi
9301 dnl Set various defines and substitutions
9302 dnl ========================================================
9304 if test "$OS_ARCH" = "BeOS"; then
9305   AC_DEFINE(XP_BEOS)
9306 elif test "$OS_ARCH" = "Darwin"; then
9307   AC_DEFINE(XP_UNIX)
9308   AC_DEFINE(UNIX_ASYNC_DNS)
9309 elif test "$OS_ARCH" = "OpenVMS"; then
9310   AC_DEFINE(XP_UNIX)
9311 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
9312   AC_DEFINE(XP_UNIX)
9313   AC_DEFINE(UNIX_ASYNC_DNS)
9316 if test "$MOZ_DEBUG"; then
9317     AC_DEFINE(MOZ_REFLOW_PERF)
9318     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9321 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9322     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9323     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9324     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9325     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9326     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9327     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9328     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9329     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9332 dnl ========================================================
9333 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
9334 dnl ========================================================
9335 case "$host_os" in
9336 mingw*)
9337     WIN_TOP_SRC=`cd $srcdir; pwd -W`
9338     ;;
9339 cygwin*|msvc*|mks*)
9340     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
9341     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
9342     CC="\$(CYGWIN_WRAPPER) $CC"
9343     CXX="\$(CYGWIN_WRAPPER) $CXX"
9344     CPP="\$(CYGWIN_WRAPPER) $CPP"
9345     LD="\$(CYGWIN_WRAPPER) $LD"
9346     AS="\$(CYGWIN_WRAPPER) $AS"
9347     RC="\$(CYGWIN_WRAPPER) $RC"
9348     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
9349     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
9350     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
9351     ;;
9352 esac
9354 AC_SUBST(CYGDRIVE_MOUNT)
9355 AC_SUBST(WIN_TOP_SRC)
9357 AC_SUBST(MOZILLA_VERSION)
9359 AC_SUBST(ac_configure_args)
9361 dnl Spit out some output
9362 dnl ========================================================
9364 dnl The following defines are used by xpcom
9365 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9366 CPP_THROW_NEW
9367 HAVE_CPP_2BYTE_WCHAR_T
9368 HAVE_CPP_ACCESS_CHANGING_USING
9369 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9370 HAVE_CPP_BOOL
9371 HAVE_CPP_CHAR16_T
9372 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9373 HAVE_CPP_EXPLICIT
9374 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9375 HAVE_CPP_NAMESPACE_STD
9376 HAVE_CPP_NEW_CASTS
9377 HAVE_CPP_PARTIAL_SPECIALIZATION
9378 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9379 HAVE_CPP_TYPENAME
9380 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9381 HAVE_STATVFS
9382 NEED_CPP_UNUSED_IMPLEMENTATIONS
9383 NEW_H
9384 HAVE_GETPAGESIZE
9385 HAVE_ICONV
9386 HAVE_ICONV_WITH_CONST_INPUT
9387 HAVE_MBRTOWC
9388 HAVE_SYS_MOUNT_H
9389 HAVE_SYS_VFS_H
9390 HAVE_WCRTOMB
9393 AC_CONFIG_HEADER(
9394 netwerk/necko-config.h
9395 xpcom/xpcom-config.h
9396 xpcom/xpcom-private.h
9399 # Save the defines header file before autoconf removes it.
9400 # (Do not add AC_DEFINE calls after this line.)
9401   _CONFIG_TMP=confdefs-tmp.h
9402   _CONFIG_DEFS_H=mozilla-config.h
9404   cat > $_CONFIG_TMP <<\EOF
9405 /* List of defines generated by configure. Included with preprocessor flag,
9406  * -include, to avoid long list of -D defines on the compile command-line.
9407  * Do not edit.
9408  */
9410 #ifndef _MOZILLA_CONFIG_H_
9411 #define _MOZILLA_CONFIG_H_
9414 _EGREP_PATTERN='^#define ('
9415 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9416     for f in $_NON_GLOBAL_ACDEFINES; do
9417         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9418     done
9420 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9422   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9424   cat >> $_CONFIG_TMP <<\EOF
9426 #endif /* _MOZILLA_CONFIG_H_ */
9430   # Only write mozilla-config.h when something changes (or it doesn't exist)
9431   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9432     rm $_CONFIG_TMP
9433   else
9434     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9435     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9437     echo ==== $_CONFIG_DEFS_H =================================
9438     cat $_CONFIG_DEFS_H
9439   fi
9441 dnl Probably shouldn't call this manually but we always want the output of DEFS
9442 rm -f confdefs.h.save
9443 mv confdefs.h confdefs.h.save
9444 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9445 AC_OUTPUT_MAKE_DEFS()
9446 MOZ_DEFINES=$DEFS
9447 AC_SUBST(MOZ_DEFINES)
9448 rm -f confdefs.h
9449 mv confdefs.h.save confdefs.h
9451 dnl Load the list of Makefiles to generate.
9452 dnl   To add new Makefiles, edit allmakefiles.sh.
9453 dnl   allmakefiles.sh sets the variable, MAKEFILES.
9454 . ${srcdir}/allmakefiles.sh
9455 dnl 
9456 dnl Run a perl script to quickly create the makefiles.
9457 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9458 dnl   for the files it cannot handle correctly. This way, config.status
9459 dnl   will handle these files.
9460 dnl If it fails, nothing is set and config.status will run as usual.
9462 dnl This does not change the $MAKEFILES variable.
9464 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9466 if test -z "${AS_PERL}"; then
9467 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9468 else
9469 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9471 . ./conftest.sh
9472 rm conftest.sh
9474 echo $MAKEFILES > unallmakefiles
9476 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9478 AC_OUTPUT($MAKEFILES)
9480 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9481 if test "$CAIRO_FEATURES_H"; then
9482   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9483     echo "$CAIRO_FEATURES_H is unchanged"
9484     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9485   else
9486     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9487   fi
9490 # Run freetype configure script
9492 if test "$MOZ_TREE_FREETYPE"; then
9493    export CFLAGS="$CFLAGS -std=c99"
9494    export CPPFLAGS="$CPPFLAGS"
9495    export CXXFLAGS="$CXXFLAGS"
9496    export LDFLAGS="$LDFLAGS"
9497    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9498    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9499    AC_OUTPUT_SUBDIRS(modules/freetype2)
9502 dnl ========================================================
9503 dnl = Setup a nice relatively clean build environment for
9504 dnl = sub-configures.
9505 dnl ========================================================
9506 CC="$_SUBDIR_CC" 
9507 CXX="$_SUBDIR_CXX" 
9508 CFLAGS="$_SUBDIR_CFLAGS" 
9509 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9510 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9511 LDFLAGS="$_SUBDIR_LDFLAGS"
9512 HOST_CC="$_SUBDIR_HOST_CC" 
9513 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9514 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9517 unset MAKEFILES
9518 unset CONFIG_FILES
9520 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9521 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9523 if test -n "$MOZ_THUMB2"; then
9524   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9526 if test -n "$MOZ_ARM_ARCH"; then
9527   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --with-cpu-arch=$MOZ_ARM_ARCH"
9529 if test -n "$_WRAP_MALLOC"; then
9530   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9533 if test -z "$MOZ_NATIVE_NSPR"; then
9534     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9535     if test -z "$MOZ_DEBUG"; then
9536         ac_configure_args="$ac_configure_args --disable-debug"
9537     fi
9538     if test "$MOZ_OPTIMIZE" = "1"; then
9539         ac_configure_args="$ac_configure_args --enable-optimize"
9540     fi
9541     if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9542        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9543     fi
9544     if test -n "$HAVE_64BIT_OS"; then
9545         ac_configure_args="$ac_configure_args --enable-64bit"
9546     fi
9547     if test -n "$USE_ARM_KUSER"; then
9548         ac_configure_args="$ac_configure_args --with-arm-kuser"
9549     fi
9550     AC_OUTPUT_SUBDIRS(nsprpub)
9551     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9554 if test -z "$MOZ_NATIVE_NSPR"; then
9555     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9556     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9557     if test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
9558        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9559        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9560        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9561        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9562     fi
9563     rm -f config/autoconf.mk.bak
9566 # Run the SpiderMonkey 'configure' script.
9567 dist=$MOZ_BUILD_ROOT/dist
9568 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9569 ac_configure_args="$ac_configure_args --enable-threadsafe"
9570 if test "$BUILD_CTYPES"; then
9571     # Build js-ctypes on the platforms we can.
9572     ac_configure_args="$ac_configure_args --enable-ctypes"
9574 if test -z "$JS_SHARED_LIBRARY" ; then
9575     ac_configure_args="$ac_configure_args --disable-shared-js"
9577 if test -z "$MOZ_NATIVE_NSPR"; then
9578     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9579     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9581 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9582 ac_configure_args="$ac_configure_args --prefix=$dist"
9583 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9584 if test "$MOZ_MEMORY"; then
9585    ac_configure_args="$ac_configure_args --enable-jemalloc"
9586    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9587      export MOZ_MEMORY_LDFLAGS
9588    fi
9590 AC_OUTPUT_SUBDIRS(js/src)
9591 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9593 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9595 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9596 dnl Needs to be at the end to respect possible changes from NSPR configure
9597 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9598   echo "config/autoconf.mk is unchanged"
9599   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9600 else
9601   rm -f config/autoconf.mk.orig 2> /dev/null