bug 671474: Fennec release builders should use the same buildid. r=mark.finkle
[gecko.git] / configure.in
blob0ed15047a20ea32441a4ca28260ff30444d72390
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
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.14
127 GNOMEVFS_VERSION=2.0
128 GNOMEUI_VERSION=2.2.0
129 GCONF_VERSION=1.2.1
130 GIO_VERSION=2.18
131 STARTUP_NOTIFICATION_VERSION=0.8
132 DBUS_VERSION=0.60
133 SQLITE_VERSION=3.7.5
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 *-mingw*)
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 -n "$L10NBASEDIR"; then
224     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
225         AC_MSG_ERROR([--with-l10n-base must specify a path])
226     elif test -d "$L10NBASEDIR"; then
227         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
228     else
229         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
230     fi
232 AC_SUBST(L10NBASEDIR)
234 dnl Check for Perl first -- needed for win32 SDK checks
235 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
236 if test -z "$PERL" -o "$PERL" = ":"; then
237     AC_MSG_ERROR([perl not found in \$PATH])
240 dnl ========================================================
241 dnl = Android uses a very custom (hacky) toolchain; we need to do this
242 dnl = here, so that the compiler checks can succeed
243 dnl ========================================================
245 MOZ_ARG_WITH_STRING(android-ndk,
246 [  --with-android-ndk=DIR
247                           location where the Android NDK can be found],
248     android_ndk=$withval)
250 MOZ_ARG_WITH_STRING(android-toolchain,
251 [  --with-android-toolchain=DIR
252                           location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
253     android_toolchain=$withval)
256 MOZ_ARG_WITH_STRING(android-version,
257 [  --with-android-version=VER
258                           android platform version, default 5],
259     android_version=$withval,
260     android_version=5)
262 MOZ_ARG_WITH_STRING(android-sdk,
263 [  --with-android-sdk=DIR
264                           location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
265     android_sdk=$withval)
267 MOZ_ARG_WITH_STRING(android-platform,
268 [  --with-android-platform=DIR
269                            location of platform dir, default NDK/build/platforms/android-5/arch-arm],
270     android_platform=$withval)
272 case "$target" in
273 arm-linux*-android*|*-linuxandroid*)
274     android_tool_prefix="arm-linux-androideabi"
275     ;;
276 arm-android-eabi)
277     android_tool_prefix="arm-eabi"
278     ;;
280     android_tool_prefix="$target_os"
281     ;;
282 esac
284 case "$target" in
285 *-android*|*-linuxandroid*)
286     if test -z "$android_ndk" ; then
287         AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
288     fi
290     if test -z "$android_sdk" ; then
291         AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
292     fi
294     android_platform_tools="$android_sdk"/../../platform-tools
295     if test ! -d "$android_platform_tools" ; then
296         android_platform_tools="$android_sdk"/tools # SDK Tools < r8
297     fi
299     if test -z "$android_toolchain" ; then
300         android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
301     fi
303     if test -z "$android_platform" ; then
304        android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
305     fi
307     dnl set up compilers
308     AS="$android_toolchain"/bin/"$android_tool_prefix"-as
309     CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
310     CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
311     CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
312     LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
313     AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
314     RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
315     STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
317     if test -e "$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a" ; then
318        STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
319        STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/  -lstlport_static"
320     elif  test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a" ; then
321        STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
322        STLPORT_LDFLAGS="-L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/armeabi-v7a  -lstlport_static"
323     elif test "$target" != "arm-android-eabi"; then
324        dnl fail if we're not building with NDKr4
325        AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
326     fi
328     CPPFLAGS="-I$android_platform/usr/include $STLPORT_CPPFLAGS $CPPFLAGS"
329     CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
330     CXXFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CXXFLAGS"
331     LIBS="$LIBS $STLPORT_LDFLAGS"
333     dnl Add -llog by default, since we use it all over the place.
334     dnl Add --allow-shlib-undefined, because libGLESv2 links to an
335     dnl undefined symbol (present on the hardware, just not in the
336     dnl NDK.)
337     LDFLAGS="-mandroid -L$android_platform/usr/lib -L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
339     dnl prevent cross compile section from using these flags as host flags
340     if test -z "$HOST_CPPFLAGS" ; then
341         HOST_CPPFLAGS=" "
342     fi
343     if test -z "$HOST_CFLAGS" ; then
344         HOST_CFLAGS=" "
345     fi
346     if test -z "$HOST_CXXFLAGS" ; then
347         HOST_CXXFLAGS=" "
348     fi
349     if test -z "$HOST_LDFLAGS" ; then
350         HOST_LDFLAGS=" "
351     fi
353     ANDROID_NDK="${android_ndk}"
354     ANDROID_TOOLCHAIN="{android_toolchain}"
355     ANDROID_PLATFORM="{android_platform}"
356     ANDROID_SDK="${android_sdk}"
357     ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
358     ANDROID_VERSION="${android_version}"
359     if test -z "$ANDROID_PACKAGE_NAME" ; then
360         ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
361     fi
363     AC_DEFINE(ANDROID)
364     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
365     AC_SUBST(ANDROID_VERSION)
366     CROSS_COMPILE=1
367     MOZ_CHROME_FILE_FORMAT=omni
368     ZLIB_DIR=yes
369     ;;
370 esac
372 AC_SUBST(ANDROID_NDK)
373 AC_SUBST(ANDROID_TOOLCHAIN)
374 AC_SUBST(ANDROID_PLATFORM)
375 AC_SUBST(ANDROID_SDK)
376 AC_SUBST(ANDROID_PLATFORM_TOOLS)
377 AC_SUBST(ANDROID_PACKAGE_NAME)
379 dnl ========================================================
380 dnl Checks for compilers.
381 dnl ========================================================
382 dnl Set CROSS_COMPILE in the environment when running configure
383 dnl to use the cross-compile setup for now
384 dnl ========================================================
386 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
387 AR_FLAGS='cr $@'
389 if test "$COMPILE_ENVIRONMENT"; then
391 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
392     echo "cross compiling from $host to $target"
393     cross_compiling=yes
395     _SAVE_CC="$CC"
396     _SAVE_CFLAGS="$CFLAGS"
397     _SAVE_LDFLAGS="$LDFLAGS"
399     AC_MSG_CHECKING([for host c compiler])
400     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
401     if test -z "$HOST_CC"; then
402         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
403     fi
404     AC_MSG_RESULT([$HOST_CC])
405     AC_MSG_CHECKING([for host c++ compiler])
406     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
407     if test -z "$HOST_CXX"; then
408         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
409     fi
410     AC_MSG_RESULT([$HOST_CXX])
412     if test -z "$HOST_CFLAGS"; then
413         HOST_CFLAGS="$CFLAGS"
414     fi
415     if test -z "$HOST_CXXFLAGS"; then
416         HOST_CXXFLAGS="$CXXFLAGS"
417     fi
418     if test -z "$HOST_LDFLAGS"; then
419         HOST_LDFLAGS="$LDFLAGS"
420     fi
421     if test -z "$HOST_AR_FLAGS"; then
422         HOST_AR_FLAGS="$AR_FLAGS"
423     fi
424     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
425     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
426     CC="$HOST_CC"
427     CFLAGS="$HOST_CFLAGS"
428     LDFLAGS="$HOST_LDFLAGS"
430     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
431     AC_TRY_COMPILE([], [return(0);], 
432         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
433         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
435     CC="$HOST_CXX"
436     CFLAGS="$HOST_CXXFLAGS"
438     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
439     AC_TRY_COMPILE([], [return(0);], 
440         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
441         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
442     
443     CC=$_SAVE_CC
444     CFLAGS=$_SAVE_CFLAGS
445     LDFLAGS=$_SAVE_LDFLAGS
447     case "$build:$target" in
448       powerpc-apple-darwin8*:i?86-apple-darwin*)
449         dnl The Darwin cross compiler doesn't necessarily point itself at a
450         dnl root that has libraries for the proper architecture, it defaults
451         dnl to the system root.  The libraries in the system root on current
452         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
453         dnl checks will fail.  Fake a working SDK in that case.
454         _SAVE_CFLAGS=$CFLAGS
455         _SAVE_CXXFLAGS=$CXXLAGS
456         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
457         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
458         ;;
459     esac
461     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
462     unset ac_cv_prog_CC
463     AC_PROG_CC
464     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
465     unset ac_cv_prog_CXX
466     AC_PROG_CXX
468     case "$build:$target" in
469       powerpc-apple-darwin8*:i?86-apple-darwin*)
470         dnl Revert the changes made above.  From this point on, the target
471         dnl compiler will never be used without applying the SDK to CFLAGS
472         dnl (see --with-macos-sdk below).
473         CFLAGS=$_SAVE_CFLAGS
474         CXXFLAGS=$_SAVE_CXXFLAGS
475         ;;
476     esac
478     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
479     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
480     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
481     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
482     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
483     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
484     AC_DEFINE(CROSS_COMPILE)
485 else
486     AC_PROG_CC
487     AC_PROG_CXX
488     AC_PROG_RANLIB
489     MOZ_PATH_PROGS(AS, $AS as, $CC)
490     AC_CHECK_PROGS(AR, ar, :)
491     AC_CHECK_PROGS(LD, ld, :)
492     AC_CHECK_PROGS(STRIP, strip, :)
493     AC_CHECK_PROGS(WINDRES, windres, :)
494     if test -z "$HOST_CC"; then
495         HOST_CC='$(CC)'
496     fi
497     if test -z "$HOST_CFLAGS"; then
498         HOST_CFLAGS='$(CFLAGS)'
499     fi
500     if test -z "$HOST_CXX"; then
501         HOST_CXX='$(CXX)'
502     fi
503     if test -z "$HOST_CXXFLAGS"; then
504         HOST_CXXFLAGS='$(CXXFLAGS)'
505     fi
506     if test -z "$HOST_LDFLAGS"; then
507         HOST_LDFLAGS='$(LDFLAGS)'
508     fi
509     if test -z "$HOST_RANLIB"; then
510         HOST_RANLIB='$(RANLIB)'
511     fi
512     if test -z "$HOST_AR"; then
513         HOST_AR='$(AR)'
514     fi
515     if test -z "$HOST_AR_FLAGS"; then
516         HOST_AR_FLAGS='$(AR_FLAGS)'
517     fi
520 GNU_AS=
521 GNU_LD=
522 GNU_CC=
523 GNU_CXX=
524 CC_VERSION='N/A'
525 CXX_VERSION='N/A'
526 if test "$GCC" = "yes"; then
527     GNU_CC=1
528     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
530 if test "$GXX" = "yes"; then
531     GNU_CXX=1
532     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
534 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
535     GNU_AS=1
537 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
538     GNU_LD=1
540 if test "$GNU_CC"; then
541     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
542         GCC_USE_GNU_LD=1
543     fi
546 INTEL_CC=
547 INTEL_CXX=
548 if test "$GCC" = yes; then
549    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
550      INTEL_CC=1
551    fi
554 if test "$GXX" = yes; then
555    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
556      INTEL_CXX=1
557    fi
560 CLANG_CC=
561 CLANG_CXX=
562 if test "$GCC" = yes; then
563    if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
564      CLANG_CC=1
565    fi
568 if test "$GXX" = yes; then
569    if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
570      CLANG_CXX=1
571    fi
574 dnl ========================================================
575 dnl Special win32 checks
576 dnl ========================================================
577 WINVER=502
578 dnl Target the Windows 7 SDK by default
579 WINSDK_TARGETVER=601
581 MOZ_ARG_WITH_STRING(windows-version,
582 [  --with-windows-version=WINSDK_TARGETVER
583                           Highest Windows version to target using this SDK
584                               502: Windows Server 2003
585                               600: Windows Vista
586                               601: Windows 7],
587   WINSDK_TARGETVER=$withval)
589 case "$WINSDK_TARGETVER" in
590 502|600|601)
591     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
592     ;;
595     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
596     ;;
598 esac
600 if test -n "$COMPILE_ENVIRONMENT"; then
601 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
602     # We can't build parental controls either
603     MOZ_DISABLE_PARENTAL_CONTROLS=1
607 case "$target" in
608 *-mingw*)
609     if test "$GCC" != "yes"; then
610         # Check to see if we are really running in a msvc environemnt
611         _WIN32_MSVC=1
612         AC_CHECK_PROGS(MIDL, midl)
614         # Make sure compilers are valid
615         CFLAGS="$CFLAGS -TC -nologo"
616         CXXFLAGS="$CXXFLAGS -TP -nologo"
617         AC_LANG_SAVE
618         AC_LANG_C
619         AC_TRY_COMPILE([#include <stdio.h>],
620             [ printf("Hello World\n"); ],,
621             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
623         AC_LANG_CPLUSPLUS
624         AC_TRY_COMPILE([#include <new.h>],
625             [ unsigned *test = new unsigned(42); ],,
626             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
627         AC_LANG_RESTORE
628         
629         changequote(,)
630         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
631         changequote([,])
632         
633         # Determine compiler version
634         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
635         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
636         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
637         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
638         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
639         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
641         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
642         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
644         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
645             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
646         fi
648         if test "$_CC_MAJOR_VERSION" = "14"; then
649             dnl Require VC8SP1 or newer.
650             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
651             if test "$_CC_RELEASE" -lt 50727 -o \
652                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
653               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.])
654             fi
656             _CC_SUITE=8
657             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
658             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
659         elif test "$_CC_MAJOR_VERSION" = "15"; then
660             _CC_SUITE=9
661             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
662             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
663         elif test "$_CC_MAJOR_VERSION" = "16"; then
664             _CC_SUITE=10
665             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
666             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
667         else
668             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
669         fi
671         _MOZ_RTTI_FLAGS_ON='-GR'
672         _MOZ_RTTI_FLAGS_OFF='-GR-'
673         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
674         _MOZ_EXCEPTIONS_FLAGS_OFF=''
675         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
677         if test -n "$WIN32_REDIST_DIR"; then
678           if test ! -d "$WIN32_REDIST_DIR"; then
679             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
680           fi
681           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
682         fi
684         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
685         dnl not something else like "magnetic tape manipulation utility".
686         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
687         if test -z "$MSMT_TOOL"; then
688           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
689         fi
691         changequote(,)
692         _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
693         changequote([,])
694         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
695         if test -z "$MSMANIFEST_TOOL_VERSION"; then
696           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
697         fi
699         MSMANIFEST_TOOL=1
700         unset MSMT_TOOL
702         # Check linker version
703         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
704         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
705         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
706             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
707         fi
709         INCREMENTAL_LINKER=1
711         # Check midl version
712         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
713         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
714         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
715         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
716         # Add flags if necessary
717         AC_MSG_CHECKING([for midl flags])
718         case "$target" in
719         i*86-*)
720             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
721                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
722                 # MIDL version 7.00.0500 or later has no problem.
723                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
724                 AC_MSG_RESULT([need -env win32])
725             else
726                 AC_MSG_RESULT([none needed])
727             fi
728             ;;
729         x86_64-*)
730             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
731             ;;
732         *)
733             AC_MSG_RESULT([none needed])
734             ;;
735         esac
737         # Identify which version of the SDK we're building with
738         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
739         # from there
740         MOZ_CHECK_HEADERS([winsdkver.h])
741         if test "$ac_cv_header_winsdkver_h" = "yes"; then
742             # Get the highest _WIN32_WINNT and NTDDI versions supported
743             # Take the higher of the two
744             # This is done because the Windows 7 beta SDK reports its
745             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
746             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
747                            ac_cv_winsdk_maxver,
748                            [cat > conftest.h <<EOF
749 #include <winsdkver.h>
750 #include <sdkddkver.h>
752 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
753 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
754 #else
755 #define WINSDK_MAXVER NTDDI_MAXVER
756 #endif
758 WINSDK_MAXVER
760                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
761                             rm -f conftest.h
762                            ])
763             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
764         else
765             # The Vista SDK is the only one to have sdkddkver.h but not
766             # WinSDKVer.h
767             MOZ_CHECK_HEADERS([sdkddkver.h])
768             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
769                 MOZ_WINSDK_MAXVER=0x06000000
770             else
771                 # Assume the Server 2003 Platform SDK
772                 MOZ_WINSDK_MAXVER=0x05020000
773             fi
774         fi
776         unset _MSVC_VER_FILTER
778         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
779             [
780                 AC_LANG_SAVE
781                 AC_LANG_CPLUSPLUS
782                 _SAVE_CXXFLAGS="$CXXFLAGS"
783                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
784                 AC_TRY_COMPILE([#include <exception>],
785                             [std::_Throw(std::exception()); return 0;],
786                             ac_cv_have_std__Throw="yes",
787                             ac_cv_have_std__Throw="no")
788                 CXXFLAGS="$_SAVE_CXXFLAGS"
789                 AC_LANG_RESTORE
790             ])
792         if test "$ac_cv_have_std__Throw" = "yes"; then
793             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
794                            ac_cv_have_dllimport_exception_bug,
795                 [
796                     AC_LANG_SAVE
797                     AC_LANG_CPLUSPLUS
798                     _SAVE_CXXFLAGS="$CXXFLAGS"
799                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
800                     AC_TRY_LINK([#include <vector>],
801                                 [std::vector<int> v; return v.at(1);],
802                                 ac_cv_have_dllimport_exception_bug="no",
803                                 ac_cv_have_dllimport_exception_bug="yes")
804                     CXXFLAGS="$_SAVE_CXXFLAGS"
805                     AC_LANG_RESTORE
806                 ])
807             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
808                 WRAP_STL_INCLUDES=1
809                 MOZ_MSVC_STL_WRAP__Throw=1
810                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
811             fi
812         else
813             AC_CACHE_CHECK(for overridable _RAISE,
814                            ac_cv_have__RAISE,
815                 [
816                     AC_LANG_SAVE
817                     AC_LANG_CPLUSPLUS
818                     _SAVE_CXXFLAGS="$CXXFLAGS"
819                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
820                     AC_TRY_COMPILE([#include <xstddef>
821                                     #undef _RAISE
822                                     #define _RAISE(x) externallyDefinedFunction((x).what())
823                                     #include <vector>
824                                    ],
825                                    [std::vector<int> v; return v.at(1);],
826                                    ac_cv_have__RAISE="no",
827                                    ac_cv_have__RAISE="yes")
828                     CXXFLAGS="$_SAVE_CXXFLAGS"
829                     AC_LANG_RESTORE
830                 ])
831             if test "$ac_cv_have__RAISE" = "yes"; then
832                 WRAP_STL_INCLUDES=1
833                 MOZ_MSVC_STL_WRAP__RAISE=1
834                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
835             else
836                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
837             fi
838         fi
840         if test "$WRAP_STL_INCLUDES" = "1"; then
841             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
842         fi
843     else
844         # Check w32api version
845         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
846         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
847         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
848         AC_TRY_COMPILE([#include <w32api.h>],
849             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
850                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
851                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
852                 #error "test failed."
853             #endif
854             , [ res=yes ], [ res=no ])
855         AC_MSG_RESULT([$res])
856         if test "$res" != "yes"; then
857             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
858         fi
859         # Check windres version
860         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
861         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
862         AC_MSG_RESULT([$_WINDRES_VERSION])
863         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
864         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
865         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
866         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
867         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
868         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
869         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
870                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
871                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
872                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
873                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
874                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
875         then
876             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
877         fi
879         MOZ_WINSDK_MAXVER=0x06010000
880     fi # !GNU_CC
882     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
883     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
884     # Require OS features provided by IE 5.0
885     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
887     # If the maximum version supported by this SDK is lower than the target
888     # version, error out
889     AC_MSG_CHECKING([for Windows SDK being recent enough])
890     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
891         AC_MSG_RESULT("yes")
892     else
893         AC_MSG_RESULT("no")
894         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.])
895     fi
897     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
898     # Definitions matching sdkddkver.h
899     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
900     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
901     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
902     ;;
903 esac
905 dnl Test breaks icc on OS/2 && MSVC
906 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
907     AC_PROG_CC_C_O
908     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
909         USING_HCC=1
910         _OLDCC=$CC
911         _OLDCXX=$CXX
912         CC="${srcdir}/build/hcc '$CC'"
913         CXX="${srcdir}/build/hcpp '$CXX'"
914     fi
917 AC_PROG_CPP
918 AC_PROG_CXXCPP
920 if test -n "$_WIN32_MSVC"; then
921     SKIP_PATH_CHECKS=1
922     SKIP_COMPILER_CHECKS=1
923     SKIP_LIBRARY_CHECKS=1
925     # Since we're skipping compiler and library checks, hard-code
926     # some facts here.
927     AC_DEFINE(HAVE_IO_H)
928     AC_DEFINE(HAVE_SETBUF)
929     AC_DEFINE(HAVE_ISATTY)
932 fi # COMPILE_ENVIRONMENT
934 AC_SUBST(MIDL_FLAGS)
935 AC_SUBST(_MSC_VER)
937 AC_SUBST(GNU_AS)
938 AC_SUBST(GNU_LD)
939 AC_SUBST(GNU_CC)
940 AC_SUBST(GNU_CXX)
941 AC_SUBST(INTEL_CC)
942 AC_SUBST(INTEL_CXX)
943 AC_SUBST(CLANG_CC)
944 AC_SUBST(CLANG_CXX)
946 AC_SUBST(STL_FLAGS)
947 AC_SUBST(WRAP_STL_INCLUDES)
948 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
949 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
951 dnl ========================================================
952 dnl Checks for programs.
953 dnl ========================================================
954 AC_PROG_INSTALL
955 AC_PROG_LN_S
957 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
958 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
959 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
960 _perl_res=$?
961 AC_MSG_RESULT([$_perl_version])
963 if test "$_perl_res" != 0; then
964     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
968 AC_MSG_CHECKING([for full perl installation])
969 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
970 _perl_res=$?
971 if test "$_perl_res" != 0; then
972     AC_MSG_RESULT([no])
973     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
974 else
975     AC_MSG_RESULT([yes])    
978 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
979 if test -z "$PYTHON"; then
980     AC_MSG_ERROR([python was not found in \$PATH])
983 if test -z "$COMPILE_ENVIRONMENT"; then
984     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
986 AC_SUBST(NSINSTALL_BIN)
988 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
989 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
990 MOZ_PATH_PROGS(UNZIP, unzip)
991 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
992     AC_MSG_ERROR([unzip not found in \$PATH])
994 MOZ_PATH_PROGS(ZIP, zip)
995 if test -z "$ZIP" -o "$ZIP" = ":"; then
996     AC_MSG_ERROR([zip not found in \$PATH])
998 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
999 MOZ_PATH_PROG(XARGS, xargs)
1000 if test -z "$XARGS" -o "$XARGS" = ":"; then
1001     AC_MSG_ERROR([xargs not found in \$PATH .])
1004 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
1005 AC_SUBST(RPMBUILD)
1007 if test "$COMPILE_ENVIRONMENT"; then
1009 dnl ========================================================
1010 dnl = Mac OS X toolchain support
1011 dnl ========================================================
1013 case "$target_os" in
1014 darwin*)
1015     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1016     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1017     dnl the environment and includedir purposes (when using an SDK, below),
1018     dnl but remember the full version number for the libdir (SDK).
1019     changequote(,)
1020     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1021     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1022     changequote([,])
1023     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1024         dnl Bug 280479, but this keeps popping up in bug 292530 too because
1025         dnl 4.0.0/4061 is the default compiler in Tiger.
1026         changequote(,)
1027         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1028         changequote([,])
1029         if test "$GCC_BUILD" = "4061" ; then
1030             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1031 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1032 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1033         fi
1034     fi
1036     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1037     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
1038     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1039     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1041     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
1042     dnl it has moved into /usr/bin.
1043     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1044     ;;
1045 esac
1047 AC_SUBST(GCC_VERSION)
1049 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1050 dnl that a universal binary is being produced.
1051 AC_SUBST(UNIVERSAL_BINARY)
1053 dnl ========================================================
1054 dnl Check for MacOS deployment target version
1055 dnl ========================================================
1057 MOZ_ARG_ENABLE_STRING(macos-target,
1058                       [  --enable-macos-target=VER (default=10.5)
1059                           Set the minimum MacOS version needed at runtime],
1060                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1062 case "$target" in
1063 *-darwin*)
1064     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1065         dnl Use the specified value
1066         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1067     else
1068         dnl No value specified on the command line or in the environment,
1069         dnl use architecture minimum.
1070         case "${target_cpu}" in
1071           ppc*)
1072             export MACOSX_DEPLOYMENT_TARGET=10.5
1073             ;;
1074           i*86)
1075             export MACOSX_DEPLOYMENT_TARGET=10.5
1076             ;;
1077           x86_64)
1078             export MACOSX_DEPLOYMENT_TARGET=10.6
1079             ;;
1080         esac
1081     fi
1082     ;;
1083 esac
1085 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1087 dnl ========================================================
1088 dnl = Mac OS X SDK support
1089 dnl ========================================================
1090 MACOS_SDK_DIR=
1091 NEXT_ROOT=
1092 MOZ_ARG_WITH_STRING(macos-sdk,
1093 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
1094     MACOS_SDK_DIR=$withval)
1096 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1097 dnl NEXT_ROOT will be set and exported only if it's needed.
1098 AC_SUBST(MACOS_SDK_DIR)
1099 AC_SUBST(NEXT_ROOT)
1101 if test "$MACOS_SDK_DIR"; then
1102   dnl Sync this section with the ones in NSPR and NSS.
1103   dnl Changes to the cross environment here need to be accounted for in
1104   dnl the libIDL checks (below) and xpidl build.
1106   if test ! -d "$MACOS_SDK_DIR"; then
1107     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1108 specify a valid SDK.  SDKs are installed when the optional cross-development
1109 tools are selected during the Xcode/Developer Tools installation.])
1110   fi
1112   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1113   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1114     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1115   else
1116     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1117     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1119     dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
1120     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1121     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1123     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1124       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1125       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1126       dnl be ignored and cause warnings when -syslibroot is specified.
1127       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1128       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1129       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1130     fi
1131   fi
1133   AC_LANG_SAVE
1134   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1135   AC_LANG_CPLUSPLUS
1136   AC_TRY_COMPILE([#include <new>],[],
1137    result=yes,
1138    result=no)
1139   AC_LANG_RESTORE
1140   AC_MSG_RESULT($result)
1142   if test "$result" = "no" ; then
1143     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1144   fi
1147 fi # COMPILE_ENVIRONMENT
1149 dnl clang prior to 2.9 (including Xcode 4) does not support all the
1150 dnl constructs required by the libtheora inline asm. This is used to
1151 dnl detect and disable it
1152 AC_LANG_SAVE
1153 AC_LANG_C
1154 AC_TRY_COMPILE([
1155 #if defined(__clang__)
1156 # if __clang_major__<2 || (__clang_major__==2 && __clang_minor__<9)
1157 #  error "clang older than 2.9 detected"
1158 # endif
1159 #endif
1160                ],
1161                [],
1162                result="yes",
1163                result="no")
1164 if test "$result" = "no"; then
1165     AC_DEFINE(HAVE_OLD_CLANG)
1166     HAVE_OLD_CLANG=1
1168 AC_LANG_RESTORE
1169 AC_SUBST(HAVE_OLD_CLANG)
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 mingw*)
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 WIN_TOP_SRC=
1217 MOZ_USER_DIR=".mozilla"
1219 MOZ_JPEG_CFLAGS=
1220 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1221 MOZ_ZLIB_CFLAGS=
1222 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1223 MOZ_BZ2_CFLAGS=
1224 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1225 MOZ_PNG_CFLAGS=
1226 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1228 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1229 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1230 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1231 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1232 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1233 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1234 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1235 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1237 MOZ_FS_LAYOUT=unix
1239 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1241 USE_DEPENDENT_LIBS=1
1243 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1245 if test -n "$CROSS_COMPILE"; then
1246     OS_TARGET="${target_os}"
1247     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1248     OS_RELEASE=
1249     case "${target_os}" in
1250         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1251         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1252         gnu*)         OS_ARCH=GNU ;;
1253         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1254         mingw*)       OS_ARCH=WINNT ;;
1255         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1256     esac
1257     case "${target}" in
1258         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1259     esac
1260 else
1261     OS_TARGET=`uname -s`
1262     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1263     OS_RELEASE=`uname -r`
1266 # Before this used `uname -m` when not cross compiling
1267 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1268 OS_TEST="${target_cpu}"
1270 _COMPILER_PREFIX=
1272 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1274 #######################################################################
1275 # Master "Core Components" macros for getting the OS target           #
1276 #######################################################################
1279 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1280 # cross-compilation.
1284 # Define and override various archtecture-specific variables, including
1285 # HOST_OS_ARCH
1286 # OS_ARCH
1287 # OS_TEST
1288 # OS_TARGET
1289 # OS_RELEASE
1290 # OS_MINOR_RELEASE
1293 case "$HOST_OS_ARCH" in
1294 mingw*)
1295     HOST_OS_ARCH=WINNT
1296     ;;
1297 darwin*)
1298     HOST_OS_ARCH=Darwin
1299     ;;
1300 linux*)
1301     HOST_OS_ARCH=Linux
1302     ;;
1303 solaris*)
1304     HOST_OS_ARCH=SunOS
1305     SOLARIS_SUNPRO_CC=
1306     SOLARIS_SUNPRO_CXX=
1307     if test -z "$GNU_CC"; then
1308         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1309             SOLARIS_SUNPRO_CC=1
1310        fi
1311     fi
1313     if test -z "$GNU_CXX"; then
1314        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1315            SOLARIS_SUNPRO_CXX=1
1316        fi
1317     fi
1318     AC_SUBST(SOLARIS_SUNPRO_CC)
1319     AC_SUBST(SOLARIS_SUNPRO_CXX)
1320     ;;
1321 BSD_386)
1322     HOST_OS_ARCH=BSD
1323     ;;
1324 dgux)
1325     HOST_OS_ARCH=DGUX
1326     ;;
1327 IRIX64)
1328     HOST_OS_ARCH=IRIX
1329     ;;
1330 UNIX_SV)
1331     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1332         HOST_OS_ARCH=NCR
1333     else
1334         HOST_OS_ARCH=UNIXWARE
1335     fi
1336     ;;
1337 ncr)
1338     HOST_OS_ARCH=NCR
1339     ;;
1340 UNIX_SYSTEM_V)
1341     HOST_OS_ARCH=NEC
1342     ;;
1343 OSF1)
1344     ;;
1345 OS_2)
1346     HOST_OS_ARCH=OS2
1347     ;;
1348 QNX)
1349     ;;
1350 SCO_SV)
1351     HOST_OS_ARCH=SCOOS
1352     ;;
1353 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1354     HOST_OS_ARCH=SINIX
1355     ;;
1356 UnixWare)
1357     HOST_OS_ARCH=UNIXWARE
1358     ;;
1359 esac
1361 case "$OS_ARCH" in
1362 WINNT)
1363     if test -z "$CROSS_COMPILE" ; then
1364         OS_TEST=`uname -p`
1365     fi
1366     ;;
1367 Windows_NT)
1369 # If uname -s returns "Windows_NT", we assume that we are using
1370 # the uname.exe in MKS toolkit.
1372 # The -r option of MKS uname only returns the major version number.
1373 # So we need to use its -v option to get the minor version number.
1374 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1376     OS_ARCH=WINNT
1377     OS_TARGET=WINNT
1378     OS_MINOR_RELEASE=`uname -v`
1379     if test "$OS_MINOR_RELEASE" = "00"; then
1380         OS_MINOR_RELEASE=0
1381     fi
1382     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1383     ;;
1384 MINGW*_NT*)
1386 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1387 # the uname.exe in the MSYS tools.
1389     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1390     OS_ARCH=WINNT
1391     OS_TARGET=WINNT
1392     ;;
1393 AIX)
1394     OS_RELEASE=`uname -v`.`uname -r`
1395     OS_TEST=${target_cpu}
1396     ;;
1397 BSD_386)
1398     OS_ARCH=BSD
1399     ;;
1400 dgux)
1401     OS_ARCH=DGUX
1402     ;;
1403 IRIX64)
1404     OS_ARCH=IRIX
1405     ;;
1406 UNIX_SV)
1407     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1408         OS_ARCH=NCR
1409     else
1410         OS_ARCH=UNIXWARE
1411         OS_RELEASE=`uname -v`
1412     fi
1413     ;;
1414 ncr)
1415     OS_ARCH=NCR
1416     ;;
1417 UNIX_SYSTEM_V)
1418     OS_ARCH=NEC
1419     ;;
1420 OSF1)
1421     case `uname -v` in
1422     148)
1423         OS_RELEASE=V3.2C
1424         ;;
1425     564)
1426         OS_RELEASE=V4.0B
1427         ;;
1428     878)
1429         OS_RELEASE=V4.0D
1430         ;;
1431     esac
1432     ;;
1433 OS_2)
1434     OS_ARCH=OS2
1435     OS_TARGET=OS2
1436     OS_RELEASE=`uname -v`
1437     ;;
1438 QNX)
1439     if test "$OS_TARGET" != "NTO"; then
1440         changequote(,)
1441         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1442         changequote([,])
1443     fi
1444     OS_TEST=x86
1445     ;;
1446 SCO_SV)
1447     OS_ARCH=SCOOS
1448     OS_RELEASE=5.0
1449     ;;
1450 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1451     OS_ARCH=SINIX
1452     OS_TEST=`uname -p`
1453     ;;
1454 UnixWare)
1455     OS_ARCH=UNIXWARE
1456     OS_RELEASE=`uname -v`
1457     ;;
1458 Darwin)
1459     case "${target_cpu}" in
1460     powerpc*)
1461         OS_TEST=ppc
1462         ;;
1463     i*86*)
1464         OS_TEST=i386 
1465         ;;
1466     x86_64)
1467         OS_TEST=x86_64
1468         ;;
1469     *)
1470         if test -z "$CROSS_COMPILE" ; then
1471             OS_TEST=`uname -p`
1472         fi
1473         ;;
1474     esac
1475     ;;
1476 esac
1478 if test "$OS_ARCH" = "NCR"; then
1479     changequote(,)
1480     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1481     changequote([,])
1484 # Only set CPU_ARCH if we recognize the value of OS_TEST
1486 case "$OS_TEST" in
1487 *86 | i86pc)
1488     CPU_ARCH=x86
1489     ;;
1491 powerpc64 | ppc64)
1492     CPU_ARCH=ppc64
1493     ;;
1495 powerpc | ppc | rs6000)
1496     CPU_ARCH=ppc
1497     ;;
1499 Alpha | alpha | ALPHA)
1500     CPU_ARCH=Alpha
1501     ;;
1503 s390)
1504     CPU_ARCH=s390
1505     ;;
1507 s390x)
1508     CPU_ARCH=s390x
1509     ;;
1511 hppa* | parisc)
1512     CPU_ARCH=hppa
1513     ;;
1515 sun4u | sparc*)
1516     CPU_ARCH=sparc
1517     ;;
1519 x86_64 | ia64)
1520     CPU_ARCH="$OS_TEST"
1521     ;;
1523 arm*)
1524     CPU_ARCH=arm
1525     ;;
1527 mips|mipsel)
1528     CPU_ARCH="mips"
1529     ;;
1530 esac
1532 if test -z "$OS_TARGET"; then
1533     OS_TARGET=$OS_ARCH
1535 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1537 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1538 dnl ===============================================================
1539 INTEL_ARCHITECTURE=
1540 case "$OS_TEST" in
1541     x86_64|i?86)
1542       INTEL_ARCHITECTURE=1
1543 esac
1545 dnl ========================================================
1546 dnl GNU specific defaults
1547 dnl ========================================================
1548 if test "$GNU_CC"; then
1549     # FIXME: Let us build with strict aliasing. bug 414641.
1550     CFLAGS="$CFLAGS -fno-strict-aliasing"
1551     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1552     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1553     DSO_LDOPTS='-shared'
1554     if test "$GCC_USE_GNU_LD"; then
1555         # Don't allow undefined symbols in libraries, and remove dead symbols
1556         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs -Wl,--gc-sections"
1557         CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
1558         CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
1559     fi
1560     WARNINGS_AS_ERRORS='-Werror'
1561     DSO_CFLAGS=''
1562     DSO_PIC_CFLAGS='-fPIC'
1563     ASFLAGS="$ASFLAGS -fPIC"
1564     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1565     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1566     _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1567     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1569     # Turn on GNU specific features
1570     # -Wall - turn on all warnings
1571     # -pedantic - make compiler warn about non-ANSI stuff, and
1572     #             be a little bit stricter
1573     # -Wdeclaration-after-statement - MSVC doesn't like these
1574     # Warnings slamm took out for now (these were giving more noise than help):
1575     # -Wbad-function-cast - warns when casting a function to a new return type
1576     # -Wshadow - removed because it generates more noise than help --pete
1577     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith -Wdeclaration-after-statement"
1578     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1579        # Don't use -Wcast-align with ICC or clang
1580        case "$CPU_ARCH" in
1581            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1582            hppa | ia64 | sparc | arm)
1583            ;;
1584            *)
1585         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1586            ;;
1587        esac
1588     fi
1590     dnl Turn pedantic on but disable the warnings for long long
1591     _PEDANTIC=1
1593     if test -z "$INTEL_CC"; then
1594       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1595     fi
1597     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1598     _USE_CPP_INCLUDE_FLAG=1
1599 elif test "$SOLARIS_SUNPRO_CC"; then
1600     DSO_CFLAGS=''
1601     if test "$CPU_ARCH" = "sparc"; then
1602         # for Sun Studio on Solaris/SPARC
1603         DSO_PIC_CFLAGS='-xcode=pic32'
1604     else
1605         DSO_PIC_CFLAGS='-KPIC'
1606     fi
1607     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1608 else
1609     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1610     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1612     DSO_LDOPTS='-shared'
1613     if test "$GNU_LD"; then
1614         # Don't allow undefined symbols in libraries
1615         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1616     fi
1618     DSO_CFLAGS=''
1619     DSO_PIC_CFLAGS='-KPIC'
1620     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1623 if test "$GNU_CXX"; then
1624     # FIXME: Let us build with strict aliasing. bug 414641.
1625     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1626     # Turn on GNU specific features
1627     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1628     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1629        # Don't use -Wcast-align with ICC or clang
1630        case "$CPU_ARCH" in
1631            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1632            hppa | ia64 | sparc | arm)
1633            ;;
1634            *)
1635         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1636            ;;
1637        esac
1638     fi
1640     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1641     _USE_CPP_INCLUDE_FLAG=1
1643     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1644                    ac_has_wno_invalid_offsetof,
1645         [
1646             AC_LANG_SAVE
1647             AC_LANG_CPLUSPLUS
1648             _SAVE_CXXFLAGS="$CXXFLAGS"
1649             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1650             AC_TRY_COMPILE([],
1651                            [return(0);],
1652                            ac_has_wno_invalid_offsetof="yes",
1653                            ac_has_wno_invalid_offsetof="no")
1654             CXXFLAGS="$_SAVE_CXXFLAGS"
1655             AC_LANG_RESTORE
1656         ])
1657     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1658         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1659     fi
1661     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1662                    ac_has_wno_variadic_macros,
1663         [
1664             AC_LANG_SAVE
1665             AC_LANG_CPLUSPLUS
1666             _SAVE_CXXFLAGS="$CXXFLAGS"
1667             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1668             AC_TRY_COMPILE([],
1669                            [return(0);],
1670                            ac_has_wno_variadic_macros="yes",
1671                            ac_has_wno_variadic_macros="no")
1672             CXXFLAGS="$_SAVE_CXXFLAGS"
1673             AC_LANG_RESTORE
1674         ])
1675     if test "$ac_has_wno_variadic_macros" = "yes"; then
1676         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1677     fi
1679     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1680                    ac_has_werror_return_type,
1681         [
1682             AC_LANG_SAVE
1683             AC_LANG_CPLUSPLUS
1684             _SAVE_CXXFLAGS="$CXXFLAGS"
1685             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1686             AC_TRY_COMPILE([],
1687                            [return(0);],
1688                            ac_has_werror_return_type="yes",
1689                            ac_has_werror_return_type="no")
1690             CXXFLAGS="$_SAVE_CXXFLAGS"
1691             AC_LANG_RESTORE
1692         ])
1693     if test "$ac_has_werror_return_type" = "yes"; then
1694         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1695     fi
1697 else
1698     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1701 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1702 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1703 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1704 dnl normal behavior.
1705 dnl ========================================================
1706 MKSHLIB_FORCE_ALL=
1707 MKSHLIB_UNFORCE_ALL=
1709 if test "$COMPILE_ENVIRONMENT"; then
1710 if test "$GNU_CC"; then
1711   AC_MSG_CHECKING(whether ld has archive extraction flags)
1712   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1713    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1714     ac_cv_mkshlib_force_and_unforce="no"
1715     exec 3<&0 <<LOOP_INPUT
1716         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1717         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1718         force="-Wl,-all";              unforce="-Wl,-none"
1719 LOOP_INPUT
1720     while read line
1721     do
1722       eval $line
1723       LDFLAGS=$force
1724       LIBS=$unforce
1725       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1726     done
1727     exec 0<&3 3<&-
1728     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1729    ])
1730   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1731     AC_MSG_RESULT(no)
1732   else
1733     AC_MSG_RESULT(yes)
1734     eval $ac_cv_mkshlib_force_and_unforce
1735     MKSHLIB_FORCE_ALL=$force
1736     MKSHLIB_UNFORCE_ALL=$unforce
1737   fi
1738 fi # GNU_CC
1739 fi # COMPILE_ENVIRONMENT
1741 dnl =================================================================
1742 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1743 dnl which is bad when cross compiling.
1744 dnl =================================================================
1745 if test "$COMPILE_ENVIRONMENT"; then
1746 configure_static_assert_macros='
1747 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1748 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1749 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1752 dnl test that the macros actually work:
1753 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1754 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1755  [AC_LANG_SAVE
1756   AC_LANG_C
1757   ac_cv_static_assertion_macros_work="yes"
1758   AC_TRY_COMPILE([$configure_static_assert_macros],
1759                  [CONFIGURE_STATIC_ASSERT(1)],
1760                  ,
1761                  ac_cv_static_assertion_macros_work="no")
1762   AC_TRY_COMPILE([$configure_static_assert_macros],
1763                  [CONFIGURE_STATIC_ASSERT(0)],
1764                  ac_cv_static_assertion_macros_work="no",
1765                  )
1766   AC_LANG_CPLUSPLUS
1767   AC_TRY_COMPILE([$configure_static_assert_macros],
1768                  [CONFIGURE_STATIC_ASSERT(1)],
1769                  ,
1770                  ac_cv_static_assertion_macros_work="no")
1771   AC_TRY_COMPILE([$configure_static_assert_macros],
1772                  [CONFIGURE_STATIC_ASSERT(0)],
1773                  ac_cv_static_assertion_macros_work="no",
1774                  )
1775   AC_LANG_RESTORE
1776  ])
1777 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1778 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1779     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1781 fi # COMPILE_ENVIRONMENT
1783 dnl ========================================================
1784 dnl Checking for 64-bit OS
1785 dnl ========================================================
1786 if test "$COMPILE_ENVIRONMENT"; then
1787 AC_LANG_SAVE
1788 AC_LANG_C
1789 AC_MSG_CHECKING(for 64-bit OS)
1790 AC_TRY_COMPILE([$configure_static_assert_macros],
1791                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1792                result="yes", result="no")
1793 AC_MSG_RESULT("$result")
1794 if test "$result" = "yes"; then
1795     AC_DEFINE(HAVE_64BIT_OS)
1796     HAVE_64BIT_OS=1
1798 AC_SUBST(HAVE_64BIT_OS)
1799 AC_LANG_RESTORE
1800 fi # COMPILE_ENVIRONMENT
1802 dnl ========================================================
1803 dnl Enable high-memory support on OS/2 by default.
1804 dnl ========================================================
1805 MOZ_OS2_HIGH_MEMORY=1
1806 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1807 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1808     MOZ_OS2_HIGH_MEMORY=,
1809     MOZ_OS2_HIGH_MEMORY=1 )
1810 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1812 dnl ========================================================
1813 dnl = Use profiling compile flags
1814 dnl ========================================================
1815 MOZ_ARG_ENABLE_BOOL(profiling,
1816 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1817     MOZ_PROFILING=1,
1818     MOZ_PROFILING= )
1820 dnl ========================================================
1821 dnl = Use Valgrind
1822 dnl ========================================================
1823 MOZ_ARG_ENABLE_BOOL(valgrind,
1824 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1825     MOZ_VALGRIND=1,
1826     MOZ_VALGRIND= )
1827 if test -n "$MOZ_VALGRIND"; then
1828     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1829         AC_MSG_ERROR(
1830             [--enable-valgrind specified but Valgrind is not installed]))
1831     AC_DEFINE(MOZ_VALGRIND)
1834 dnl ========================================================
1835 dnl jprof
1836 dnl ========================================================
1837 MOZ_ARG_ENABLE_BOOL(jprof,
1838 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1839     MOZ_JPROF=1,
1840     MOZ_JPROF= )
1841 if test -n "$MOZ_JPROF"; then
1842     MOZ_PROFILING=1
1843     AC_DEFINE(MOZ_JPROF)
1846 dnl ========================================================
1847 dnl shark
1848 dnl ========================================================
1849 MOZ_ARG_ENABLE_BOOL(shark,
1850 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1851     MOZ_SHARK=1,
1852     MOZ_SHARK= )
1853 if test -n "$MOZ_SHARK"; then
1854     MOZ_PROFILING=1
1855     AC_DEFINE(MOZ_SHARK)
1858 dnl ========================================================
1859 dnl callgrind
1860 dnl ========================================================
1861 MOZ_ARG_ENABLE_BOOL(callgrind,
1862 [  --enable-callgrind      Enable callgrind profiling],
1863     MOZ_CALLGRIND=1,
1864     MOZ_CALLGRIND= )
1865 if test -n "$MOZ_CALLGRIND"; then
1866     AC_DEFINE(MOZ_CALLGRIND)
1869 dnl ========================================================
1870 dnl vtune
1871 dnl ========================================================
1872 MOZ_ARG_ENABLE_BOOL(vtune,
1873 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1874     MOZ_VTUNE=1,
1875     MOZ_VTUNE= )
1876 if test -n "$MOZ_VTUNE"; then
1877     MOZ_PROFILING=1
1878     AC_DEFINE(MOZ_VTUNE)
1881 dnl ========================================================
1882 dnl Profiling
1883 dnl ========================================================
1884 if test -n "$MOZ_PROFILING"; then
1885     AC_DEFINE(MOZ_PROFILING)
1888 dnl ========================================================
1889 dnl System overrides of the defaults for host
1890 dnl ========================================================
1891 case "$host" in
1892 *mingw*)
1893     if test -n "$_WIN32_MSVC"; then
1894         HOST_AR=lib
1895         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1896         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1897         HOST_RANLIB='echo ranlib'
1898     else
1899         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1900     fi
1901     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1902     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1903     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1904     HOST_BIN_SUFFIX=.exe
1905     case "$host" in
1906     *mingw*)
1907         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1908         ;;
1909     esac
1911     case "${host_cpu}" in
1912     x86_64)
1913         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1914         ;;
1915     esac
1916     ;;
1918 *-darwin*)
1919     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1920     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1921     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1922     ;;
1924 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1925     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1926     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1927     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1928     ;;
1930 *os2*)
1931     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1932     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1933     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1934     HOST_BIN_SUFFIX=.exe
1935     MOZ_FIX_LINK_PATHS=
1936     ;;
1938 *-osf*)
1939     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1940     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1941     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1942     ;;
1945     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1946     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1947     ;;
1948 esac
1950 dnl We require version 2.5 or newer of Python to build.
1951 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1952 changequote(,)
1953 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1954 _python_res=$?
1955 changequote([,])
1956 if test "$_python_res" != 0; then
1957     AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1959 AC_MSG_RESULT([yes])
1961 dnl Get mozilla version from central milestone file
1962 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1964 dnl Get version of various core apps from the version files.
1965 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1967 if test -z "$FIREFOX_VERSION"; then
1968     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1971 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1972 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1974 MOZ_DOING_LTO(lto_is_enabled)
1976 dnl ========================================================
1977 dnl System overrides of the defaults for target
1978 dnl ========================================================
1980 case "$target" in
1981 *-aix*)
1982     AC_DEFINE(AIX)
1983     if test ! "$GNU_CC"; then
1984         if test ! "$HAVE_64BIT_OS"; then
1985             # Compiling with Visual Age C++ object model compat is the
1986             # default. To compile with object model ibm, add 
1987             # AIX_OBJMODEL=ibm to .mozconfig.
1988             if test "$AIX_OBJMODEL" = "ibm"; then
1989                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1990             else
1991                 AIX_OBJMODEL=compat
1992             fi
1993         else
1994             AIX_OBJMODEL=compat
1995         fi
1996         AC_SUBST(AIX_OBJMODEL)
1997         DSO_LDOPTS='-qmkshrobj=1'
1998         DSO_CFLAGS='-qflag=w:w'
1999         DSO_PIC_CFLAGS=
2000         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
2001         MOZ_FIX_LINK_PATHS=
2002         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2003         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2004         if test "$COMPILE_ENVIRONMENT"; then
2005             AC_LANG_SAVE
2006             AC_LANG_CPLUSPLUS
2007             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
2008             AC_TRY_COMPILE([],
2009                 [#if (__IBMCPP__ < 900)
2010                  #error "Bad compiler"
2011                  #endif],
2012                 _BAD_COMPILER=,_BAD_COMPILER=1)
2013             if test -n "$_BAD_COMPILER"; then
2014                 AC_MSG_RESULT([no])    
2015                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
2016             else
2017                 AC_MSG_RESULT([yes])    
2018             fi
2019             AC_LANG_RESTORE
2020             TARGET_COMPILER_ABI="ibmc"
2021             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
2022             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
2023         fi
2024     fi
2025     case "${target_os}" in
2026     aix4.1*)
2027         DLL_SUFFIX='_shr.a'
2028         ;;
2029     esac
2030     if test "$COMPILE_ENVIRONMENT"; then
2031         MOZ_CHECK_HEADERS(sys/inttypes.h)
2032     fi
2033     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2034     ;;
2036 *-bsdi*)
2037     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2038     _PEDANTIC=
2039     case $OS_RELEASE in
2040         4.*|5.*)
2041             STRIP="$STRIP -d"
2042             ;;
2043         *)
2044             DSO_CFLAGS=''
2045             DSO_LDOPTS='-r'
2046             _WARNINGS_CFLAGS="-Wall"
2047             _WARNINGS_CXXFLAGS="-Wall"
2048             # The test above doesn't work properly, at least on 3.1.
2049             MKSHLIB_FORCE_ALL=''
2050             MKSHLIB_UNFORCE_ALL=''
2051         ;;
2052     esac
2053     ;;
2055 *-darwin*) 
2056     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2057     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2058     # If we're building with --enable-profiling, we need a frame pointer.
2059     if test -z "$MOZ_PROFILING"; then
2060         MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
2061     else
2062         MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
2063     fi
2064     _PEDANTIC=
2065     CFLAGS="$CFLAGS -fno-common"
2066     CXXFLAGS="$CXXFLAGS -fno-common"
2067     DLL_SUFFIX=".dylib"
2068     DSO_LDOPTS=''
2069     STRIP="$STRIP -x -S"
2070     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2071     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2072     # The ExceptionHandling framework is needed for Objective-C exception
2073     # logging code in nsObjCExceptions.h. Currently we only use that in debug
2074     # builds.
2075     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2077     if test "x$lto_is_enabled" = "xyes"; then
2078         echo "Skipping -dead_strip because lto is enabled."
2079     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2080     dnl ===================================================================
2081     elif test "x$enable_dtrace" = "xyes"; then
2082         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2083     else
2084         dnl check for the presence of the -dead_strip linker flag
2085         AC_MSG_CHECKING([for -dead_strip option to ld])
2086         _SAVE_LDFLAGS=$LDFLAGS
2087         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2088         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2089         if test -n "$_HAVE_DEAD_STRIP" ; then
2090             AC_MSG_RESULT([yes])
2091             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2092         else
2093             AC_MSG_RESULT([no])
2094         fi
2095         
2096         LDFLAGS=$_SAVE_LDFLAGS
2097     fi
2098     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2099     ;;
2101 *-freebsd*)
2102     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2103         DLL_SUFFIX=".so.1.0"
2104         DSO_LDOPTS="-shared"
2105     fi
2106     if test ! "$GNU_CC"; then
2107         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2108     fi
2109     ;; 
2111 ia64*-hpux*)
2112     DLL_SUFFIX=".so"
2113     if test ! "$GNU_CC"; then
2114        DSO_LDOPTS='-b'
2115        DSO_CFLAGS=""
2116        DSO_PIC_CFLAGS=
2117        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2118        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2119        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2120     else
2121        DSO_LDOPTS='-b -E'
2122        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2123        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2124     fi
2125     MOZ_FIX_LINK_PATHS=
2126     SYSTEM_MAKEDEPEND=
2127     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2128     AC_DEFINE(_LARGEFILE64_SOURCE)
2129     ;;
2131 *-hpux*)
2132     DLL_SUFFIX=".sl"
2133     if test ! "$GNU_CC"; then
2134         DSO_LDOPTS='-b -Wl,+s'
2135         DSO_CFLAGS=""
2136         DSO_PIC_CFLAGS="+Z"
2137         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2138         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2139         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2140     else
2141         DSO_LDOPTS='-b -E +s'
2142         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2143         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2144     fi
2145     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2146     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2147     ;;
2149 *-irix5*)
2150     AC_DEFINE(IRIX)
2151     DSO_LDOPTS='-elf -shared'
2153     if test "$GNU_CC"; then
2154        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2155        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2156        MKSHLIB_FORCE_ALL='-Wl,-all'
2157        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2158        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2159     else
2160        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2161        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2162        MKSHLIB_FORCE_ALL='-all'
2163        MKSHLIB_UNFORCE_ALL='-none'
2164     fi
2165     ;;
2167 *-irix6*)
2168     AC_DEFINE(IRIX)
2169     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2170     dnl compile and link using -n32
2171     USE_N32=1
2172     TARGET_COMPILER_ABI=n32
2173     DSO_LDOPTS='-elf -shared'
2174     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2175     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2176     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2177     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2178     if test "$GNU_CC"; then
2179        MKSHLIB_FORCE_ALL='-Wl,-all'
2180        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2181        _WARNINGS_CFLAGS="-Wall"
2182        _WARNINGS_CXXFLAGS="-Wall"
2183        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2184     else
2185        MKSHLIB_FORCE_ALL='-all'
2186        MKSHLIB_UNFORCE_ALL='-none'
2187            AR_LIST="$AR t"
2188            AR_EXTRACT="$AR x"
2189            AR_DELETE="$AR d"
2190            AR='$(CXX) -ar'
2191            AR_FLAGS='-o $@'
2192        CFLAGS="$CFLAGS -woff 3262 -G 4"
2193        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2194        if test -n "$USE_N32"; then
2195            ASFLAGS="$ASFLAGS -n32"
2196            CFLAGS="$CFLAGS -n32"
2197            CXXFLAGS="$CXXFLAGS -n32"
2198            LDFLAGS="$LDFLAGS -n32"
2199        fi
2200        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2201        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2202        MOZ_FIX_LINK_PATHS=
2203     fi
2204     if test -z "$GNU_CXX"; then
2205       MIPSPRO_CXX=1
2206     fi
2207     ;;
2209 *-android*|*-linuxandroid*)
2210     AC_DEFINE(NO_PW_GECOS)
2211     no_x=yes
2212     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2213     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2215     MOZ_GFX_OPTIMIZE_MOBILE=1
2216     # If we're building with --enable-profiling, we need a frame pointer.
2217     if test -z "$MOZ_PROFILING"; then
2218         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2219     else
2220         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
2221     fi
2222     ;;
2224 *-*linux*)
2225     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2226     # Similarly for GNU_CXX and INTEL_CXX.
2227     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2228         # -Os has been broken on Intel's C/C++ compilers for quite a
2229         # while; Intel recommends against using it.
2230         MOZ_OPTIMIZE_FLAGS="-O2"
2231         MOZ_DEBUG_FLAGS="-g"
2232     elif test "$GNU_CC" -o "$GNU_CXX"; then
2233         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2234         case $GCC_VERSION in
2235         4.1.*|4.2.*|4.5.*)
2236             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2237             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2238         esac
2239         # If we're building with --enable-profiling, we need a frame pointer.
2240         if test -z "$MOZ_PROFILING"; then
2241             MOZ_FRAMEPTR_FLAGS="-fomit-frame-pointer"
2242         else
2243             MOZ_FRAMEPTR_FLAGS="-fno-omit-frame-pointer"
2244         fi
2245         MOZ_PGO_OPTIMIZE_FLAGS="-O3 $MOZ_FRAMEPTR_FLAGS"
2246         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK $MOZ_FRAMEPTR_FLAGS"
2247         MOZ_DEBUG_FLAGS="-g"
2248     fi
2250     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2252     MOZ_MEMORY=1
2254     case "${target_cpu}" in
2255     alpha*)
2256         CFLAGS="$CFLAGS -mieee"
2257         CXXFLAGS="$CXXFLAGS -mieee"
2258     ;;
2259     i*86)
2260         USE_ELF_DYNSTR_GC=1
2261     ;;
2262     mips*)
2263         MOZ_DEBUG_FLAGS="-g" # We want inlining
2264     ;;
2265     esac
2267     if test -z "$MC"; then 
2268         MC=mc.exe  
2269     fi
2270     ;;
2271 *-mingw*)
2272     DSO_CFLAGS=
2273     DSO_PIC_CFLAGS=
2274     DLL_SUFFIX=.dll
2275     RC=rc.exe
2276     MC=mc.exe
2277     # certain versions of cygwin's makedepend barf on the 
2278     # #include <string> vs -I./dist/include/string issue so don't use it
2279     SYSTEM_MAKEDEPEND=
2280     if test -n "$GNU_CC"; then
2281         CC="$CC -mwindows"
2282         CXX="$CXX -mwindows"
2283         CPP="$CPP -mwindows"
2284         CFLAGS="$CFLAGS -mms-bitfields"
2285         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2286         DSO_LDOPTS='-shared'
2287         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2288         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2289         RC='$(WINDRES)'
2290         # Use temp file for windres (bug 213281)
2291         RCFLAGS='-O coff --use-temp-file'
2292         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2293         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2294         MOZ_FIX_LINK_PATHS=
2295         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2296         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2297         DLL_PREFIX=
2298         IMPORT_LIB_SUFFIX=dll.a
2299         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2300     else
2301         TARGET_COMPILER_ABI=msvc
2302         HOST_CC='$(CC)'
2303         HOST_CXX='$(CXX)'
2304         HOST_LD='$(LD)'
2305         if test "$AS_BIN"; then
2306             AS="$(basename "$AS_BIN")"
2307         fi
2308         AR='lib'
2309         AR_FLAGS='-NOLOGO -OUT:"$@"'
2310         AR_EXTRACT=
2311         RANLIB='echo not_ranlib'
2312         STRIP='echo not_strip'
2313         PKG_SKIP_STRIP=1
2314         XARGS=xargs
2315         ZIP=zip
2316         UNZIP=unzip
2317         DOXYGEN=:
2318         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2319         ASM_SUFFIX=asm
2320         OBJ_SUFFIX=obj
2321         LIB_SUFFIX=lib
2322         DLL_PREFIX=
2323         LIB_PREFIX=
2324         IMPORT_LIB_SUFFIX=lib
2325         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2326         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2327         MKSHLIB_FORCE_ALL=
2328         MKSHLIB_UNFORCE_ALL=
2329         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2330         _USE_CPP_INCLUDE_FLAG=1
2331         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2332         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2333         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2334         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2335         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2336         # make 'foo == bar;' error out
2337         CFLAGS="$CFLAGS -we4553"
2338         CXXFLAGS="$CXXFLAGS -we4553"
2339         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2340         MOZ_DEBUG_FLAGS='-Zi'
2341         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2342         WARNINGS_AS_ERRORS='-WX'
2343         # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
2344         if test -z "$MOZ_PROFILING"; then
2345             MOZ_OPTIMIZE_FLAGS='-O1'
2346         else
2347             MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
2348         fi
2349         MOZ_FIX_LINK_PATHS=
2350         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2351         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2352         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2353         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2354         if test $_MSC_VER -ge 1400; then
2355             LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2356             dnl For profile-guided optimization
2357             PROFILE_GEN_CFLAGS="-GL"
2358             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2359             dnl XXX: PGO builds can fail with warnings treated as errors,
2360             dnl specifically "no profile data available" appears to be
2361             dnl treated as an error sometimes. This might be a consequence
2362             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2363             dnl with the linker doing most of the work in the whole-program
2364             dnl optimization/PGO case. I think it's probably a compiler bug,
2365             dnl but we work around it here.
2366             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2367             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2368             dnl Probably also a compiler bug, but what can you do?
2369             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2370             LDFLAGS="$LDFLAGS -DYNAMICBASE"
2371         fi
2372     fi
2373     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2374     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2375     AC_DEFINE(HAVE_SNPRINTF)
2376     AC_DEFINE(_WINDOWS)
2377     AC_DEFINE(WIN32)
2378     AC_DEFINE(XP_WIN)
2379     AC_DEFINE(XP_WIN32)
2380     AC_DEFINE(HW_THREADS)
2381     AC_DEFINE(STDC_HEADERS)
2382     AC_DEFINE(NEW_H, <new>)
2383     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2384     TARGET_MD_ARCH=win32
2385     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2386     BIN_SUFFIX='.exe'
2387     MOZ_USER_DIR="Mozilla"
2389     dnl Hardcode to win95 for now - cls
2390     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2392     dnl set NO_X11 defines here as the general check is skipped on win32
2393     no_x=yes
2394     AC_DEFINE(NO_X11)
2396     case "$host" in
2397     *-mingw*)
2398         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2399         ;;
2400     esac
2402     case "$host" in
2403     *-mingw*)
2404         if test -z "$MOZ_TOOLS"; then
2405             AC_MSG_ERROR([MOZ_TOOLS is not set])
2406         fi
2407         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2408         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2409             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2410         fi
2411         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2412         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2413             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2414         fi
2415         ;;
2416     esac 
2418     case "$host_os" in
2419     cygwin*|msvc*|mks*)
2420         AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
2421         ;;
2422     *)
2423         AC_CHECK_HEADERS(oleacc.idl)
2424         AC_LANG_SAVE
2425         AC_LANG_CPLUSPLUS
2426         MOZ_CHECK_HEADERS(atlbase.h)
2427         AC_LANG_RESTORE
2428         ;;
2429     esac
2431     case "$target" in
2432     i*86-*)
2433         if test "$HAVE_64BIT_OS"; then
2434             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2435         fi
2437         if test $_MSC_VER -ge 1400; then
2438             LDFLAGS="$LDFLAGS -SAFESEH"
2439         fi
2441         if test -n "$GNU_CC"; then
2442             CFLAGS="$CFLAGS -mstackrealign"
2443             CXXFLAGS="$CXXFLAGS -mstackrealign"
2444         fi
2446         MOZ_CHECK_HEADERS(mmintrin.h)
2447         AC_DEFINE(_X86_)
2448         ;;
2449     x86_64-*)
2450         AC_DEFINE(_AMD64_)
2451         ;;
2452     *)
2453         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2454         ;;
2455     esac
2457     if test "$HAVE_64BIT_OS"; then
2458         AC_DEFINE(_WIN64)
2459     fi
2460     ;;
2462 *-netbsd*)
2463     DSO_CFLAGS=''
2464     CFLAGS="$CFLAGS -Dunix"
2465     CXXFLAGS="$CXXFLAGS -Dunix"
2466     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2467         DLL_SUFFIX=".so"
2468         DSO_PIC_CFLAGS='-fPIC -DPIC'
2469         DSO_LDOPTS='-shared'
2470         BIN_FLAGS='-Wl,--export-dynamic'
2471     else
2472         DSO_PIC_CFLAGS='-fPIC -DPIC'
2473         DLL_SUFFIX=".so.1.0"
2474         DSO_LDOPTS='-shared'
2475     fi
2476     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2477     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2478     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2479     if test "$LIBRUNPATH"; then
2480         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2481     fi
2482     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2483     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2484     ;;
2486 *-nto*) 
2487         AC_DEFINE(NTO)  
2488         AC_DEFINE(_QNX_SOURCE)
2489         AC_DEFINE(_i386)
2490         OS_TARGET=NTO
2491         WARNINGS_AS_ERRORS=''
2492         MOZ_OPTIMIZE_FLAGS="-O"
2493         MOZ_DEBUG_FLAGS="-gstabs"
2494         USE_PTHREADS=1
2495         _PEDANTIC=
2496         LIBS="$LIBS -lsocket -lstdc++"
2497         _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2498         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2499         if test "$with_x" != "yes"
2500         then
2501                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2502             TK_CFLAGS='-I/usr/include/photon'
2503                 TK_LIBS='-lph'
2504         fi
2505         case "${target_cpu}" in
2506         ppc*)
2507         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2508         ;;
2509         esac
2510         case "${host_cpu}" in
2511         i*86)
2512         USE_ELF_DYNSTR_GC=1
2513         ;;
2514         esac
2515         ;;
2517 *-openbsd*)
2518     if test "$SO_VERSION"; then
2519         DLL_SUFFIX=".so.$SO_VERSION"
2520     else
2521         DLL_SUFFIX=".so.1.0"
2522     fi
2523     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2524     DSO_CFLAGS=''
2525     DSO_PIC_CFLAGS='-fPIC'
2526     DSO_LDOPTS='-shared -fPIC'
2527     if test "$LIBRUNPATH"; then
2528         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2529     fi
2530     ;;
2532 *-os2*)
2533     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2534     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2535     AC_DEFINE(OS2)
2536     AC_DEFINE(XP_OS2)
2537     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2538     AC_DEFINE(TCPV40HDRS)
2539     DLL_PREFIX=
2540     LIB_PREFIX=
2541     LIB_SUFFIX=lib
2542     BIN_SUFFIX=".exe"
2543     DLL_SUFFIX=".dll"
2544     IMPORT_LIB_SUFFIX=lib
2545     DSO_PIC_CFLAGS=
2546     AR=emxomfar
2547     AR_FLAGS='r $@'
2548     CFLAGS="$CFLAGS -Zomf"
2549     CXXFLAGS="$CXXFLAGS -Zomf"
2550     DSO_LDOPTS='-Zdll'
2551     BIN_FLAGS='-Zlinker /ST:0x100000'
2552     IMPLIB='emximp -o'
2553     FILTER='true'
2554     LDFLAGS='-Zmap'
2555     WARNINGS_AS_ERRORS='-Werror'
2556     MOZ_DEBUG_FLAGS="-g -fno-inline"
2557     MOZ_OPTIMIZE_FLAGS="-O2"
2558     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2559     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2560     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2561     TARGET_MD_ARCH=os2
2562     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2563     RC=rc.exe
2564     MC=mc.exe
2565     RCFLAGS='-n'
2566     MOZ_USER_DIR="Mozilla"
2567     ZIP="$ZIP -X"
2569     if test "$MOZTOOLS"; then
2570         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2571     else
2572         AC_MSG_ERROR([MOZTOOLS is not set])
2573     fi
2574     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2575         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2576         LDFLAGS="$LDFLAGS -Zhigh-mem"
2577         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2578         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2579     fi
2581     # GCC for OS/2 currently predefines these, but we don't want them
2582     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2583     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2585     AC_CACHE_CHECK(for __declspec(dllexport),
2586         ac_os2_declspec,
2587         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2588                         [return 0;],
2589                         ac_os2_declspec="yes",
2590                         ac_os2_declspec="no")])
2591     if test "$ac_os2_declspec" != "yes"; then
2592         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2593     fi
2594     ;;
2596 alpha*-*-osf*)
2597     if test "$GNU_CC"; then
2598       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2599       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2601     else
2602         MOZ_DEBUG_FLAGS='-g'
2603         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2604         CFLAGS="$CFLAGS -ieee"
2605         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2606         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2607         DSO_CFLAGS=
2608         DSO_PIC_CFLAGS=
2609         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2610         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2611         MKSHLIB_FORCE_ALL='-all'
2612         MKSHLIB_UNFORCE_ALL='-none'
2613         dnl Might fix the libxpcom.so breakage on this platform as well....
2614         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2615         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2616     fi
2617     if test -z "$GNU_CXX"; then
2618       COMPAQ_CXX=1
2619     fi
2620     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2621     ;;
2623 *-qnx*) 
2624     DIRENT_INO=d_stat.st_ino
2625     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2626     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2627     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2628     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2629     AC_DEFINE(STDC_HEADERS)
2630     if test "$no_x" = "yes"; then
2631             _PLATFORM_DEFAULT_TOOLKIT='photon'
2632             TK_CFLAGS='-I/usr/nto/include/photon'
2633             TK_LIBS='-lphoton -lphrender'
2634     fi
2635     ;;
2637 *-sco*) 
2638     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2639     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2640     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2641     if test ! "$GNU_CC"; then
2642        DSO_LDOPTS='-G'
2643     fi
2644     ;;
2646 *-solaris*) 
2647     AC_DEFINE(SOLARIS)
2648     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2649     SYSTEM_MAKEDEPEND=
2650     MOZ_FIX_LINK_PATHS=
2651     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2652     # libraries one level up (e.g. libnspr4.so)
2653     if test "$SOLARIS_SUNPRO_CC"; then
2654        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2655        LIBS="-lCrun -lCstd -lc $LIBS"
2656        NS_USE_NATIVE=1
2657        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2658        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2659        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2660        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2661        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2662        LDFLAGS="-xildoff $LDFLAGS"
2663        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2664            _SAVE_LDFLAGS=$LDFLAGS
2665            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2666            AC_TRY_LINK([#include <stdio.h>],
2667                        [printf("Hello World\n");],
2668                        ,
2669                        [LDFLAGS=$_SAVE_LDFLAGS])
2670        fi
2671        MOZ_OPTIMIZE_FLAGS="-xO4"
2672        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2673        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2674        MKSHLIB_FORCE_ALL='-z allextract'
2675        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2676        DSO_LDOPTS='-G'
2677        AR_LIST="$AR t"
2678        AR_EXTRACT="$AR x"
2679        AR_DELETE="$AR d"
2680        AR='$(CXX) -xar'
2681        AR_FLAGS='-o $@'
2682        AS='/usr/ccs/bin/as'
2683        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2684        AS_DASH_C_FLAG=''
2685        TARGET_COMPILER_ABI="sunc"
2686        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2687        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2688        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2689        AC_LANG_SAVE
2690        AC_LANG_CPLUSPLUS
2691        AC_TRY_COMPILE([],
2692            [#if (__SUNPRO_CC < 0x590)
2693            #error "Denied"
2694            #endif],
2695            _BAD_COMPILER=,_BAD_COMPILER=1)
2696        if test -n "$_BAD_COMPILER"; then
2697            _res="no"
2698            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2699        else
2700            _res="yes"
2701        fi
2702        AC_TRY_COMPILE([],
2703            [#if (__SUNPRO_CC >= 0x5100)
2704            #error "Sun C++ 5.10 or above"
2705            #endif],
2706            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2707        if test "$_ABOVE_SS12U1"; then
2708            # disable xannotate
2709            CXXFLAGS="$CXXFLAGS -xannotate=no"
2710        fi
2711        AC_MSG_RESULT([$_res])
2712        AC_LANG_RESTORE
2713     else
2714        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2715        LIBS="-lc $LIBS"
2716        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2717        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2718        ASFLAGS="$ASFLAGS -fPIC"
2719        DSO_LDOPTS='-shared'
2720        WARNINGS_AS_ERRORS='-Werror'
2721        _WARNINGS_CFLAGS=''
2722        _WARNINGS_CXXFLAGS=''
2723        if test "$OS_RELEASE" = "5.3"; then
2724            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2725        fi
2726     fi
2727     if test "$OS_RELEASE" = "5.5.1"; then
2728         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2729     fi
2730     ;;
2732 *-sunos*) 
2733     DSO_LDOPTS='-Bdynamic'
2734     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2735     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2736     AC_DEFINE(SUNOS4)
2737     AC_DEFINE(SPRINTF_RETURNS_STRING)
2738     case "$(target_os)" in
2739     sunos4.1*)
2740         DLL_SUFFIX='.so.1.0'
2741         ;;
2742     esac
2743     ;;
2745 *-sysv4.2uw7*) 
2746         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2747     ;;
2749 *-os2*)
2750     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2751     ;;
2753 esac
2755 dnl Only one oddball right now (QNX), but this gives us flexibility
2756 dnl if any other platforms need to override this in the future.
2757 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2759 dnl ========================================================
2760 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2761 dnl by now will not have any way to link most binaries (tests
2762 dnl as well as viewer, apprunner, etc.), because some symbols
2763 dnl will be left out of the "composite" .so's by ld as unneeded.
2764 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2765 dnl they can link in the static libs that provide the missing
2766 dnl symbols.
2767 dnl ========================================================
2768 NO_LD_ARCHIVE_FLAGS=
2769 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2770     NO_LD_ARCHIVE_FLAGS=1
2772 case "$target" in
2773 *-os2*)
2774     NO_LD_ARCHIVE_FLAGS=
2775     ;;
2776 *-aix4.3*|*-aix5*)
2777     NO_LD_ARCHIVE_FLAGS=
2778     ;;
2779 *-mingw*)
2780     if test -z "$GNU_CC"; then
2781         NO_LD_ARCHIVE_FLAGS=
2782     fi
2783     ;;
2784 esac
2785 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2787 dnl ========================================================
2788 dnl = Flags to strip unused symbols from .so components and
2789 dnl = to export jemalloc symbols when linking a program
2790 dnl ========================================================
2791 case "$target" in
2792     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2793         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2794         MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS='-rdynamic -Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/jemalloc-standalone-linkage-version-script'
2795         ;;
2796     *-solaris*)
2797         if test -z "$GNU_CC"; then
2798          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2799         else
2800          if test -z "$GCC_USE_GNU_LD"; then
2801           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2802          else
2803           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2804          fi
2805         fi
2806         ;;
2807     *-nto*) 
2808         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2809         ;;
2810     *-darwin*)
2811         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2812         ;;
2813     *-mingw*)
2814         if test -n "$GNU_CC"; then
2815            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2816         fi
2817         ;;
2818 esac
2820 if test -z "$COMPILE_ENVIRONMENT"; then
2821     SKIP_COMPILER_CHECKS=1
2822     SKIP_LIBRARY_CHECKS=1
2825 if test -z "$SKIP_COMPILER_CHECKS"; then
2826 dnl Checks for typedefs, structures, and compiler characteristics.
2827 dnl ========================================================
2828 AC_HEADER_STDC
2829 AC_C_CONST
2830 AC_TYPE_MODE_T
2831 AC_TYPE_OFF_T
2832 AC_TYPE_PID_T
2833 AC_TYPE_SIZE_T
2834 AC_LANG_CPLUSPLUS
2835 AC_MSG_CHECKING(for __stdcall)
2836 AC_CACHE_VAL(ac_cv___stdcall,
2837  [AC_TRY_COMPILE([template <typename Method> struct foo;
2838                   template <> struct foo<void (*)()> {};
2839                   template <> struct foo<void (__stdcall*)()> {};],
2840                  [],
2841                  [ac_cv___stdcall=true],
2842                  [ac_cv___stdcall=false])])
2843 if test "$ac_cv___stdcall" = true ; then
2844   AC_DEFINE(HAVE_STDCALL)
2845   AC_MSG_RESULT(yes)
2846 else
2847   AC_MSG_RESULT(no)
2849 AC_LANG_C
2850 AC_MSG_CHECKING(for ssize_t)
2851 AC_CACHE_VAL(ac_cv_type_ssize_t,
2852  [AC_TRY_COMPILE([#include <stdio.h>
2853                   #include <sys/types.h>],
2854                  [ssize_t foo = 0;],
2855                  [ac_cv_type_ssize_t=true],
2856                  [ac_cv_type_ssize_t=false])])
2857 if test "$ac_cv_type_ssize_t" = true ; then
2858   AC_DEFINE(HAVE_SSIZE_T)
2859   AC_MSG_RESULT(yes)
2860 else
2861   AC_MSG_RESULT(no)
2863 AC_STRUCT_ST_BLKSIZE
2864 AC_MSG_CHECKING(for siginfo_t)
2865 AC_CACHE_VAL(ac_cv_siginfo_t,
2866  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2867                   #include <signal.h>],
2868                  [siginfo_t* info;],
2869                  [ac_cv_siginfo_t=true],
2870                  [ac_cv_siginfo_t=false])])
2871 if test "$ac_cv_siginfo_t" = true ; then
2872   AC_DEFINE(HAVE_SIGINFO_T)
2873   AC_MSG_RESULT(yes)
2874 else
2875   AC_MSG_RESULT(no)
2878 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2879 dnl ========================================================
2880 AC_MSG_CHECKING(for int16_t)
2881 AC_CACHE_VAL(ac_cv_int16_t,
2882  [AC_TRY_COMPILE([#include <stdio.h>
2883                   #include <sys/types.h>],
2884                  [int16_t foo = 0;],
2885                  [ac_cv_int16_t=true],
2886                  [ac_cv_int16_t=false])])
2887 if test "$ac_cv_int16_t" = true ; then
2888   AC_DEFINE(HAVE_INT16_T)
2889   AC_MSG_RESULT(yes)
2890 else
2891   AC_MSG_RESULT(no)
2893 AC_MSG_CHECKING(for int32_t)
2894 AC_CACHE_VAL(ac_cv_int32_t,
2895  [AC_TRY_COMPILE([#include <stdio.h>
2896                   #include <sys/types.h>],
2897                  [int32_t foo = 0;],
2898                  [ac_cv_int32_t=true],
2899                  [ac_cv_int32_t=false])])
2900 if test "$ac_cv_int32_t" = true ; then
2901   AC_DEFINE(HAVE_INT32_T)
2902   AC_MSG_RESULT(yes)
2903 else
2904   AC_MSG_RESULT(no)
2906 AC_MSG_CHECKING(for int64_t)
2907 AC_CACHE_VAL(ac_cv_int64_t,
2908  [AC_TRY_COMPILE([#include <stdio.h>
2909                   #include <sys/types.h>],
2910                  [int64_t foo = 0;],
2911                  [ac_cv_int64_t=true],
2912                  [ac_cv_int64_t=false])])
2913 if test "$ac_cv_int64_t" = true ; then
2914   AC_DEFINE(HAVE_INT64_T)
2915   AC_MSG_RESULT(yes)
2916 else
2917   AC_MSG_RESULT(no)
2919 AC_MSG_CHECKING(for int64)
2920 AC_CACHE_VAL(ac_cv_int64,
2921  [AC_TRY_COMPILE([#include <stdio.h>
2922                   #include <sys/types.h>],
2923                  [int64 foo = 0;],
2924                  [ac_cv_int64=true],
2925                  [ac_cv_int64=false])])
2926 if test "$ac_cv_int64" = true ; then
2927   AC_DEFINE(HAVE_INT64)
2928   AC_MSG_RESULT(yes)
2929 else
2930   AC_MSG_RESULT(no)
2932 AC_MSG_CHECKING(for uint)
2933 AC_CACHE_VAL(ac_cv_uint,
2934  [AC_TRY_COMPILE([#include <stdio.h>
2935                   #include <sys/types.h>],
2936                  [uint foo = 0;],
2937                  [ac_cv_uint=true],
2938                  [ac_cv_uint=false])])
2939 if test "$ac_cv_uint" = true ; then
2940   AC_DEFINE(HAVE_UINT)
2941   AC_MSG_RESULT(yes)
2942 else
2943   AC_MSG_RESULT(no)
2945 AC_MSG_CHECKING(for uint_t)
2946 AC_CACHE_VAL(ac_cv_uint_t,
2947  [AC_TRY_COMPILE([#include <stdio.h>
2948                   #include <sys/types.h>],
2949                  [uint_t foo = 0;],
2950                  [ac_cv_uint_t=true],
2951                  [ac_cv_uint_t=false])])
2952 if test "$ac_cv_uint_t" = true ; then
2953   AC_DEFINE(HAVE_UINT_T)
2954   AC_MSG_RESULT(yes)
2955 else
2956   AC_MSG_RESULT(no)
2958 AC_MSG_CHECKING(for uint16_t)
2959 AC_CACHE_VAL(ac_cv_uint16_t,
2960  [AC_TRY_COMPILE([#include <stdio.h>
2961                   #include <sys/types.h>],
2962                  [uint16_t foo = 0;],
2963                  [ac_cv_uint16_t=true],
2964                  [ac_cv_uint16_t=false])])
2965 if test "$ac_cv_uint16_t" = true ; then
2966   AC_DEFINE(HAVE_UINT16_T)
2967   AC_MSG_RESULT(yes)
2968 else
2969   AC_MSG_RESULT(no)
2972 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2973 dnl are defined when compiling C++ but not C.  Since the result of this
2974 dnl test is used only in C++, do it in C++.
2975 AC_LANG_CPLUSPLUS
2977 AC_MSG_CHECKING(for uname.domainname)
2978 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2979     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2980         [ struct utsname *res; char *domain; 
2981             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2982         [ac_cv_have_uname_domainname_field=true],
2983         [ac_cv_have_uname_domainname_field=false])])
2985 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2986     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2987     AC_MSG_RESULT(yes)
2988 else
2989     AC_MSG_RESULT(no)
2992 AC_MSG_CHECKING(for uname.__domainname)
2993 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2994     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2995         [ struct utsname *res; char *domain; 
2996             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2997         [ac_cv_have_uname_us_domainname_field=true],
2998         [ac_cv_have_uname_us_domainname_field=false])])
3000 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3001     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3002     AC_MSG_RESULT(yes)
3003 else
3004     AC_MSG_RESULT(no)
3007 dnl ========================================================
3008 dnl C++ rtti
3009 dnl Should be smarter and check that the compiler does indeed have rtti
3010 dnl ========================================================
3012 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
3013 [  --enable-cpp-rtti       Enable C++ RTTI ],
3014 [ _MOZ_USE_RTTI=1 ],
3015 [ _MOZ_USE_RTTI= ])
3017 if test "$_MOZ_USE_RTTI"; then
3018    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
3019 else
3020    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
3023 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
3025 dnl Check whether we can use gcc's c++0x mode
3026 AC_LANG_CPLUSPLUS
3028 if test "$GNU_CXX"; then
3029     _SAVE_CXXFLAGS=$CXXFLAGS
3030     CXXFLAGS="$CXXFLAGS -std=gnu++0x"
3032     if test -z "$_MOZ_USE_RTTI"; then
3033         CXXFLAGS="$CXXFLAGS $_MOZ_RTTI_FLAGS"
3034         AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
3035             ac_cv_cxx0x_headers_bug,
3036             [AC_TRY_COMPILE([#include <memory>], [],
3037                             ac_cv_cxx0x_headers_bug="no",
3038                             ac_cv_cxx0x_headers_bug="yes")])
3039         CXXFLAGS="$_SAVE_CXXFLAGS"
3040         if test "$ac_cv_cxx0x_headers_bug" = "no"; then
3041             CXXFLAGS="$CXXFLAGS -std=gnu++0x"
3042         fi
3043     fi
3046 dnl Check for usable char16_t (2 bytes, unsigned)
3047 dnl (we might not need the unsignedness check anymore)
3048 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3049     ac_cv_have_usable_char16_t,
3050     [AC_TRY_COMPILE([$configure_static_assert_macros],
3051                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3052                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3053                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3054                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3055                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3056                     ac_cv_have_usable_char16_t="yes",
3057                     ac_cv_have_usable_char16_t="no")])
3058 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3059     AC_DEFINE(HAVE_CPP_CHAR16_T)
3060     HAVE_CPP_CHAR16_T=1
3061 elif test "$GNU_CXX"; then
3062     CXXFLAGS="$_SAVE_CXXFLAGS"
3065 dnl Check for usable wchar_t (2 bytes, unsigned)
3066 dnl (we really don't need the unsignedness check anymore)
3067 dnl ========================================================
3069 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3070     ac_cv_have_usable_wchar_v2,
3071     [AC_TRY_COMPILE([#include <stddef.h>
3072                      $configure_static_assert_macros],
3073                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3074                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3075                     ac_cv_have_usable_wchar_v2="yes",
3076                     ac_cv_have_usable_wchar_v2="no")])
3077 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3078     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3079     HAVE_CPP_2BYTE_WCHAR_T=1
3080 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3081 dnl This is really gcc-only
3082 dnl Do this test using CXX only since some versions of gcc
3083 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3084 dnl only have short-wchar support for c++.
3085 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3087     _SAVE_CXXFLAGS=$CXXFLAGS
3088     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3090     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3091         ac_cv_have_usable_wchar_option_v2,
3092         [AC_TRY_LINK([#include <stddef.h>
3093                       $configure_static_assert_macros],
3094                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3095                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3096                      ac_cv_have_usable_wchar_option_v2="yes",
3097                      ac_cv_have_usable_wchar_option_v2="no")])
3099     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3100         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3101         HAVE_CPP_2BYTE_WCHAR_T=1
3102         if test "$OS_TARGET" = Android; then
3103             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3104             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3105             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3106             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3107         else
3108             WCHAR_CFLAGS="-fshort-wchar"
3109         fi
3110     else    
3111         CXXFLAGS=$_SAVE_CXXFLAGS
3112     fi
3115 AC_LANG_C
3117 dnl Check for .hidden assembler directive and visibility attribute.
3118 dnl Borrowed from glibc configure.in
3119 dnl ===============================================================
3120 if test "$GNU_CC"; then
3121   AC_CACHE_CHECK(for visibility(hidden) attribute,
3122                  ac_cv_visibility_hidden,
3123                  [cat > conftest.c <<EOF
3124                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3126                   ac_cv_visibility_hidden=no
3127                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3128                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3129                       ac_cv_visibility_hidden=yes
3130                     fi
3131                   fi
3132                   rm -f conftest.[cs]
3133                  ])
3134   if test "$ac_cv_visibility_hidden" = "yes"; then
3135     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3137     AC_CACHE_CHECK(for visibility(default) attribute,
3138                    ac_cv_visibility_default,
3139                    [cat > conftest.c <<EOF
3140                     int foo __attribute__ ((visibility ("default"))) = 1;
3142                     ac_cv_visibility_default=no
3143                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3144                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3145                         ac_cv_visibility_default=yes
3146                       fi
3147                     fi
3148                     rm -f conftest.[cs]
3149                    ])
3150     if test "$ac_cv_visibility_default" = "yes"; then
3151       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3153       AC_CACHE_CHECK(for visibility pragma support,
3154                      ac_cv_visibility_pragma,
3155                      [cat > conftest.c <<EOF
3156 #pragma GCC visibility push(hidden)
3157                       int foo_hidden = 1;
3158 #pragma GCC visibility push(default)
3159                       int foo_default = 1;
3161                       ac_cv_visibility_pragma=no
3162                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3163                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3164                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3165                             ac_cv_visibility_pragma=yes
3166                           fi
3167                         fi
3168                       fi
3169                       rm -f conftest.[cs]
3170                     ])
3171       if test "$ac_cv_visibility_pragma" = "yes"; then
3172         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3173                        ac_cv_have_visibility_class_bug,
3174                        [cat > conftest.c <<EOF
3175 #pragma GCC visibility push(hidden)
3176 struct __attribute__ ((visibility ("default"))) TestStruct {
3177   static void Init();
3179 __attribute__ ((visibility ("default"))) void TestFunc() {
3180   TestStruct::Init();
3183                        ac_cv_have_visibility_class_bug=no
3184                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3185                          ac_cv_have_visibility_class_bug=yes
3186                        else
3187                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3188                            ac_cv_have_visibility_class_bug=yes
3189                          fi
3190                        fi
3191                        rm -rf conftest.{c,S}
3192                        ])
3194         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3195                        ac_cv_have_visibility_builtin_bug,
3196                        [cat > conftest.c <<EOF
3197 #pragma GCC visibility push(hidden)
3198 #pragma GCC visibility push(default)
3199 #include <string.h>
3200 #pragma GCC visibility pop
3202 __attribute__ ((visibility ("default"))) void Func() {
3203   char c[[100]];
3204   memset(c, 0, sizeof(c));
3207                        ac_cv_have_visibility_builtin_bug=no
3208                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3209                          ac_cv_have_visibility_builtin_bug=yes
3210                        else
3211                          if test `grep -c "@PLT" conftest.S` = 0; then
3212                            ac_cv_visibility_builtin_bug=yes
3213                          fi
3214                        fi
3215                        rm -f conftest.{c,S}
3216                        ])
3217         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3218                 "$ac_cv_have_visibility_class_bug" = "no"; then
3219           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3220           WRAP_SYSTEM_INCLUDES=1
3221           STL_FLAGS='-I$(DIST)/stl_wrappers'
3222           WRAP_STL_INCLUDES=1
3223         else
3224           VISIBILITY_FLAGS='-fvisibility=hidden'
3225         fi # have visibility pragma bug
3226       fi   # have visibility pragma
3227     fi     # have visibility(default) attribute
3228   fi       # have visibility(hidden) attribute
3229 fi         # GNU_CC
3231 # visibility hidden flag for Sun Studio on Solaris
3232 if test "$SOLARIS_SUNPRO_CC"; then
3233 VISIBILITY_FLAGS='-xldscope=hidden'
3234 fi         # Sun Studio on Solaris
3236 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3237 AC_SUBST(VISIBILITY_FLAGS)
3239 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3240 dnl ========================================================
3241 if test "$GNU_CC"; then
3242   CFLAGS_save="${CFLAGS}"
3243   CFLAGS="${CFLAGS} -Werror"
3244   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3245                  ac_cv_force_align_arg_pointer,
3246                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3247                                  [],
3248                                  ac_cv_force_align_arg_pointer="yes",
3249                                  ac_cv_force_align_arg_pointer="no")])
3250   CFLAGS="${CFLAGS_save}"
3251   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3252     HAVE_GCC_ALIGN_ARG_POINTER=1
3253   else
3254     HAVE_GCC_ALIGN_ARG_POINTER=
3255   fi
3257 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3259 dnl Checks for header files.
3260 dnl ========================================================
3261 AC_HEADER_DIRENT
3262 case "$target_os" in
3263 freebsd*|openbsd*)
3264 # for stuff like -lXshm
3265     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3266     ;;
3267 esac
3268 MOZ_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3269 MOZ_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3270 MOZ_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3271 MOZ_CHECK_HEADERS(malloc.h)
3272 MOZ_CHECK_HEADERS(X11/XKBlib.h)
3273 MOZ_CHECK_HEADERS(io.h)
3275 dnl These are all the places some variant of statfs can be hiding.
3276 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3278 dnl Quota support
3279 MOZ_CHECK_HEADERS(sys/quota.h)
3280 MOZ_CHECK_HEADERS(linux/quota.h)
3282 dnl Try for MMX support
3283 dnl NB - later gcc versions require -mmmx for this header to be successfully
3284 dnl included (or another option which implies it, such as -march=pentium-mmx)
3285 MOZ_CHECK_HEADERS(mmintrin.h)
3287 dnl Check whether the compiler supports the new-style C++ standard
3288 dnl library headers (i.e. <new>) or needs the old "new.h"
3289 AC_LANG_CPLUSPLUS
3290 NEW_H=new.h
3291 MOZ_CHECK_HEADER(new, [NEW_H=new])
3292 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3293 AC_LANG_C
3295 AC_ARG_ENABLE(dtrace,
3296               [  --enable-dtrace         build with dtrace support if available (default=no)],
3297               [enable_dtrace="yes"],)
3298 if test "x$enable_dtrace" = "xyes"; then
3299   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3300   if test -n "$HAVE_DTRACE"; then
3301       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3302   else
3303       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3304   fi
3306 AC_SUBST(HAVE_DTRACE)
3308 case $target in
3309 *-aix4.3*|*-aix5*)
3310         ;;
3312         MOZ_CHECK_HEADERS(sys/cdefs.h)
3313         ;;
3314 esac
3316 dnl Checks for libraries.
3317 dnl ========================================================
3318 case $target in
3319 *-hpux11.*)
3320         ;;
3322         AC_CHECK_LIB(c_r, gethostbyname_r)
3323         ;;
3324 esac
3326 dnl We don't want to link with libdl even if it's present on OS X, since
3327 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3328 dnl in libc.
3329 dnl We don't want to link against libm or libpthread on Darwin since
3330 dnl they both are just symlinks to libSystem and explicitly linking
3331 dnl against libSystem causes issues when debugging (see bug 299601).
3332 case $target in
3333 *-darwin*)
3334     ;;
3335 *-os2*)
3336     ;;
3338     AC_SEARCH_LIBS(dlopen, dl, 
3339         MOZ_CHECK_HEADER(dlfcn.h, 
3340         AC_DEFINE(HAVE_DLOPEN)))
3341     ;;
3342 esac
3344 _SAVE_CFLAGS="$CFLAGS"
3345 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3346 AC_CHECK_FUNCS(dladdr memmem)
3347 CFLAGS="$_SAVE_CFLAGS"
3349 if test ! "$GNU_CXX"; then
3351     case $target in
3352     *-aix*)
3353         AC_CHECK_LIB(C_r, demangle)
3354         ;;
3355      *)
3356         AC_CHECK_LIB(C, demangle)
3357         ;;
3358      esac
3361 dnl OS/2 has socket in libc.
3362 case $target in
3363 *-os2*)
3364     ;;
3366     AC_CHECK_LIB(socket, socket)
3367 esac
3369 XLDFLAGS="$X_LIBS"
3370 XLIBS="$X_EXTRA_LIBS"
3372 dnl ========================================================
3373 dnl Checks for X libraries.
3374 dnl Ordering is important.
3375 dnl Xt is dependent upon SM as of X11R6
3376 dnl ========================================================
3377 if test "$no_x" = "yes"; then
3378     AC_DEFINE(NO_X11)
3379 else
3380     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3381         XLIBS="-lX11 $XLIBS"
3382         _SAVE_LDFLAGS="$LDFLAGS"
3383         LDFLAGS="$XLDFLAGS $LDFLAGS"
3384         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3385                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3386         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3387                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3388      
3389         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3390         unset ac_cv_lib_Xt_XtFree
3391             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3392             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3393         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3394                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3395         ])
3397     # AIX needs the motif library linked before libXt to prevent
3398     # crashes in plugins linked against Motif - Bug #98892
3399     case "${target_os}" in
3400     aix*)
3401         XT_LIBS="-lXm $XT_LIBS"
3402         ;;
3403     esac
3405     dnl ========================================================
3406     dnl = Check for XShm
3407     dnl ========================================================
3408     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3409         $XLIBS $XEXT_LIBS)
3411     dnl ========================================================
3412     dnl = Check for Xss
3413     dnl ========================================================
3414     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3415         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3416             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3417              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3419         LDFLAGS="$_SAVE_LDFLAGS"
3421     dnl ========================================================
3422     dnl = Check for freetype2 and its functionality
3423     dnl ========================================================
3424     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3426     if test "$_HAVE_FREETYPE2"; then
3427         _SAVE_LIBS="$LIBS"
3428         _SAVE_CFLAGS="$CFLAGS"
3429         LIBS="$LIBS $FT2_LIBS"
3430         CFLAGS="$CFLAGS $FT2_CFLAGS"
3432         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3433             ac_cv_member_FT_Bitmap_Size_y_ppem,
3434             [AC_TRY_COMPILE([#include <ft2build.h>
3435                              #include FT_FREETYPE_H],
3436                             [FT_Bitmap_Size s;
3437                              if (sizeof s.y_ppem) return 0;
3438                              return 1],
3439                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3440                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3441         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3442             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3443         else
3444             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3445         fi
3446         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3447                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3448                            [FT_Bitmap_Size structure includes y_ppem field])
3450         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3452         LIBS="$_SAVE_LIBS"
3453         CFLAGS="$_SAVE_CFLAGS"
3454     fi
3456 fi # $no_x
3458 AC_SUBST(XCFLAGS)
3459 AC_SUBST(XLDFLAGS)
3460 AC_SUBST(XLIBS)
3461 AC_SUBST(XEXT_LIBS)
3462 AC_SUBST(XT_LIBS)
3463 AC_SUBST(XSS_LIBS)
3465 dnl ========================================================
3466 dnl = pthread support
3467 dnl = Start by checking whether the system support pthreads
3468 dnl ========================================================
3469 case "$target_os" in
3470 darwin*)
3471     USE_PTHREADS=1
3472     ;;
3474     MOZ_CHECK_PTHREADS(pthreads,
3475         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3476         MOZ_CHECK_PTHREADS(pthread,
3477             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3478             MOZ_CHECK_PTHREADS(c_r,
3479                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3480                 MOZ_CHECK_PTHREADS(c,
3481                     USE_PTHREADS=1
3482                 )
3483             )
3484         )
3485     )
3486     ;;
3487 esac
3489 dnl ========================================================
3490 dnl Check the command line for --with-pthreads 
3491 dnl ========================================================
3492 MOZ_ARG_WITH_BOOL(pthreads,
3493 [  --with-pthreads         Force use of system pthread library with NSPR ],
3494 [ if test "$USE_PTHREADS"x = x; then
3495     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3496 fi],
3497     USE_PTHREADS=
3498     _PTHREAD_LDFLAGS=
3501 dnl ========================================================
3502 dnl Do the platform specific pthread hackery
3503 dnl ========================================================
3504 if test "$USE_PTHREADS"x != x
3505 then
3506         dnl
3507         dnl See if -pthread is supported.
3508         dnl
3509         rm -f conftest*
3510         ac_cv_have_dash_pthread=no
3511         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3512         echo 'int main() { return 0; }' | cat > conftest.c
3513         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3514         if test $? -eq 0; then
3515                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3516                         ac_cv_have_dash_pthread=yes
3517                 case "$target_os" in
3518                 freebsd*)
3519 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3520                 ;;
3521                 *)
3522                             CFLAGS="$CFLAGS -pthread"
3523                             CXXFLAGS="$CXXFLAGS -pthread"
3524                 ;;
3525                 esac
3526                 fi
3527         fi
3528         rm -f conftest*
3529     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3531         dnl
3532         dnl See if -pthreads is supported.
3533         dnl
3534     ac_cv_have_dash_pthreads=no
3535     if test "$ac_cv_have_dash_pthread" = "no"; then
3536             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3537         echo 'int main() { return 0; }' | cat > conftest.c
3538             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3539         if test $? -eq 0; then
3540                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3541                             ac_cv_have_dash_pthreads=yes
3542                             CFLAGS="$CFLAGS -pthreads"
3543                             CXXFLAGS="$CXXFLAGS -pthreads"
3544                     fi
3545             fi
3546             rm -f conftest*
3547         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3548     fi
3550         case "$target" in
3551             *-*-freebsd*)
3552                         AC_DEFINE(_REENTRANT)
3553                         AC_DEFINE(_THREAD_SAFE)
3554                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3555                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3556                                 _PTHREAD_LDFLAGS="-pthread"
3557                         else
3558                                 _PTHREAD_LDFLAGS="-lc_r"
3559                         fi
3560                         ;;
3562             *-*-openbsd*|*-*-bsdi*)
3563                         AC_DEFINE(_REENTRANT)
3564                         AC_DEFINE(_THREAD_SAFE)
3565                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3566                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3567                 _PTHREAD_LDFLAGS="-pthread"
3568                         fi
3569                         ;;
3571             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3572                         AC_DEFINE(_REENTRANT) 
3573                         ;;
3575             *-*-nto*) 
3576                         AC_DEFINE(_REENTRANT) 
3577                         ;;
3579             *-aix4.3*|*-aix5*)
3580                         AC_DEFINE(_REENTRANT) 
3581                         ;;
3583             *-hpux11.*)
3584                         AC_DEFINE(_REENTRANT) 
3585                         ;;
3587             alpha*-*-osf*)
3588                         AC_DEFINE(_REENTRANT)
3589                         ;;
3591             *-*-solaris*) 
3592                         AC_DEFINE(_REENTRANT)
3593                         if test "$SOLARIS_SUNPRO_CC"; then
3594                                 CFLAGS="$CFLAGS -mt" 
3595                                 CXXFLAGS="$CXXFLAGS -mt" 
3596                         fi
3597                         ;;
3598         esac
3599     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3602 dnl ========================================================
3603 dnl See if mmap sees writes
3604 dnl For cross compiling, just define it as no, which is a safe default
3605 dnl ========================================================
3606 AC_MSG_CHECKING(whether mmap() sees write()s)
3608 changequote(,)
3609 mmap_test_prog='
3610     #include <stdlib.h>
3611     #include <unistd.h>
3612     #include <sys/mman.h>
3613     #include <sys/types.h>
3614     #include <sys/stat.h>
3615     #include <fcntl.h>
3617     char fname[] = "conftest.file";
3618     char zbuff[1024]; /* Fractional page is probably worst case */
3620     int main() {
3621         char *map;
3622         int fd;
3623         int i;
3624         unlink(fname);
3625         fd = open(fname, O_RDWR | O_CREAT, 0660);
3626         if(fd<0) return 1;
3627         unlink(fname);
3628         write(fd, zbuff, sizeof(zbuff));
3629         lseek(fd, 0, SEEK_SET);
3630         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3631         if(map==(char*)-1) return 2;
3632         for(i=0; fname[i]; i++) {
3633             int rc = write(fd, &fname[i], 1);
3634             if(map[i]!=fname[i]) return 4;
3635         }
3636         return 0;
3637     }
3639 changequote([,])
3641 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3643 AC_MSG_RESULT("$result")
3645 if test "$result" = "no"; then
3646     AC_DEFINE(MMAP_MISSES_WRITES)
3650 dnl Checks for library functions.
3651 dnl ========================================================
3652 AC_PROG_GCC_TRADITIONAL
3653 AC_FUNC_MEMCMP
3654 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3655 AC_CHECK_FUNCS(flockfile getpagesize)
3656 AC_CHECK_FUNCS(localtime_r strtok_r)
3658 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3659 _SAVE_LDFLAGS=$LDFLAGS
3660 LDFLAGS="$LDFLAGS -lrt"
3661 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3662                ac_cv_have_clock_monotonic,
3663                [AC_TRY_LINK([#include <time.h>],
3664                             [ struct timespec ts;
3665                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3666                             ac_cv_have_clock_monotonic=yes,
3667                             ac_cv_have_clock_monotonic=no)])
3668 LDFLAGS=$_SAVE_LDFLAGS
3669 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3670     HAVE_CLOCK_MONOTONIC=1
3671     REALTIME_LIBS=-lrt
3672     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3673     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3674     AC_SUBST(REALTIME_LIBS)
3677 dnl check for wcrtomb/mbrtowc
3678 dnl =======================================================================
3679 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3680 AC_LANG_SAVE
3681 AC_LANG_CPLUSPLUS
3682 AC_CACHE_CHECK(for wcrtomb,
3683     ac_cv_have_wcrtomb,
3684     [AC_TRY_LINK([#include <wchar.h>],
3685                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3686                  ac_cv_have_wcrtomb="yes",
3687                  ac_cv_have_wcrtomb="no")])
3688 if test "$ac_cv_have_wcrtomb" = "yes"; then
3689     AC_DEFINE(HAVE_WCRTOMB)
3691 AC_CACHE_CHECK(for mbrtowc,
3692     ac_cv_have_mbrtowc,
3693     [AC_TRY_LINK([#include <wchar.h>],
3694                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3695                  ac_cv_have_mbrtowc="yes",
3696                  ac_cv_have_mbrtowc="no")])
3697 if test "$ac_cv_have_mbrtowc" = "yes"; then
3698     AC_DEFINE(HAVE_MBRTOWC)
3700 AC_LANG_RESTORE
3703 AC_CACHE_CHECK(
3704     [for res_ninit()],
3705     ac_cv_func_res_ninit,
3706     [AC_TRY_LINK([
3707         #ifdef linux
3708         #define _BSD_SOURCE 1
3709         #endif
3710         #include <resolv.h>
3711         ],
3712         [int foo = res_ninit(&_res);],
3713         [ac_cv_func_res_ninit=yes],
3714         [ac_cv_func_res_ninit=no])
3715     ])
3717 if test "$ac_cv_func_res_ninit" = "yes"; then
3718     AC_DEFINE(HAVE_RES_NINIT)
3719 dnl must add the link line we do something as foolish as this... dougt
3720 dnl else
3721 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3722 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3725 AC_LANG_CPLUSPLUS
3726 AC_CACHE_CHECK(
3727     [for gnu_get_libc_version()],
3728     ac_cv_func_gnu_get_libc_version,
3729     [AC_TRY_LINK([
3730         #ifdef HAVE_GNU_LIBC_VERSION_H
3731         #include <gnu/libc-version.h>
3732         #endif
3733         ],
3734         [const char *glibc_version = gnu_get_libc_version();],
3735         [ac_cv_func_gnu_get_libc_version=yes],
3736         [ac_cv_func_gnu_get_libc_version=no] 
3737         )]
3738     )
3740 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3741     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3744 case $target_os in
3745     darwin*|mingw*|os2*)
3746         ;;
3747     *)
3748     
3749 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3750     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3751         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3752 _SAVE_LIBS=$LIBS
3753 LIBS="$LIBS $_ICONV_LIBS"
3754 AC_CACHE_CHECK(
3755     [for iconv()],
3756     ac_cv_func_iconv,
3757     [AC_TRY_LINK([
3758         #include <stdlib.h>
3759         #include <iconv.h>
3760         ],
3761         [
3762             iconv_t h = iconv_open("", "");
3763             iconv(h, NULL, NULL, NULL, NULL);
3764             iconv_close(h);
3765         ],
3766         [ac_cv_func_iconv=yes],
3767         [ac_cv_func_iconv=no] 
3768         )]
3769     )
3770 if test "$ac_cv_func_iconv" = "yes"; then
3771     AC_DEFINE(HAVE_ICONV)
3772     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3773     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3774     LIBICONV="$_ICONV_LIBS"
3775     AC_CACHE_CHECK(
3776         [for iconv() with const input],
3777         ac_cv_func_const_iconv,
3778         [AC_TRY_COMPILE([
3779             #include <stdlib.h>
3780             #include <iconv.h>
3781             ],
3782             [
3783                 const char *input = "testing";
3784                 iconv_t h = iconv_open("", "");
3785                 iconv(h, &input, NULL, NULL, NULL);
3786                 iconv_close(h);
3787             ],
3788             [ac_cv_func_const_iconv=yes],
3789             [ac_cv_func_const_iconv=no] 
3790             )]
3791         )
3792     if test "$ac_cv_func_const_iconv" = "yes"; then
3793         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3794     fi
3796 LIBS=$_SAVE_LIBS
3798     ;;
3799 esac
3801 AM_LANGINFO_CODESET
3803 AC_LANG_C
3805 dnl **********************
3806 dnl *** va_copy checks ***
3807 dnl **********************
3808 dnl we currently check for all three va_copy possibilities, so we get
3809 dnl all results in config.log for bug reports.
3810 AC_MSG_CHECKING(for an implementation of va_copy())
3811 AC_CACHE_VAL(ac_cv_va_copy,[
3812     AC_TRY_RUN([
3813         #include <stdarg.h>
3814         void f (int i, ...) {
3815             va_list args1, args2;
3816             va_start (args1, i);
3817             va_copy (args2, args1);
3818             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3819                 exit (1);
3820             va_end (args1); va_end (args2);
3821         }
3822         int main() { f (0, 42); return 0; }],
3823         ac_cv_va_copy=yes,
3824         ac_cv_va_copy=no,
3825         ac_cv_va_copy=no
3826     )
3828 AC_MSG_RESULT($ac_cv_va_copy)
3829 AC_MSG_CHECKING(for an implementation of __va_copy())
3830 AC_CACHE_VAL(ac_cv___va_copy,[
3831     AC_TRY_RUN([
3832         #include <stdarg.h>
3833         void f (int i, ...) {
3834             va_list args1, args2;
3835             va_start (args1, i);
3836             __va_copy (args2, args1);
3837             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3838                 exit (1);
3839             va_end (args1); va_end (args2);
3840         }
3841         int main() { f (0, 42); return 0; }],
3842         ac_cv___va_copy=yes,
3843         ac_cv___va_copy=no,
3844         ac_cv___va_copy=no
3845     )
3847 AC_MSG_RESULT($ac_cv___va_copy)
3848 AC_MSG_CHECKING(whether va_lists can be copied by value)
3849 AC_CACHE_VAL(ac_cv_va_val_copy,[
3850     AC_TRY_RUN([
3851         #include <stdarg.h>
3852         void f (int i, ...) {
3853             va_list args1, args2;
3854             va_start (args1, i);
3855             args2 = args1;
3856             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3857                 exit (1);
3858             va_end (args1); va_end (args2);
3859         }
3860         int main() { f (0, 42); return 0; }],
3861         ac_cv_va_val_copy=yes,
3862         ac_cv_va_val_copy=no,
3863         ac_cv_va_val_copy=yes
3864     )
3866 if test "x$ac_cv_va_copy" = "xyes"; then
3867     AC_DEFINE(VA_COPY, va_copy)
3868     AC_DEFINE(HAVE_VA_COPY)
3869 elif test "x$ac_cv___va_copy" = "xyes"; then
3870     AC_DEFINE(VA_COPY, __va_copy)
3871     AC_DEFINE(HAVE_VA_COPY)
3874 if test "x$ac_cv_va_val_copy" = "xno"; then
3875    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3877 AC_MSG_RESULT($ac_cv_va_val_copy)
3879 dnl Check for dll-challenged libc's.
3880 dnl This check is apparently only needed for Linux.
3881 case "$target" in
3882         *-linux*)
3883             dnl ===================================================================
3884             _curdir=`pwd`
3885             export _curdir
3886             rm -rf conftest* _conftest
3887             mkdir _conftest
3888             cat >> conftest.C <<\EOF
3889 #include <stdio.h>
3890 #include <link.h>
3891 #include <dlfcn.h>
3892 #ifdef _dl_loaded
3893 void __dump_link_map(void) {
3894   struct link_map *map = _dl_loaded;
3895   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3897 int main() {
3898   dlopen("./conftest1.so",RTLD_LAZY);
3899   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3900   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3901   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3902   __dump_link_map();
3904 #else
3905 /* _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).*/
3906 int main() { printf("./conftest1.so\n"); }
3907 #endif
3910             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3912             cat >> conftest1.C <<\EOF
3913 #include <stdio.h>
3914 void foo(void) {printf("foo in dll called\n");}
3916             ${CXX-g++} -fPIC -c -g conftest1.C
3917             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3918             ${CXX-g++} -g conftest.C -o conftest -ldl
3919             cp -f conftest1.so conftest _conftest
3920             cd _conftest
3921             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3922             then
3923                 echo
3924                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3925                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3926                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3927                 echo "*** will be excessive memory usage at runtime."
3928                 echo
3929             fi
3930             cd ${_curdir}
3931             rm -rf conftest* _conftest
3932             dnl ===================================================================
3933             ;;
3934 esac
3936 dnl ===================================================================
3937 dnl ========================================================
3938 dnl Put your C++ language/feature checks below
3939 dnl ========================================================
3940 AC_LANG_CPLUSPLUS
3942 ARM_ABI_PREFIX=
3943 HAVE_GCC3_ABI=
3944 if test "$GNU_CC"; then
3945   if test "$CPU_ARCH" = "arm" ; then
3946     AC_CACHE_CHECK(for ARM EABI,
3947         ac_cv_gcc_arm_eabi,
3948         [AC_TRY_COMPILE([],
3949                         [
3950 #if defined(__ARM_EABI__)
3951   return 0;
3952 #else
3953 #error Not ARM EABI.
3954 #endif
3955                         ],
3956                         ac_cv_gcc_arm_eabi="yes",
3957                         ac_cv_gcc_arm_eabi="no")])
3958     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3959         HAVE_ARM_EABI=1
3960         ARM_ABI_PREFIX=eabi-
3961     else
3962         ARM_ABI_PREFIX=oabi-
3963     fi
3964   fi
3966   AC_CACHE_CHECK(for gcc 3.0 ABI,
3967       ac_cv_gcc_three_abi,
3968       [AC_TRY_COMPILE([],
3969                       [
3970 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3971   return 0;
3972 #else
3973 #error Not gcc3.
3974 #endif
3975                       ],
3976                       ac_cv_gcc_three_abi="yes",
3977                       ac_cv_gcc_three_abi="no")])
3978   if test "$ac_cv_gcc_three_abi" = "yes"; then
3979       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3980       HAVE_GCC3_ABI=1
3981   else
3982       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
3983   fi
3985 AC_SUBST(HAVE_GCC3_ABI)
3988 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3989                ac_cv_cpp_explicit,
3990                [AC_TRY_COMPILE(class X {
3991                                public: explicit X(int i) : i_(i) {}
3992                                private: int i_;
3993                                };,
3994                                X x(3);,
3995                                ac_cv_cpp_explicit=yes,
3996                                ac_cv_cpp_explicit=no)])
3997 if test "$ac_cv_cpp_explicit" = yes ; then
3998    AC_DEFINE(HAVE_CPP_EXPLICIT)
4001 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4002                ac_cv_cpp_typename,
4003                [AC_TRY_COMPILE(class param {
4004                                public:
4005                                    typedef unsigned long num_type;
4006                                };
4008                                template <class T> class tplt {
4009                                public:
4010                                    typedef typename T::num_type t_num_type;
4011                                    t_num_type foo(typename T::num_type num) {
4012                                        return num;
4013                                    }
4014                                };,
4015                                tplt<param> A;
4016                                A.foo(0);,
4017                                ac_cv_cpp_typename=yes,
4018                                ac_cv_cpp_typename=no)])
4019 if test "$ac_cv_cpp_typename" = yes ; then
4020    AC_DEFINE(HAVE_CPP_TYPENAME)
4023 dnl Check for support of modern template specialization syntax
4024 dnl Test code and requirement from scc@netscape.com.
4025 dnl Autoconf cut-and-paste job by waterson@netscape.com
4026 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4027                ac_cv_cpp_modern_specialize_template_syntax,
4028                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4029                                class Y {};
4030                                template <> struct X<Y> { double a; };,
4031                                X<int> int_x;
4032                                X<Y> y_x;,
4033                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4034                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4035 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4036   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4040 dnl Some compilers support only full specialization, and some don't.
4041 AC_CACHE_CHECK(whether partial template specialization works,
4042                ac_cv_cpp_partial_specialization,
4043                [AC_TRY_COMPILE(template <class T> class Foo {};
4044                                template <class T> class Foo<T*> {};,
4045                                return 0;,
4046                                ac_cv_cpp_partial_specialization=yes,
4047                                ac_cv_cpp_partial_specialization=no)])
4048 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4049   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4052 dnl Some compilers have limited support for operators with templates;
4053 dnl specifically, it is necessary to define derived operators when a base
4054 dnl class's operator declaration should suffice.
4055 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4056                ac_cv_need_derived_template_operators,
4057                [AC_TRY_COMPILE([template <class T> class Base { };
4058                                 template <class T>
4059                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4060                                 template <class T> class Derived : public Base<T> { };],
4061                                [Derived<char> a, b;
4062                                 Base<char> c = a + b;
4063                                 return 0;],
4064                                ac_cv_need_derived_template_operators=no,
4065                                ac_cv_need_derived_template_operators=yes)])
4066 if test "$ac_cv_need_derived_template_operators" = yes ; then
4067   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4071 dnl Some compilers have trouble detecting that a template class
4072 dnl that derives from another template is actually an instance
4073 dnl of the base class. This test checks for that.
4074 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4075                ac_cv_need_cpp_template_cast_to_base,
4076                [AC_TRY_COMPILE([template <class T> class Base { };
4077                                 template <class T> class Derived : public Base<T> { };
4078                                 template <class T> int foo(const Base<T>&) { return 0; }],
4079                                [Derived<char> bar; return foo(bar);],
4080                                ac_cv_need_cpp_template_cast_to_base=no,
4081                                ac_cv_need_cpp_template_cast_to_base=yes)])
4082 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4083   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4086 dnl Some compilers have trouble resolving the ambiguity between two
4087 dnl functions whose arguments differ only by cv-qualifications.
4088 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4089                ac_cv_can_resolve_const_ambiguity,
4090                [AC_TRY_COMPILE([
4091                                 template <class T> class ptrClass {
4092                                   public: T* ptr;
4093                                 };
4095                                 template <class T> T* a(ptrClass<T> *arg) {
4096                                   return arg->ptr;
4097                                 }
4099                                 template <class T>
4100                                 const T* a(const ptrClass<T> *arg) {
4101                                   return arg->ptr;
4102                                 }
4103                                ],
4104                                [ ptrClass<int> i;
4105                                  a(&i); ],
4106                                ac_cv_can_resolve_const_ambiguity=yes,
4107                                ac_cv_can_resolve_const_ambiguity=no)])
4108 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4109   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4113 dnl We don't do exceptions on unix.  The only reason this used to be here
4114 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4115 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4116 dnl So im commenting this out until someone writes some artificial 
4117 dnl intelligence to detect not only if the compiler has exceptions, but if 
4118 dnl they are enabled as well.
4119 dnl 
4120 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4121 dnl                ac_cv_cpp_exceptions,
4122 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4123 dnl                                static void F() { throw X(); },
4124 dnl                                try { F(); } catch(X & e) { },
4125 dnl                                ac_cv_cpp_exceptions=yes,
4126 dnl                                ac_cv_cpp_exceptions=no)])
4127 dnl if test $ac_cv_cpp_exceptions = yes ; then
4128 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4129 dnl fi
4131 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4132 dnl supports it well enough to allow us to use it to change access, but not
4133 dnl to resolve ambiguity. The next two tests determine how well the |using|
4134 dnl keyword is supported.
4136 dnl Check to see if we can change access with |using|.  Test both a
4137 dnl legal and an illegal example.
4138 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4139                ac_cv_cpp_access_changing_using2,
4140                [AC_TRY_COMPILE(
4141                    class A { protected: int foo() { return 0; } };
4142                    class B : public A { public: using A::foo; };,
4143                    B b; return b.foo();,
4144                    [AC_TRY_COMPILE(
4145                        class A { public: int foo() { return 1; } };
4146                        class B : public A { private: using A::foo; };,
4147                        B b; return b.foo();,
4148                        ac_cv_cpp_access_changing_using2=no,
4149                        ac_cv_cpp_access_changing_using2=yes)],
4150                    ac_cv_cpp_access_changing_using2=no)])
4151 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4152    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4155 dnl Check to see if we can resolve ambiguity with |using|.
4156 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4157                ac_cv_cpp_ambiguity_resolving_using,
4158                [AC_TRY_COMPILE(class X { 
4159                                  public: int go(const X&) {return 3;}
4160                                          int jo(const X&) {return 3;}
4161                                };
4162                                class Y : public X {
4163                                  public:  int go(int) {return 2;}
4164                                           int jo(int) {return 2;}
4165                                           using X::jo;
4166                                  private: using X::go;
4167                                };,
4168                                X x; Y y; y.jo(x);,
4169                                ac_cv_cpp_ambiguity_resolving_using=yes,
4170                                ac_cv_cpp_ambiguity_resolving_using=no)])
4171 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4172    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4175 dnl Check to see if the |std| namespace is supported. If so, we'll want
4176 dnl to qualify any standard library calls with "std::" to ensure that
4177 dnl those functions can be resolved.
4178 AC_CACHE_CHECK(for \"std::\" namespace,
4179                ac_cv_cpp_namespace_std,
4180                [AC_TRY_COMPILE([#include <algorithm>],
4181                                [return std::min(0, 1);],
4182                                ac_cv_cpp_namespace_std=yes,
4183                                ac_cv_cpp_namespace_std=no)])
4184 if test "$ac_cv_cpp_namespace_std" = yes ; then
4185    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4188 dnl Older compilers are overly ambitious with respect to using the standard
4189 dnl template library's |operator!=()| when |operator==()| is defined. In
4190 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4191 dnl ambiguity at compile-time. This test checks for that case.
4192 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4193                ac_cv_cpp_unambiguous_std_notequal,
4194                [AC_TRY_COMPILE([#include <algorithm>
4195                                 struct T1 {};
4196                                 int operator==(const T1&, const T1&) { return 0; }
4197                                 int operator!=(const T1&, const T1&) { return 0; }],
4198                                [T1 a,b; return a != b;],
4199                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4200                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4201 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4202   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4206 AC_CACHE_CHECK(for C++ reinterpret_cast,
4207                ac_cv_cpp_reinterpret_cast,
4208                [AC_TRY_COMPILE(struct X { int i; };
4209                                struct Y { int i; };,
4210                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4211                                ac_cv_cpp_reinterpret_cast=yes,
4212                                ac_cv_cpp_reinterpret_cast=no)])
4213 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4214    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4217 dnl See if a dynamic_cast to void* gives the most derived object.
4218 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4219                ac_cv_cpp_dynamic_cast_void_ptr,
4220                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4221                             class Y { int j; public: virtual ~Y() { } };
4222                             class Z : public X, public Y { int k; };
4224                             int main() {
4225                                  Z mdo;
4226                                  X *subx = (X*)&mdo;
4227                                  Y *suby = (Y*)&mdo;
4228                                  return !((((void*)&mdo != (void*)subx) &&
4229                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4230                                           (((void*)&mdo != (void*)suby) &&
4231                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4232                             }],
4233                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4234                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4235                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4236 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4237    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4241 dnl note that this one is reversed - if the test fails, then
4242 dnl we require implementations of unused virtual methods. Which
4243 dnl really blows because it means we'll have useless vtable
4244 dnl bloat.
4245 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4246                ac_cv_cpp_unused_required,
4247                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4248                                X x;,
4249                                ac_cv_cpp_unused_required=no,
4250                                ac_cv_cpp_unused_required=yes)])
4251 if test "$ac_cv_cpp_unused_required" = yes ; then
4252    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4256 dnl Some compilers have trouble comparing a constant reference to a templatized
4257 dnl class to zero, and require an explicit operator==() to be defined that takes
4258 dnl an int. This test separates the strong from the weak.
4260 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4261                ac_cv_trouble_comparing_to_zero,
4262                [AC_TRY_COMPILE([#include <algorithm>
4263                                 template <class T> class Foo {};
4264                                 class T2;
4265                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4266                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4267                                [Foo<int> f; return (0 != f);],
4268                                ac_cv_trouble_comparing_to_zero=no,
4269                                ac_cv_trouble_comparing_to_zero=yes)])
4270 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4271   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4274 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4275 _SAVE_LDFLAGS=$LDFLAGS
4276 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4277 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4278                ac_cv_thread_keyword,
4279                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4280                             [return tlsIsMainThread;],
4281                             ac_cv_thread_keyword=yes,
4282                             ac_cv_thread_keyword=no)])
4283 LDFLAGS=$_SAVE_LDFLAGS
4284 if test "$ac_cv_thread_keyword" = yes; then
4285   # mips builds fail with TLS variables because of a binutils bug.
4286   # See bug 528687
4287   case "${target}" in
4288     mips*-*)
4289       :
4290       ;;
4291     *-android*|*-linuxandroid*)
4292       :
4293       ;;
4294     *)
4295       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4296       ;;
4297   esac
4300 dnl Check for the existence of various allocation headers/functions
4302 MALLOC_H=
4303 MOZ_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4304 if test "$MALLOC_H" = ""; then
4305   MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4306   if test "$MALLOC_H" = ""; then
4307     MOZ_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4308   fi
4310 if test "$MALLOC_H" != ""; then
4311    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4314 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4315 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4317 dnl See if compiler supports some gcc-style attributes
4319 AC_CACHE_CHECK(for __attribute__((always_inline)),
4320                ac_cv_attribute_always_inline,
4321                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
4322                                [],
4323                                ac_cv_attribute_always_inline=yes,
4324                                ac_cv_attribute_always_inline=no)])
4326 AC_CACHE_CHECK(for __attribute__((malloc)),
4327                ac_cv_attribute_malloc,
4328                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
4329                                [],
4330                                ac_cv_attribute_malloc=yes,
4331                                ac_cv_attribute_malloc=no)])
4333 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4334                ac_cv_attribute_warn_unused,
4335                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
4336                                [],
4337                                ac_cv_attribute_warn_unused=yes,
4338                                ac_cv_attribute_warn_unused=no)])
4340 AC_CACHE_CHECK(for __attribute__((noreturn)),
4341                ac_cv_attribute_noreturn,
4342                [AC_TRY_COMPILE([void f(void) __attribute__((noreturn));],
4343                                [],
4344                                ac_cv_attribute_noreturn=yes,
4345                                ac_cv_attribute_noreturn=no)])
4347 dnl End of C++ language/feature checks
4348 AC_LANG_C
4350 dnl ========================================================
4351 dnl =  Internationalization checks
4352 dnl ========================================================
4354 dnl Internationalization and Locale support is different
4355 dnl on various UNIX platforms.  Checks for specific i18n
4356 dnl features go here.
4358 dnl check for LC_MESSAGES
4359 AC_CACHE_CHECK(for LC_MESSAGES,
4360                 ac_cv_i18n_lc_messages,
4361                 [AC_TRY_COMPILE([#include <locale.h>],
4362                                 [int category = LC_MESSAGES;],
4363                                 ac_cv_i18n_lc_messages=yes,
4364                                 ac_cv_i18n_lc_messages=no)])
4365 if test "$ac_cv_i18n_lc_messages" = yes; then
4366    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4369 AC_HAVE_FUNCS(localeconv)
4370 fi # ! SKIP_COMPILER_CHECKS
4372 TARGET_XPCOM_ABI=
4373 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4374     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4377 dnl Mozilla specific options
4378 dnl ========================================================
4379 dnl The macros used for command line options
4380 dnl are defined in build/autoconf/altoptions.m4.
4382 dnl If the compiler supports these attributes, define them as
4383 dnl convenience macros.
4384 if test "$ac_cv_attribute_always_inline" = yes ; then
4385   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4386 else
4387   AC_DEFINE(NS_ALWAYS_INLINE,)
4390 if test "$ac_cv_attribute_malloc" = yes ; then
4391   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4392 else
4393   AC_DEFINE(NS_ATTR_MALLOC,)
4396 if test "$ac_cv_attribute_warn_unused" = yes ; then
4397   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4398 else
4399   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4402 if test "$ac_cv_attribute_noreturn" = yes ; then
4403   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4404 else
4405   AC_DEFINE(NS_NORETURN,)
4408 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4409 dnl features that Windows actually does support.
4411 if test -n "$SKIP_COMPILER_CHECKS"; then
4412    dnl Windows has malloc.h
4413    AC_DEFINE(MALLOC_H, [<malloc.h>])
4414    AC_DEFINE(HAVE_FORCEINLINE)
4415    AC_DEFINE(HAVE_LOCALECONV)
4416 fi # SKIP_COMPILER_CHECKS
4418 dnl ========================================================
4419 dnl =
4420 dnl = Check for external package dependencies
4421 dnl =
4422 dnl ========================================================
4423 MOZ_ARG_HEADER(External Packages)
4425 MOZ_ARG_WITH_STRING(libxul-sdk,
4426 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4427   LIBXUL_SDK_DIR=$withval)
4429 if test "$LIBXUL_SDK_DIR" = "yes"; then
4430     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4431 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4432     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4434     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4435         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4436     fi
4439 AC_SUBST(LIBXUL_SDK)
4441 if test -n "$LIBXUL_SDK"; then
4442     LIBXUL_DIST="$LIBXUL_SDK"
4443 else
4444     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4446 AC_SUBST(LIBXUL_DIST)
4448 SYSTEM_LIBXUL=
4450 MOZ_ARG_WITH_BOOL(system-libxul,
4451 [  --with-system-libxul    Use system installed libxul SDK],
4452     SYSTEM_LIBXUL=1)
4454 dnl ========================================================
4455 dnl = If NSPR was not detected in the system, 
4456 dnl = use the one in the source tree (mozilla/nsprpub)
4457 dnl ========================================================
4458 MOZ_ARG_WITH_BOOL(system-nspr,
4459 [  --with-system-nspr      Use system installed NSPR],
4460     _USE_SYSTEM_NSPR=1 )
4462 if test -n "$_USE_SYSTEM_NSPR"; then
4463     AM_PATH_NSPR(4.8.8, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
4466 if test -n "$MOZ_NATIVE_NSPR"; then
4467     _SAVE_CFLAGS=$CFLAGS
4468     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4469     AC_TRY_COMPILE([#include "prtypes.h"],
4470                 [#ifndef PR_STATIC_ASSERT
4471                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4472                  #endif],
4473                 [MOZ_NATIVE_NSPR=1],
4474                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4475     CFLAGS=$_SAVE_CFLAGS
4476 else
4477     if test "$OS_ARCH" = "WINNT"; then
4478         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4479         if test -n "$GNU_CC"; then
4480             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4481         else
4482             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4483         fi
4484     else
4485         NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4486         NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4487     fi
4490 dnl system libevent Support
4491 dnl ========================================================
4492 MOZ_ARG_WITH_STRING(system-libevent,
4493 [  --with-system-libevent=[PFX]
4494                           Use system libevent [installed at prefix PFX]],
4495     LIBEVENT_DIR=$withval)
4497 _SAVE_CFLAGS=$CFLAGS
4498 _SAVE_LDFLAGS=$LDFLAGS
4499 _SAVE_LIBS=$LIBS
4500 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4501     MOZ_NATIVE_LIBEVENT=
4502 else
4503     if test "${LIBEVENT_DIR}" = "yes"; then
4504         LIBEVENT_DIR=/usr
4505     fi
4506     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4507     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4508     MOZ_CHECK_HEADER(event.h,
4509         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4510              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4511          fi],
4512         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4513     AC_CHECK_LIB(event, event_init,
4514                  [MOZ_NATIVE_LIBEVENT=1
4515                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4516                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4517                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4519 CFLAGS=$_SAVE_CFLAGS
4520 LDFLAGS=$_SAVE_LDFLAGS
4521 LIBS=$_SAVE_LIBS
4523 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4524 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4525 AC_SUBST(MOZ_LIBEVENT_LIBS)
4527 dnl ========================================================
4528 dnl = If NSS was not detected in the system, 
4529 dnl = use the one in the source tree (mozilla/security/nss)
4530 dnl ========================================================
4532 MOZ_ARG_WITH_BOOL(system-nss,
4533 [  --with-system-nss       Use system installed NSS],
4534     _USE_SYSTEM_NSS=1 )
4536 if test -n "$_USE_SYSTEM_NSS"; then
4537     AM_PATH_NSS(3.12.10, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
4540 if test -n "$MOZ_NATIVE_NSS"; then
4541    NSS_LIBS="$NSS_LIBS -lcrmf"
4542 else
4543    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4544    NSS_DEP_LIBS="\
4545         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4546         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4547         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4548         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4549         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4551    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
4552        NSS_LIBS="\
4553         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4554         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4555         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4556         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4557         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4558    else
4559        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4560    fi
4563 dnl ======================
4564 dnl Detect yasm
4565 dnl ======================
4567 AC_MSG_CHECKING([for YASM assembler])
4568 AC_CHECK_PROGS(YASM, yasm, "")
4570 if test -n "$YASM"; then
4571   dnl Pull out yasm's version string
4572   changequote(,)
4573   _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
4574   changequote([,])
4576   YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4577   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4578   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4579   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4580   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4583 if test -z "$SKIP_LIBRARY_CHECKS"; then
4584 dnl system JPEG support
4585 dnl ========================================================
4586 MOZ_ARG_WITH_STRING(system-jpeg,
4587 [  --with-system-jpeg[=PFX]
4588                           Use system libjpeg [installed at prefix PFX]],
4589     JPEG_DIR=$withval)
4591 _SAVE_CFLAGS=$CFLAGS
4592 _SAVE_LDFLAGS=$LDFLAGS
4593 _SAVE_LIBS=$LIBS
4594 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4595     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4596     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4598 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4599     SYSTEM_JPEG=
4600 else
4601     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4604 if test "$SYSTEM_JPEG" = 1; then
4605     LIBS="$JPEG_LIBS $LIBS"
4606     AC_TRY_COMPILE([ #include <stdio.h>
4607                      #include <sys/types.h>
4608                      #include <jpeglib.h> ],
4609                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4610                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4611                      #endif ],
4612                    SYSTEM_JPEG=1,
4613                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4616 MOZ_LIBJPEG_TURBO=
4617 if test -z "$SYSTEM_JPEG"; then
4618     MOZ_LIBJPEG_TURBO=1
4619 fi 
4620 CFLAGS=$_SAVE_CFLAGS
4621 LDFLAGS=$_SAVE_LDFLAGS
4622 LIBS=$_SAVE_LIBS
4624 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4625     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4626     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4629 dnl system ZLIB support
4630 dnl ========================================================
4631 MOZ_ARG_WITH_STRING(system-zlib,
4632 [  --with-system-zlib[=PFX]
4633                           Use system libz [installed at prefix PFX]],
4634     ZLIB_DIR=$withval)
4636 _SAVE_CFLAGS=$CFLAGS
4637 _SAVE_LDFLAGS=$LDFLAGS
4638 _SAVE_LIBS=$LIBS
4639 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4640     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4641     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4643 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4644     SYSTEM_ZLIB=
4645 else
4646     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4647         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4649 if test "$SYSTEM_ZLIB" = 1; then
4650     LIBS="$ZLIB_LIBS $LIBS"
4651     AC_TRY_COMPILE([ #include <stdio.h>
4652                      #include <string.h>
4653                      #include <zlib.h> ],
4654                    [ #if ZLIB_VERNUM < $MOZZLIB 
4655                      #error "Insufficient zlib version ($MOZZLIB required)."
4656                      #endif ],
4657                    SYSTEM_ZLIB=1,
4658                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4660 CFLAGS=$_SAVE_CFLAGS
4661 LDFLAGS=$_SAVE_LDFLAGS
4662 LIBS=$_SAVE_LIBS
4664 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4665     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4666     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4669 dnl system BZIP2 Support
4670 dnl ========================================================
4671 MOZ_ARG_WITH_STRING(system-bz2,
4672 [  --with-system-bz2[=PFX]
4673                           Use system libbz2 [installed at prefix PFX]],
4674     BZ2_DIR=$withval)
4676 _SAVE_CFLAGS=$CFLAGS
4677 _SAVE_LDFLAGS=$LDFLAGS
4678 _SAVE_LIBS=$LIBS
4679 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4680     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4681     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4683 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4684     SYSTEM_BZ2=
4685 else
4686     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4687         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4689 CFLAGS=$_SAVE_CFLAGS
4690 LDFLAGS=$_SAVE_LDFLAGS
4691 LIBS=$_SAVE_LIBS
4693 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4694     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4695     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4698 dnl system PNG Support
4699 dnl ========================================================
4700 MOZ_ARG_WITH_STRING(system-png, 
4701 [  --with-system-png[=PFX]
4702                           Use system libpng [installed at prefix PFX]],
4703     PNG_DIR=$withval)
4705 _SAVE_CFLAGS=$CFLAGS
4706 _SAVE_LDFLAGS=$LDFLAGS
4707 _SAVE_LIBS=$LIBS
4708 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4709 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4710 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4711     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4712     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4714 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4715     SYSTEM_PNG=
4716 else
4717     _SAVE_PNG_LIBS=$PNG_LIBS
4718     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4719                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4720                  $PNG_LIBS)
4721     AC_CHECK_LIB(png, png_get_acTL, ,
4722                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4723                  $_SAVE_PNG_LIBS)
4725 if test "$SYSTEM_PNG" = 1; then
4726     LIBS="$PNG_LIBS $LIBS"
4727     AC_TRY_COMPILE([ #include <stdio.h>
4728                      #include <sys/types.h>
4729                      #include <png.h> ],
4730                    [ #if PNG_LIBPNG_VER < $MOZPNG
4731                      #error "Insufficient libpng version ($MOZPNG required)."
4732                      #endif
4733                      #ifndef PNG_UINT_31_MAX
4734                      #error "Insufficient libpng version."
4735                      #endif ],
4736                    SYSTEM_PNG=1,
4737                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4739 CFLAGS=$_SAVE_CFLAGS
4740 LDFLAGS=$_SAVE_LDFLAGS
4741 LIBS=$_SAVE_LIBS
4743 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4744     PNG_CFLAGS="-I${PNG_DIR}/include"
4745     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4748 fi # SKIP_LIBRARY_CHECKS
4750 dnl system HunSpell Support
4751 dnl ========================================================
4752 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4753 [  --enable-system-hunspell
4754                           Use system hunspell (located with pkgconfig)],
4755     SYSTEM_HUNSPELL=1 )
4757 if test -n "$SYSTEM_HUNSPELL"; then
4758     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4761 AC_SUBST(SYSTEM_HUNSPELL)
4763 dnl ========================================================
4764 dnl Java SDK support
4765 dnl ========================================================
4767 JAVA_BIN_PATH=
4768 MOZ_ARG_WITH_STRING(java-bin-path,
4769 [  --with-java-bin-path=dir
4770                           Location of Java binaries (java, javac, jar)],
4771     JAVA_BIN_PATH=$withval)
4773 dnl ========================================================
4774 dnl =
4775 dnl = Application
4776 dnl =
4777 dnl ========================================================
4779 MOZ_ARG_HEADER(Application)
4781 ENABLE_TESTS=1
4782 MOZ_BRANDING_DIRECTORY=
4783 MOZ_OFFICIAL_BRANDING=
4784 MOZ_FEEDS=1
4785 MOZ_INSTALLER=1
4786 MOZ_JSDEBUGGER=1
4787 MOZ_MORK=
4788 MOZ_MORKREADER=
4789 MOZ_AUTH_EXTENSION=1
4790 MOZ_OGG=1
4791 MOZ_RAW=
4792 MOZ_SYDNEYAUDIO=
4793 MOZ_VORBIS=
4794 MOZ_TREMOR=
4795 MOZ_WAVE=1
4796 MOZ_MEDIA=
4797 MOZ_WEBM=1
4798 VPX_AS=
4799 VPX_ASFLAGS=
4800 VPX_AS_DASH_C_FLAG=
4801 VPX_AS_CONVERSION=
4802 VPX_ASM_SUFFIX=
4803 VPX_X86_ASM=
4804 VPX_ARM_ASM=
4805 LIBJPEG_TURBO_AS=
4806 LIBJPEG_TURBO_ASFLAGS=
4807 LIBJPEG_TURBO_X86_ASM=
4808 LIBJPEG_TURBO_X64_ASM=
4809 MOZ_PANGO=1
4810 MOZ_PERMISSIONS=1
4811 MOZ_PLACES=1
4812 MOZ_PREF_EXTENSIONS=1
4813 MOZ_PROFILELOCKING=1
4814 MOZ_PSM=1
4815 MOZ_RDF=1
4816 MOZ_REFLOW_PERF=
4817 MOZ_SAFE_BROWSING=
4818 MOZ_HELP_VIEWER=
4819 MOZ_SPELLCHECK=1
4820 MOZ_SPLASHSCREEN=
4821 MOZ_STORAGE=1
4822 MOZ_SVG_DLISTS=
4823 MOZ_TOOLKIT_SEARCH=1
4824 MOZ_UI_LOCALE=en-US
4825 MOZ_UNIVERSALCHARDET=1
4826 MOZ_URL_CLASSIFIER=
4827 MOZ_XSLT_STANDALONE=
4828 MOZ_XTF=1
4829 MOZ_XUL=1
4830 MOZ_ZIPWRITER=1
4831 NS_PRINTING=1
4832 MOZ_PDF_PRINTING=
4833 MOZ_DISABLE_DOMCRYPTO=
4834 NSS_DISABLE_DBM=
4835 NECKO_WIFI=1
4836 NECKO_COOKIES=1
4837 NECKO_DISK_CACHE=1
4838 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg"
4839 USE_ARM_KUSER=
4840 BUILD_CTYPES=1
4841 MOZ_USE_NATIVE_POPUP_WINDOWS=
4844 case "${target}" in
4845 *android*|*darwin*)
4846     ACCESSIBILITY=
4847     ;;
4849     ACCESSIBILITY=1
4850     ;;
4851 esac
4853 case "$target_os" in
4854     mingw*)
4855         NS_ENABLE_TSF=1
4856         if test -z "$GNU_CC"; then 
4857             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4858                 NS_ENABLE_TSF=
4859             fi
4860         fi
4861         if test -n "$NS_ENABLE_TSF"; then
4862             AC_DEFINE(NS_ENABLE_TSF)
4863         fi
4864         ;;
4865 esac
4867 case "${target}" in
4868     *-android*|*-linuxandroid*)
4869         NSS_DISABLE_DBM=1
4870         USE_ARM_KUSER=1
4871         MOZ_INSTALLER=
4872         NECKO_WIFI=
4873         MOZ_THEME_FASTSTRIPE=1
4874         MOZ_TREE_FREETYPE=1
4875         MOZ_MEMORY=1
4876         ;;
4877 esac
4879 MOZ_ARG_ENABLE_STRING(application,
4880 [  --enable-application=APP
4881                           Options include:
4882                             browser (Firefox)
4883                             xulrunner
4884                             content/xslt (Standalone Transformiix XSLT)
4885                             netwerk (Standalone Necko)
4886                             tools/update-packaging (AUS-related packaging tools)
4887                             standalone (use this for standalone
4888                               xpcom/xpconnect or to manually drive a build)],
4889 [ MOZ_BUILD_APP=$enableval ] )
4891 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4892 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4893   XULRUNNER_STUB_NAME=$withval)
4895 if test -z "$XULRUNNER_STUB_NAME"; then
4896   case "$target_os" in
4897   darwin*)
4898     XULRUNNER_STUB_NAME=xulrunner
4899     ;;
4900   *)
4901     XULRUNNER_STUB_NAME=xulrunner-stub
4902   esac
4904 AC_SUBST(XULRUNNER_STUB_NAME)
4906 AC_MSG_CHECKING([for application to build])
4907 if test -z "$MOZ_BUILD_APP"; then
4908   AC_MSG_RESULT([browser])
4909   MOZ_BUILD_APP=browser
4910 else
4911   # We have a valid application only if it has a build.mk file in its top
4912   # directory.
4913   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4914     AC_MSG_RESULT([none])
4915     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4916   else
4917     AC_MSG_RESULT([$MOZ_BUILD_APP])
4918   fi
4921 # Allow the application to influence configure with a confvars.sh script.
4923 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4924 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4925   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4926   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4927 else
4928   AC_MSG_RESULT([no])
4931 # Allow someone to change MOZ_APP_NAME in mozconfig
4932 MOZ_ARG_WITH_STRING(app-name,
4933 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4934 WITH_APP_NAME=$withval,
4937 if test -n "$WITH_APP_NAME" ; then
4938     MOZ_APP_NAME="$WITH_APP_NAME"
4941 # Now is a good time to test for logic errors, define mismatches, etc.
4942 case "$MOZ_BUILD_APP" in
4943 xulrunner)
4944   if test "$LIBXUL_SDK"; then
4945     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4946   fi
4947   ;;
4948 esac
4950 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4951 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4952 # MOZ_BUILD_APP.
4953 case "$MOZ_BUILD_APP" in
4954 browser)
4955   AC_DEFINE(MOZ_PHOENIX)
4956   ;;
4958 xulrunner)
4959   AC_DEFINE(MOZ_XULRUNNER)
4960   ;;
4962 content/xslt)
4963   AC_DEFINE(TX_EXE)
4964   ;;
4966 standalone) 
4967   MOZ_APP_NAME=mozilla
4968   MOZ_APP_DISPLAYNAME=Mozilla
4969   MOZ_APP_VERSION=$MOZILLA_VERSION
4970   ;;
4972 esac
4974 AC_SUBST(MOZ_BUILD_APP)
4975 AC_SUBST(MOZ_PHOENIX)
4976 AC_SUBST(MOZ_XULRUNNER)
4978 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4980 dnl ========================================================
4981 dnl = 
4982 dnl = Toolkit Options
4983 dnl = 
4984 dnl ========================================================
4985 MOZ_ARG_HEADER(Toolkit Options)
4987     dnl ========================================================
4988     dnl = Select the default toolkit
4989     dnl ========================================================
4990         MOZ_ARG_ENABLE_STRING(default-toolkit,
4991         [  --enable-default-toolkit=TK
4992                           Select default toolkit
4993                           Platform specific defaults:
4994                             Mac OS X - cairo-cocoa
4995                             Neutrino/QNX - photon
4996                             OS/2 - cairo-os2
4997                             Win32 - cairo-windows
4998                             Gtk2 with DirectFB - cairo-gtk2-dfb
4999                             * - cairo-gtk2
5000                             * - cairo-qt],
5001     [ _DEFAULT_TOOLKIT=$enableval ],
5002     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5004     if test "$_DEFAULT_TOOLKIT" = "photon" \
5005         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5006         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5007         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5008         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5009         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5010         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5011         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5012         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5013     then
5014         dnl nglayout only supports building with one toolkit,
5015         dnl so ignore everything after the first comma (",").
5016         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5017     else
5018         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5019     fi
5021 dnl ========================================================
5022 dnl = Enable the toolkit as needed                         =
5023 dnl ========================================================
5025 case "$MOZ_WIDGET_TOOLKIT" in
5026 photon)
5027         MOZ_ENABLE_PHOTON=1
5028         AC_DEFINE(MOZ_WIDGET_PHOTON)
5029     ;;
5031 cairo-windows)
5032     MOZ_WIDGET_TOOLKIT=windows
5033     MOZ_WEBGL=1
5034     MOZ_PDF_PRINTING=1
5035     MOZ_INSTRUMENT_EVENT_LOOP=1
5036     ;;
5038 cairo-gtk2|cairo-gtk2-x11)
5039     MOZ_WIDGET_TOOLKIT=gtk2
5040     MOZ_ENABLE_GTK2=1
5041     MOZ_ENABLE_XREMOTE=1
5042     MOZ_WEBGL=1
5043     MOZ_WEBGL_GLX=1
5045     AC_DEFINE(MOZ_X11)
5046     MOZ_X11=1
5047     USE_FC_FREETYPE=1
5049     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5050     TK_LIBS='$(MOZ_GTK2_LIBS)'
5051     AC_DEFINE(MOZ_WIDGET_GTK2)
5052     MOZ_PDF_PRINTING=1
5053     MOZ_INSTRUMENT_EVENT_LOOP=1
5054     ;;
5056 cairo-gtk2-dfb)
5057     MOZ_WIDGET_TOOLKIT=gtk2
5058     MOZ_ENABLE_GTK2=1
5059     MOZ_WEBGL=
5061     AC_DEFINE(MOZ_DFB)
5062     MOZ_DFB=1
5064     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5065     TK_LIBS='$(MOZ_GTK2_LIBS)'
5066     AC_DEFINE(MOZ_WIDGET_GTK2)
5067     if test "$no_x" != "yes"; then
5068         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5069         no_x=yes
5070     fi
5071     MOZ_PDF_PRINTING=1
5072     ;;
5074 cairo-qt)
5075     MOZ_WIDGET_TOOLKIT=qt
5076     MOZ_ENABLE_QT=1
5077     MOZ_ENABLE_XREMOTE=1
5078     MOZ_WEBGL=1
5079     MOZ_WEBGL_GLX=1
5080     USE_ELF_DYNSTR_GC=
5082     AC_DEFINE(MOZ_X11)
5083     MOZ_X11=1
5084     USE_FC_FREETYPE=1
5085     XT_LIBS=
5087     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5088     TK_LIBS='$(MOZ_QT_LIBS)'
5089     AC_DEFINE(MOZ_WIDGET_QT)
5090     MOZ_PDF_PRINTING=1
5091     ;;
5093 cairo-os2)
5094     MOZ_WIDGET_TOOLKIT=os2
5095     USE_FC_FREETYPE=1
5096     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5097     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5098     MOZ_PDF_PRINTING=1
5099     ;;
5101 cairo-cocoa)
5102     MOZ_WIDGET_TOOLKIT=cocoa
5103     AC_DEFINE(MOZ_WIDGET_COCOA)
5104     MOZ_USER_DIR="Mozilla"
5105     AC_DEFINE(XP_MACOSX)
5106     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5107     TK_CFLAGS="-DNO_X11"
5108     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5109     CFLAGS="$CFLAGS $TK_CFLAGS"
5110     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5111     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5112     MOZ_FS_LAYOUT=bundle
5113     MOZ_WEBGL=1
5114     MOZ_INSTRUMENT_EVENT_LOOP=1
5115     ;;
5117 cairo-android)
5118     AC_DEFINE(MOZ_WIDGET_ANDROID)
5119     MOZ_WIDGET_TOOLKIT=android
5120     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5121     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5122     MOZ_WEBGL=1
5123     MOZ_PDF_PRINTING=1
5124     ;;
5126 esac
5128 AC_SUBST(MOZ_PDF_PRINTING)
5129 if test "$MOZ_PDF_PRINTING"; then
5130    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
5131    AC_DEFINE(MOZ_PDF_PRINTING)
5134 if test "$MOZ_ENABLE_XREMOTE"; then
5135     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5138 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
5139    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
5142 if test "$COMPILE_ENVIRONMENT"; then
5143   if test "$MOZ_ENABLE_GTK2"; then
5144     if test "$MOZ_X11"; then
5145       GDK_PACKAGES=gdk-x11-2.0
5146     elif test "$MOZ_DFB"; then
5147       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5148       GDK_PACKAGES=directfb
5149     fi
5151     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5152   fi
5154 fi # COMPILE_ENVIRONMENT
5156 AC_SUBST(MOZ_FS_LAYOUT)
5158 dnl ========================================================
5159 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5160 dnl their usage and use them in spidermonkey.
5161 dnl ========================================================
5162 MOZ_ARG_WITH_BOOL(arm-kuser,
5163 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5164     USE_ARM_KUSER=1,)
5165 if test -n "$USE_ARM_KUSER"; then
5166    AC_DEFINE(USE_ARM_KUSER)
5169 dnl ========================================================
5170 dnl = startup-notification support module
5171 dnl ========================================================
5173 if test "$MOZ_ENABLE_GTK2"
5174 then
5175     MOZ_ENABLE_STARTUP_NOTIFICATION=
5177     MOZ_ARG_ENABLE_BOOL(startup-notification,
5178     [  --enable-startup-notification
5179                           Enable startup-notification support (default: disabled) ],
5180         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5181         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5182     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5183     then
5184         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5185                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5186         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5187             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5188             then
5189                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5190             fi
5191             MOZ_ENABLE_STARTUP_NOTIFICATION=
5192         ])
5193     fi
5195     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5196         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5197     fi
5199     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5201 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5202 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5203 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5205 dnl ========================================================
5206 dnl = QT support
5207 dnl ========================================================
5208 if test "$MOZ_ENABLE_QT"
5209 then
5210     MOZ_ARG_WITH_STRING(qtdir,
5211     [  --with-qtdir=\$dir       Specify Qt directory ],
5212     [ QTDIR=$withval])
5214     if test -z "$QTDIR"; then
5215         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5216         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5217     else
5218         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5220         MOZ_QT_CFLAGS="-DQT_SHARED"
5221         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5222         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5223         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5224         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5225         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5226         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5227         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5228         HOST_MOC="$QTDIR/bin/moc"
5229     fi
5230     if test -z "$HOST_MOC"; then
5231         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5232 incorrect])
5233     fi
5234     MOC=$HOST_MOC
5236     MOZ_ENABLE_QMSYSTEM2=
5237     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
5238                       MOZ_ENABLE_QMSYSTEM2=1,
5239                       MOZ_ENABLE_QMSYSTEM2=)
5241     if test "$MOZ_ENABLE_QMSYSTEM2"; then
5242       MOZ_ENABLE_QMSYSTEM2=1
5243       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
5244       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
5245       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
5246     fi
5248     MOZ_ENABLE_QTNETWORK=
5249     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5250                       MOZ_ENABLE_QTNETWORK=1,
5251                       MOZ_ENABLE_QTNETWORK=)
5253     if test "$MOZ_ENABLE_QTNETWORK"; then
5254       MOZ_ENABLE_QTNETWORK=1
5255       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5256     fi
5258     MOZ_ENABLE_QTMOBILITY=
5259     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors,
5260                       MOZ_ENABLE_QTMOBILITY=1,
5261                       MOZ_ENABLE_QTMOBILITY=)
5262     if test "$MOZ_ENABLE_QTMOBILITY"; then
5263        MOZ_ENABLE_QTMOBILITY=1
5264        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
5265        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
5266     else
5267        AC_CHECK_LIB(QtSensors, main, [
5268           MOZ_ENABLE_QTMOBILITY=1
5269           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtMobility"
5270           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtSensors"
5271           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors"
5272        ])
5273     fi
5274     if test "$MOZ_ENABLE_QTMOBILITY"; then
5275        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
5276     fi
5279 AC_SUBST(GTK_CONFIG)
5280 AC_SUBST(TK_CFLAGS)
5281 AC_SUBST(TK_LIBS)
5283 AC_SUBST(MOZ_ENABLE_GTK2)
5284 AC_SUBST(MOZ_ENABLE_PHOTON)
5285 AC_SUBST(MOZ_ENABLE_QT)
5286 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5287 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
5288 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
5289 AC_SUBST(MOZ_ENABLE_XREMOTE)
5290 AC_SUBST(MOZ_GTK2_CFLAGS)
5291 AC_SUBST(MOZ_GTK2_LIBS)
5292 AC_SUBST(MOZ_QT_CFLAGS)
5293 AC_SUBST(MOZ_QT_LIBS)
5295 AC_SUBST(MOC)
5297 AC_SUBST(MOZ_DFB)
5298 AC_SUBST(MOZ_X11)
5300 dnl ========================================================
5301 dnl =
5302 dnl = Components & Features
5303 dnl = 
5304 dnl ========================================================
5305 MOZ_ARG_HEADER(Components and Features)
5307 dnl ========================================================
5308 dnl = Localization
5309 dnl ========================================================
5310 MOZ_ARG_ENABLE_STRING(ui-locale,
5311 [  --enable-ui-locale=ab-CD
5312                           Select the user interface locale (default: en-US)],
5313     MOZ_UI_LOCALE=$enableval )
5314 AC_SUBST(MOZ_UI_LOCALE)
5316 dnl ========================================================
5317 dnl = Trademarked Branding 
5318 dnl ========================================================
5319 MOZ_ARG_ENABLE_BOOL(official-branding,
5320 [  --enable-official-branding
5321                           Enable Official mozilla.org Branding
5322                           Do not distribute builds with
5323                           --enable-official-branding unless you have
5324                           permission to use trademarks per
5325                           http://www.mozilla.org/foundation/trademarks/ .],
5327   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5328     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5329   else
5330     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5331     MOZ_OFFICIAL_BRANDING=1
5332   fi
5333 ], MOZ_OFFICIAL_BRANDING=)
5335 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5336 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5337   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5340 MOZ_ARG_WITH_STRING(branding,
5341 [  --with-branding=dir     Use branding from the specified directory.],
5342     MOZ_BRANDING_DIRECTORY=$withval)
5344 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5345 if test -z "$REAL_BRANDING_DIRECTORY"; then
5346   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5349 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5350   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5353 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5355 dnl ========================================================
5356 dnl = Distribution ID
5357 dnl ========================================================
5358 MOZ_ARG_WITH_STRING(distribution-id,
5359 [  --with-distribution-id=ID
5360                           Set distribution-specific id (default=org.mozilla)],
5361 [ val=`echo $withval`
5362     MOZ_DISTRIBUTION_ID="$val"])
5364 if test -z "$MOZ_DISTRIBUTION_ID"; then
5365    MOZ_DISTRIBUTION_ID="org.mozilla"
5368 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5369 AC_SUBST(MOZ_DISTRIBUTION_ID)
5372 dnl ========================================================
5373 dnl complex text support off by default
5374 dnl ========================================================
5375 MOZ_ARG_DISABLE_BOOL(pango,
5376 [  --disable-pango         Disable usage of Pango ],
5377     MOZ_PANGO=,
5378     MOZ_PANGO=1)
5380 dnl ========================================================
5381 dnl = Pango
5382 dnl ========================================================
5383 if test "$MOZ_ENABLE_GTK2"
5384 then
5385     AC_SUBST(MOZ_PANGO)
5387     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5389     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5390     AC_SUBST(MOZ_PANGO_CFLAGS)
5391     AC_SUBST(MOZ_PANGO_LIBS)
5392     if test "$MOZ_PANGO"
5393     then
5394         AC_DEFINE(MOZ_PANGO)
5395     else
5396         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5397         AC_SUBST(FT2_CFLAGS)
5398         AC_SUBST(FT2_LIBS)
5399     fi
5402 if test "$MOZ_ENABLE_QT"
5403 then
5404     if test "$MOZ_PANGO"
5405     then
5406         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5407         [
5408             AC_SUBST(MOZ_PANGO_CFLAGS)
5409             AC_SUBST(MOZ_PANGO_LIBS)
5410             AC_DEFINE(MOZ_PANGO)
5411         ],
5412         [
5413             echo "Pango library not found, will use FT2 font engine"
5414             MOZ_PANGO=
5415         ])
5416     fi
5417     AC_SUBST(MOZ_PANGO)
5420 dnl ========================================================
5421 dnl = GnomeVFS, GIO and GConf support module
5422 dnl ========================================================
5424 if test "$MOZ_X11"
5425 then
5426     dnl build the gnomevfs extension by default only when the
5427     dnl GTK2 toolkit is in use.
5428     if test "$MOZ_ENABLE_GTK2"
5429     then
5430         MOZ_ENABLE_GNOMEVFS=1
5431         MOZ_ENABLE_GCONF=1
5432     fi
5434     dnl ========================================================
5435     dnl = GnomeVFS support module
5436     dnl ========================================================
5437     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5438     [  --disable-gnomevfs      Disable GnomeVFS support ],
5439         MOZ_ENABLE_GNOMEVFS=,
5440         MOZ_ENABLE_GNOMEVFS=force)
5442     if test "$MOZ_ENABLE_GNOMEVFS"
5443     then
5444         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5445             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5446             MOZ_ENABLE_GNOMEVFS=1
5447             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5448         ],[
5449             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5450             then
5451                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5452             fi
5453             MOZ_ENABLE_GNOMEVFS=
5454         ])
5455     else
5456         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5457             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5458               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5459             ])
5460         fi
5461     fi
5463     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5464     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5465     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5467     dnl ========================================================
5468     dnl = GIO support module
5469     dnl ========================================================
5470     MOZ_ARG_ENABLE_BOOL(gio,
5471     [  --enable-gio            Enable GIO support (default: disabled)],
5472         MOZ_ENABLE_GIO=force,
5473         MOZ_ENABLE_GIO=)
5475     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5476     then
5477         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, , 
5478                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
5479         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5480             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5481             MOZ_ENABLE_GIO=1
5482             AC_DEFINE(MOZ_ENABLE_GIO)
5483         ],[
5484             if test "$MOZ_ENABLE_GIO" = "force"
5485             then
5486                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5487             fi
5488             MOZ_ENABLE_GIO=
5489         ])
5490     fi
5492     AC_SUBST(MOZ_ENABLE_GIO)
5493     AC_SUBST(MOZ_GIO_CFLAGS)
5494     AC_SUBST(MOZ_GIO_LIBS)
5495    
5496     dnl ========================================================
5497     dnl = GConf support module
5498     dnl ========================================================
5499     MOZ_ARG_DISABLE_BOOL(gconf,
5500     [  --disable-gconf      Disable Gconf support ],
5501         MOZ_ENABLE_GCONF=,
5502         MOZ_ENABLE_GCONF=force)
5504     if test "$MOZ_ENABLE_GCONF"
5505     then
5506         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5507             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5508             MOZ_ENABLE_GCONF=1
5509         ],[
5510             if test "$MOZ_ENABLE_GCONF" = "force"
5511             then
5512                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5513             fi
5514             MOZ_ENABLE_GCONF=
5515         ])
5516     fi
5518     if test "$MOZ_ENABLE_GCONF"; then
5519         AC_DEFINE(MOZ_ENABLE_GCONF)
5520     fi
5522     AC_SUBST(MOZ_ENABLE_GCONF)
5523     AC_SUBST(MOZ_GCONF_CFLAGS)
5524     AC_SUBST(MOZ_GCONF_LIBS)
5527 dnl ========================================================
5528 dnl = libproxy support
5529 dnl ========================================================
5531 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5532 then
5533     MOZ_ENABLE_LIBPROXY=
5535     MOZ_ARG_ENABLE_BOOL(libproxy,
5536     [  --enable-libproxy         Enable libproxy support ],
5537     MOZ_ENABLE_LIBPROXY=1,
5538     MOZ_ENABLE_LIBPROXY=)
5540     if test "$MOZ_ENABLE_LIBPROXY"
5541     then
5542         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5543         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5544     fi
5546 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5547 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5548 AC_SUBST(MOZ_LIBPROXY_LIBS)
5550 dnl ========================================================
5551 dnl = libnotify support
5552 dnl ========================================================
5554 if test "$MOZ_ENABLE_GTK2"
5555 then
5556     MOZ_ENABLE_LIBNOTIFY=1
5558     MOZ_ARG_DISABLE_BOOL(libnotify,
5559     [  --disable-libnotify     Disable libnotify support ],
5560     MOZ_ENABLE_LIBNOTIFY=,
5561     MOZ_ENABLE_LIBNOTIFY=1)
5563     if test "$MOZ_ENABLE_LIBNOTIFY"
5564     then
5565         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5566     fi
5569 if test -z "$SKIP_LIBRARY_CHECKS"
5570 then
5571     if test "$MOZ_ENABLE_GTK2"
5572     then
5573         if test "$MOZ_ENABLE_LIBNOTIFY"
5574         then
5575             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5576         fi
5577     fi
5579 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5580 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5581 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5583 dnl ========================================================
5584 dnl = GNOME component (mozgnome)
5585 dnl ========================================================
5587 # The GNOME component is built if one of 
5588 # gnome-vfs, gio, gconf or libnotify is available.
5589 if test "$MOZ_ENABLE_GCONF" -o \
5590    "$MOZ_ENABLE_GNOMEVFS" -o \
5591    "$MOZ_ENABLE_GIO" -o \
5592    "$MOZ_ENABLE_LIBNOTIFY"; then
5593     MOZ_ENABLE_GNOME_COMPONENT=1
5594 else
5595     MOZ_ENABLE_GNOME_COMPONENT=
5597 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5599 dnl ========================================================
5600 dnl = libgnomeui support module
5601 dnl ========================================================
5603 if test "$MOZ_ENABLE_GTK2"
5604 then
5605     MOZ_ENABLE_GNOMEUI=1
5607     MOZ_ARG_DISABLE_BOOL(gnomeui,
5608     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5609         MOZ_ENABLE_GNOMEUI=,
5610         MOZ_ENABLE_GNOMEUI=force)
5612     if test "$MOZ_ENABLE_GNOMEUI"
5613     then
5614         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5615         [
5616             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5617             MOZ_ENABLE_GNOMEUI=1
5618         ],[
5619             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5620             then
5621                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5622             fi
5623             MOZ_ENABLE_GNOMEUI=
5624         ])
5625     fi
5627     if test "$MOZ_ENABLE_GNOMEUI"; then
5628         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5629     fi
5632 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5633 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5634 AC_SUBST(MOZ_GNOMEUI_LIBS)
5636 dnl ========================================================
5637 dnl = dbus support
5638 dnl ========================================================
5640 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5641 then
5642     MOZ_ENABLE_DBUS=1
5644     MOZ_ARG_DISABLE_BOOL(dbus,
5645     [  --disable-dbus          Disable dbus support ],
5646         MOZ_ENABLE_DBUS=,
5647         MOZ_ENABLE_DBUS=1)
5649     if test "$MOZ_ENABLE_DBUS"
5650     then
5651         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5652         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5653         AC_DEFINE(MOZ_ENABLE_DBUS)
5654     fi
5656 AC_SUBST(MOZ_ENABLE_DBUS)
5657 AC_SUBST(MOZ_DBUS_CFLAGS)
5658 AC_SUBST(MOZ_DBUS_LIBS)
5659 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5660 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5662 dnl ========================================================
5663 dnl = Build Personal Security Manager
5664 dnl ========================================================
5665 MOZ_ARG_DISABLE_BOOL(crypto,
5666 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5667     MOZ_PSM=,
5668     MOZ_PSM=1 )
5670 dnl ========================================================
5671 dnl = JS Debugger XPCOM component (js/jsd)
5672 dnl ========================================================
5673 MOZ_ARG_DISABLE_BOOL(jsd,
5674 [  --disable-jsd           Disable JavaScript debug library],
5675     MOZ_JSDEBUGGER=,
5676     MOZ_JSDEBUGGER=1)
5679 dnl ========================================================
5680 dnl = Enable IPDL's "expensive" unit tests
5681 dnl ========================================================
5682 MOZ_IPDL_TESTS=
5684 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5685 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5686     MOZ_IPDL_TESTS=1,
5687     MOZ_IPDL_TESTS=)
5689 if test -n "$MOZ_IPDL_TESTS"; then
5690     AC_DEFINE(MOZ_IPDL_TESTS)
5693 AC_SUBST(MOZ_IPDL_TESTS)
5695 dnl ========================================================
5696 dnl = Turns off code necessary for e10s compatibility
5697 dnl ========================================================
5698 dnl This is a temporary flag to be removed in bug 662601 when
5699 dnl it's no longer needed
5701 MOZ_E10S_COMPAT=
5703 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5704 [  --enable-e10s-compat     Turns off code for e10s compat],
5705     MOZ_E10S_COMPAT=1,
5706     MOZ_E10S_COMPAT=)
5708 if test -n "$MOZ_E10S_COMPAT"; then
5709     AC_DEFINE(MOZ_E10S_COMPAT)
5712 dnl ========================================================
5713 dnl = Disable building dbm
5714 dnl ========================================================
5715 MOZ_ARG_DISABLE_BOOL(dbm,
5716 [  --disable-dbm           Disable building dbm],
5717     NSS_DISABLE_DBM=1,
5718     NSS_DISABLE_DBM=)
5720 dnl bi-directional support always on
5721 IBMBIDI=1
5722 AC_DEFINE(IBMBIDI)
5724 dnl ========================================================
5725 dnl accessibility support on by default on all platforms 
5726 dnl except OS X.
5727 dnl ========================================================
5728 MOZ_ARG_DISABLE_BOOL(accessibility,
5729 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5730     ACCESSIBILITY=,
5731     ACCESSIBILITY=1 )
5732 if test "$ACCESSIBILITY"; then
5733     AC_DEFINE(ACCESSIBILITY)
5736 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5737 case "$target" in
5738 *-mingw*)
5739     if test "$ac_cv_header_atlbase_h" = "no"; then
5740         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.])
5741     fi
5742     if test "$ac_cv_header_oleacc_idl" = "no"; then
5743         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.])
5744     fi
5745     ;;
5746 esac
5749 dnl ========================================================
5750 dnl Disable printing
5751 dnl ========================================================
5752 MOZ_ARG_DISABLE_BOOL(printing,
5753 [  --disable-printing      Disable printing support],
5754     NS_PRINTING=,
5755     NS_PRINTING=1)
5757 if test "$NS_PRINTING"; then
5758     AC_DEFINE(NS_PRINTING)
5759     AC_DEFINE(NS_PRINT_PREVIEW)
5762 dnl ========================================================
5763 dnl = Enable Raw Codecs
5764 dnl ========================================================
5765 MOZ_ARG_ENABLE_BOOL(raw,
5766 [  --enable-raw           Enable support for RAW media],
5767     MOZ_RAW=1,
5768     MOZ_RAW=)
5770 if test -n "$MOZ_RAW"; then
5771     AC_DEFINE(MOZ_RAW)
5772     MOZ_MEDIA=1
5775 AC_SUBST(MOZ_RAW)
5777 dnl ========================================================
5778 dnl = Disable Ogg Codecs
5779 dnl ========================================================
5780 MOZ_ARG_DISABLE_BOOL(ogg,
5781 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5782     MOZ_OGG=,
5783     MOZ_OGG=1)
5785 if test -n "$MOZ_OGG"; then
5786     AC_DEFINE(MOZ_OGG)
5787     MOZ_SYDNEYAUDIO=1
5788     MOZ_MEDIA=1
5789     case "$target_cpu" in
5790     arm*)
5791         MOZ_TREMOR=1
5792     ;;
5793     *)
5794         MOZ_VORBIS=1
5795     ;;
5796     esac
5798     dnl Checks for __attribute__(aligned()) directive
5799     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5800         [ac_cv_c_attribute_aligned],
5801         [ac_cv_c_attribute_aligned=0
5802          CFLAGS_save="${CFLAGS}"
5803          CFLAGS="${CFLAGS} -Werror"
5804          for ac_cv_c_attr_align_try in 64 32 16 8; do
5805            echo "trying $ac_cv_c_attr_align_try"
5806            AC_TRY_COMPILE([],
5807                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5808                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5809            if test "$ac_cv_c_attribute_aligned" != 0; then
5810              break;
5811            fi
5812          done
5813            CFLAGS="${CFLAGS_save}"])
5814     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5815       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5816                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5817     fi
5820 dnl ========================================================
5821 dnl = Disable VP8 decoder support
5822 dnl ========================================================
5823 MOZ_ARG_DISABLE_BOOL(webm,
5824 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5825     MOZ_WEBM=,
5826     MOZ_WEBM=1)
5828 dnl system libvpx Support
5829 dnl ========================================================
5830 MOZ_ARG_WITH_STRING(system-libvpx,
5831 [  --with-system-libvpx=[PFX]
5832                           Use system libvpx [installed at prefix PFX]],
5833     LIBVPX_DIR=$withval)
5835 MOZ_NATIVE_LIBVPX=
5836 MOZ_LIBVPX_INCLUDES=
5837 MOZ_LIBVPX_LIBS=
5839 if test -n "$MOZ_WEBM"; then
5840     AC_DEFINE(MOZ_WEBM)
5842     if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
5843         _SAVE_CFLAGS=$CFLAGS
5844         _SAVE_LDFLAGS=$LDFLAGS
5845         _SAVE_LIBS=$LIBS
5846         if test "${LIBVPX_DIR}" = "yes"; then
5847             LIBVPX_DIR=/usr
5848         fi
5849         CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
5850         LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
5851         MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
5852             [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
5853              AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
5854             fi],
5855             AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
5856         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
5857                      [MOZ_NATIVE_LIBVPX=1
5858                       MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
5859                       MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
5860                      ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
5861         CFLAGS=$_SAVE_CFLAGS
5862         LDFLAGS=$_SAVE_LDFLAGS
5863         LIBS=$_SAVE_LIBS
5864     fi
5867 AC_SUBST(MOZ_NATIVE_LIBVPX)
5868 AC_SUBST(MOZ_LIBVPX_INCLUDES)
5869 AC_SUBST(MOZ_LIBVPX_LIBS)
5871 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
5872     MOZ_SYDNEYAUDIO=1
5873     MOZ_MEDIA=1
5874     case "$target_cpu" in
5875     arm*)
5876         MOZ_TREMOR=1
5877     ;;
5878     *)
5879         MOZ_VORBIS=1
5880     ;;
5881     esac
5884     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5885     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5886     dnl We currently require gcc on all arm platforms.
5887     VPX_AS=$YASM
5888     VPX_ASM_SUFFIX=asm
5890     dnl See if we have assembly on this platform.  
5891     case "$OS_ARCH:$CPU_ARCH" in
5892     Linux:x86)
5893       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5894       VPX_X86_ASM=1
5895     ;;
5896     Linux:x86_64)
5897       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5898       VPX_X86_ASM=1
5899     ;;
5900     SunOS:x86)
5901       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5902       VPX_X86_ASM=1
5903     ;;
5904     SunOS:x86_64)
5905       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5906       VPX_X86_ASM=1
5907     ;;
5908     Darwin:x86)
5909       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5910       VPX_X86_ASM=1
5911     ;;
5912     Darwin:x86_64)
5913       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5914       VPX_X86_ASM=1
5915     ;;
5916     WINNT:x86_64)
5917       if test -z "$GNU_CC"; then
5918         VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5919         VPX_X86_ASM=1
5920       fi
5921     ;;
5922     WINNT:x86)
5923       if test -z "$GNU_CC"; then
5924         dnl Check for yasm 1.1 or greater.
5925         if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5926           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.])
5927         elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5928           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.])
5929         else
5930           VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5931           VPX_X86_ASM=1
5932         fi
5933       fi
5934     ;;
5935     *:arm*)
5936       if test -n "$GNU_AS" ; then
5937         VPX_AS=$AS
5938         dnl These flags are a lie; they're just used to enable the requisite
5939         dnl opcodes; actual arch detection is done at runtime.
5940         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5941         VPX_DASH_C_FLAG="-c"
5942         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5943         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5944         VPX_ARM_ASM=1
5945       fi
5946     esac
5948     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5949       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.])
5950     fi
5952     if test -n "$VPX_X86_ASM"; then
5953       AC_DEFINE(VPX_X86_ASM)
5954     elif test -n "$VPX_ARM_ASM"; then
5955       AC_DEFINE(VPX_ARM_ASM)
5956     else
5957       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5958     fi
5961 dnl ========================================================
5962 dnl = Disable Wave decoder support
5963 dnl ========================================================
5964 MOZ_ARG_DISABLE_BOOL(wave,
5965 [  --disable-wave          Disable Wave decoder support],
5966     MOZ_WAVE=,
5967     MOZ_WAVE=1)
5969 if test -n "$MOZ_WAVE"; then
5970     AC_DEFINE(MOZ_WAVE)
5971     MOZ_SYDNEYAUDIO=1
5972     MOZ_MEDIA=1
5975 dnl ========================================================
5976 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5977 dnl ========================================================
5979 if test -n "$MOZ_SYDNEYAUDIO"; then
5980     AC_DEFINE(MOZ_SYDNEYAUDIO)
5983 if test -n "$MOZ_MEDIA"; then
5984     AC_DEFINE(MOZ_MEDIA)
5987 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5988     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/])
5991 if test -n "$MOZ_VORBIS"; then
5992     AC_DEFINE(MOZ_VORBIS)
5995 if test -n "$MOZ_TREMOR"; then
5996     AC_DEFINE(MOZ_TREMOR)
5999 dnl ========================================================
6000 dnl = Check alsa availability on Linux if using sydneyaudio
6001 dnl ========================================================
6003 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6004 if test -n "$MOZ_SYDNEYAUDIO"; then
6005    case "$target_os" in
6006 linux*)
6007       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6008          [echo "$MOZ_ALSA_PKG_ERRORS"
6009           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.)])])
6010       ;;
6011    esac
6014 dnl ========================================================
6015 dnl Splashscreen
6016 dnl ========================================================
6017 AC_ARG_ENABLE(splashscreen,
6018               [  --enable-splashscreen   display splashscreen while loading (default=no)],
6019               [enable_splash="yes"],[enable_splash=""])
6020 if test "x$enable_splash" = "xyes"; then
6021   MOZ_SPLASHSCREEN=1
6022   AC_DEFINE(MOZ_SPLASHSCREEN)
6024 AC_SUBST(MOZ_SPLASHSCREEN)
6026 dnl ========================================================
6027 dnl Permissions System
6028 dnl ========================================================
6029 MOZ_ARG_DISABLE_BOOL(permissions,
6030 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
6031     MOZ_PERMISSIONS=,
6032     MOZ_PERMISSIONS=1
6035 dnl ========================================================
6036 dnl NegotiateAuth
6037 dnl ========================================================
6038 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6039 [  --disable-negotiateauth Disable GSS-API negotiation ],
6040     MOZ_AUTH_EXTENSION=,
6041     MOZ_AUTH_EXTENSION=1 )
6043 dnl ========================================================
6044 dnl XTF
6045 dnl ========================================================
6046 MOZ_ARG_DISABLE_BOOL(xtf,
6047 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
6048     MOZ_XTF=,
6049     MOZ_XTF=1 )
6050 if test "$MOZ_XTF"; then
6051   AC_DEFINE(MOZ_XTF)
6054 dnl ========================================================
6055 dnl Pref extensions (autoconfig and system-pref)
6056 dnl ========================================================
6057 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6058 [  --disable-pref-extensions
6059                           Disable pref extensions such as autoconfig and
6060                           system-pref],
6061   MOZ_PREF_EXTENSIONS=,
6062   MOZ_PREF_EXTENSIONS=1 )
6064 dnl ========================================================
6065 dnl = Universalchardet
6066 dnl ========================================================
6067 MOZ_ARG_DISABLE_BOOL(universalchardet,
6068 [  --disable-universalchardet
6069                           Disable universal encoding detection],
6070   MOZ_UNIVERSALCHARDET=,
6071   MOZ_UNIVERSALCHARDET=1 )
6073 if test -n "${JAVA_BIN_PATH}"; then
6074   dnl Look for javac and jar in the specified path.
6075   JAVA_PATH="$JAVA_BIN_PATH"
6076 else
6077   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6078   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6081 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6082 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6083 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6085 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6086   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6087     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}])
6088   fi
6091 dnl ========================================================
6092 dnl = ANGLE OpenGL->D3D translator for WebGL
6093 dnl = * only applies to win32
6094 dnl = * enabled by default (shipping build); requires explicit --disable to disable
6095 dnl ========================================================
6096 MOZ_ANGLE=
6097 MOZ_DIRECTX_SDK_PATH=
6098 MOZ_DIRECTX_SDK_CPU_SUFFIX=
6099 MOZ_D3DX9_VERSION=
6100 MOZ_D3DX9_CAB=
6101 MOZ_D3DCOMPILER_CAB=
6102 MOZ_D3DX9_DLL=
6103 MOZ_D3DCOMPILER_DLL=
6104 case "$target_os" in
6105 *mingw*)
6106     MOZ_ANGLE=1
6107     ;;
6108 esac
6110 # The DirectX SDK libraries are split into x86 and x64 sub-directories
6111 case "${target_cpu}" in
6112 i*86)
6113   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
6114   ;;
6115 x86_64)
6116   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
6117   # currently we disable ANGLE in 64bit builds
6118   MOZ_ANGLE=
6119   ;;
6120 esac
6122 if test -n "$MOZ_ANGLE"; then
6123 MOZ_ARG_DISABLE_BOOL(angle,
6124 [  --disable-angle     Disable building of ANGLE for WebGL->D3D translation],
6125     MOZ_ANGLE=,
6126     MOZ_ANGLE=1)
6128 if test -n "$MOZ_ANGLE"; then
6129   if test -z "$_WIN32_MSVC"; then
6130     AC_MSG_ERROR([Building ANGLE requires MSVC.  To build without ANGLE, reconfigure with --disable-angle.])
6131   fi
6133   # Get the SDK path from the registry.
6134   # First try to get the June 2010 SDK
6135   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
6136   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
6137     # Otherwise just take whatever comes first
6138     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
6139   fi
6141   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
6142     AC_MSG_WARN([Found the February 2010 DirectX SDK. This is too old. We now require the June 2010 DirectX SDK, or newer.])
6143   else
6144     MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
6145   fi
6147   MOZ_ANGLE=
6149   if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
6150     if test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h && test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
6151       AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
6152       MOZ_ANGLE=1
6153     fi
6154   fi
6156   if test -z "$MOZ_ANGLE" ; then
6157     AC_MSG_WARN([Couldn't find the DirectX SDK, needed for ANGLE. Please install it (June 2010 or newer). To explicitly build without ANGLE, reconfigure with --disable-angle.])
6158     AC_MSG_WARN([This will become an error in the future.])
6159   fi
6161   if test -n "$MOZ_ANGLE" ; then
6162     # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
6163     MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
6165     if test -z "$MOZ_D3DX9_VERSION" ; then
6166       MOZ_ANGLE=
6167       AC_MSG_WARN([Couldn't determine the D3DX9 version! Disabling ANGLE.])
6168       AC_MSG_WARN([This will become an error in the future.])
6169     fi
6171     if test -n "$MOZ_ANGLE" ; then
6172       MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6173       MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6175       MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
6176       MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
6177     fi
6178   fi
6182 dnl ========================================================
6183 dnl = Breakpad crash reporting (on by default on supported platforms)
6184 dnl ========================================================
6186 case $target in
6187 i?86-*-mingw*|x86_64-*-mingw*)
6188   MOZ_CRASHREPORTER=1
6189   ;;
6190 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6191   MOZ_CRASHREPORTER=1
6192   ;;
6193 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6194   if test "$MOZ_ENABLE_GTK2"; then
6195     MOZ_CRASHREPORTER=1
6196   fi
6197   ;;
6198 *-android*|*-linuxandroid*)
6199   MOZ_CRASHREPORTER=1
6200   ;;
6201 *solaris*)
6202   MOZ_CRASHREPORTER=1
6203   ;;
6204 esac
6206 MOZ_ARG_DISABLE_BOOL(crashreporter,
6207 [  --disable-crashreporter Disable breakpad crash reporting],
6208     MOZ_CRASHREPORTER=,
6209     MOZ_CRASHREPORTER=1)
6211 if test -n "$MOZ_CRASHREPORTER"; then
6212    AC_DEFINE(MOZ_CRASHREPORTER)
6214   if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6215     test -z "$SKIP_LIBRARY_CHECKS"; then
6216     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6217     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6218     AC_SUBST(MOZ_GTHREAD_LIBS)
6220     MOZ_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.])])
6221   fi
6224 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6225 [  --with-crashreporter-enable-percent=NN
6226                           Enable sending crash reports by default on NN% of users. (default=100)],
6227 [ val=`echo $withval | sed 's/[^0-9]//g'`
6228     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6230 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6231    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6233 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6235 dnl ========================================================
6236 dnl = libjpeg-turbo configuration
6237 dnl ========================================================
6239 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6240 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
6241     MOZ_LIBJPEG_TURBO=,
6242     MOZ_LIBJPEG_TURBO=1)
6244 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6245 dnl files.
6247 if test -n "$MOZ_LIBJPEG_TURBO"; then
6249   dnl Do we support libjpeg-turbo on this platform?
6250   case "$OS_ARCH:$OS_TEST" in
6251   Linux:x86|Linux:i?86)
6252     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6253     LIBJPEG_TURBO_X86_ASM=1
6254   ;;
6255   Linux:x86_64)
6256     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6257     LIBJPEG_TURBO_X64_ASM=1
6258   ;;
6259   SunOS:i?86)
6260     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6261     LIBJPEG_TURBO_X86_ASM=1
6262   ;;
6263   SunOS:x86_64)
6264     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6265     LIBJPEG_TURBO_X64_ASM=1
6266   ;;
6267   Darwin:i?86)
6268     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6269     LIBJPEG_TURBO_X86_ASM=1
6270   ;;
6271   Darwin:x86_64)
6272     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6273     LIBJPEG_TURBO_X64_ASM=1
6274   ;;
6275   WINNT:x86|WINNT:i?86)
6276     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6277     LIBJPEG_TURBO_X86_ASM=1
6278   ;;
6279   WINNT:x86_64)
6280     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6281     LIBJPEG_TURBO_X64_ASM=1
6282   ;;
6283   esac
6287 dnl If we're on a system which supports libjpeg-turbo's asm routines and
6288 dnl --disable-libjpeg-turbo wasn't passed, check for yasm, and error out if it
6289 dnl doesn't exist or we have too old of a version.
6290 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6291     AC_MSG_CHECKING([for YASM assembler])
6292     AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6294     if test -z "$LIBJPEG_TURBO_AS" ; then
6295         AC_MSG_ERROR([yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have yasm installed.  Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
6296     fi
6298     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
6299     dnl on Linux and 1.1 or newer everywhere else.
6300     if test "$OS_ARCH" = "Linux" ; then
6301         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
6302             AC_MSG_ERROR([yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
6303         fi
6304     else
6305         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6306             AC_MSG_ERROR([yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
6307         fi
6308     fi
6311 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6312     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6313 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6314     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6315 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6316     dnl Warn if we're not building the optimized routines, even though the user
6317     dnl didn't specify --disable-libjpeg-turbo.
6318     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6321 dnl ========================================================
6322 dnl = Enable compilation of specific extension modules
6323 dnl ========================================================
6325 MOZ_ARG_ENABLE_STRING(extensions,
6326 [  --enable-extensions     Enable extensions],
6327 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6328     if test "$option" = "yes" -o "$option" = "all"; then
6329         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6330     elif test "$option" = "no" -o "$option" = "none"; then
6331         MOZ_EXTENSIONS=""
6332     elif test "$option" = "default"; then
6333         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6334     elif test `echo "$option" | grep -c \^-` != 0; then
6335         option=`echo $option | sed 's/^-//'`
6336         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6337     else
6338         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6339     fi
6340 done],
6341     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6343 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6344     # Suppress warning on non-X11 platforms
6345     if test -n "$MOZ_X11"; then
6346         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6347     fi
6348     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6351 dnl Do not build gnomevfs with libxul based apps
6352 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6353     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6356 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6357     # Suppress warning on non-X11 platforms
6358     if test -n "$MOZ_X11"; then
6359         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6360     fi
6361     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6364 dnl Do not build gio with libxul based apps
6365 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6366     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6369 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6370     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6371     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6374 dnl xforms requires xtf
6375 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6376     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6377     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6380 dnl Remove dupes
6381 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6383 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6384 dnl when trying to build a nonexistent extension.
6385 for extension in $MOZ_EXTENSIONS; do
6386     if test ! -d "${srcdir}/extensions/${extension}"; then
6387         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6388     fi
6389 done
6391 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6392   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6395 dnl ========================================================
6396 dnl SVG Display Lists
6397 dnl ========================================================
6398 if test -n "$MOZ_SVG_DLISTS"; then
6399   AC_DEFINE(MOZ_SVG_DLISTS)
6402 dnl ========================================================
6403 dnl SMIL
6404 dnl ========================================================
6405 MOZ_SMIL=1
6406 MOZ_ARG_DISABLE_BOOL(smil,
6407 [  --disable-smil          Disable SMIL animation support],
6408     MOZ_SMIL=,
6409     MOZ_SMIL=1 )
6410 if test -n "$MOZ_SMIL"; then
6411   AC_DEFINE(MOZ_SMIL)
6414 dnl ========================================================
6415 dnl Build Freetype in the tree
6416 dnl ========================================================
6417 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6418 [  --enable-tree-freetype  Enable Tree FreeType],
6419     MOZ_TREE_FREETYPE=1,
6420     MOZ_TREE_FREETYPE= )
6421 if test -n "$MOZ_TREE_FREETYPE"; then
6422    if test -n "$_WIN32_MSVC"; then
6423       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6424    fi
6425    AC_DEFINE(MOZ_TREE_FREETYPE)
6426    AC_SUBST(MOZ_TREE_FREETYPE)
6427    MOZ_ENABLE_CAIRO_FT=1       
6428    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6429    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6430    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6431    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6432    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6433    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6434    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6435    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6436    AC_SUBST(CAIRO_FT_CFLAGS)
6439 dnl ========================================================
6440 dnl Installer
6441 dnl ========================================================
6442 case "$target_os" in
6443     aix*|solaris*|linux*|mingw*|os2*)
6444         MOZ_INSTALLER=1
6445         ;;
6446 esac
6448 MOZ_ARG_DISABLE_BOOL(installer,
6449 [  --disable-installer     Disable building of installer],
6450     MOZ_INSTALLER=,
6451     MOZ_INSTALLER=1)
6452 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6453     # Disable installer for Windows builds that use the new toolkit if the
6454     # required major version and minimum minor version of Unicode NSIS isn't in
6455     # the path.
6456     REQ_NSIS_MAJOR_VER=2
6457     MIN_NSIS_MINOR_VER=33
6458     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6459     if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6460         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.])
6461     fi
6462     changequote(,)
6463     MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6464     changequote([,])
6465     if test ! "$MAKENSISU_VER" = ""; then
6466         MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6467         MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6468     fi
6469     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6470     if test "$MAKENSISU_VER" = "" ||
6471        test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6472             ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6473         AC_MSG_RESULT([no])
6474         AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path. To build without the installer reconfigure using --disable-installer.])
6475     fi
6476     AC_MSG_RESULT([yes])
6479 AC_SUBST(MOZ_INSTALLER)
6481 AC_MSG_CHECKING([for tar archiver])
6482 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6483 if test -z "$TAR"; then
6484     AC_MSG_ERROR([no tar archiver found in \$PATH])
6486 AC_MSG_RESULT([$TAR])
6487 AC_SUBST(TAR)
6489 AC_MSG_CHECKING([for wget])
6490 AC_CHECK_PROGS(WGET, wget, "")
6491 AC_MSG_RESULT([$WGET])
6492 AC_SUBST(WGET)
6494 dnl ========================================================
6495 dnl Updater
6496 dnl ========================================================
6498 MOZ_ARG_DISABLE_BOOL(updater,
6499 [  --disable-updater       Disable building of updater],
6500     MOZ_UPDATER=,
6501     MOZ_UPDATER=1 )
6503 if test -n "$MOZ_UPDATER"; then
6504     AC_DEFINE(MOZ_UPDATER)
6507 # app update channel is 'default' when not supplied.
6508 MOZ_ARG_ENABLE_STRING([update-channel],
6509 [  --enable-update-channel=CHANNEL
6510                           Select application update channel (default=default)],
6511     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6513 if test -z "$MOZ_UPDATE_CHANNEL"; then
6514     MOZ_UPDATE_CHANNEL=default
6516 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6517 AC_SUBST(MOZ_UPDATE_CHANNEL)
6519 # tools/update-packaging is not checked out by default.
6520 MOZ_ARG_ENABLE_BOOL(update-packaging,
6521 [  --enable-update-packaging
6522                           Enable tools/update-packaging],
6523     MOZ_UPDATE_PACKAGING=1,
6524     MOZ_UPDATE_PACKAGING= )
6525 AC_SUBST(MOZ_UPDATE_PACKAGING)
6527 dnl ========================================================
6528 dnl leaky
6529 dnl ========================================================
6530 MOZ_ARG_ENABLE_BOOL(leaky,
6531 [  --enable-leaky          Build leaky memory tool],
6532     MOZ_LEAKY=1,
6533     MOZ_LEAKY=)
6536 dnl ========================================================
6537 dnl build the tests by default
6538 dnl ========================================================
6539 MOZ_ARG_DISABLE_BOOL(tests,
6540 [  --disable-tests         Do not build test libraries & programs],
6541     ENABLE_TESTS=,
6542     ENABLE_TESTS=1 )
6544 dnl ========================================================
6545 dnl parental controls (for Windows Vista)
6546 dnl ========================================================
6547 MOZ_ARG_DISABLE_BOOL(parental-controls,
6548 [  --disable-parental-controls
6549                           Do not build parental controls],
6550    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6551    MOZ_DISABLE_PARENTAL_CONTROLS=)
6552 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6553     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6556 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6558 dnl ========================================================
6559 dnl = Disable DOMCrypto
6560 dnl ========================================================
6561 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6562     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6565 dnl ========================================================
6566 dnl =
6567 dnl = Module specific options
6568 dnl =
6569 dnl ========================================================
6570 MOZ_ARG_HEADER(Individual module options)
6572 dnl ========================================================
6573 dnl = Disable feed handling components
6574 dnl ========================================================
6575 MOZ_ARG_DISABLE_BOOL(feeds,
6576 [  --disable-feeds         Disable feed handling and processing components],
6577     MOZ_FEEDS=,
6578     MOZ_FEEDS=1 )
6579 if test -n "$MOZ_FEEDS"; then
6580     AC_DEFINE(MOZ_FEEDS)
6581 else
6582     if test "$MOZ_BUILD_APP" = "browser"; then
6583         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6584     fi
6587 dnl ========================================================
6588 dnl = Enable mozStorage
6589 dnl ========================================================
6590 dnl Implicitly enabled by default if building calendar or places
6591 MOZ_ARG_ENABLE_BOOL(storage,
6592 [  --enable-storage        Enable mozStorage module and related components],
6593     MOZ_STORAGE=1,
6594     MOZ_STORAGE= )
6595 if test -n "$MOZ_STORAGE"; then
6596     AC_DEFINE(MOZ_STORAGE)
6599 dnl ========================================================
6600 dnl Check for sqlite
6601 dnl ========================================================
6603 MOZ_NATIVE_SQLITE=
6604 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6605 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6606 MOZ_NATIVE_SQLITE=1,
6607 MOZ_NATIVE_SQLITE= )
6609 if test -z "$MOZ_NATIVE_SQLITE"
6610 then
6611     SQLITE_CFLAGS=
6612     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6613 else
6614     dnl ============================
6615     dnl === SQLite Version check ===
6616     dnl ============================
6617     dnl Check to see if the system SQLite package is new enough.
6618     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6620     dnl ==================================
6621     dnl === SQLITE_SECURE_DELETE check ===
6622     dnl ==================================
6623     dnl Check to see if the system SQLite package is compiled with
6624     dnl SQLITE_SECURE_DELETE enabled.
6625     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6626     _SAVE_CFLAGS="$CFLAGS"
6627     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6628     _SAVE_LIBS="$LIBS"
6629     LIBS="$LIBS $SQLITE_LIBS"
6630     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6631         AC_TRY_RUN([
6632             #include "sqlite3.h"
6634             int main(int argc, char **argv){
6635               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6636             }],
6637             ac_cv_sqlite_secure_delete=yes,
6638             ac_cv_sqlite_secure_delete=no,
6639             ac_cv_sqlite_secure_delete=no
6640         )
6641     ])
6642     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6643     CFLAGS="$_SAVE_CFLAGS"
6644     LIBS="$_SAVE_LIBS"
6645     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6646         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6647     fi
6649     dnl ===============================
6650     dnl === SQLITE_THREADSAFE check ===
6651     dnl ===============================
6652     dnl Check to see if the system SQLite package is compiled with
6653     dnl SQLITE_THREADSAFE enabled.
6654     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6655     _SAVE_CFLAGS="$CFLAGS"
6656     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6657     _SAVE_LIBS="$LIBS"
6658     LIBS="$LIBS $SQLITE_LIBS"
6659     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6660         AC_TRY_RUN([
6661             #include "sqlite3.h"
6663             int main(int argc, char **argv){
6664               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6665             }],
6666             ac_cv_sqlite_threadsafe=yes,
6667             ac_cv_sqlite_threadsafe=no,
6668             ac_cv_sqlite_threadsafe=no
6669         )
6670     ])
6671     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6672     CFLAGS="$_SAVE_CFLAGS"
6673     LIBS="$_SAVE_LIBS"
6674     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6675         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6676     fi
6678     dnl ================================
6679     dnl === SQLITE_ENABLE_FTS3 check ===
6680     dnl ================================
6681     dnl check to see if the system SQLite package is compiled with
6682     dnl SQLITE_ENABLE_FTS3 enabled.
6683     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6684     _SAVE_CFLAGS="$CFLAGS"
6685     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6686     _SAVE_LIBS="$LIBS"
6687     LIBS="$LIBS $SQLITE_LIBS"
6688     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6689         AC_TRY_RUN([
6690             #include "sqlite3.h"
6692             int main(int argc, char **argv){
6693               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6694             }],
6695             ac_cv_sqlite_enable_fts3=yes,
6696             ac_cv_sqlite_enable_fts3=no,
6697             ac_cv_sqlite_enable_fts3=no
6698         )
6699     ])
6700     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6701     CFLAGS="$_SAVE_CFLAGS"
6702     LIBS="$_SAVE_LIBS"
6703     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6704         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6705     fi
6707     dnl =========================================
6708     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6709     dnl =========================================
6710     dnl check to see if the system SQLite package is compiled with
6711     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6712     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6713     _SAVE_CFLAGS="$CFLAGS"
6714     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6715     _SAVE_LIBS="$LIBS"
6716     LIBS="$LIBS $SQLITE_LIBS"
6717     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6718         AC_TRY_RUN([
6719             #include "sqlite3.h"
6721             int main(int argc, char **argv){
6722               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6723             }],
6724             ac_cv_sqlite_enable_unlock_notify=yes,
6725             ac_cv_sqlite_enable_unlock_notify=no,
6726             ac_cv_sqlite_enable_unlock_notify=no
6727         )
6728     ])
6729     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6730     CFLAGS="$_SAVE_CFLAGS"
6731     LIBS="$_SAVE_LIBS"
6732     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6733         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6734     fi
6737 if test -n "$MOZ_NATIVE_SQLITE"; then
6738     AC_DEFINE(MOZ_NATIVE_SQLITE)
6740 AC_SUBST(MOZ_NATIVE_SQLITE)
6742 dnl ========================================================
6743 dnl = Enable help viewer (off by default)
6744 dnl ========================================================
6745 if test -n "$MOZ_HELP_VIEWER"; then
6746      dnl Do this if defined in confvars.sh
6747      AC_DEFINE(MOZ_HELP_VIEWER)
6750 dnl ========================================================
6751 dnl = Enable safe browsing (anti-phishing)
6752 dnl ========================================================
6753 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6754 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6755     MOZ_SAFE_BROWSING=1,
6756     MOZ_SAFE_BROWSING= )
6757 if test -n "$MOZ_SAFE_BROWSING"; then
6758     AC_DEFINE(MOZ_SAFE_BROWSING)
6760 AC_SUBST(MOZ_SAFE_BROWSING)
6762 dnl ========================================================
6763 dnl = Enable url-classifier
6764 dnl ========================================================
6765 dnl Implicitly enabled by default if building with safe-browsing
6766 if test -n "$MOZ_SAFE_BROWSING"; then
6767     MOZ_URL_CLASSIFIER=1
6769 MOZ_ARG_ENABLE_BOOL(url-classifier,
6770 [  --enable-url-classifier Enable url classifier module],
6771     MOZ_URL_CLASSIFIER=1,
6772     MOZ_URL_CLASSIFIER= )
6773 if test -n "$MOZ_URL_CLASSIFIER"; then
6774     AC_DEFINE(MOZ_URL_CLASSIFIER)
6776 AC_SUBST(MOZ_URL_CLASSIFIER)
6778 dnl ========================================================
6779 dnl = Disable zipwriter
6780 dnl ========================================================
6781 MOZ_ARG_DISABLE_BOOL(zipwriter,
6782 [  --disable-zipwriter     Disable zipwriter component],
6783     MOZ_ZIPWRITER=,
6784     MOZ_ZIPWRITER=1 )
6785 AC_SUBST(MOZ_ZIPWRITER)
6787 dnl ========================================================
6788 dnl = libconic
6789 dnl ========================================================
6790 dnl superseded by QtNetwork starting from 4.7
6791 MOZ_ENABLE_LIBCONIC=1
6793 if test -n "$MOZ_ENABLE_QT"; then
6794   if test "$MOZ_ENABLE_QTNETWORK"; then
6795     MOZ_ENABLE_LIBCONIC=
6796   fi
6799 MOZ_ARG_DISABLE_BOOL(libconic,
6800 [  --disable-libconic      Disable libconic],
6801     MOZ_ENABLE_LIBCONIC=,
6802     MOZ_ENABLE_LIBCONIC=1 )
6804 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6805     PKG_CHECK_MODULES(LIBCONIC, conic,
6806                       MOZ_ENABLE_LIBCONIC=1,
6807                       MOZ_ENABLE_LIBCONIC=)
6809 if test "$MOZ_ENABLE_LIBCONIC"; then
6810     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6813 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6814 AC_SUBST(LIBCONIC_CFLAGS)
6815 AC_SUBST(LIBCONIC_LIBS)
6817 dnl ========================================================
6818 dnl = Maemo checks
6819 dnl ========================================================
6821 MAEMO_SDK_TARGET_VER=-1
6823 MOZ_ARG_WITH_STRING(maemo-version,
6824 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6825                           Maemo SDK Version],
6826   MAEMO_SDK_TARGET_VER=$withval)
6828 case "$MAEMO_SDK_TARGET_VER" in
6830     MOZ_PLATFORM_MAEMO=5
6831     ;;
6834     MOZ_PLATFORM_MAEMO=6
6835     ;;
6838     dnl We aren't compiling for Maemo, move on.
6839     ;;
6841     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6842     ;;
6843 esac
6845 if test $MOZ_PLATFORM_MAEMO; then
6846    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6848    if test -z "$MOZ_ENABLE_DBUS"; then
6849        AC_MSG_ERROR([DBus is required when building for Maemo])
6850    fi
6852    MOZ_GFX_OPTIMIZE_MOBILE=1
6853    MOZ_WEBGL_GLX=
6854    MOZ_MAEMO_LIBLOCATION=
6856    if test $MOZ_PLATFORM_MAEMO = 5; then
6857       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6858       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6859           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6860       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6861                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6863       AC_SUBST(XCOMPOSITE_LIBS)
6865       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6866       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6867       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6868       if test -z "$_LIB_FOUND"; then
6869          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6870       fi
6873       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6874       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6875       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6876       if test -z "$_LIB_FOUND"; then
6877          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6878       fi
6880       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6881       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6882       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6883       if test -z "$_LIB_FOUND"; then
6884          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6885       fi
6887    fi
6888    if test $MOZ_PLATFORM_MAEMO = 6; then
6889       dnl ========================================================
6890       dnl = Enable meego libcontentaction
6891       dnl ========================================================
6892       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6893       [  --enable-meegocontentaction           Enable meegocontentaction support],
6894          MOZ_MEEGOCONTENTACTION=1,
6895          MOZ_MEEGOCONTENTACTION=)
6897       if test -n "$MOZ_MEEGOCONTENTACTION"; then
6899          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6900          if test "$_LIB_FOUND"; then
6901             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6902             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6903             MOZ_ENABLE_CONTENTACTION=1
6904             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6905             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6906          fi
6907       fi
6909       MOZ_ARG_ENABLE_BOOL(meegotouch,
6910       [  --enable-meegotouch  Enable meegotouch support],
6911          MOZ_MEEGOTOUCHENABLED=1,
6912          MOZ_MEEGOTOUCHENABLED=)
6914       if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6915           PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6916           if test "$_LIB_FOUND"; then
6917               MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6918               MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6919               AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6920           else
6921               AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6922           fi
6923       fi
6924    fi
6926    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6927    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6928    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6929    if test "$_LIB_FOUND"; then
6930       MOZ_MAEMO_LIBLOCATION=1
6931       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6932    else
6933       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6934    fi
6935    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6937    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6938    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6939    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6940    if test "$_LIB_FOUND"; then
6941       MOZ_ENABLE_MEEGOTOUCHSHARE=1
6942       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6943    else
6944       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6945    fi
6946    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6948    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6949    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6952 dnl ========================================================
6953 dnl = ARM toolchain tweaks
6954 dnl ========================================================
6956 dnl Defaults
6957 case "${target}" in
6958 arm-android*|arm-linuxandroid*)
6959     MOZ_THUMB=yes
6960     MOZ_ARCH=armv7-a
6961     MOZ_FPU=vfp
6962     MOZ_FLOAT_ABI=softfp
6963     ;;
6964 arm*-*)
6965     if test -n "$MOZ_PLATFORM_MAEMO"; then
6966         MOZ_THUMB=no
6967         MOZ_ARCH=armv7-a
6968         MOZ_FLOAT_ABI=softfp
6969     fi
6970     if test "$MOZ_PLATFORM_MAEMO" = 6; then
6971         MOZ_THUMB=yes
6972     fi
6973     ;;
6974 esac
6976 dnl Kept for compatibility with some buildbot mozconfig
6977 MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes)
6979 MOZ_ARG_WITH_STRING(thumb,
6980 [  --with-thumb[[=yes|no|toolchain-default]]]
6981 [                          Use Thumb instruction set (-mthumb)],
6982     if test -z "$GNU_CC"; then
6983         AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchains])
6984     fi
6985     MOZ_THUMB=$withval)
6987 MOZ_ARG_WITH_STRING(thumb-interwork,
6988 [  --with-thumb-interwork[[=yes|no|toolchain-default]]
6989                            Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
6990     if test -z "$GNU_CC"; then
6991         AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchains])
6992     fi
6993     MOZ_THUMB_INTERWORK=$withval)
6995 MOZ_ARG_WITH_STRING(arch,
6996 [  --with-arch=[[type|toolchain-default]]
6997                            Use specific CPU features (-march=type)],
6998     if test -z "$GNU_CC"; then
6999         AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchains])
7000     fi
7001     MOZ_ARCH=$withval)
7003 MOZ_ARG_WITH_STRING(fpu,
7004 [  --with-fpu=[[type|toolchain-default]]
7005                            Use specific FPU type (-mfpu=type)],
7006     if test -z "$GNU_CC"; then
7007         AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchains])
7008     fi
7009     MOZ_FPU=$withval)
7011 MOZ_ARG_WITH_STRING(float-abi,
7012 [  --with-float-abi=[[type|toolchain-default]]
7013                            Use specific arm float ABI (-mfloat-abi=type)],
7014     if test -z "$GNU_CC"; then
7015         AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchains])
7016     fi
7017     MOZ_FLOAT_ABI=$withval)
7019 MOZ_ARG_WITH_STRING(soft-float,
7020 [  --with-soft-float[[=yes|no|toolchain-default]]
7021                            Use soft float library (-msoft-float)],
7022     if test -z "$GNU_CC"; then
7023         AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchains])
7024     fi
7025     MOZ_SOFT_FLOAT=$withval)
7027 case "$MOZ_ARCH" in
7028 toolchain-default|"")
7029     arch_flag=""
7030     ;;
7032     arch_flag="-march=$MOZ_ARCH"
7033     ;;
7034 esac
7036 case "$MOZ_THUMB" in
7037 yes)
7038     MOZ_THUMB2=1
7039     thumb_flag="-mthumb"
7040     ;;
7042     MOZ_THUMB2=
7043     thumb_flag="-marm"
7044     ;;
7046     _SAVE_CFLAGS="$CFLAGS"
7047     CFLAGS="$arch_flag"
7048     AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
7049         MOZ_THUMB2=1,
7050         MOZ_THUMB2=)
7051     CFLAGS="$_SAVE_CFLAGS"
7052     thumb_flag=""
7053     ;;
7054 esac
7056 if test "$MOZ_THUMB2" = 1; then
7057     AC_DEFINE(MOZ_THUMB2)
7060 case "$MOZ_THUMB_INTERWORK" in
7061 yes)
7062     thumb_interwork_flag="-mthumb-interwork"
7063     ;;
7065     thumb_interwork_flag="-mno-thumb-interwork"
7066     ;;
7067 *) # toolchain-default
7068     thumb_interwork_flag=""
7069     ;;
7070 esac
7072 case "$MOZ_FPU" in
7073 toolchain-default|"")
7074     fpu_flag=""
7075     ;;
7077     fpu_flag="-mfpu=$MOZ_FPU"
7078     ;;
7079 esac
7081 case "$MOZ_FLOAT_ABI" in
7082 toolchain-default|"")
7083     float_abi_flag=""
7084     ;;
7086     float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
7087     ;;
7088 esac
7090 case "$MOZ_SOFT_FLOAT" in
7091 yes)
7092     soft_float_flag="-msoft-float"
7093     ;;
7095     soft_float_flag="-mno-soft-float"
7096     ;;
7097 *) # toolchain-default
7098     soft_float_flag=""
7099     ;;
7100 esac
7102 dnl Use echo to avoid accumulating space characters
7103 all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
7104 if test -n "$all_flags"; then
7105     _SAVE_CFLAGS="$CFLAGS"
7106     CFLAGS="$all_flags"
7107     AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
7108     AC_TRY_COMPILE([],[return 0;],
7109         AC_MSG_RESULT([yes]),
7110         AC_MSG_ERROR([no]))
7112     CFLAGS="$_SAVE_CFLAGS $all_flags"
7113     CXXFLAGS="$CXXFLAGS $all_flags"
7114     ASFLAGS="$ASFLAGS $all_flags"
7115     if test -n "$thumb_flag"; then
7116         LDFLAGS="$LDFLAGS $thumb_flag"
7117     fi
7120 AC_SUBST(MOZ_THUMB2)
7122 if test "$CPU_ARCH" = "arm"; then
7123   AC_MSG_CHECKING(for ARM SIMD support in compiler)
7124   # We try to link so that this also fails when
7125   # building with LTO.
7126   AC_TRY_LINK([],
7127                  [asm("uqadd8 r1, r1, r2");],
7128                  result="yes", result="no")
7129   AC_MSG_RESULT("$result")
7130   if test "$result" = "yes"; then
7131       AC_DEFINE(HAVE_ARM_SIMD)
7132       HAVE_ARM_SIMD=1
7133   fi
7135   AC_MSG_CHECKING(for ARM NEON support in compiler)
7136   # We try to link so that this also fails when
7137   # building with LTO.
7138   AC_TRY_LINK([],
7139                  [asm(".fpu neon\n vadd.i8 d0, d0, d0");],
7140                  result="yes", result="no")
7141   AC_MSG_RESULT("$result")
7142   if test "$result" = "yes"; then
7143       AC_DEFINE(HAVE_ARM_NEON)
7144       HAVE_ARM_NEON=1
7145   fi
7146 fi # CPU_ARCH = arm
7148 AC_SUBST(HAVE_ARM_SIMD)
7149 AC_SUBST(HAVE_ARM_NEON)
7151 dnl ========================================================
7152 dnl = faststripe theme
7153 dnl ========================================================
7154 MOZ_ARG_ENABLE_BOOL(faststripe,
7155 [  --enable-faststripe     Use faststripe theme],
7156     MOZ_THEME_FASTSTRIPE=1,
7157     MOZ_THEME_FASTSTRIPE= )
7158 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7160 dnl ========================================================
7161 dnl =
7162 dnl = Feature options that require extra sources to be pulled
7163 dnl =
7164 dnl ========================================================
7165 dnl MOZ_ARG_HEADER(Features that require extra sources)
7167 dnl ========================================================
7168 dnl =
7169 dnl = Debugging Options
7170 dnl = 
7171 dnl ========================================================
7172 MOZ_ARG_HEADER(Debugging and Optimizations)
7174 dnl ========================================================
7175 dnl = Disable building with debug info.
7176 dnl = Debugging is OFF by default
7177 dnl ========================================================
7178 if test -z "$MOZ_DEBUG_FLAGS"; then
7179   MOZ_DEBUG_FLAGS="-g"
7182 MOZ_ARG_ENABLE_STRING(debug,
7183 [  --enable-debug[=DBG]    Enable building with developer debug info
7184                            (using compiler flags DBG)],
7185 [ if test "$enableval" != "no"; then
7186     MOZ_DEBUG=1
7187     if test -n "$enableval" -a "$enableval" != "yes"; then
7188         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7189         _MOZ_DEBUG_FLAGS_SET=1
7190     fi
7191   else
7192     MOZ_DEBUG=
7193   fi ],
7194   MOZ_DEBUG=)
7196 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7197 MOZ_ARG_WITH_STRING(debug-label,
7198 [  --with-debug-label=LABELS
7199                           Define DEBUG_<value> for each comma-separated
7200                           value given.],
7201 [ for option in `echo $withval | sed 's/,/ /g'`; do
7202     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7203 done])
7205 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7207 if test -n "$MOZ_DEBUG"; then
7208     AC_MSG_CHECKING([for valid debug flags])
7209     _SAVE_CFLAGS=$CFLAGS
7210     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7211     AC_TRY_COMPILE([#include <stdio.h>], 
7212         [printf("Hello World\n");],
7213         _results=yes,
7214         _results=no)
7215     AC_MSG_RESULT([$_results])
7216     if test "$_results" = "no"; then
7217         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7218     fi
7219     CFLAGS=$_SAVE_CFLAGS
7222 dnl ========================================================
7223 dnl enable mobile optimizations
7224 dnl ========================================================
7225 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7226 [  --enable-mobile-optimize
7227                           Enable mobile optimizations],
7228     MOZ_GFX_OPTIMIZE_MOBILE=1)
7230 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7232 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7233     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7236 dnl ========================================================
7237 dnl = Enable code optimization. ON by default.
7238 dnl ========================================================
7239 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7240         MOZ_OPTIMIZE_FLAGS="-O"
7243 MOZ_ARG_ENABLE_STRING(optimize,
7244 [  --disable-optimize      Disable compiler optimization
7245   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7246 [ if test "$enableval" != "no"; then
7247     MOZ_OPTIMIZE=1
7248     if test -n "$enableval" -a "$enableval" != "yes"; then
7249         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7250         MOZ_OPTIMIZE=2
7251     fi
7252 else
7253     MOZ_OPTIMIZE=
7254 fi ], MOZ_OPTIMIZE=1)
7256 if test "$COMPILE_ENVIRONMENT"; then
7257 if test -n "$MOZ_OPTIMIZE"; then
7258     AC_MSG_CHECKING([for valid optimization flags])
7259     _SAVE_CFLAGS=$CFLAGS
7260     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7261     AC_TRY_COMPILE([#include <stdio.h>], 
7262         [printf("Hello World\n");],
7263         _results=yes,
7264         _results=no)
7265     AC_MSG_RESULT([$_results])
7266     if test "$_results" = "no"; then
7267         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7268     fi
7269     CFLAGS=$_SAVE_CFLAGS
7271 fi # COMPILE_ENVIRONMENT
7273 AC_SUBST(MOZ_OPTIMIZE)
7274 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7275 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7276 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7277 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
7279 dnl ========================================================
7280 dnl = Enable generation of debug symbols
7281 dnl ========================================================
7282 MOZ_ARG_ENABLE_STRING(debug-symbols,
7283 [  --enable-debug-symbols[=DBG]
7284                           Enable debugging symbols (using compiler flags DBG)],
7285 [ if test "$enableval" != "no"; then
7286       MOZ_DEBUG_SYMBOLS=1
7287       if test -n "$enableval" -a "$enableval" != "yes"; then
7288           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7289               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7290           else
7291               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7292           fi
7293       fi
7294   else
7295       MOZ_DEBUG_SYMBOLS=
7296   fi ],
7297   MOZ_DEBUG_SYMBOLS=1)
7299 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7300     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7301     export MOZ_DEBUG_SYMBOLS
7304 dnl ========================================================
7305 dnl = Disable any treating of compile warnings as errors
7306 dnl ========================================================
7307 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7308 [  --disable-warnings-as-errors
7309                           Disable treating of warnings as errors],
7310     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7311     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7312 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7313    WARNINGS_AS_ERRORS=''
7316 dnl ========================================================
7317 dnl = Disable runtime logging checks
7318 dnl ========================================================
7319 MOZ_ARG_DISABLE_BOOL(logging,
7320 [  --disable-logging       Disable logging facilities],
7321     NS_DISABLE_LOGGING=1,
7322     NS_DISABLE_LOGGING= )
7323 if test "$NS_DISABLE_LOGGING"; then
7324     AC_DEFINE(NS_DISABLE_LOGGING)
7325 else
7326     AC_DEFINE(MOZ_LOGGING)
7329 dnl ========================================================
7330 dnl = This will enable logging of addref, release, ctor, dtor.
7331 dnl ========================================================
7332 _ENABLE_LOGREFCNT=42
7333 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7334 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7335     _ENABLE_LOGREFCNT=1,
7336     _ENABLE_LOGREFCNT= )
7337 if test "$_ENABLE_LOGREFCNT" = "1"; then
7338     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7339 elif test -z "$_ENABLE_LOGREFCNT"; then
7340     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7343 dnl ========================================================
7344 dnl = Enable trace malloc
7345 dnl ========================================================
7346 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7347 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7348 [  --enable-trace-malloc   Enable malloc tracing],
7349     NS_TRACE_MALLOC=1,
7350     NS_TRACE_MALLOC= )
7351 if test "$NS_TRACE_MALLOC"; then
7352   # Please, Mr. Linker Man, don't take away our symbol names
7353   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7354   USE_ELF_DYNSTR_GC=
7355   AC_DEFINE(NS_TRACE_MALLOC)
7357 AC_SUBST(NS_TRACE_MALLOC)
7359 dnl ========================================================
7360 dnl = Enable jemalloc
7361 dnl ========================================================
7362 MOZ_ARG_ENABLE_BOOL(jemalloc,
7363 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7364     MOZ_MEMORY=1,
7365     MOZ_MEMORY=)
7367 if test "$NS_TRACE_MALLOC"; then
7368     MOZ_MEMORY=
7371 if test -z "$MOZ_MEMORY"; then
7372   case "${target}" in
7373     *-mingw*)
7374       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7375         AC_MSG_WARN([When not building jemalloc, you need to set WIN32_REDIST_DIR to the path to the Visual C++ Redist (usually VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT, for VC++ v8) if you intend to distribute your build.])
7376       fi
7377       ;;
7378   esac
7379 else
7380   dnl Don't try to run compiler tests on Windows  
7381   if test "$OS_ARCH" = "WINNT"; then
7382     if test -z "$HAVE_64BIT_OS"; then
7383       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7384     else
7385       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7386     fi
7387   else
7388     AC_CHECK_SIZEOF([int *], [4])
7389     case "${ac_cv_sizeof_int_p}" in
7390     4)
7391       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7392       ;;
7393     8)
7394       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7395       ;;
7396     *)
7397       AC_MSG_ERROR([Unexpected pointer size])
7398       ;;
7399     esac
7400   fi
7402   AC_DEFINE(MOZ_MEMORY)
7403   if test "x$MOZ_DEBUG" = "x1"; then
7404     AC_DEFINE(MOZ_MEMORY_DEBUG)
7405   fi
7406   dnl The generic feature tests that determine how to compute ncpus are long and
7407   dnl complicated.  Therefore, simply define special cpp variables for the
7408   dnl platforms we have special knowledge of.
7409   case "${target}" in
7410   *-darwin*)
7411     AC_DEFINE(MOZ_MEMORY_DARWIN)
7412     ;;
7413   *-*freebsd*)
7414     AC_DEFINE(MOZ_MEMORY_BSD)
7415     ;;
7416   *-android*|*-linuxandroid*)
7417     AC_DEFINE(MOZ_MEMORY_LINUX)
7418     AC_DEFINE(MOZ_MEMORY_ANDROID)
7419     _WRAP_MALLOC=1
7420     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
7421     WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
7422     ;;
7423   *-*linux*)
7424     AC_DEFINE(MOZ_MEMORY_LINUX)
7425     ;;
7426   *-netbsd*)
7427     AC_DEFINE(MOZ_MEMORY_BSD)
7428     ;;
7429   *-solaris*)
7430     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7431     ;;
7432   *-mingw*)
7433     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7434     dnl This is sort of awful. Will revisit if we add support for more versions
7435     if test "$CC_VERSION" == "14.00.50727.762" -o "$CC_VERSION" == "15.00.30729.01"; then
7436       WIN32_OLD_STYLE_JEMALLOC=1
7437       AC_DEFINE(WIN32_OLD_STYLE_JEMALLOC)
7438     elif test "$CC_VERSION" == "16.00.30319.01" -o "$CC_VERSION" == "16.00.40219.01"; then
7439       WIN32_NEW_STYLE_JEMALLOC=1
7440       AC_DEFINE(WIN32_NEW_STYLE_JEMALLOC)
7441     else        
7442       AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 or 2010 currently.])
7443     fi
7444     if test -z "$WIN32_CRT_SRC_DIR" -a -n "$WIN32_OLD_STYLE_JEMALLOC"; then
7445       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7446         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).])
7447       else
7448         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7449       fi
7450     fi
7451     dnl cpu check
7452     case "${target_cpu}" in
7453     i*86)
7454       MOZ_CRT_CPU_ARCH=intel
7455       ;;
7456     x86_64)
7457       MOZ_CRT_CPU_ARCH=amd64
7458       ;;
7459     *)
7460       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7461       ;;
7462     esac
7464     AC_SUBST(MOZ_CRT_CPU_ARCH)
7466     if test -n "$WIN32_OLD_STYLE_JEMALLOC"; then
7467       if test ! -d "$WIN32_CRT_SRC_DIR"; then
7468         AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7469       fi
7470       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7471       _objdir_win=`pwd -W`
7472       WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7473       MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7474     else
7475       if test -z "$MOZ_DEBUG"; then
7476         WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7477       else
7478         WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7479       fi
7480       dnl Look for a broken crtdll.obj
7481       WIN32_CRTDLL_FULLPATH=`lib -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7482       lib -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7483       if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7484         MOZ_MEMORY_LDFLAGS='-MANIFEST:NO -LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7485       else
7486         MOZ_MEMORY_LDFLAGS='$(DIST)/../memory/jemalloc/jemalloc.lib'
7487       fi
7488       rm crtdll.obj
7489     fi
7490     dnl Also pass this to NSPR/NSS
7491     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7492     export DLLFLAGS
7493     ;;
7494   *)
7495     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7496     ;;
7497   esac
7499   if test "$OS_ARCH" != "WINNT"; then
7500     dnl NB: this must be kept in sync with jemalloc.h
7501     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7502   fi
7503   AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7504   AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7505 fi # MOZ_MEMORY
7506 AC_SUBST(MOZ_MEMORY)
7507 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7508 AC_SUBST(WIN32_OLD_STYLE_JEMALLOC)
7509 AC_SUBST(WIN32_CRT_LIBS)
7510 AC_SUBST(WIN32_CRT_SRC_DIR)
7511 dnl Need to set this for make because NSS doesn't have configure
7512 AC_SUBST(DLLFLAGS)
7514 dnl ========================================================
7515 dnl = Use malloc wrapper lib
7516 dnl ========================================================
7517 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7518 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7519     _WRAP_MALLOC=1,
7520     _WRAP_MALLOC= )
7522 if test -n "$_WRAP_MALLOC"; then
7523     if test "$GNU_CC"; then
7524     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"
7525     MKSHLIB="$MKSHLIB"' $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB)'
7526     MKCSHLIB="$MKCSHLIB"' $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB)'
7527     fi
7530 dnl ========================================================
7531 dnl = Location of malloc wrapper lib
7532 dnl ========================================================
7533 MOZ_ARG_WITH_STRING(wrap-malloc,
7534 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7535     WRAP_MALLOC_LIB=$withval)
7537 dnl ========================================================
7538 dnl = Use JS Call tracing
7539 dnl ========================================================
7540 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7541 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7542     MOZ_TRACE_JSCALLS=1,
7543     MOZ_TRACE_JSCALLS= )
7544 if test -n "$MOZ_TRACE_JSCALLS"; then
7545     AC_DEFINE(MOZ_TRACE_JSCALLS)
7548 dnl ========================================================
7549 dnl = Use TraceVis
7550 dnl ========================================================
7551 MOZ_ARG_ENABLE_BOOL(tracevis,
7552 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7553     MOZ_TRACEVIS=1,
7554     MOZ_TRACEVIS= )
7555 if test -n "$MOZ_TRACEVIS"; then
7556     AC_DEFINE(MOZ_TRACEVIS)
7559 dnl ========================================================
7560 dnl = Use GCTimer
7561 dnl ========================================================
7562 MOZ_ARG_ENABLE_BOOL(gctimer,
7563 [  --enable-gctimer        Enable GC timer (default=no)],
7564     MOZ_GCTIMER=1,
7565     MOZ_GCTIMER= )
7566 if test -n "$MOZ_GCTIMER"; then
7567     AC_DEFINE(MOZ_GCTIMER)
7570 dnl ========================================================
7571 dnl ETW - Event Tracing for Windows
7572 dnl ========================================================
7573 MOZ_ARG_ENABLE_BOOL(ETW,
7574 [  --enable-ETW            Enable ETW (Event Tracing for Windows) event reporting
7575                           (needs Windows Vista+ SDK)],
7576     MOZ_ETW=1,
7577     MOZ_ETW= )
7578 if test -n "$MOZ_ETW"; then
7579     AC_DEFINE(MOZ_ETW)
7582 if test -n "$MOZ_ETW"; then
7583     if test -z "$MOZ_WINSDK_TARGETVER"; then
7584         AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7585     elif test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
7586         AC_MSG_ERROR([--enable-ETW requires the Windows Vista SDK or newer])
7587     fi
7590 dnl ========================================================
7591 dnl Zealous JavaScript GC
7592 dnl ========================================================
7593 MOZ_ARG_ENABLE_BOOL(gczeal,
7594 [  --enable-gczeal         Enable zealous JavaScript GCing],
7595     JS_GC_ZEAL=1,
7596     JS_GC_ZEAL= )
7597 if test -n "$JS_GC_ZEAL"; then
7598     AC_DEFINE(JS_GC_ZEAL)
7601 dnl ======================================================
7602 dnl = Enable compiling with ccache
7603 dnl ======================================================
7604 MOZ_ARG_WITH_STRING(ccache,
7605 [  --with-ccache[=path/to/ccache]
7606                           Enable compiling with ccache],
7607     CCACHE=$withval, CCACHE="no")
7609 if test "$CCACHE" != "no"; then
7610     if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7611         CCACHE=
7612     else
7613         if test ! -e "$CCACHE"; then
7614             AC_MSG_ERROR([$CCACHE not found])
7615         fi
7616     fi
7617     MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7618     if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7619         AC_MSG_ERROR([ccache not found])
7620     elif test -x "$CCACHE"; then
7621         CC="$CCACHE $CC"
7622         CXX="$CCACHE $CXX"
7623     else
7624         AC_MSG_ERROR([$CCACHE is not executable])
7625     fi
7628 dnl ========================================================
7629 dnl = Enable static checking using gcc-dehydra
7630 dnl ========================================================
7632 MOZ_ARG_WITH_STRING(static-checking,
7633 [  --with-static-checking=path/to/gcc_dehydra.so
7634                           Enable static checking of code using GCC-dehydra],
7635     DEHYDRA_PATH=$withval,
7636     DEHYDRA_PATH= )
7638 if test -n "$DEHYDRA_PATH"; then
7639     if test ! -f "$DEHYDRA_PATH"; then
7640         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7641     fi
7642     AC_DEFINE(NS_STATIC_CHECKING)
7644 AC_SUBST(DEHYDRA_PATH)
7646 dnl ========================================================
7647 dnl = Enable stripping of libs & executables
7648 dnl ========================================================
7649 MOZ_ARG_ENABLE_BOOL(strip,
7650 [  --enable-strip          Enable stripping of libs & executables ],
7651     ENABLE_STRIP=1,
7652     ENABLE_STRIP= )
7654 dnl ========================================================
7655 dnl = Enable stripping of libs & executables when packaging
7656 dnl ========================================================
7657 MOZ_ARG_ENABLE_BOOL(install-strip,
7658 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7659     PKG_SKIP_STRIP= ,
7660     PKG_SKIP_STRIP=1)
7662 dnl ========================================================
7663 dnl = --enable-elf-dynstr-gc
7664 dnl ========================================================
7665 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7666 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7667     USE_ELF_DYNSTR_GC=1,
7668     USE_ELF_DYNSTR_GC= )
7670 dnl ========================================================
7671 dnl = --disable-elf-hack
7672 dnl ========================================================
7674 USE_ELF_HACK=1
7675 MOZ_ARG_DISABLE_BOOL(elf-hack,
7676 [  --disable-elf-hack      Disable elf hacks],
7677     USE_ELF_HACK=,
7678     USE_ELF_HACK=1)
7680 # Only enable elfhack where supported
7681 if test "$USE_ELF_HACK" = 1; then
7682     case "${HOST_OS_ARCH},${OS_ARCH}" in
7683     Linux,Linux)
7684         case "${CPU_ARCH}" in
7685         arm | x86 | x86_64)
7686             USE_ELF_HACK=1
7687             ;;
7688         *)
7689             USE_ELF_HACK=
7690             ;;
7691         esac
7692         ;;
7693     *)
7694         USE_ELF_HACK=
7695         ;;
7696     esac
7699 if test "$USE_ELF_HACK" = 1; then
7700     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7701     dnl memory addresses it maps to. The result is that by the time elfhack
7702     dnl kicks in, it is not possible to apply relocations because of that,
7703     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7704     dnl segment. It makes elfhack mostly useless, so considering the problems
7705     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7706     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7707     dnl the linker creates PT_GNU_RELRO segments.
7708     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7709         LINK_WITH_PT_GNU_RELRO,
7710         [echo "int main() {return 0;}" > conftest.${ac_ext}
7711          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7712             test -s conftest${ac_exeext}; then
7713             if readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7714                 LINK_WITH_PT_GNU_RELRO=yes
7715             else
7716                 LINK_WITH_PT_GNU_RELRO=no
7717             fi
7718          else
7719              dnl We really don't expect to get here, but just in case
7720              AC_ERROR([couldn't compile a simple C file])
7721          fi
7722          rm -rf conftest*])
7723     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7724         AC_MSG_WARN([Disabling elfhack])
7725         USE_ELF_HACK=
7726     fi
7729 dnl ========================================================
7730 dnl = libstdc++ compatibility hacks
7731 dnl ========================================================
7733 STDCXX_COMPAT=
7734 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7735 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7736     STDCXX_COMPAT=stdc++compat.cpp)
7738 AC_SUBST(STDCXX_COMPAT)
7740 if test -n "$STDCXX_COMPAT"; then
7741    eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7742    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7743    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7746 dnl ========================================================
7747 dnl = 
7748 dnl = Profiling and Instrumenting
7749 dnl = 
7750 dnl ========================================================
7751 MOZ_ARG_HEADER(Profiling and Instrumenting)
7753 dnl ========================================================
7754 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7755 dnl = timing for identifying code bottlenecks 
7756 dnl = NS_FUNCTION_TIMER is off by default.
7757 dnl ========================================================
7758 MOZ_ARG_ENABLE_BOOL(functiontimer,
7759 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7760     NS_FUNCTION_TIMER=1,
7761     NS_FUNCTION_TIMER= )
7762 if test -n "$NS_FUNCTION_TIMER"; then
7763     AC_DEFINE(NS_FUNCTION_TIMER)
7766 dnl ========================================================
7767 dnl Turn on reflow counting
7768 dnl ========================================================
7769 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7770 [  --enable-reflow-perf    Enable reflow performance tracing],
7771     MOZ_REFLOW_PERF=1,
7772     MOZ_REFLOW_PERF= )
7773 if test -n "$MOZ_REFLOW_PERF"; then
7774     AC_DEFINE(MOZ_REFLOW_PERF)
7777 dnl ========================================================
7778 dnl Enable code size metrics.
7779 dnl ========================================================
7780 MOZ_ARG_ENABLE_BOOL(codesighs,
7781 [  --enable-codesighs      Enable code size analysis tools],
7782     _ENABLE_CODESIGHS=1,
7783     _ENABLE_CODESIGHS= )
7784 if test -n "$_ENABLE_CODESIGHS"; then
7785     if test -d $srcdir/tools/codesighs; then 
7786         MOZ_MAPINFO=1
7787     else
7788         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7789     fi
7792 dnl ========================================================
7793 dnl = Support for Quantify (Windows)
7794 dnl ========================================================
7795 MOZ_ARG_ENABLE_BOOL(quantify,
7796 [  --enable-quantify       Enable Quantify support (Windows only) ],
7797     MOZ_QUANTIFY=1,
7798     MOZ_QUANTIFY= )
7800 dnl ========================================================
7801 dnl = Support for demangling undefined symbols
7802 dnl ========================================================
7803 if test -z "$SKIP_LIBRARY_CHECKS"; then
7804     AC_LANG_SAVE
7805     AC_LANG_CPLUSPLUS
7806     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7807     AC_LANG_RESTORE
7810 # Demangle only for debug or trace-malloc builds
7811 MOZ_DEMANGLE_SYMBOLS=
7812 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7813     MOZ_DEMANGLE_SYMBOLS=1
7814     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7816 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7818 dnl ========================================================
7819 dnl = Support for gcc stack unwinding (from gcc 3.3)
7820 dnl ========================================================
7821 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7822     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7825 dnl ========================================================
7826 dnl =
7827 dnl = Misc. Options
7828 dnl = 
7829 dnl ========================================================
7830 MOZ_ARG_HEADER(Misc. Options)
7832 dnl ========================================================
7833 dnl update xterm title
7834 dnl ========================================================
7835 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7836 [  --enable-xterm-updates  Update XTERM titles with current command.],
7837     MOZ_UPDATE_XTERM=1,
7838     MOZ_UPDATE_XTERM= )
7840 dnl =========================================================
7841 dnl = Chrome format
7842 dnl =========================================================
7843 MOZ_ARG_ENABLE_STRING([chrome-format],
7844 [  --enable-chrome-format=jar|flat|both|symlink|omni
7845                           Select FORMAT of chrome files (default=jar)],
7846     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7848 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7849     MOZ_CHROME_FILE_FORMAT=jar
7852 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7853     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7854     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7855     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7856     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7857     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7860 dnl =========================================================
7861 dnl Omnijar packaging (bug 552121)
7862 dnl =========================================================
7863 dnl Omnijar packaging is compatible with flat packaging.
7864 dnl In unpackaged builds, omnijar looks for files as if
7865 dnl things were flat packaged. After packaging, all files
7866 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7867 dnl is set to flat since putting files into jars is only
7868 dnl done during packaging with omnijar.
7869 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7870     MOZ_OMNIJAR=1
7871     AC_DEFINE(MOZ_OMNIJAR)
7872     MOZ_CHROME_FILE_FORMAT=flat
7873 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7874     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7877 AC_SUBST(MOZ_OMNIJAR)
7879 dnl ========================================================
7880 dnl = Define default location for MOZILLA_FIVE_HOME
7881 dnl ========================================================
7882 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7883 [  --with-default-mozilla-five-home
7884                           Set the default value for MOZILLA_FIVE_HOME],
7885 [ val=`echo $withval`
7886   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7888 dnl ========================================================
7889 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7890 dnl ========================================================
7891 MOZ_ARG_WITH_STRING(user-appdir,
7892 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7893 [ val=`echo $withval`
7894 if echo "$val" | grep "\/" >/dev/null; then
7895     AC_MSG_ERROR("Homedir must be single relative path.")
7896 else 
7897     MOZ_USER_DIR="$val"
7898 fi])
7900 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7902 dnl ========================================================
7903 dnl = Doxygen configuration
7904 dnl ========================================================
7905 dnl Use commas to specify multiple dirs to this arg
7906 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7907 MOZ_ARG_WITH_STRING(doc-input-dirs,
7908 [  --with-doc-input-dirs=DIRS
7909                           Header/idl dirs to create docs from],
7910 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7911 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7913 dnl Use commas to specify multiple dirs to this arg
7914 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7915 MOZ_ARG_WITH_STRING(doc-include-dirs,
7916 [  --with-doc-include-dirs=DIRS  
7917                           Include dirs to preprocess doc headers],
7918 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7919 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7921 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7922 MOZ_ARG_WITH_STRING(doc-output-dir,
7923 [  --with-doc-output-dir=DIR
7924                           Dir to generate docs into],
7925 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7926 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7928 if test -z "$SKIP_COMPILER_CHECKS"; then
7929 dnl ========================================================
7930 dnl =
7931 dnl = Compiler Options
7932 dnl = 
7933 dnl ========================================================
7934 MOZ_ARG_HEADER(Compiler Options)
7936 dnl ========================================================
7937 dnl Check for gcc -pipe support
7938 dnl ========================================================
7939 AC_MSG_CHECKING([for gcc -pipe support])
7940 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
7941     echo '#include <stdio.h>' > dummy-hello.c
7942     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7943     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7944     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7945     if test $? = 0; then
7946         _res_as_stdin="yes"
7947     else
7948         _res_as_stdin="no"
7949     fi
7950     if test "$_res_as_stdin" = "yes"; then
7951         _SAVE_CFLAGS=$CFLAGS
7952         CFLAGS="$CFLAGS -pipe"
7953         AC_TRY_COMPILE( [ #include <stdio.h> ],
7954             [printf("Hello World\n");],
7955             [_res_gcc_pipe="yes"],
7956             [_res_gcc_pipe="no"] )
7957         CFLAGS=$_SAVE_CFLAGS
7958     fi
7959     if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
7960         _res="yes";
7961         CFLAGS="$CFLAGS -pipe"
7962         CXXFLAGS="$CXXFLAGS -pipe"
7963     else
7964         _res="no"
7965     fi
7966     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7967     AC_MSG_RESULT([$_res])
7968 else
7969     AC_MSG_RESULT([no])
7972 dnl ========================================================
7973 dnl Profile guided optimization (gcc checks)
7974 dnl ========================================================
7975 dnl Test for profiling options
7976 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7978 _SAVE_CFLAGS="$CFLAGS"
7979 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7981 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7982 AC_TRY_COMPILE([], [return 0;],
7983                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7984                  result="yes" ], result="no")
7985 AC_MSG_RESULT([$result])
7987 if test $result = "yes"; then
7988   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7989   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7990   PROFILE_USE_LDFLAGS="-fprofile-use"
7993 CFLAGS="$_SAVE_CFLAGS"
7995 if test -n "$INTEL_CC"; then
7996   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7997   PROFILE_GEN_LDFLAGS=
7998   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7999   PROFILE_USE_LDFLAGS=
8002 dnl Sun Studio on Solaris
8003 if test "$SOLARIS_SUNPRO_CC"; then
8004   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
8005   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
8006   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
8007   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
8010 AC_SUBST(PROFILE_GEN_CFLAGS)
8011 AC_SUBST(PROFILE_GEN_LDFLAGS)
8012 AC_SUBST(PROFILE_USE_CFLAGS)
8013 AC_SUBST(PROFILE_USE_LDFLAGS)
8015 AC_LANG_CPLUSPLUS
8017 dnl ========================================================
8018 dnl Test for -pedantic bustage
8019 dnl ========================================================
8020 MOZ_ARG_DISABLE_BOOL(pedantic,
8021 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
8022 _PEDANTIC= )
8023 if test "$_PEDANTIC"; then
8024     _SAVE_CXXFLAGS=$CXXFLAGS
8025     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8026     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
8027     AC_TRY_COMPILE([$configure_static_assert_macros],
8028                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
8029                    result="no", result="yes" )
8030     AC_MSG_RESULT([$result])
8031     CXXFLAGS="$_SAVE_CXXFLAGS"
8033     case "$result" in
8034     no)
8035         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8036         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8037         ;;
8038     yes)
8039         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
8040         ;;
8041     esac
8044 dnl ========================================================
8045 dnl Test for correct temporary object destruction order
8046 dnl ========================================================
8047 dnl We want to make sure the compiler follows the C++ spec here as 
8048 dnl xpcom and the string classes depend on it (bug 235381).
8049 AC_MSG_CHECKING([for correct temporary object destruction order])
8050 AC_TRY_RUN([ class A {
8051              public:  A(int& x) : mValue(x) {}
8052                       ~A() { mValue--; }
8053                       operator char**() { return 0; }
8054              private:  int& mValue;
8055              };
8056              void func(char **arg) {}
8057              int m=2;
8058              void test() {
8059                   func(A(m));
8060                   if (m==1) m = 0;
8061              }
8062              int main() {
8063                  test();
8064                  return(m);
8065              }
8066              ],
8067      result="yes", result="no", result="maybe")
8068 AC_MSG_RESULT([$result])
8070 if test "$result" = "no"; then
8071     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
8074 dnl ========================================================
8075 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
8076 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
8077 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
8078 dnl ========================================================
8079 _SAVE_CXXFLAGS=$CXXFLAGS
8080 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
8081 AC_CACHE_CHECK(for correct overload resolution with const and templates,
8082     ac_nscap_nonconst_opeq_bug,
8083     [AC_TRY_COMPILE([
8084                       template <class T>
8085                       class Pointer
8086                         {
8087                         public:
8088                           T* myPtr;
8089                         };
8090                       
8091                       template <class T, class U>
8092                       int operator==(const Pointer<T>& rhs, U* lhs)
8093                         {
8094                           return rhs.myPtr == lhs;
8095                         }
8096                       
8097                       template <class T, class U>
8098                       int operator==(const Pointer<T>& rhs, const U* lhs)
8099                         {
8100                           return rhs.myPtr == lhs;
8101                         }
8102                     ],
8103                     [
8104                       Pointer<int> foo;
8105                       const int* bar;
8106                       return foo == bar;
8107                     ],
8108                     ac_nscap_nonconst_opeq_bug="no",
8109                     ac_nscap_nonconst_opeq_bug="yes")])
8110 CXXFLAGS="$_SAVE_CXXFLAGS"
8112 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8113     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8115 fi # ! SKIP_COMPILER_CHECKS
8117 dnl ========================================================
8118 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
8119 dnl Should be smarter and check that the compiler does indeed have exceptions
8120 dnl ========================================================
8121 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
8122 [  --enable-cpp-exceptions Enable C++ exceptions ],
8123 [ _MOZ_CPP_EXCEPTIONS=1 ],
8124 [ _MOZ_CPP_EXCEPTIONS= ])
8126 if test "$_MOZ_CPP_EXCEPTIONS"; then
8127     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
8128     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
8129 else
8130     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
8133 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
8135 # Irix & OSF native compilers do not like exception declarations 
8136 # when exceptions are disabled
8137 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
8138     AC_DEFINE(CPP_THROW_NEW, [])
8139 else
8140     AC_DEFINE(CPP_THROW_NEW, [throw()])
8142 AC_LANG_C
8144 dnl ========================================================
8145 dnl =
8146 dnl = Check what kind of list files are supported by the
8147 dnl = linker
8148 dnl =
8149 dnl ========================================================
8151 AC_CACHE_CHECK(what kind of list files are supported by the linker,
8152     EXPAND_LIBS_LIST_STYLE,
8153     [echo "int main() {return 0;}" > conftest.${ac_ext}
8154      if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&2) && test -s conftest.${OBJ_SUFFIX}; then
8155          echo "INPUT(conftest.${OBJ_SUFFIX})" > conftest.list
8156          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.list $LIBS 1>&2) && test -s conftest${ac_exeext}; then
8157              EXPAND_LIBS_LIST_STYLE=linkerscript
8158          else
8159              echo "conftest.${OBJ_SUFFIX}" > conftest.list
8160              if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS @conftest.list $LIBS 1>&2) && test -s conftest${ac_exeext}; then
8161                  EXPAND_LIBS_LIST_STYLE=list
8162              else
8163                  EXPAND_LIBS_LIST_STYLE=none
8164              fi
8165          fi
8166      else
8167          dnl We really don't expect to get here, but just in case
8168          AC_ERROR([couldn't compile a simple C file])
8169      fi
8170      rm -rf conftest*])
8172 LIBS_DESC_SUFFIX=desc
8173 AC_SUBST(LIBS_DESC_SUFFIX)
8174 AC_SUBST(EXPAND_LIBS_LIST_STYLE)
8176 dnl ========================================================
8177 dnl =
8178 dnl = Build depencency options
8179 dnl =
8180 dnl ========================================================
8181 MOZ_ARG_HEADER(Build dependencies)
8183 dnl ========================================================
8184 dnl = Do not auto generate dependency info
8185 dnl ========================================================
8186 MOZ_AUTO_DEPS=1
8187 MOZ_ARG_DISABLE_BOOL(auto-deps,
8188 [  --disable-auto-deps     Do not automatically generate dependency info],
8189     MOZ_AUTO_DEPS=,
8190     MOZ_AUTO_DEPS=1)
8192 if test -n "$MOZ_AUTO_DEPS"; then
8193 dnl ========================================================
8194 dnl = Use mkdepend instead of $CC -MD for dependency generation
8195 dnl ========================================================
8196 _cpp_md_flag=
8197 MOZ_ARG_DISABLE_BOOL(md,
8198 [  --disable-md            Do not use compiler-based dependencies ],
8199   [_cpp_md_flag=],
8200   [_cpp_md_flag=1],
8201   [dnl Default is to turn on -MD if using GNU-compatible compilers
8202    if test "$GNU_CC" -a "$GNU_CXX"; then
8203      _cpp_md_flag=1
8204    fi
8205   dnl Default is to use -xM if using Sun Studio on Solaris
8206    if test "$SOLARIS_SUNPRO_CC"; then
8207      _cpp_md_flag=1
8208    fi])
8209 if test "$_cpp_md_flag"; then
8210   COMPILER_DEPEND=1
8211   _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8212   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8213   if test "$SOLARIS_SUNPRO_CC"; then
8214     _DEPEND_CFLAGS=
8215   fi
8216 else
8217   COMPILER_DEPEND=
8218   dnl Don't override this for MSVC
8219   if test -z "$_WIN32_MSVC"; then
8220     _USE_CPP_INCLUDE_FLAG=
8221     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8222     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8223   else
8224     echo '#include <stdio.h>' > dummy-hello.c
8225     changequote(,)
8226     CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8227     changequote([,])
8228     if test -z "$CL_INCLUDES_PREFIX"; then
8229         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8230     fi
8231     AC_SUBST(CL_INCLUDES_PREFIX)
8232     rm -f dummy-hello.c
8233     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8234     dnl cl.py provides dependency generation for MSVC
8235     CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8236     CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8237     COMPILER_DEPEND=1
8238   fi
8240 fi # MOZ_AUTO_DEPS
8241 MDDEPDIR='.deps'
8242 AC_SUBST(MOZ_AUTO_DEPS)
8243 AC_SUBST(COMPILER_DEPEND)
8244 AC_SUBST(MDDEPDIR)
8245 AC_SUBST(CC_WRAPPER)
8246 AC_SUBST(CXX_WRAPPER)
8249 dnl ========================================================
8250 dnl =
8251 dnl = Static Build Options
8252 dnl =
8253 dnl ========================================================
8254 MOZ_ARG_HEADER(Static build options)
8256 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8257 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
8258   ENABLE_SHARED_JS=1
8261 MOZ_ARG_ENABLE_BOOL(shared-js,
8262 [  --enable-shared-js
8263                           Create a shared JavaScript library.],
8264     ENABLE_SHARED_JS=1,
8265     ENABLE_SHARED_JS=)
8267 if test -n "$ENABLE_SHARED_JS"; then
8268   JS_SHARED_LIBRARY=1
8269   MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
8270 else
8271   MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
8272   AC_DEFINE(MOZ_STATIC_JS)
8274 AC_SUBST(JS_SHARED_LIBRARY)
8276 AC_SUBST(LIBXUL_LIBS)
8277 XPCOM_LIBS="$LIBXUL_LIBS"
8279 dnl ========================================================
8280 dnl =
8281 dnl = Standalone module options
8282 dnl = 
8283 dnl ========================================================
8284 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8286 dnl Check for GLib and libIDL.
8287 dnl ========================================================
8288 SKIP_IDL_CHECK="no"
8290 if test -z "$COMPILE_ENVIRONMENT"; then
8291     SKIP_IDL_CHECK="yes"
8294 dnl = Allow users to disable libIDL checking for standalone modules
8295 MOZ_ARG_WITHOUT_BOOL(libIDL,
8296 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
8297         SKIP_IDL_CHECK="yes")
8299 if test -z "$CROSS_COMPILE"; then
8300     if test -z "$HOST_LIBIDL_CONFIG"; then
8301         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8302     fi
8303     if test -z "$HOST_LIBIDL_PREFIX"; then
8304         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8305     fi
8308 if test "$SKIP_IDL_CHECK" = "no"
8309 then
8310     _LIBIDL_FOUND=
8311     case "$host" in
8312     *-mingw*)
8313         if test -n "$GLIB_PREFIX"; then
8314             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8315             if test "$?" = "0"; then
8316                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8317                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8318                 fi
8319             else
8320                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8321             fi
8322         else
8323             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8324         fi
8325         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8326             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8327         fi
8328         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8329         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8330             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8331         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8332             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8333         else
8334             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8335         fi
8337         if test -n "$HOST_LIBIDL_PREFIX"; then
8338             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8339             if test "$?" = "0"; then
8340                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8341                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8342                 fi
8343             else
8344                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8345             fi
8346         else
8347             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8348         fi        
8349         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8350             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8351         fi
8352         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8353         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8354             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8355             STATIC_LIBIDL=1
8356         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8357             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8358         else
8359             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8360         fi
8361         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8362         _LIBIDL_FOUND=1
8363         ;;
8364     esac
8366     if test -z "$_LIBIDL_FOUND"; then
8367         if test "$MACOS_SDK_DIR"; then 
8368             dnl xpidl, and therefore libIDL, is only needed on the build host.
8369             dnl Don't build it against the SDK, as that causes problems.
8370             _MACSAVE_CFLAGS="$CFLAGS"
8371             _MACSAVE_LIBS="$LIBS"
8372             _MACSAVE_LDFLAGS="$LDFLAGS"
8373             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8374           changequote(,)
8375           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"`
8376           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8377           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8378           changequote([,])
8379           unset NEXT_ROOT
8380         fi
8382         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8383     fi
8385     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8386     dnl to either libIDL1 or libIDL2.
8387     if test -z "$_LIBIDL_FOUND"; then
8388         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8389         if test -z "$_LIBIDL_FOUND"; then
8390             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8391         fi
8392     fi
8393     dnl
8394     dnl If we don't have a libIDL config program & not cross-compiling, 
8395     dnl     look for orbit-config instead.
8396     dnl
8397     if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8398         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8399         if test -n "$ORBIT_CONFIG"; then
8400             AC_MSG_CHECKING([for ORBit libIDL usability])
8401                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8402             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8403             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8404             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8405             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8406             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8407             HOST_LIBIDL_CONFIG=
8408             _SAVE_CFLAGS="$CFLAGS"
8409             _SAVE_LIBS="$LIBS"
8410             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8411             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8412             AC_TRY_RUN([
8413 #include <stdlib.h>
8414 #include <libIDL/IDL.h>
8415 int main() {
8416   char *s;
8417   s=strdup(IDL_get_libver_string());
8418   if(s==NULL) {
8419     exit(1);
8420   }
8421   exit(0);
8423             ], [_LIBIDL_FOUND=1
8424                 result="yes"],
8425                [HOST_LIBIDL_CFLAGS=
8426                 HOST_LIBIDL_LIBS=
8427                 result="no"],
8428                [_LIBIDL_FOUND=1
8429                 result="maybe"] )
8430             AC_MSG_RESULT($result)
8431             CFLAGS="$_SAVE_CFLAGS"
8432             LIBS="$_SAVE_LIBS"
8433         fi
8434     fi
8435     if test -z "$_LIBIDL_FOUND"; then
8436         AC_MSG_ERROR([libIDL not found.
8437         libIDL $LIBIDL_VERSION or higher is required.])
8438     fi
8439     if test "$MACOS_SDK_DIR"; then
8440       CFLAGS="$_MACSAVE_CFLAGS"
8441       LIBS="$_MACSAVE_LIBS"
8442       LDFLAGS="$_MACSAVE_LDFLAGS"
8443       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8444         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8445       fi
8446     fi
8449 if test -n "$CROSS_COMPILE"; then
8450     case "$target" in
8451     *-mingw*)
8452         if test -n "$GLIB_PREFIX"; then
8453             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8454             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8455                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8456             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8457                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8458             else
8459                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8460             fi
8461         fi
8463         if test -n "$LIBIDL_PREFIX"; then
8464             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8465             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8466                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8467                 STATIC_LIBIDL=1
8468             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8469                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8470             else
8471                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8472             fi
8473         fi
8474         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8475         ;;
8476     *)
8477         if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8478             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8479             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8480         fi
8481         ;;
8482     esac
8483 else
8484     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8485     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8488 if test -z "$SKIP_PATH_CHECKS"; then
8489 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8490     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8491         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8492     else
8493         AM_PATH_GLIB(${GLIB_VERSION})
8494     fi
8498 if test -z "${GLIB_GMODULE_LIBS}" \
8499    -a -n "${GLIB_CONFIG}"\
8500     -a "${GLIB_CONFIG}" != no\
8501 ; then
8502     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8505 AC_SUBST(LIBIDL_CFLAGS)
8506 AC_SUBST(LIBIDL_LIBS)
8507 AC_SUBST(STATIC_LIBIDL)
8508 AC_SUBST(GLIB_CFLAGS)
8509 AC_SUBST(GLIB_LIBS)
8510 AC_SUBST(GLIB_GMODULE_LIBS)
8511 AC_SUBST(HOST_LIBIDL_CONFIG)
8512 AC_SUBST(HOST_LIBIDL_CFLAGS)
8513 AC_SUBST(HOST_LIBIDL_LIBS)
8515 dnl ========================================================
8516 dnl Check for cairo
8517 dnl ========================================================
8518 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8520 MOZ_TREE_CAIRO=1
8521 MOZ_ARG_ENABLE_BOOL(system-cairo,
8522 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8523 MOZ_TREE_CAIRO=,
8524 MOZ_TREE_CAIRO=1 )
8526 MOZ_TREE_PIXMAN=1
8527 MOZ_ARG_ENABLE_BOOL(system-pixman,
8528 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8529 MOZ_TREE_PIXMAN=,
8530 MOZ_TREE_PIXMAN=1 )
8532 # Check for headers defining standard int types.
8533 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8535 if test "$MOZ_TREE_CAIRO"; then
8536     AC_DEFINE(MOZ_TREE_CAIRO)
8538     # For now we assume that we will have a uint64_t available through
8539     # one of the above headers or mozstdint.h.
8540     AC_DEFINE(HAVE_UINT64_T)
8542     # Define macros for cairo-features.h
8543     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8544     if test "$MOZ_X11"; then
8545         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8546         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8547         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8548         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8549         MOZ_ENABLE_CAIRO_FT=1
8550         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8551     fi
8552     case "$MOZ_WIDGET_TOOLKIT" in
8553       qt)
8554         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8555         ;;
8556       cocoa)
8557         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8558         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8559         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8560         ;;
8561       windows)
8562         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8563         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8564         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8565             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8566             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8567             MOZ_ENABLE_D2D_SURFACE=1
8568             MOZ_ENABLE_DWRITE_FONT=1
8569         else
8570             WIN32_DWRITE_FONT_FEATURE=
8571             WIN32_D2D_SURFACE_FEATURE=
8572         fi
8574         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8576         dnl D3D10 Layers depend on D2D Surfaces.
8577         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8578           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8579         fi
8580         ;;
8581       os2)
8582         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8583         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8584         MOZ_ENABLE_CAIRO_FT=1
8585         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8586         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8587         ;;
8588     esac
8589     if test "$USE_FC_FREETYPE"; then
8590         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8591     fi
8592     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8593     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8594     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8595     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8596     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8597     AC_SUBST(CAIRO_FT_CFLAGS)
8599     if test "$MOZ_DEBUG"; then
8600       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8601     else
8602       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8603     fi
8605     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8607     AC_SUBST(PS_SURFACE_FEATURE)
8608     AC_SUBST(PDF_SURFACE_FEATURE)
8609     AC_SUBST(SVG_SURFACE_FEATURE)
8610     AC_SUBST(XLIB_SURFACE_FEATURE)
8611     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8612     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8613     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8614     AC_SUBST(XCB_SURFACE_FEATURE)
8615     AC_SUBST(WIN32_SURFACE_FEATURE)
8616     AC_SUBST(OS2_SURFACE_FEATURE)
8617     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8618     AC_SUBST(FT_FONT_FEATURE)
8619     AC_SUBST(FC_FONT_FEATURE)
8620     AC_SUBST(WIN32_FONT_FEATURE)
8621     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8622     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8623     AC_SUBST(QUARTZ_FONT_FEATURE)
8624     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8625     AC_SUBST(QT_SURFACE_FEATURE)
8626     AC_SUBST(TEE_SURFACE_FEATURE)
8628     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8630     if test "$MOZ_TREE_PIXMAN"; then
8631         AC_DEFINE(MOZ_TREE_PIXMAN)
8632         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8633     else
8634         PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8635         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8636         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8637     fi
8639     if test "$MOZ_X11"; then
8640         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8641     fi
8643     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8644     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8646 else
8647    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8648    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8649    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8650    PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8651    if test "$MOZ_X11"; then
8652         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8653         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8654         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8655    fi
8658 AC_SUBST(MOZ_TREE_CAIRO)
8659 AC_SUBST(MOZ_CAIRO_CFLAGS)
8660 AC_SUBST(MOZ_CAIRO_LIBS)
8661 AC_SUBST(MOZ_TREE_PIXMAN)
8663 dnl ========================================================
8664 dnl qcms
8665 dnl ========================================================
8667 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8668 AC_SUBST(QCMS_LIBS)
8670 dnl ========================================================
8671 dnl HarfBuzz
8672 dnl ========================================================
8673 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8674 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8676 dnl ========================================================
8677 dnl OTS
8678 dnl ========================================================
8679 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8680 AC_SUBST(MOZ_OTS_LIBS)
8682 dnl ========================================================
8683 dnl disable xul
8684 dnl ========================================================
8685 MOZ_ARG_DISABLE_BOOL(xul,
8686 [  --disable-xul           Disable XUL],
8687     MOZ_XUL= )
8688 if test "$MOZ_XUL"; then
8689   AC_DEFINE(MOZ_XUL)
8690 else
8691   dnl remove extensions that require XUL
8692   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8695 AC_SUBST(MOZ_XUL)
8697 dnl ========================================================
8698 dnl disable profile locking
8699 dnl   do no use this in applications that can have more than
8700 dnl   one process accessing the profile directory.
8701 dnl ========================================================
8702 MOZ_ARG_DISABLE_BOOL(profilelocking,
8703 [  --disable-profilelocking
8704                           Disable profile locking],
8705     MOZ_PROFILELOCKING=,
8706     MOZ_PROFILELOCKING=1 )
8707 if test "$MOZ_PROFILELOCKING"; then
8708   AC_DEFINE(MOZ_PROFILELOCKING)
8711 dnl ========================================================
8712 dnl disable rdf services
8713 dnl ========================================================
8714 MOZ_ARG_DISABLE_BOOL(rdf,
8715 [  --disable-rdf           Disable RDF],
8716     MOZ_RDF= )
8717 if test "$MOZ_RDF"; then
8718   AC_DEFINE(MOZ_RDF)
8721 AC_SUBST(MOZ_RDF)
8723 dnl ========================================================
8724 dnl necko configuration options
8725 dnl ========================================================
8728 dnl option to disable various necko protocols
8730 MOZ_ARG_ENABLE_STRING(necko-protocols,
8731 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8732                           Enable/disable specific protocol handlers],
8733 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8734     if test "$option" = "yes" -o "$option" = "all"; then
8735         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8736     elif test "$option" = "no" -o "$option" = "none"; then
8737         NECKO_PROTOCOLS=""
8738     elif test "$option" = "default"; then
8739         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8740     elif test `echo "$option" | grep -c \^-` != 0; then
8741         option=`echo $option | sed 's/^-//'`
8742         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8743     else
8744         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8745     fi
8746 done],
8747     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8748 dnl Remove dupes
8749 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8750 AC_SUBST(NECKO_PROTOCOLS)
8751 for p in $NECKO_PROTOCOLS; do
8752     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8753 done
8756 dnl option to disable necko's disk cache
8758 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8759 [  --disable-necko-disk-cache
8760                           Disable necko disk cache],
8761     NECKO_DISK_CACHE=,
8762     NECKO_DISK_CACHE=1)
8763 AC_SUBST(NECKO_DISK_CACHE)
8764 if test "$NECKO_DISK_CACHE"; then
8765     AC_DEFINE(NECKO_DISK_CACHE)
8769 dnl option to disable necko's wifi scanner
8771 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8772 [  --disable-necko-wifi    Disable necko wifi scanner],
8773     NECKO_WIFI=,
8774     NECKO_WIFI=1)
8776 if test "$OS_ARCH" = "OS2"; then
8777   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8778   NECKO_WIFI=
8780 if test "$NECKO_WIFI" -a \
8781         "$OS_ARCH" != "Linux" -a \
8782         "$OS_ARCH" != "Darwin" -a \
8783         "$OS_ARCH" != "SunOS" -a \
8784         "$OS_ARCH" != "WINNT"; then
8785   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8788 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8789 then
8790   MOZ_CHECK_HEADER([iwlib.h])
8791   if test "$ac_cv_header_iwlib_h" != "yes"; then
8792     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) or libiw-devel (openSUSE)); use --disable-necko-wifi to disable])
8793   fi
8796 if test "$NECKO_WIFI"; then
8797   AC_DEFINE(NECKO_WIFI)
8799 AC_SUBST(NECKO_WIFI)
8802 dnl option to disable cookies
8804 MOZ_ARG_DISABLE_BOOL(cookies,
8805 [  --disable-cookies       Disable cookie support],
8806     NECKO_COOKIES=,
8807     NECKO_COOKIES=1)
8808 AC_SUBST(NECKO_COOKIES)
8809 if test "$NECKO_COOKIES"; then
8810     AC_DEFINE(NECKO_COOKIES)
8814 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8816 MOZ_ARG_DISABLE_BOOL(ctypes,
8817 [  --disable-ctypes        Disable js-ctypes],
8818     BUILD_CTYPES=,
8819     BUILD_CTYPES=1)
8820 AC_SUBST(BUILD_CTYPES)
8821 if test "$BUILD_CTYPES"; then
8822     AC_DEFINE(BUILD_CTYPES)
8825 dnl NECKO_ configuration options are not global
8826 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8828 dnl Only build Mork if it's required
8829 AC_SUBST(MOZ_MORK)
8830 if test "$MOZ_MORK"; then
8831   AC_DEFINE(MOZ_MORK)
8834 dnl Build the lightweight Mork reader if required
8835 AC_SUBST(MOZ_MORKREADER)
8836 if test "$MOZ_MORKREADER"; then
8837   AC_DEFINE(MOZ_MORKREADER)
8840 dnl Build Places if required
8841 if test "$MOZ_PLACES"; then
8842   AC_DEFINE(MOZ_PLACES)
8845 dnl Build Sync Services if required
8846 AC_SUBST(MOZ_SERVICES_SYNC)
8847 if test -n "$MOZ_SERVICES_SYNC"; then
8848   AC_DEFINE(MOZ_SERVICES_SYNC)
8851 dnl ========================================================
8852 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8853     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8856 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8857   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8860 if test "$MOZ_APP_COMPONENT_MODULES"; then
8861   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8864 dnl ========================================================
8865 dnl =
8866 dnl = Maintainer debug option (no --enable equivalent)
8867 dnl =
8868 dnl ========================================================
8870 AC_SUBST(AR)
8871 AC_SUBST(AR_FLAGS)
8872 AC_SUBST(AR_LIST)
8873 AC_SUBST(AR_EXTRACT)
8874 AC_SUBST(AR_DELETE)
8875 AC_SUBST(AS)
8876 AC_SUBST(ASFLAGS)
8877 AC_SUBST(AS_DASH_C_FLAG)
8878 AC_SUBST(LD)
8879 AC_SUBST(RC)
8880 AC_SUBST(RCFLAGS)
8881 AC_SUBST(MC)
8882 AC_SUBST(WINDRES)
8883 AC_SUBST(IMPLIB)
8884 AC_SUBST(FILTER)
8885 AC_SUBST(BIN_FLAGS)
8886 AC_SUBST(NS_USE_NATIVE)
8887 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8888 AC_SUBST(MOZ_UPDATE_XTERM)
8889 AC_SUBST(MINIMO)
8890 AC_SUBST(MOZ_PLATFORM_MAEMO)
8891 AC_SUBST(MOZ_AUTH_EXTENSION)
8892 AC_SUBST(MOZ_PERMISSIONS)
8893 AC_SUBST(MOZ_XTF)
8894 AC_SUBST(MOZ_PREF_EXTENSIONS)
8895 AC_SUBST(MOZ_SMIL)
8896 AC_SUBST(MOZ_XSLT_STANDALONE)
8897 AC_SUBST(MOZ_JS_LIBS)
8898 AC_SUBST(MOZ_PSM)
8899 AC_SUBST(MOZ_DEBUG)
8900 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8901 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8902 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8903 AC_SUBST(MOZ_DEBUG_FLAGS)
8904 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8905 AC_SUBST(WARNINGS_AS_ERRORS)
8906 AC_SUBST(MOZ_EXTENSIONS)
8907 AC_SUBST(MOZ_JSDEBUGGER)
8908 AC_SUBST(MOZ_LOG_REFCNT)
8909 AC_SUBST(MOZ_LEAKY)
8910 AC_SUBST(MOZ_JPROF)
8911 AC_SUBST(MOZ_SHARK)
8912 AC_SUBST(MOZ_CALLGRIND)
8913 AC_SUBST(MOZ_VTUNE)
8914 AC_SUBST(MOZ_ETW)
8915 AC_SUBST(MOZ_PROFILING)
8916 AC_SUBST(MOZ_QUANTIFY)
8917 AC_SUBST(LIBICONV)
8918 AC_SUBST(MOZ_PLACES)
8919 AC_SUBST(MOZ_STORAGE)
8920 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8921 AC_SUBST(MOZ_FEEDS)
8922 AC_SUBST(NS_PRINTING)
8923 AC_SUBST(MOZ_WEBGL)
8924 AC_SUBST(MOZ_HELP_VIEWER)
8926 AC_SUBST(JAVA)
8927 AC_SUBST(JAVAC)
8928 AC_SUBST(JAR)
8930 AC_SUBST(MOZ_PROFILELOCKING)
8932 AC_SUBST(ENABLE_TESTS)
8933 AC_SUBST(IBMBIDI)
8934 AC_SUBST(MOZ_UNIVERSALCHARDET)
8935 AC_SUBST(ACCESSIBILITY)
8936 AC_SUBST(MOZ_SPELLCHECK)
8937 AC_SUBST(MOZ_USER_DIR)
8938 AC_SUBST(MOZ_CRASHREPORTER)
8939 AC_SUBST(MOZ_UPDATER)
8940 AC_SUBST(MOZ_ANGLE)
8941 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8942 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8943 AC_SUBST(MOZ_D3DX9_VERSION)
8944 AC_SUBST(MOZ_D3DX9_CAB)
8945 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8946 AC_SUBST(MOZ_D3DX9_DLL)
8947 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8949 AC_SUBST(ENABLE_STRIP)
8950 AC_SUBST(PKG_SKIP_STRIP)
8951 AC_SUBST(USE_ELF_DYNSTR_GC)
8952 AC_SUBST(USE_ELF_HACK)
8953 AC_SUBST(INCREMENTAL_LINKER)
8954 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8955 AC_SUBST(MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS)
8956 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8958 AC_SUBST(MOZ_FIX_LINK_PATHS)
8959 AC_SUBST(XPCOM_LIBS)
8960 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8961 AC_SUBST(XPCOM_GLUE_LDOPTS)
8962 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8964 AC_SUBST(USE_DEPENDENT_LIBS)
8966 AC_SUBST(MOZ_BUILD_ROOT)
8967 AC_SUBST(MOZ_OS2_TOOLS)
8969 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8970 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8972 # The following variables are available to branding and application
8973 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8974 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8975 # impacts profile location and user-visible fields.
8976 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8977 # versions of a given application (e.g. Aurora and Firefox both use
8978 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8979 # for application.ini's "Name" field, which controls profile location in
8980 # the absence of a "Profile" field (see below), and various system
8981 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8982 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8983 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8984 # builds (e.g. Aurora for Firefox).
8985 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8986 # defaults to a lowercase form of MOZ_APP_BASENAME.
8987 # - MOZ_APP_PROFILE: When set, used for application.ini's
8988 # "Profile" field, which controls profile location.
8990 if test -z "$MOZ_APP_NAME"; then
8991    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8994 AC_SUBST(MOZ_APP_NAME)
8995 AC_SUBST(MOZ_APP_DISPLAYNAME)
8996 AC_SUBST(MOZ_APP_BASENAME)
8997 AC_SUBST(MOZ_APP_VENDOR)
8998 AC_SUBST(MOZ_APP_PROFILE)
8999 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
9000 AC_SUBST(MOZ_APP_UA_NAME)
9001 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
9002 AC_SUBST(MOZ_APP_VERSION)
9003 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
9004 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
9005 AC_SUBST(FIREFOX_VERSION)
9006 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
9007 AC_SUBST(MOZ_UA_BUILDID)
9009 AC_SUBST(MOZ_PKG_SPECIAL)
9011 AC_SUBST(MOZILLA_OFFICIAL)
9013 if test "$MOZ_TELEMETRY_REPORTING"; then
9014     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
9017 dnl win32 options
9018 AC_SUBST(MOZ_MAPINFO)
9019 AC_SUBST(MOZ_BROWSE_INFO)
9020 AC_SUBST(MOZ_TOOLS_DIR)
9021 AC_SUBST(WIN32_REDIST_DIR)
9022 AC_SUBST(PYTHON)
9023 AC_SUBST(MAKENSISU)
9025 dnl Echo the CFLAGS to remove extra whitespace.
9026 CFLAGS=`echo \
9027         $_WARNINGS_CFLAGS \
9028         $CFLAGS`
9030 CXXFLAGS=`echo \
9031         $_MOZ_RTTI_FLAGS \
9032         $_MOZ_EXCEPTIONS_FLAGS \
9033         $_WARNINGS_CXXFLAGS \
9034         $CXXFLAGS`
9036 COMPILE_CFLAGS=`echo \
9037     $_DEFINES_CFLAGS \
9038         $_DEPEND_CFLAGS \
9039     $COMPILE_CFLAGS`
9041 COMPILE_CXXFLAGS=`echo \
9042     $_DEFINES_CXXFLAGS \
9043         $_DEPEND_CFLAGS \
9044     $COMPILE_CXXFLAGS`
9046 AC_SUBST(SYSTEM_MAKEDEPEND)
9047 AC_SUBST(SYSTEM_LIBXUL)
9048 AC_SUBST(SYSTEM_JPEG)
9049 AC_SUBST(SYSTEM_PNG)
9050 AC_SUBST(SYSTEM_ZLIB)
9051 AC_SUBST(SYSTEM_BZ2)
9053 AC_SUBST(JPEG_CFLAGS)
9054 AC_SUBST(JPEG_LIBS)
9055 AC_SUBST(ZLIB_CFLAGS)
9056 AC_SUBST(ZLIB_LIBS)
9057 AC_SUBST(BZ2_CFLAGS)
9058 AC_SUBST(BZ2_LIBS)
9059 AC_SUBST(PNG_CFLAGS)
9060 AC_SUBST(PNG_LIBS)
9062 AC_SUBST(MOZ_JPEG_CFLAGS)
9063 AC_SUBST(MOZ_JPEG_LIBS)
9064 AC_SUBST(MOZ_ZLIB_CFLAGS)
9065 AC_SUBST(MOZ_ZLIB_LIBS)
9066 AC_SUBST(MOZ_BZ2_CFLAGS)
9067 AC_SUBST(MOZ_BZ2_LIBS)
9068 AC_SUBST(MOZ_PNG_CFLAGS)
9069 AC_SUBST(MOZ_PNG_LIBS)
9071 AC_SUBST(NSPR_CFLAGS)
9072 AC_SUBST(NSPR_LIBS)
9073 AC_SUBST(MOZ_NATIVE_NSPR)
9075 AC_SUBST(NSS_CFLAGS)
9076 AC_SUBST(NSS_LIBS)
9077 AC_SUBST(NSS_DEP_LIBS)
9078 AC_SUBST(MOZ_NATIVE_NSS)
9079 AC_SUBST(NSS_DISABLE_DBM)
9081 AC_SUBST(CFLAGS)
9082 AC_SUBST(CXXFLAGS)
9083 AC_SUBST(CPPFLAGS)
9084 AC_SUBST(COMPILE_CFLAGS)
9085 AC_SUBST(COMPILE_CXXFLAGS)
9086 AC_SUBST(LDFLAGS)
9087 AC_SUBST(LIBS)
9088 AC_SUBST(CROSS_COMPILE)
9089 AC_SUBST(WCHAR_CFLAGS)
9091 AC_SUBST(HOST_CC)
9092 AC_SUBST(HOST_CXX)
9093 AC_SUBST(HOST_CFLAGS)
9094 AC_SUBST(HOST_CXXFLAGS)
9095 AC_SUBST(HOST_LDFLAGS)
9096 AC_SUBST(HOST_OPTIMIZE_FLAGS)
9097 AC_SUBST(HOST_AR)
9098 AC_SUBST(HOST_AR_FLAGS)
9099 AC_SUBST(HOST_LD)
9100 AC_SUBST(HOST_RANLIB)
9101 AC_SUBST(HOST_NSPR_MDCPUCFG)
9102 AC_SUBST(HOST_BIN_SUFFIX)
9103 AC_SUBST(HOST_OS_ARCH)
9105 AC_SUBST(TARGET_CPU)
9106 AC_SUBST(TARGET_VENDOR)
9107 AC_SUBST(TARGET_OS)
9108 AC_SUBST(TARGET_NSPR_MDCPUCFG)
9109 AC_SUBST(TARGET_MD_ARCH)
9110 AC_SUBST(TARGET_XPCOM_ABI)
9111 AC_SUBST(OS_TARGET)
9112 AC_SUBST(OS_ARCH)
9113 AC_SUBST(OS_RELEASE)
9114 AC_SUBST(OS_TEST)
9115 AC_SUBST(CPU_ARCH)
9116 AC_SUBST(INTEL_ARCHITECTURE)
9118 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
9119 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
9121 AC_SUBST(WRAP_MALLOC_CFLAGS)
9122 AC_SUBST(WRAP_MALLOC_LIB)
9123 AC_SUBST(MKSHLIB)
9124 AC_SUBST(MKCSHLIB)
9125 AC_SUBST(MKSHLIB_FORCE_ALL)
9126 AC_SUBST(MKSHLIB_UNFORCE_ALL)
9127 AC_SUBST(DSO_CFLAGS)
9128 AC_SUBST(DSO_PIC_CFLAGS)
9129 AC_SUBST(DSO_LDOPTS)
9130 AC_SUBST(LIB_PREFIX)
9131 AC_SUBST(DLL_PREFIX)
9132 AC_SUBST(DLL_SUFFIX)
9133 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
9134 AC_SUBST(LIB_SUFFIX)
9135 AC_SUBST(OBJ_SUFFIX)
9136 AC_SUBST(BIN_SUFFIX)
9137 AC_SUBST(ASM_SUFFIX)
9138 AC_SUBST(IMPORT_LIB_SUFFIX)
9139 AC_SUBST(USE_N32)
9140 AC_SUBST(CC_VERSION)
9141 AC_SUBST(CXX_VERSION)
9142 AC_SUBST(MSMANIFEST_TOOL)
9143 AC_SUBST(NS_ENABLE_TSF)
9144 AC_SUBST(MOZ_NSS_PATCH)
9145 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9146 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9148 AC_SUBST(MOZ_MEDIA)
9149 AC_SUBST(MOZ_SYDNEYAUDIO)
9150 AC_SUBST(MOZ_WAVE)
9151 AC_SUBST(MOZ_VORBIS)
9152 AC_SUBST(MOZ_TREMOR)
9153 AC_SUBST(MOZ_WEBM)
9154 AC_SUBST(MOZ_OGG)
9155 AC_SUBST(MOZ_ALSA_LIBS)
9156 AC_SUBST(VPX_AS)
9157 AC_SUBST(VPX_ASFLAGS)
9158 AC_SUBST(VPX_DASH_C_FLAG)
9159 AC_SUBST(VPX_AS_CONVERSION)
9160 AC_SUBST(VPX_ASM_SUFFIX)
9161 AC_SUBST(VPX_X86_ASM)
9162 AC_SUBST(VPX_ARM_ASM)
9163 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
9164 AC_SUBST(LIBJPEG_TURBO_AS)
9165 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
9166 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
9167 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
9169 if test "$USING_HCC"; then
9170    CC='${topsrcdir}/build/hcc'
9171    CC="$CC '$_OLDCC'"
9172    CXX='${topsrcdir}/build/hcpp'
9173    CXX="$CXX '$_OLDCXX'"
9174    AC_SUBST(CC)
9175    AC_SUBST(CXX)
9178 AC_MSG_CHECKING([for posix_fallocate])       
9179 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9180   #include <fcntl.h>],
9181                  [posix_fallocate(0, 0, 0);],
9182                  [ac_cv___posix_fallocate=true],
9183                  [ac_cv___posix_fallocate=false])
9185 if test "$ac_cv___posix_fallocate" = true ; then
9186   AC_DEFINE(HAVE_POSIX_FALLOCATE)
9187   AC_MSG_RESULT(yes)
9188 else
9189   AC_MSG_RESULT(no)
9192 dnl Check for missing components
9193 if test "$COMPILE_ENVIRONMENT"; then
9194 if test "$MOZ_X11"; then
9195     dnl ====================================================
9196     dnl = Check if X headers exist
9197     dnl ====================================================
9198     _SAVE_CFLAGS=$CFLAGS
9199     CFLAGS="$CFLAGS $XCFLAGS"
9200     AC_TRY_COMPILE([
9201         #include <stdio.h>
9202         #include <stdlib.h>
9203         #include <X11/Xlib.h>
9204         #include <X11/Intrinsic.h>
9205         #include <X11/extensions/XShm.h>
9206     ],
9207     [
9208         Display *dpy = 0;
9209         if ((dpy = XOpenDisplay(NULL)) == NULL) {
9210             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9211             exit(1);
9212         }
9213     ], [], 
9214     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9215     CFLAGS="$_SAVE_CFLAGS"
9217     if test -n "$MISSING_X"; then
9218         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9219     fi
9221 fi # MOZ_X11
9223 dnl Check for headers, etc. needed by WebGL.
9224 if test -n "$MOZ_WEBGL_GLX"; then
9225     MOZ_CHECK_HEADER(GL/glx.h)
9226     if test "$ac_cv_header_GL_glx_h" != "yes"; then
9227         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa-devel (openSUSE))])
9228     fi
9229 fi # MOZ_WEBGL_GLX
9230 fi # COMPILE_ENVIRONMENT
9232 if test "$USE_FC_FREETYPE"; then
9233     if test "$COMPILE_ENVIRONMENT"; then
9234         _SAVE_CPPFLAGS="$CPPFLAGS"
9235         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
9236         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
9237             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
9238         CPPFLAGS="$_SAVE_CPPFLAGS"
9239     else
9240         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
9241     fi
9244 dnl Set various defines and substitutions
9245 dnl ========================================================
9247 if test "$OS_ARCH" = "Darwin"; then
9248   AC_DEFINE(XP_UNIX)
9249   AC_DEFINE(UNIX_ASYNC_DNS)
9250 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
9251   AC_DEFINE(XP_UNIX)
9252   AC_DEFINE(UNIX_ASYNC_DNS)
9255 if test "$MOZ_DEBUG"; then
9256     AC_DEFINE(MOZ_REFLOW_PERF)
9257     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9260 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9261     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9262     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9263     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9264     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9265     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9266     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9267     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9268     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9271 case "$host_os" in
9272 mingw*)
9273     WIN_TOP_SRC=`cd $srcdir; pwd -W`
9274     ;;
9275 esac
9277 AC_SUBST(WIN_TOP_SRC)
9279 AC_SUBST(MOZILLA_VERSION)
9281 AC_SUBST(ac_configure_args)
9283 dnl Spit out some output
9284 dnl ========================================================
9286 dnl The following defines are used by xpcom
9287 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9288 CPP_THROW_NEW
9289 HAVE_CPP_2BYTE_WCHAR_T
9290 HAVE_CPP_ACCESS_CHANGING_USING
9291 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9292 HAVE_CPP_BOOL
9293 HAVE_CPP_CHAR16_T
9294 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9295 HAVE_CPP_EXPLICIT
9296 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9297 HAVE_CPP_NAMESPACE_STD
9298 HAVE_CPP_NEW_CASTS
9299 HAVE_CPP_PARTIAL_SPECIALIZATION
9300 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9301 HAVE_CPP_TYPENAME
9302 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9303 HAVE_STATVFS
9304 NEED_CPP_UNUSED_IMPLEMENTATIONS
9305 NEW_H
9306 HAVE_GETPAGESIZE
9307 HAVE_ICONV
9308 HAVE_ICONV_WITH_CONST_INPUT
9309 HAVE_MBRTOWC
9310 HAVE_SYS_MOUNT_H
9311 HAVE_SYS_VFS_H
9312 HAVE_WCRTOMB
9315 AC_CONFIG_HEADER(
9316 netwerk/necko-config.h
9317 xpcom/xpcom-config.h
9318 xpcom/xpcom-private.h
9321 # Save the defines header file before autoconf removes it.
9322 # (Do not add AC_DEFINE calls after this line.)
9323   _CONFIG_TMP=confdefs-tmp.h
9324   _CONFIG_DEFS_H=mozilla-config.h
9326   cat > $_CONFIG_TMP <<\EOF
9327 /* List of defines generated by configure. Included with preprocessor flag,
9328  * -include, to avoid long list of -D defines on the compile command-line.
9329  * Do not edit.
9330  */
9332 #ifndef _MOZILLA_CONFIG_H_
9333 #define _MOZILLA_CONFIG_H_
9336 _EGREP_PATTERN='^#define ('
9337 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9338     for f in $_NON_GLOBAL_ACDEFINES; do
9339         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9340     done
9342 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9344   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9346   cat >> $_CONFIG_TMP <<\EOF
9348 #endif /* _MOZILLA_CONFIG_H_ */
9352   # Only write mozilla-config.h when something changes (or it doesn't exist)
9353   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9354     rm $_CONFIG_TMP
9355   else
9356     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9357     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9359     echo ==== $_CONFIG_DEFS_H =================================
9360     cat $_CONFIG_DEFS_H
9361   fi
9363 dnl Probably shouldn't call this manually but we always want the output of DEFS
9364 rm -f confdefs.h.save
9365 mv confdefs.h confdefs.h.save
9366 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9367 AC_OUTPUT_MAKE_DEFS()
9368 MOZ_DEFINES=$DEFS
9369 AC_SUBST(MOZ_DEFINES)
9370 rm -f confdefs.h
9371 mv confdefs.h.save confdefs.h
9373 dnl Load the list of Makefiles to generate.
9374 dnl   To add new Makefiles, edit allmakefiles.sh.
9375 dnl   allmakefiles.sh sets the variable, MAKEFILES.
9376 . ${srcdir}/allmakefiles.sh
9377 dnl 
9378 dnl Run a perl script to quickly create the makefiles.
9379 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9380 dnl   for the files it cannot handle correctly. This way, config.status
9381 dnl   will handle these files.
9382 dnl If it fails, nothing is set and config.status will run as usual.
9384 dnl This does not change the $MAKEFILES variable.
9386 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9387 . ./conftest.sh
9388 rm conftest.sh
9390 echo $MAKEFILES > unallmakefiles
9392 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9394 AC_OUTPUT($MAKEFILES)
9396 # Generate a JSON config file for unittest harnesses etc to read
9397 # build configuration details from in a standardized way.
9398 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
9399 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
9400   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
9401 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
9402   rm ./mozinfo.json.tmp
9403 else
9404   mv -f ./mozinfo.json.tmp ./mozinfo.json
9407 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9408 if test "$CAIRO_FEATURES_H"; then
9409   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9410     echo "$CAIRO_FEATURES_H is unchanged"
9411     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9412   else
9413     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9414   fi
9417 # Run freetype configure script
9419 if test "$MOZ_TREE_FREETYPE"; then
9420    export CFLAGS="$CFLAGS -std=c99"
9421    export CPPFLAGS="$CPPFLAGS"
9422    export CXXFLAGS="$CXXFLAGS"
9423    export LDFLAGS="$LDFLAGS"
9424    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9425    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9426    AC_OUTPUT_SUBDIRS(modules/freetype2)
9429 dnl ========================================================
9430 dnl = Setup a nice relatively clean build environment for
9431 dnl = sub-configures.
9432 dnl ========================================================
9433 CC="$_SUBDIR_CC" 
9434 CXX="$_SUBDIR_CXX" 
9435 CFLAGS="$_SUBDIR_CFLAGS" 
9436 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9437 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9438 LDFLAGS="$_SUBDIR_LDFLAGS"
9439 HOST_CC="$_SUBDIR_HOST_CC" 
9440 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9441 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9444 unset MAKEFILES
9445 unset CONFIG_FILES
9447 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9448 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9450 if test -n "$_WRAP_MALLOC"; then
9451   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9454 if test -z "$MOZ_NATIVE_NSPR"; then
9455     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9456     if test -z "$MOZ_DEBUG"; then
9457         ac_configure_args="$ac_configure_args --disable-debug"
9458     fi
9459     if test "$MOZ_OPTIMIZE" = "1"; then
9460         ac_configure_args="$ac_configure_args --enable-optimize"
9461     fi
9462     if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9463        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9464     fi
9465     if test -n "$HAVE_64BIT_OS"; then
9466         ac_configure_args="$ac_configure_args --enable-64bit"
9467     fi
9468     if test -n "$USE_ARM_KUSER"; then
9469         ac_configure_args="$ac_configure_args --with-arm-kuser"
9470     fi
9471     AC_OUTPUT_SUBDIRS(nsprpub)
9472     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9475 if test -z "$MOZ_NATIVE_NSPR"; then
9476     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9477     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9478     if test "$OS_ARCH" != "WINNT"; then
9479        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9480        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9481        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9482        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9483     fi
9484     rm -f config/autoconf.mk.bak
9487 # Run the SpiderMonkey 'configure' script.
9488 dist=$MOZ_BUILD_ROOT/dist
9489 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9490 ac_configure_args="$ac_configure_args --enable-threadsafe"
9491 if test "$BUILD_CTYPES"; then
9492     # Build js-ctypes on the platforms we can.
9493     ac_configure_args="$ac_configure_args --enable-ctypes"
9495 if test -z "$JS_SHARED_LIBRARY" ; then
9496     ac_configure_args="$ac_configure_args --disable-shared-js"
9498 if test -z "$MOZ_NATIVE_NSPR"; then
9499     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9500     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9502 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9503 ac_configure_args="$ac_configure_args --prefix=$dist"
9504 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9505 if test "$MOZ_MEMORY"; then
9506    ac_configure_args="$ac_configure_args --enable-jemalloc"
9507    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9508      export MOZ_MEMORY_LDFLAGS
9509    fi
9511 export MOZ_APP_NAME
9512 AC_OUTPUT_SUBDIRS(js/src)
9513 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9515 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9517 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9518 dnl Needs to be at the end to respect possible changes from NSPR configure
9519 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9520   echo "config/autoconf.mk is unchanged"
9521   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9522 else
9523   rm -f config/autoconf.mk.orig 2> /dev/null