CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / configure.in
blob867425599982ee7147a80ffc0275d0271d052976
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 dnl
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
10 dnl
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
14 dnl License.
15 dnl
16 dnl The Original Code is this file as it was released upon August 6, 1998.
17 dnl
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
22 dnl
23 dnl Contributor(s):
24 dnl   Jamie Zawinski <jwz@jwz.org>
25 dnl   gettimeofday args check
26 dnl   Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl   gnomefe update & enable-pthreads
28 dnl   Ramiro Estrugo <ramiro@netscape.com>
29 dnl   X11 makedepend support
30 dnl   Insure support.
31 dnl   Henry Sobotka <sobotka@axess.com>
32 dnl   OS/2 support
33 dnl   Dan Mosedale <dmose@mozilla.org>
34 dnl   LDAP support
35 dnl   Seth Spitzer <sspitzer@netscape.com>
36 dnl   xpctools support
37 dnl   Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl   Howard Chu <hyc@symas.com>
39 dnl   MSYS support
40 dnl   Mark Mentovai <mark@moxienet.com>:
41 dnl   Mac OS X 10.4 support
42 dnl   Giorgio Maone <g.maone@informaction.com>
43 dnl   MSVC l10n compatible version check
44 dnl   Ben Turner <mozilla@songbirdnest.com>
45 dnl   Windows x64 support
46 dnl   Makoto Kato <m_kato@ga2.so-net.ne.jp>
47 dnl
48 dnl Alternatively, the contents of this file may be used under the terms of
49 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
50 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
51 dnl in which case the provisions of the GPL or the LGPL are applicable instead
52 dnl of those above. If you wish to allow use of your version of this file only
53 dnl under the terms of either the GPL or the LGPL, and not to allow others to
54 dnl use your version of this file under the terms of the MPL, indicate your
55 dnl decision by deleting the provisions above and replace them with the notice
56 dnl and other provisions required by the GPL or the LGPL. If you do not delete
57 dnl the provisions above, a recipient may use your version of this file under
58 dnl the terms of any one of the MPL, the GPL or the LGPL.
59 dnl
60 dnl ***** END LICENSE BLOCK *****
62 dnl Process this file with autoconf to produce a configure script.
63 dnl ========================================================
65 AC_PREREQ(2.13)
66 AC_INIT(config/config.mk)
67 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
68 AC_CANONICAL_SYSTEM
69 TARGET_CPU="${target_cpu}"
70 TARGET_VENDOR="${target_vendor}"
71 TARGET_OS="${target_os}"
73 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1` 
74 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
77 dnl =
78 dnl = Don't change the following two lines.  Doing so breaks:
79 dnl =
80 dnl = CFLAGS="-foo" ./configure
81 dnl =
82 dnl ========================================================
83 CFLAGS="${CFLAGS=}"
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
86 LDFLAGS="${LDFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
96 _SUBDIR_CC="$CC"
97 _SUBDIR_CXX="$CXX"
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
110 MOZJPEG=62
111 MOZPNG=10401
112 MOZZLIB=0x1230
113 NSPR_VERSION=4
114 NSS_VERSION=3
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
118 GLIB_VERSION=1.2.0
119 LIBIDL_VERSION=0.6.3
120 PERL_VERSION=5.006
121 PYTHON_VERSION=2.5
122 CAIRO_VERSION=1.10
123 PANGO_VERSION=1.14.0
124 GTK2_VERSION=2.10.0
125 WINDRES_VERSION=2.14.90
126 W32API_VERSION=3.8
127 GNOMEVFS_VERSION=2.0
128 GNOMEUI_VERSION=2.2.0
129 GCONF_VERSION=1.2.1
130 GIO_VERSION=2.0
131 STARTUP_NOTIFICATION_VERSION=0.8
132 DBUS_VERSION=0.60
133 SQLITE_VERSION=3.7.4
134 LIBNOTIFY_VERSION=0.4
136 MSMANIFEST_TOOL=
138 dnl Set various checks
139 dnl ========================================================
140 MISSING_X=
141 AC_PROG_AWK
143 dnl Initialize the Pthread test variables early so they can be
144 dnl  overridden by each platform.
145 dnl ========================================================
146 USE_PTHREADS=
147 _PTHREAD_LDFLAGS=""
149 dnl Do not allow a separate objdir build if a srcdir build exists.
150 dnl ==============================================================
151 _topsrcdir=`cd \`dirname $0\`; pwd`
152 _objdir=`pwd`
154 if test "$_topsrcdir" != "$_objdir"
155 then
156   # Check for a couple representative files in the source tree
157   _conflict_files=
158   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
159     if test -f $file; then
160       _conflict_files="$_conflict_files $file"
161     fi
162   done
163   if test "$_conflict_files"; then
164     echo "***"
165     echo "*   Your source tree contains these files:"
166     for file in $_conflict_files; do
167       echo "*         $file"
168     done
169     cat 1>&2 <<-EOF
170         *   This indicates that you previously built in the source tree.
171         *   A source tree build can confuse the separate objdir build.
172         *
173         *   To clean up the source tree:
174         *     1. cd $_topsrcdir
175         *     2. gmake distclean
176         ***
177         EOF
178     exit 1
179     break
180   fi
182 MOZ_BUILD_ROOT=`pwd`
184 dnl Default to MSVC for win32 and gcc-4.2 for darwin
185 dnl ==============================================================
186 if test -z "$CROSS_COMPILE"; then
187 case "$target" in
188 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
189     if test -z "$CC"; then CC=cl; fi
190     if test -z "$CXX"; then CXX=cl; fi
191     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
192     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
193     if test -z "$LD"; then LD=link; fi
194     if test -z "$AS"; then
195         case "${target_cpu}" in
196         i*86)
197             AS=ml;
198             ;;
199         x86_64)
200             AS=ml64;
201             ;;
202         esac
203     fi
204     if test -z "$MIDL"; then MIDL=midl; fi
205     ;;
206 *-darwin*)
207     if test -z "$CC"; then CC=gcc-4.2; fi
208     if test -z "$CXX"; then CXX=g++-4.2; fi
209     ;;
210 esac
213 COMPILE_ENVIRONMENT=1
214 MOZ_ARG_DISABLE_BOOL(compile-environment,
215 [  --disable-compile-environment
216                           Disable compiler/library checks.],
217     COMPILE_ENVIRONMENT= )
218 AC_SUBST(COMPILE_ENVIRONMENT)
220 MOZ_ARG_WITH_STRING(l10n-base,
221 [  --with-l10n-base=DIR    path to l10n repositories],
222     L10NBASEDIR=$withval)
223 if test ! -z "$L10NBASEDIR"; then
224     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
225         AC_MSG_ERROR([--with-l10n-base must specify a path])
226     elif test -d "$L10NBASEDIR"; then
227         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
228     else
229         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
230     fi
232 AC_SUBST(L10NBASEDIR)
234 dnl Check for Perl first -- needed for win32 SDK checks
235 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
236 if test -z "$PERL" -o "$PERL" = ":"; then
237     AC_MSG_ERROR([perl not found in \$PATH])
240 dnl ========================================================
241 dnl = Android uses a very custom (hacky) toolchain; we need to do this
242 dnl = here, so that the compiler checks can succeed
243 dnl ========================================================
245 MOZ_ARG_WITH_STRING(android-ndk,
246 [  --with-android-ndk=DIR
247                           location where the Android NDK can be found],
248     android_ndk=$withval)
250 MOZ_ARG_WITH_STRING(android-toolchain,
251 [  --with-android-toolchain=DIR
252                           location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
253     android_toolchain=$withval)
256 MOZ_ARG_WITH_STRING(android-version,
257 [  --with-android-version=VER
258                           android platform version, default 5],
259     android_version=$withval,
260     android_version=5)
262 MOZ_ARG_WITH_STRING(android-sdk,
263 [  --with-android-sdk=DIR
264                           location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
265     android_sdk=$withval)
267 if test "$target" = "arm-android-eabi" ; then
268     if test -z "$android_ndk" ; then
269         AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
270     fi
272     if test -z "$android_sdk" ; then
273         AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
274     fi
276     android_platform_tools="$android_sdk"/../../platform-tools
277     if test ! -d "$android_platform_tools" ; then
278         android_platform_tools="$android_sdk"/tools # SDK Tools < r8
279     fi
281     if test -z "$android_toolchain" ; then
282         android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
283     fi
285     if test -z "$android_platform" ; then
286        android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
287     fi
289     dnl set up compilers
290     AS="$android_toolchain"/bin/arm-eabi-as
291     CC="$android_toolchain"/bin/arm-eabi-gcc
292     CXX="$android_toolchain"/bin/arm-eabi-g++
293     CPP="$android_toolchain"/bin/arm-eabi-cpp
294     LD="$android_toolchain"/bin/arm-eabi-ld
295     AR="$android_toolchain"/bin/arm-eabi-ar
296     RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
297     STRIP="$android_toolchain"/bin/arm-eabi-strip
299     CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
300     CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
301     CXXFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CXXFLAGS"
303     dnl Add -llog by default, since we use it all over the place.
304     dnl Add --allow-shlib-undefined, because libGLESv2 links to an
305     dnl undefined symbol (present on the hardware, just not in the
306     dnl NDK.)
307     LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
309     dnl prevent cross compile section from using these flags as host flags
310     if test -z "$HOST_CPPFLAGS" ; then
311         HOST_CPPFLAGS=" "
312     fi
313     if test -z "$HOST_CFLAGS" ; then
314         HOST_CFLAGS=" "
315     fi
316     if test -z "$HOST_CXXFLAGS" ; then
317         HOST_CXXFLAGS=" "
318     fi
319     if test -z "$HOST_LDFLAGS" ; then
320         HOST_LDFLAGS=" "
321     fi
323     ANDROID_NDK="${android_ndk}"
324     ANDROID_TOOLCHAIN="{android_toolchain}"
325     ANDROID_PLATFORM="{android_platform}"
326     ANDROID_SDK="${android_sdk}"
327     ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
328     ANDROID_VERSION="${android_version}"
329     if test -z "$ANDROID_PACKAGE_NAME" ; then
330         ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
331     fi
333     AC_DEFINE(ANDROID)
334     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
335     AC_SUBST(ANDROID_VERSION)
336     CROSS_COMPILE=1
337     MOZ_CHROME_FILE_FORMAT=omni
338     ZLIB_DIR=yes
341 AC_SUBST(ANDROID_NDK)
342 AC_SUBST(ANDROID_TOOLCHAIN)
343 AC_SUBST(ANDROID_PLATFORM)
344 AC_SUBST(ANDROID_SDK)
345 AC_SUBST(ANDROID_PLATFORM_TOOLS)
346 AC_SUBST(ANDROID_PACKAGE_NAME)
348 dnl ========================================================
349 dnl Checks for compilers.
350 dnl ========================================================
351 dnl Set CROSS_COMPILE in the environment when running configure
352 dnl to use the cross-compile setup for now
353 dnl ========================================================
355 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
356 AR_FLAGS='cr $@'
358 if test "$COMPILE_ENVIRONMENT"; then
360 dnl Do some special WinCE toolchain stuff
361 case "$target" in
362 *wince|*winmo)
364     MOZ_ARG_WITH_STRING(wince-sdk,
365     [  --with-wince-sdk=WINCE_SDK_DIR
366                           The path to the Windows CE SDK],
367     WINCE_SDK_DIR=$withval)
369     MOZ_ARG_WITH_STRING(ogles-sdk,
370     [  --with-ogles-sdk=OGLES_SDK_DIR
371                           The path to the OGLES SDK],
372     OGLES_SDK_DIR=$withval)
374     AC_DEFINE(WINCE)
375     
376     export WINCE=1
378     echo -----------------------------------------------------------------------------
379     echo Building Windows CE Shunt Library and Tool Chain
380     echo Using SDK in:
381     echo $WINCE_SDK_DIR
383     ac_exeext=.exe
385     _pwd=`pwd -W`
386     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
387     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
388     TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
389     -C $srcdir/build/wince/tools
391     CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
392     CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
393     CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
394     CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
395     LD="$_pwd/dist/sdk/bin/$target-link.exe"
396     AR="$_pwd/dist/sdk/bin/$target-lib.exe"
397     AS="$_pwd/dist/sdk/bin/$target-as.exe"
398     RC="$_pwd/dist/sdk/bin/$target-res.exe"
401     echo -----------------------------------------------------------------------------
403     ;;
404 esac
406 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
407     echo "cross compiling from $host to $target"
408     cross_compiling=yes
410     _SAVE_CC="$CC"
411     _SAVE_CFLAGS="$CFLAGS"
412     _SAVE_LDFLAGS="$LDFLAGS"
414     AC_MSG_CHECKING([for host c compiler])
415     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
416     if test -z "$HOST_CC"; then
417         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
418     fi
419     AC_MSG_RESULT([$HOST_CC])
420     AC_MSG_CHECKING([for host c++ compiler])
421     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
422     if test -z "$HOST_CXX"; then
423         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
424     fi
425     AC_MSG_RESULT([$HOST_CXX])
427     if test -z "$HOST_CFLAGS"; then
428         HOST_CFLAGS="$CFLAGS"
429     fi
430     if test -z "$HOST_CXXFLAGS"; then
431         HOST_CXXFLAGS="$CXXFLAGS"
432     fi
433     if test -z "$HOST_LDFLAGS"; then
434         HOST_LDFLAGS="$LDFLAGS"
435     fi
436     if test -z "$HOST_AR_FLAGS"; then
437         HOST_AR_FLAGS="$AR_FLAGS"
438     fi
439     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
440     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
441     CC="$HOST_CC"
442     CFLAGS="$HOST_CFLAGS"
443     LDFLAGS="$HOST_LDFLAGS"
445     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
446     AC_TRY_COMPILE([], [return(0);], 
447         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
448         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
450     CC="$HOST_CXX"
451     CFLAGS="$HOST_CXXFLAGS"
453     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
454     AC_TRY_COMPILE([], [return(0);], 
455         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
456         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
457     
458     CC=$_SAVE_CC
459     CFLAGS=$_SAVE_CFLAGS
460     LDFLAGS=$_SAVE_LDFLAGS
462     case "$build:$target" in
463       powerpc-apple-darwin8*:i?86-apple-darwin*)
464         dnl The Darwin cross compiler doesn't necessarily point itself at a
465         dnl root that has libraries for the proper architecture, it defaults
466         dnl to the system root.  The libraries in the system root on current
467         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
468         dnl checks will fail.  Fake a working SDK in that case.
469         _SAVE_CFLAGS=$CFLAGS
470         _SAVE_CXXFLAGS=$CXXLAGS
471         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
472         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
473         ;;
474     esac
476     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
477     unset ac_cv_prog_CC
478     AC_PROG_CC
479     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
480     unset ac_cv_prog_CXX
481     AC_PROG_CXX
483     case "$build:$target" in
484       powerpc-apple-darwin8*:i?86-apple-darwin*)
485         dnl Revert the changes made above.  From this point on, the target
486         dnl compiler will never be used without applying the SDK to CFLAGS
487         dnl (see --with-macos-sdk below).
488         CFLAGS=$_SAVE_CFLAGS
489         CXXFLAGS=$_SAVE_CXXFLAGS
490         ;;
491     esac
493     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
494     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
495     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
496     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
497     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
498     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
499     AC_DEFINE(CROSS_COMPILE)
500 else
501     AC_PROG_CC
502     AC_PROG_CXX
503     AC_PROG_RANLIB
504     MOZ_PATH_PROGS(AS, $AS as, $CC)
505     AC_CHECK_PROGS(AR, ar, :)
506     AC_CHECK_PROGS(LD, ld, :)
507     AC_CHECK_PROGS(STRIP, strip, :)
508     AC_CHECK_PROGS(WINDRES, windres, :)
509     if test -z "$HOST_CC"; then
510         HOST_CC='$(CC)'
511     fi
512     if test -z "$HOST_CFLAGS"; then
513         HOST_CFLAGS='$(CFLAGS)'
514     fi
515     if test -z "$HOST_CXX"; then
516         HOST_CXX='$(CXX)'
517     fi
518     if test -z "$HOST_CXXFLAGS"; then
519         HOST_CXXFLAGS='$(CXXFLAGS)'
520     fi
521     if test -z "$HOST_LDFLAGS"; then
522         HOST_LDFLAGS='$(LDFLAGS)'
523     fi
524     if test -z "$HOST_RANLIB"; then
525         HOST_RANLIB='$(RANLIB)'
526     fi
527     if test -z "$HOST_AR"; then
528         HOST_AR='$(AR)'
529     fi
530     if test -z "$HOST_AR_FLAGS"; then
531         HOST_AR_FLAGS='$(AR_FLAGS)'
532     fi
535 GNU_AS=
536 GNU_LD=
537 GNU_CC=
538 GNU_CXX=
539 CC_VERSION='N/A'
540 CXX_VERSION='N/A'
541 if test "$GCC" = "yes"; then
542     GNU_CC=1
543     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
545 if test "$GXX" = "yes"; then
546     GNU_CXX=1
547     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
549 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
550     GNU_AS=1
552 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
553     GNU_LD=1
555 if test "$GNU_CC"; then
556     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
557         GCC_USE_GNU_LD=1
558     fi
561 INTEL_CC=
562 INTEL_CXX=
563 if test "$GCC" = yes; then
564    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
565      INTEL_CC=1
566    fi
569 if test "$GXX" = yes; then
570    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
571      INTEL_CXX=1
572    fi
575 dnl Special win32 checks
576 dnl ========================================================
577 case "$target" in
578 *-wince|*-winmo)
579     WINVER=500
580     WINSDK_TARGETVER=502
581     ;;
583     WINVER=502
584     dnl Target the Windows 7 SDK by default
585     WINSDK_TARGETVER=601
586     ;;
587 esac
589 MOZ_ARG_WITH_STRING(windows-version,
590 [  --with-windows-version=WINSDK_TARGETVER
591                           Highest Windows version to target using this SDK
592                               502: Windows Server 2003
593                               600: Windows Vista
594                               601: Windows 7],
595   WINSDK_TARGETVER=$withval)
597 case "$WINSDK_TARGETVER" in
598 502|600|601)
599     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
600     ;;
603     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
604     ;;
606 esac
608 if test -n "$COMPILE_ENVIRONMENT"; then
609 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
610     # We can't build parental controls either
611     MOZ_DISABLE_PARENTAL_CONTROLS=1
615 case "$target" in
616 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
617     if test "$GCC" != "yes"; then
618         # Check to see if we are really running in a msvc environemnt
619         _WIN32_MSVC=1
620         AC_CHECK_PROGS(MIDL, midl)
622         # Make sure compilers are valid
623         CFLAGS="$CFLAGS -TC -nologo"
624         CXXFLAGS="$CXXFLAGS -TP -nologo"
625         AC_LANG_SAVE
626         AC_LANG_C
627         AC_TRY_COMPILE([#include <stdio.h>],
628             [ printf("Hello World\n"); ],,
629             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
631         AC_LANG_CPLUSPLUS
632         AC_TRY_COMPILE([#include <new.h>],
633             [ unsigned *test = new unsigned(42); ],,
634             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
635         AC_LANG_RESTORE
636         
637         changequote(,)
638         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
639         changequote([,])
640         
641         # Determine compiler version
642         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
643         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
644         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
645         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
646         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
647         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
649         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
650         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
652         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
653             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
654         fi
656         if test "$_CC_MAJOR_VERSION" = "14"; then
657             dnl Require VC8SP1 or newer.
658             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
659             if test "$_CC_RELEASE" -lt 50727 -o \
660                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
661               AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
662             fi
664             _CC_SUITE=8
665             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
666             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
667             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
668         elif test "$_CC_MAJOR_VERSION" = "15"; then
669             _CC_SUITE=9
670             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
671             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
672             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
673         elif test "$_CC_MAJOR_VERSION" = "16"; then
674             _CC_SUITE=10
675             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
676             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
677             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
678         else
679             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
680         fi
682         _MOZ_RTTI_FLAGS_ON='-GR'
683         _MOZ_RTTI_FLAGS_OFF='-GR-'
684         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
685         _MOZ_EXCEPTIONS_FLAGS_OFF=''
686         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
688         if test -n "$WIN32_REDIST_DIR"; then
689             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
690         fi
692         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
693         dnl not something else like "magnetic tape manipulation utility".
694         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
695         if test -z "$MSMT_TOOL"; then
696           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
697         fi
699         changequote(,)
700         _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
701         changequote([,])
702         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
703         if test -z "$MSMANIFEST_TOOL_VERSION"; then
704           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
705         fi
707         MSMANIFEST_TOOL=1
708         unset MSMT_TOOL
710         # Check linker version
711         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
712         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
713         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
714             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
715         fi
717         INCREMENTAL_LINKER=1
719         # Check midl version
720         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
721         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
722         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
723         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
724         # Add flags if necessary
725         AC_MSG_CHECKING([for midl flags])
726         case "$target" in
727         i*86-*)
728             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
729                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
730                 # MIDL version 7.00.0500 or later has no problem.
731                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
732                 AC_MSG_RESULT([need -env win32])
733             else
734                 AC_MSG_RESULT([none needed])
735             fi
736             ;;
737         x86_64-*)
738             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
739             ;;
740         *)
741             AC_MSG_RESULT([none needed])
742             ;;
743         esac
745         # Identify which version of the SDK we're building with
746         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
747         # from there
748         AC_CHECK_HEADERS([winsdkver.h])
749         if test "$ac_cv_header_winsdkver_h" = "yes"; then
750             # Get the highest _WIN32_WINNT and NTDDI versions supported
751             # Take the higher of the two
752             # This is done because the Windows 7 beta SDK reports its
753             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
754             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
755                            ac_cv_winsdk_maxver,
756                            [cat > conftest.h <<EOF
757 #include <winsdkver.h>
758 #include <sdkddkver.h>
760 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
761 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
762 #else
763 #define WINSDK_MAXVER NTDDI_MAXVER
764 #endif
766 WINSDK_MAXVER
768                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
769                             rm -f conftest.h
770                            ])
771             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
772         else
773             # The Vista SDK is the only one to have sdkddkver.h but not
774             # WinSDKVer.h
775             AC_CHECK_HEADERS([sdkddkver.h])
776             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
777                 MOZ_WINSDK_MAXVER=0x06000000
778             else
779                 # Assume the Server 2003 Platform SDK
780                 MOZ_WINSDK_MAXVER=0x05020000
781             fi
782         fi
784         unset _MSVC_VER_FILTER
786         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
787             [
788                 AC_LANG_SAVE
789                 AC_LANG_CPLUSPLUS
790                 _SAVE_CXXFLAGS="$CXXFLAGS"
791                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
792                 AC_TRY_COMPILE([#include <exception>],
793                             [std::_Throw(std::exception()); return 0;],
794                             ac_cv_have_std__Throw="yes",
795                             ac_cv_have_std__Throw="no")
796                 CXXFLAGS="$_SAVE_CXXFLAGS"
797                 AC_LANG_RESTORE
798             ])
800         if test "$ac_cv_have_std__Throw" = "yes"; then
801             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
802                            ac_cv_have_dllimport_exception_bug,
803                 [
804                     AC_LANG_SAVE
805                     AC_LANG_CPLUSPLUS
806                     _SAVE_CXXFLAGS="$CXXFLAGS"
807                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
808                     AC_TRY_LINK([#include <vector>],
809                                 [std::vector<int> v; return v.at(1);],
810                                 ac_cv_have_dllimport_exception_bug="no",
811                                 ac_cv_have_dllimport_exception_bug="yes")
812                     CXXFLAGS="$_SAVE_CXXFLAGS"
813                     AC_LANG_RESTORE
814                 ])
815             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
816                 WRAP_STL_INCLUDES=1
817                 MOZ_MSVC_STL_WRAP__Throw=1
818                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
819             fi
820         else
821             AC_CACHE_CHECK(for overridable _RAISE,
822                            ac_cv_have__RAISE,
823                 [
824                     AC_LANG_SAVE
825                     AC_LANG_CPLUSPLUS
826                     _SAVE_CXXFLAGS="$CXXFLAGS"
827                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
828                     AC_TRY_COMPILE([#include <xstddef>
829                                     #undef _RAISE
830                                     #define _RAISE(x) externallyDefinedFunction((x).what())
831                                     #include <vector>
832                                    ],
833                                    [std::vector<int> v; return v.at(1);],
834                                    ac_cv_have__RAISE="no",
835                                    ac_cv_have__RAISE="yes")
836                     CXXFLAGS="$_SAVE_CXXFLAGS"
837                     AC_LANG_RESTORE
838                 ])
839             if test "$ac_cv_have__RAISE" = "yes"; then
840                 WRAP_STL_INCLUDES=1
841                 MOZ_MSVC_STL_WRAP__RAISE=1
842                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
843             else
844                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
845             fi
846         fi
848         if test "$WRAP_STL_INCLUDES" = "1"; then
849             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
850         fi
851     else
852         # Check w32api version
853         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
854         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
855         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
856         AC_TRY_COMPILE([#include <w32api.h>],
857             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
858                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
859                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
860                 #error "test failed."
861             #endif
862             , [ res=yes ], [ res=no ])
863         AC_MSG_RESULT([$res])
864         if test "$res" != "yes"; then
865             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
866         fi
867         # Check windres version
868         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
869         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
870         AC_MSG_RESULT([$_WINDRES_VERSION])
871         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
872         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
873         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
874         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
875         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
876         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
877         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
878                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
879                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
880                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
881                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
882                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
883         then
884             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
885         fi
887         # Server 2003 is the highest version supported
888         MOZ_WINSDK_MAXVER=0x05020000
889     fi # !GNU_CC
891     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
892     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
893     # Require OS features provided by IE 5.0
894     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
896     # If the maximum version supported by this SDK is lower than the target
897     # version, error out
898     AC_MSG_CHECKING([for Windows SDK being recent enough])
899     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
900         AC_MSG_RESULT("yes")
901     else
902         AC_MSG_RESULT("no")
903         AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
904     fi
906     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
907     # Definitions matching sdkddkver.h
908     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
909     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
910     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
911     ;;
912 esac
914 dnl Test breaks icc on OS/2 && MSVC
915 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
916     AC_PROG_CC_C_O
917     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
918         USING_HCC=1
919         _OLDCC=$CC
920         _OLDCXX=$CXX
921         CC="${srcdir}/build/hcc '$CC'"
922         CXX="${srcdir}/build/hcpp '$CXX'"
923     fi
926 AC_PROG_CPP
927 AC_PROG_CXXCPP
929 if test -n "$_WIN32_MSVC"; then
930     SKIP_PATH_CHECKS=1
931     SKIP_COMPILER_CHECKS=1
932     SKIP_LIBRARY_CHECKS=1
934     # Since we're skipping compiler and library checks, hard-code
935     # some facts here.
936     case "$target" in
937     *-wince|*-winmo)
938         ;;
939     *)
940         AC_DEFINE(HAVE_IO_H)
941         AC_DEFINE(HAVE_SETBUF)
942         AC_DEFINE(HAVE_ISATTY)
943         ;;
944     esac
947 fi # COMPILE_ENVIRONMENT
949 AC_SUBST(MIDL_FLAGS)
950 AC_SUBST(_MSC_VER)
952 AC_SUBST(GNU_AS)
953 AC_SUBST(GNU_LD)
954 AC_SUBST(GNU_CC)
955 AC_SUBST(GNU_CXX)
956 AC_SUBST(INTEL_CC)
957 AC_SUBST(INTEL_CXX)
959 AC_SUBST(STL_FLAGS)
960 AC_SUBST(WRAP_STL_INCLUDES)
961 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
962 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
964 dnl ========================================================
965 dnl Checks for programs.
966 dnl ========================================================
967 AC_PROG_INSTALL
968 AC_PROG_LN_S
970 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
971 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
972 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
973 _perl_res=$?
974 AC_MSG_RESULT([$_perl_version])
976 if test "$_perl_res" != 0; then
977     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
981 AC_MSG_CHECKING([for full perl installation])
982 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
983 _perl_res=$?
984 if test "$_perl_res" != 0; then
985     AC_MSG_RESULT([no])
986     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
987 else
988     AC_MSG_RESULT([yes])    
991 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
992 if test -z "$PYTHON"; then
993     AC_MSG_ERROR([python was not found in \$PATH])
996 if test -z "$COMPILE_ENVIRONMENT"; then
997     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
999 AC_SUBST(NSINSTALL_BIN)
1001 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1002 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1003 MOZ_PATH_PROG(UNZIP, unzip, :)
1004 MOZ_PATH_PROGS(ZIP, zip)
1005 if test -z "$ZIP" -o "$ZIP" = ":"; then
1006     AC_MSG_ERROR([zip not found in \$PATH])
1008 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1009 MOZ_PATH_PROG(XARGS, xargs)
1010 if test -z "$XARGS" -o "$XARGS" = ":"; then
1011     AC_MSG_ERROR([xargs not found in \$PATH .])
1014 if test "$COMPILE_ENVIRONMENT"; then
1016 dnl ========================================================
1017 dnl = Mac OS X toolchain support
1018 dnl ========================================================
1020 case "$target_os" in
1021 darwin*)
1022     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1023     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1024     dnl the environment and includedir purposes (when using an SDK, below),
1025     dnl but remember the full version number for the libdir (SDK).
1026     changequote(,)
1027     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1028     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1029     changequote([,])
1030     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1031         dnl Bug 280479, but this keeps popping up in bug 292530 too because
1032         dnl 4.0.0/4061 is the default compiler in Tiger.
1033         changequote(,)
1034         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1035         changequote([,])
1036         if test "$GCC_BUILD" = "4061" ; then
1037             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1038 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1039 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1040         fi
1041     fi
1043     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1044     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
1045     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1046     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1048     case "$PBBUILD" in
1049       *xcodebuild*)
1050         changequote(,)
1051         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1052         changequote([,])
1053         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
1054           HAS_XCODE_2_1=1;
1055         fi
1056       ;;
1057     esac
1059     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
1060     dnl it has moved into /usr/bin.
1061     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1062     ;;
1063 esac
1065 AC_SUBST(GCC_VERSION)
1066 AC_SUBST(XCODEBUILD_VERSION)
1067 AC_SUBST(HAS_XCODE_2_1)
1069 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1070 dnl that a universal binary is being produced.
1071 AC_SUBST(UNIVERSAL_BINARY)
1073 dnl ========================================================
1074 dnl Check for MacOS deployment target version
1075 dnl ========================================================
1077 MOZ_ARG_ENABLE_STRING(macos-target,
1078                       [  --enable-macos-target=VER (default=10.5)
1079                           Set the minimum MacOS version needed at runtime],
1080                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1082 case "$target" in
1083 *-darwin*)
1084     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1085         dnl Use the specified value
1086         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1087         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1088     else
1089         dnl No value specified on the command line or in the environment,
1090         dnl use architecture minimum.
1091         case "${target_cpu}" in
1092           ppc*)
1093             export MACOSX_DEPLOYMENT_TARGET=10.5
1094             ;;
1095           i*86)
1096             export MACOSX_DEPLOYMENT_TARGET=10.5
1097             ;;
1098           x86_64)
1099             export MACOSX_DEPLOYMENT_TARGET=10.6
1100             ;;
1101         esac
1102     fi
1103     ;;
1104 esac
1106 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1108 dnl ========================================================
1109 dnl = Mac OS X SDK support
1110 dnl ========================================================
1111 MACOS_SDK_DIR=
1112 NEXT_ROOT=
1113 MOZ_ARG_WITH_STRING(macos-sdk,
1114 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
1115     MACOS_SDK_DIR=$withval)
1117 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1118 dnl NEXT_ROOT will be set and exported only if it's needed.
1119 AC_SUBST(MACOS_SDK_DIR)
1120 AC_SUBST(NEXT_ROOT)
1122 if test "$MACOS_SDK_DIR"; then
1123   dnl Sync this section with the ones in NSPR and NSS.
1124   dnl Changes to the cross environment here need to be accounted for in
1125   dnl the libIDL checks (below) and xpidl build.
1127   if test ! -d "$MACOS_SDK_DIR"; then
1128     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1129 specify a valid SDK.  SDKs are installed when the optional cross-development
1130 tools are selected during the Xcode/Developer Tools installation.])
1131   fi
1133   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1134   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1135     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1136   else
1137     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1138     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1140     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1141     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1142     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1144     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1145       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1146       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1147       dnl be ignored and cause warnings when -syslibroot is specified.
1148       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1149       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1150       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1151     fi
1152   fi
1154   AC_LANG_SAVE
1155   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1156   AC_LANG_CPLUSPLUS
1157   AC_TRY_COMPILE([#include <new>
1158                  int main() { return 0; }],
1159    result=yes,
1160    result=no)
1161   AC_LANG_RESTORE
1162   AC_MSG_RESULT($result)
1164   if test "$result" = "no" ; then
1165     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1166   fi
1169 fi # COMPILE_ENVIRONMENT
1171 if test -n "$MAKE"; then
1172   if test `echo $MAKE | grep -c make.py` != 1; then
1173      NOT_PYMAKE=$MAKE
1174   fi
1177 case "$host_os" in
1178 cygwin*|mingw*|mks*|msvc*)
1179     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1180     ;;
1182     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1183     ;;
1184 esac
1185 if test "$GMAKE" = ":"; then
1186    AC_MSG_ERROR([GNU make not found])
1188 AC_SUBST(GMAKE)
1190 if test "$COMPILE_ENVIRONMENT"; then
1192 AC_PATH_XTRA
1194 XCFLAGS="$X_CFLAGS"
1196 fi # COMPILE_ENVIRONMENT
1198 dnl ========================================================
1199 dnl set the defaults first
1200 dnl ========================================================
1201 AS_BIN=$AS
1202 AR_LIST='$(AR) t'
1203 AR_EXTRACT='$(AR) x'
1204 AR_DELETE='$(AR) d'
1205 AS='$(CC)'
1206 AS_DASH_C_FLAG='-c'
1207 DLL_PREFIX=lib
1208 LIB_PREFIX=lib
1209 DLL_SUFFIX=.so
1210 OBJ_SUFFIX=o
1211 LIB_SUFFIX=a
1212 ASM_SUFFIX=s
1213 IMPORT_LIB_SUFFIX=
1214 TARGET_MD_ARCH=unix
1215 DIRENT_INO=d_ino
1216 CYGWIN_WRAPPER=
1217 WIN_TOP_SRC=
1218 MOZ_USER_DIR=".mozilla"
1220 MOZ_JPEG_CFLAGS=
1221 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1222 MOZ_ZLIB_CFLAGS=
1223 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1224 MOZ_BZ2_CFLAGS=
1225 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1226 MOZ_PNG_CFLAGS=
1227 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1229 MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
1230 MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1231 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1232 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1233 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1234 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1235 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1236 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1238 MOZ_FS_LAYOUT=unix
1240 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1242 USE_DEPENDENT_LIBS=1
1244 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1246 if test -n "$CROSS_COMPILE"; then
1247     OS_TARGET="${target_os}"
1248     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1249     OS_RELEASE=
1250     case "${target_os}" in
1251         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1252         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1253         gnu*)         OS_ARCH=GNU ;;
1254         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1255         mingw*)       OS_ARCH=WINNT ;;
1256         wince*)       OS_ARCH=WINCE ;;
1257         winmo*)       OS_ARCH=WINCE ;;
1258         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1259     esac
1260     case "${target}" in
1261         arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1262     esac
1263 else
1264     OS_TARGET=`uname -s`
1265     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1266     OS_RELEASE=`uname -r`
1269 # Before this used `uname -m` when not cross compiling
1270 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1271 OS_TEST="${target_cpu}"
1273 _COMPILER_PREFIX=
1275 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1277 #######################################################################
1278 # Master "Core Components" macros for getting the OS target           #
1279 #######################################################################
1282 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1283 # cross-compilation.
1287 # Define and override various archtecture-specific variables, including
1288 # HOST_OS_ARCH
1289 # OS_ARCH
1290 # OS_TEST
1291 # OS_TARGET
1292 # OS_RELEASE
1293 # OS_MINOR_RELEASE
1296 case "$HOST_OS_ARCH" in
1297 cygwin*|mingw*|mks*|msvc*)
1298     HOST_OS_ARCH=WINNT
1299     ;;
1300 darwin*)
1301     HOST_OS_ARCH=Darwin
1302     ;;
1303 linux*)
1304     HOST_OS_ARCH=Linux
1305     ;;
1306 solaris*)
1307     HOST_OS_ARCH=SunOS
1308     SOLARIS_SUNPRO_CC=
1309     SOLARIS_SUNPRO_CXX=
1310     if test -z "$GNU_CC"; then
1311         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1312             SOLARIS_SUNPRO_CC=1
1313        fi
1314     fi
1316     if test -z "$GNU_CXX"; then
1317        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1318            SOLARIS_SUNPRO_CXX=1
1319        fi
1320     fi
1321     AC_SUBST(SOLARIS_SUNPRO_CC)
1322     AC_SUBST(SOLARIS_SUNPRO_CXX)
1323     ;;
1324 BSD_386)
1325     HOST_OS_ARCH=BSD
1326     ;;
1327 dgux)
1328     HOST_OS_ARCH=DGUX
1329     ;;
1330 IRIX64)
1331     HOST_OS_ARCH=IRIX
1332     ;;
1333 UNIX_SV)
1334     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1335         HOST_OS_ARCH=NCR
1336     else
1337         HOST_OS_ARCH=UNIXWARE
1338     fi
1339     ;;
1340 ncr)
1341     HOST_OS_ARCH=NCR
1342     ;;
1343 UNIX_SYSTEM_V)
1344     HOST_OS_ARCH=NEC
1345     ;;
1346 OSF1)
1347     ;;
1348 *OpenVMS*)
1349     HOST_OS_ARCH=OpenVMS
1350     ;;
1351 OS_2)
1352     HOST_OS_ARCH=OS2
1353     ;;
1354 QNX)
1355     ;;
1356 SCO_SV)
1357     HOST_OS_ARCH=SCOOS
1358     ;;
1359 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1360     HOST_OS_ARCH=SINIX
1361     ;;
1362 UnixWare)
1363     HOST_OS_ARCH=UNIXWARE
1364     ;;
1365 esac
1367 case "$OS_ARCH" in
1368 WINNT)
1369     if test -z "$CROSS_COMPILE" ; then
1370         OS_TEST=`uname -p`
1371     fi
1372     ;;
1373 Windows_NT)
1375 # If uname -s returns "Windows_NT", we assume that we are using
1376 # the uname.exe in MKS toolkit.
1378 # The -r option of MKS uname only returns the major version number.
1379 # So we need to use its -v option to get the minor version number.
1380 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1382     OS_ARCH=WINNT
1383     OS_TARGET=WINNT
1384     OS_MINOR_RELEASE=`uname -v`
1385     if test "$OS_MINOR_RELEASE" = "00"; then
1386         OS_MINOR_RELEASE=0
1387     fi
1388     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1389     ;;
1390 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1392 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1393 # the uname.exe in the Cygwin tools.
1394 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1395 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1396 # the uname.exe in the GNU-Win32 tools.
1397 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1398 # the uname.exe in the MSYS tools.
1400     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1401     OS_ARCH=WINNT
1402     OS_TARGET=WINNT
1403     ;;
1404 AIX)
1405     OS_RELEASE=`uname -v`.`uname -r`
1406     OS_TEST=${target_cpu}
1407     ;;
1408 BSD_386)
1409     OS_ARCH=BSD
1410     ;;
1411 dgux)
1412     OS_ARCH=DGUX
1413     ;;
1414 IRIX64)
1415     OS_ARCH=IRIX
1416     ;;
1417 UNIX_SV)
1418     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1419         OS_ARCH=NCR
1420     else
1421         OS_ARCH=UNIXWARE
1422         OS_RELEASE=`uname -v`
1423     fi
1424     ;;
1425 ncr)
1426     OS_ARCH=NCR
1427     ;;
1428 UNIX_SYSTEM_V)
1429     OS_ARCH=NEC
1430     ;;
1431 OSF1)
1432     case `uname -v` in
1433     148)
1434         OS_RELEASE=V3.2C
1435         ;;
1436     564)
1437         OS_RELEASE=V4.0B
1438         ;;
1439     878)
1440         OS_RELEASE=V4.0D
1441         ;;
1442     esac
1443     ;;
1444 *OpenVMS*)
1445     OS_ARCH=OpenVMS
1446     OS_RELEASE=`uname -v`
1447     OS_TEST=`uname -p`
1448     ;;
1449 OS_2)
1450     OS_ARCH=OS2
1451     OS_TARGET=OS2
1452     OS_RELEASE=`uname -v`
1453     ;;
1454 QNX)
1455     if test "$OS_TARGET" != "NTO"; then
1456         changequote(,)
1457         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1458         changequote([,])
1459     fi
1460     OS_TEST=x86
1461     ;;
1462 SCO_SV)
1463     OS_ARCH=SCOOS
1464     OS_RELEASE=5.0
1465     ;;
1466 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1467     OS_ARCH=SINIX
1468     OS_TEST=`uname -p`
1469     ;;
1470 UnixWare)
1471     OS_ARCH=UNIXWARE
1472     OS_RELEASE=`uname -v`
1473     ;;
1474 WINCE)
1475     OS_ARCH=WINCE
1476     case "${target_os}" in
1477     *winmo)
1478         OS_TARGET=WINMO
1479         WINCE_WINDOWS_MOBILE=1
1480         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1481         ;;
1482     *)
1483         OS_TARGET=WINCE
1484         ;;
1485     esac
1486     ;;
1487 Darwin)
1488     case "${target_cpu}" in
1489     powerpc*)
1490         OS_TEST=ppc
1491         ;;
1492     i*86*)
1493         OS_TEST=i386 
1494         ;;
1495     x86_64)
1496         OS_TEST=x86_64
1497         ;;
1498     *)
1499         if test -z "$CROSS_COMPILE" ; then
1500             OS_TEST=`uname -p`
1501         fi
1502         ;;
1503     esac
1504     ;;
1505 esac
1507 if test "$OS_ARCH" = "NCR"; then
1508     changequote(,)
1509     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1510     changequote([,])
1513 # Only set CPU_ARCH if we recognize the value of OS_TEST
1515 case "$OS_TEST" in
1516 *86 | i86pc)
1517     CPU_ARCH=x86
1518     ;;
1520 powerpc64 | ppc64)
1521     CPU_ARCH=ppc64
1522     ;;
1524 powerpc | ppc | rs6000)
1525     CPU_ARCH=ppc
1526     ;;
1528 Alpha | alpha | ALPHA)
1529     CPU_ARCH=Alpha
1530     ;;
1532 s390)
1533     CPU_ARCH=s390
1534     ;;
1536 s390x)
1537     CPU_ARCH=s390x
1538     ;;
1540 hppa* | parisc)
1541     CPU_ARCH=hppa
1542     ;;
1544 sun4u | sparc*)
1545     CPU_ARCH=sparc
1546     ;;
1548 x86_64 | ia64)
1549     CPU_ARCH="$OS_TEST"
1550     ;;
1552 arm*)
1553     CPU_ARCH=arm
1554     ;;
1556 mips|mipsel)
1557     CPU_ARCH="mips"
1558     ;;
1559 esac
1561 if test -z "$OS_TARGET"; then
1562     OS_TARGET=$OS_ARCH
1564 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1566 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1567 dnl ===============================================================
1568 INTEL_ARCHITECTURE=
1569 case "$OS_TEST" in
1570     x86_64|i?86)
1571       INTEL_ARCHITECTURE=1
1572 esac
1574 dnl ========================================================
1575 dnl GNU specific defaults
1576 dnl ========================================================
1577 if test "$GNU_CC"; then
1578     # FIXME: Let us build with strict aliasing. bug 414641.
1579     CFLAGS="$CFLAGS -fno-strict-aliasing"
1580     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1581     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1582     DSO_LDOPTS='-shared'
1583     if test "$GCC_USE_GNU_LD"; then
1584         # Don't allow undefined symbols in libraries
1585         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1586     fi
1587     WARNINGS_AS_ERRORS='-Werror'
1588     DSO_CFLAGS=''
1589     DSO_PIC_CFLAGS='-fPIC'
1590     ASFLAGS="$ASFLAGS -fPIC"
1591     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1592     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1593     _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1594     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1596     # Turn on GNU specific features
1597     # -Wall - turn on all warnings
1598     # -pedantic - make compiler warn about non-ANSI stuff, and
1599     #             be a little bit stricter
1600     # Warnings slamm took out for now (these were giving more noise than help):
1601     # -Wbad-function-cast - warns when casting a function to a new return type
1602     # -Wshadow - removed because it generates more noise than help --pete
1603     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1604     if test -z "$INTEL_CC"; then
1605        # Don't use -Wcast-align with ICC
1606        case "$CPU_ARCH" in
1607            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1608            hppa | ia64 | sparc | arm)
1609            ;;
1610            *)
1611         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1612            ;;
1613        esac
1614     fi
1616     dnl Turn pedantic on but disable the warnings for long long
1617     _PEDANTIC=1
1619     if test -z "$INTEL_CC"; then
1620       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1621     fi
1623     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1624     _USE_CPP_INCLUDE_FLAG=1
1625 elif test "$SOLARIS_SUNPRO_CC"; then
1626     DSO_CFLAGS=''
1627     if test "$CPU_ARCH" = "sparc"; then
1628         # for Sun Studio on Solaris/SPARC
1629         DSO_PIC_CFLAGS='-xcode=pic32'
1630     else
1631         DSO_PIC_CFLAGS='-KPIC'
1632     fi
1633     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1634 else
1635     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1636     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1638     DSO_LDOPTS='-shared'
1639     if test "$GNU_LD"; then
1640         # Don't allow undefined symbols in libraries
1641         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1642     fi
1644     DSO_CFLAGS=''
1645     DSO_PIC_CFLAGS='-KPIC'
1646     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1649 if test "$GNU_CXX"; then
1650     # FIXME: Let us build with strict aliasing. bug 414641.
1651     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1652     # Turn on GNU specific features
1653     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1654     if test -z "$INTEL_CC"; then
1655        # Don't use -Wcast-align with ICC
1656        case "$CPU_ARCH" in
1657            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1658            hppa | ia64 | sparc | arm)
1659            ;;
1660            *)
1661         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1662            ;;
1663        esac
1664     fi
1666     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1667     _USE_CPP_INCLUDE_FLAG=1
1669     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1670                    ac_has_wno_invalid_offsetof,
1671         [
1672             AC_LANG_SAVE
1673             AC_LANG_CPLUSPLUS
1674             _SAVE_CXXFLAGS="$CXXFLAGS"
1675             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1676             AC_TRY_COMPILE([],
1677                            [return(0);],
1678                            ac_has_wno_invalid_offsetof="yes",
1679                            ac_has_wno_invalid_offsetof="no")
1680             CXXFLAGS="$_SAVE_CXXFLAGS"
1681             AC_LANG_RESTORE
1682         ])
1683     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1684         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1685     fi
1687     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1688                    ac_has_wno_variadic_macros,
1689         [
1690             AC_LANG_SAVE
1691             AC_LANG_CPLUSPLUS
1692             _SAVE_CXXFLAGS="$CXXFLAGS"
1693             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1694             AC_TRY_COMPILE([],
1695                            [return(0);],
1696                            ac_has_wno_variadic_macros="yes",
1697                            ac_has_wno_variadic_macros="no")
1698             CXXFLAGS="$_SAVE_CXXFLAGS"
1699             AC_LANG_RESTORE
1700         ])
1701     if test "$ac_has_wno_variadic_macros" = "yes"; then
1702         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1703     fi
1705     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1706                    ac_has_werror_return_type,
1707         [
1708             AC_LANG_SAVE
1709             AC_LANG_CPLUSPLUS
1710             _SAVE_CXXFLAGS="$CXXFLAGS"
1711             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1712             AC_TRY_COMPILE([],
1713                            [return(0);],
1714                            ac_has_werror_return_type="yes",
1715                            ac_has_werror_return_type="no")
1716             CXXFLAGS="$_SAVE_CXXFLAGS"
1717             AC_LANG_RESTORE
1718         ])
1719     if test "$ac_has_werror_return_type" = "yes"; then
1720         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1721     fi
1723 else
1724     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1727 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1728 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1729 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1730 dnl normal behavior.
1731 dnl ========================================================
1732 MKSHLIB_FORCE_ALL=
1733 MKSHLIB_UNFORCE_ALL=
1735 if test "$COMPILE_ENVIRONMENT"; then
1736 if test "$GNU_CC"; then
1737   AC_MSG_CHECKING(whether ld has archive extraction flags)
1738   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1739    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1740     ac_cv_mkshlib_force_and_unforce="no"
1741     exec 3<&0 <<LOOP_INPUT
1742         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1743         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1744         force="-Wl,-all";              unforce="-Wl,-none"
1745 LOOP_INPUT
1746     while read line
1747     do
1748       eval $line
1749       LDFLAGS=$force
1750       LIBS=$unforce
1751       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1752     done
1753     exec 0<&3 3<&-
1754     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1755    ])
1756   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1757     AC_MSG_RESULT(no)
1758   else
1759     AC_MSG_RESULT(yes)
1760     eval $ac_cv_mkshlib_force_and_unforce
1761     MKSHLIB_FORCE_ALL=$force
1762     MKSHLIB_UNFORCE_ALL=$unforce
1763   fi
1764 fi # GNU_CC
1765 fi # COMPILE_ENVIRONMENT
1767 dnl =================================================================
1768 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1769 dnl which is bad when cross compiling.
1770 dnl =================================================================
1771 if test "$COMPILE_ENVIRONMENT"; then
1772 configure_static_assert_macros='
1773 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1774 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1775 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1778 dnl test that the macros actually work:
1779 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1780 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1781  [AC_LANG_SAVE
1782   AC_LANG_C
1783   ac_cv_static_assertion_macros_work="yes"
1784   AC_TRY_COMPILE([$configure_static_assert_macros],
1785                  [CONFIGURE_STATIC_ASSERT(1)],
1786                  ,
1787                  ac_cv_static_assertion_macros_work="no")
1788   AC_TRY_COMPILE([$configure_static_assert_macros],
1789                  [CONFIGURE_STATIC_ASSERT(0)],
1790                  ac_cv_static_assertion_macros_work="no",
1791                  )
1792   AC_LANG_CPLUSPLUS
1793   AC_TRY_COMPILE([$configure_static_assert_macros],
1794                  [CONFIGURE_STATIC_ASSERT(1)],
1795                  ,
1796                  ac_cv_static_assertion_macros_work="no")
1797   AC_TRY_COMPILE([$configure_static_assert_macros],
1798                  [CONFIGURE_STATIC_ASSERT(0)],
1799                  ac_cv_static_assertion_macros_work="no",
1800                  )
1801   AC_LANG_RESTORE
1802  ])
1803 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1804 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1805     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1807 fi # COMPILE_ENVIRONMENT
1809 dnl ========================================================
1810 dnl Checking for 64-bit OS
1811 dnl ========================================================
1812 if test "$COMPILE_ENVIRONMENT"; then
1813 AC_LANG_SAVE
1814 AC_LANG_C
1815 AC_MSG_CHECKING(for 64-bit OS)
1816 AC_TRY_COMPILE([$configure_static_assert_macros],
1817                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1818                result="yes", result="no")
1819 AC_MSG_RESULT("$result")
1820 if test "$result" = "yes"; then
1821     AC_DEFINE(HAVE_64BIT_OS)
1822     HAVE_64BIT_OS=1
1824 AC_SUBST(HAVE_64BIT_OS)
1825 AC_LANG_RESTORE
1826 fi # COMPILE_ENVIRONMENT
1828 dnl ========================================================
1829 dnl Enable high-memory support on OS/2 by default.
1830 dnl ========================================================
1831 MOZ_OS2_HIGH_MEMORY=1
1832 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1833 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1834     MOZ_OS2_HIGH_MEMORY=,
1835     MOZ_OS2_HIGH_MEMORY=1 )
1836 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1838 dnl ========================================================
1839 dnl = Use profiling compile flags
1840 dnl ========================================================
1841 MOZ_ARG_ENABLE_BOOL(profiling,
1842 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1843     MOZ_PROFILING=1,
1844     MOZ_PROFILING= )
1846 dnl ========================================================
1847 dnl System overrides of the defaults for host
1848 dnl ========================================================
1849 case "$host" in
1850 *-beos*)
1851     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1852     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1853     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1854     ;;
1856 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1857     if test -n "$_WIN32_MSVC"; then
1858         HOST_AR=lib
1859         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1860         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1861         HOST_RANLIB='echo ranlib'
1862     else
1863         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1864     fi
1865     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1866     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1867     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1868     HOST_BIN_SUFFIX=.exe
1869     case "$host" in
1870     *mingw*)
1871     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1872         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1873         ;;
1874     *)
1875         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1876         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1877             _pwd=`pwd`
1878             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1879         fi
1880         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1881             AS_PERL=1
1882             PERL="${CYGWIN_WRAPPER} $PERL"
1883         fi
1885         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1886             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1887         fi
1888         ;;
1889     esac
1891     case "${host_cpu}" in
1892     x86_64)
1893         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1894         ;;
1895     esac
1896     ;;
1898 *-darwin*)
1899     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1900     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1901     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1902     ;;
1904 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1905     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1906     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1907     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1908     ;;
1910 *os2*)
1911     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1912     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1913     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1914     HOST_BIN_SUFFIX=.exe
1915     MOZ_FIX_LINK_PATHS=
1916     ;;
1918 *-osf*)
1919     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1920     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1921     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1922     ;;
1925     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1926     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1927     ;;
1928 esac
1930 dnl We require version 2.5 or newer of Python to build.
1931 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1932 changequote(,)
1933 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1934 _python_res=$?
1935 changequote([,])
1936 if test "$_python_res" != 0; then
1937     AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1939 AC_MSG_RESULT([yes])
1941 dnl Get mozilla version from central milestone file
1942 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1944 dnl Get version of various core apps from the version files.
1945 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1947 if test -z "$FIREFOX_VERSION"; then
1948     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1951 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1952 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1954 dnl ========================================================
1955 dnl System overrides of the defaults for target
1956 dnl ========================================================
1958 case "$target" in
1959 *-aix*)
1960     AC_DEFINE(AIX)
1961     if test ! "$GNU_CC"; then
1962         if test ! "$HAVE_64BIT_OS"; then
1963             # Compiling with Visual Age C++ object model compat is the
1964             # default. To compile with object model ibm, add 
1965             # AIX_OBJMODEL=ibm to .mozconfig.
1966             if test "$AIX_OBJMODEL" = "ibm"; then
1967                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1968             else
1969                 AIX_OBJMODEL=compat
1970             fi
1971         else
1972             AIX_OBJMODEL=compat
1973         fi
1974         AC_SUBST(AIX_OBJMODEL)
1975         DSO_LDOPTS='-qmkshrobj=1'
1976         DSO_CFLAGS='-qflag=w:w'
1977         DSO_PIC_CFLAGS=
1978         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1979         MOZ_FIX_LINK_PATHS=
1980         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1981         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1982         if test "$COMPILE_ENVIRONMENT"; then
1983             AC_LANG_SAVE
1984             AC_LANG_CPLUSPLUS
1985             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1986             AC_TRY_COMPILE([],
1987                 [#if (__IBMCPP__ < 900)
1988                  #error "Bad compiler"
1989                  #endif],
1990                 _BAD_COMPILER=,_BAD_COMPILER=1)
1991             if test -n "$_BAD_COMPILER"; then
1992                 AC_MSG_RESULT([no])    
1993                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1994             else
1995                 AC_MSG_RESULT([yes])    
1996             fi
1997             AC_LANG_RESTORE
1998             TARGET_COMPILER_ABI="ibmc"
1999             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
2000             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
2001         fi
2002     fi
2003     case "${target_os}" in
2004     aix4.1*)
2005         DLL_SUFFIX='_shr.a'
2006         ;;
2007     esac
2008     if test "$COMPILE_ENVIRONMENT"; then
2009         AC_CHECK_HEADERS(sys/inttypes.h)
2010     fi
2011     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2012     ;;
2014 *-beos*)
2015     no_x=yes
2016     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
2017     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
2018     DSO_LDOPTS='-nostart'
2019     TK_LIBS='-lbe -lroot'
2020     LIBS="$LIBS -lbe"
2021     if test "$COMPILE_ENVIRONMENT"; then
2022         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
2023         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
2024     fi
2025     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
2026     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
2027     _MOZ_USE_RTTI=1
2028     USE_DEPENDENT_LIBS=
2029     MOZ_USER_DIR="Mozilla"
2030     ;;
2032 *-bsdi*)
2033     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2034     _PEDANTIC=
2035     case $OS_RELEASE in
2036         4.*|5.*)
2037             STRIP="$STRIP -d"
2038             ;;
2039         *)
2040             DSO_CFLAGS=''
2041             DSO_LDOPTS='-r'
2042             _WARNINGS_CFLAGS="-Wall"
2043             _WARNINGS_CXXFLAGS="-Wall"
2044             # The test above doesn't work properly, at least on 3.1.
2045             MKSHLIB_FORCE_ALL=''
2046             MKSHLIB_UNFORCE_ALL=''
2047         ;;
2048     esac
2049     ;;
2051 *-darwin*) 
2052     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2053     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2054     # If we're building with --enable-profiling, we need a frame pointer.
2055     if test -z "$MOZ_PROFILING"; then
2056         MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
2057     else
2058         MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
2059     fi
2060     _PEDANTIC=
2061     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2062     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2063     DLL_SUFFIX=".dylib"
2064     DSO_LDOPTS=''
2065     STRIP="$STRIP -x -S"
2066     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2067     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2068     # The ExceptionHandling framework is needed for Objective-C exception
2069     # logging code in nsObjCExceptions.h. Currently we only use that in debug
2070     # builds.
2071     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2073     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2074     dnl ===================================================================
2075     if test "x$enable_dtrace" = "xyes"; then
2076         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2077     else
2078         dnl check for the presence of the -dead_strip linker flag
2079         AC_MSG_CHECKING([for -dead_strip option to ld])
2080         _SAVE_LDFLAGS=$LDFLAGS
2081         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2082         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2083         if test -n "$_HAVE_DEAD_STRIP" ; then
2084             AC_MSG_RESULT([yes])
2085             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2086         else
2087             AC_MSG_RESULT([no])
2088         fi
2089         
2090         LDFLAGS=$_SAVE_LDFLAGS
2091     fi
2092     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2093     ;;
2095 *-freebsd*)
2096     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2097         DLL_SUFFIX=".so.1.0"
2098         DSO_LDOPTS="-shared"
2099     fi
2100     if test ! "$GNU_CC"; then
2101         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2102     fi
2103     ;; 
2105 ia64*-hpux*)
2106     DLL_SUFFIX=".so"
2107     if test ! "$GNU_CC"; then
2108        DSO_LDOPTS='-b'
2109        DSO_CFLAGS=""
2110        DSO_PIC_CFLAGS=
2111        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2112        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2113        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2114     else
2115        DSO_LDOPTS='-b -E'
2116        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2117        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2118     fi
2119     MOZ_FIX_LINK_PATHS=
2120     SYSTEM_MAKEDEPEND=
2121     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2122     AC_DEFINE(_LARGEFILE64_SOURCE)
2123     ;;
2125 *-hpux*)
2126     DLL_SUFFIX=".sl"
2127     if test ! "$GNU_CC"; then
2128         DSO_LDOPTS='-b -Wl,+s'
2129         DSO_CFLAGS=""
2130         DSO_PIC_CFLAGS="+Z"
2131         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2132         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2133         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2134     else
2135         DSO_LDOPTS='-b -E +s'
2136         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2137         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2138     fi
2139     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2140     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2141     ;;
2143 *-irix5*)
2144     AC_DEFINE(IRIX)
2145     DSO_LDOPTS='-elf -shared'
2147     if test "$GNU_CC"; then
2148        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2149        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2150        MKSHLIB_FORCE_ALL='-Wl,-all'
2151        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2152        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2153     else
2154        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2155        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2156        MKSHLIB_FORCE_ALL='-all'
2157        MKSHLIB_UNFORCE_ALL='-none'
2158     fi
2159     ;;
2161 *-irix6*)
2162     AC_DEFINE(IRIX)
2163     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2164     dnl compile and link using -n32
2165     USE_N32=1
2166     TARGET_COMPILER_ABI=n32
2167     DSO_LDOPTS='-elf -shared'
2168     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2169     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2170     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2171     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2172     if test "$GNU_CC"; then
2173        MKSHLIB_FORCE_ALL='-Wl,-all'
2174        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2175        _WARNINGS_CFLAGS="-Wall"
2176        _WARNINGS_CXXFLAGS="-Wall"
2177        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2178     else
2179        MKSHLIB_FORCE_ALL='-all'
2180        MKSHLIB_UNFORCE_ALL='-none'
2181            AR_LIST="$AR t"
2182            AR_EXTRACT="$AR x"
2183            AR_DELETE="$AR d"
2184            AR='$(CXX) -ar'
2185            AR_FLAGS='-o $@'
2186        CFLAGS="$CFLAGS -woff 3262 -G 4"
2187        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2188        if test -n "$USE_N32"; then
2189            ASFLAGS="$ASFLAGS -n32"
2190            CFLAGS="$CFLAGS -n32"
2191            CXXFLAGS="$CXXFLAGS -n32"
2192            LDFLAGS="$LDFLAGS -n32"
2193        fi
2194        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2195        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2196        MOZ_FIX_LINK_PATHS=
2197     fi
2198     if test -z "$GNU_CXX"; then
2199       MIPSPRO_CXX=1
2200     fi
2201     ;;
2203 *-*linux*)
2204     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2205     # Similarly for GNU_CXX and INTEL_CXX.
2206     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2207         # -Os has been broken on Intel's C/C++ compilers for quite a
2208         # while; Intel recommends against using it.
2209         MOZ_OPTIMIZE_FLAGS="-O2"
2210         MOZ_DEBUG_FLAGS="-g"
2211     elif test "$GNU_CC" -o "$GNU_CXX"; then
2212         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2213         case $GCC_VERSION in
2214         4.1.*|4.2.*|4.5.*)
2215             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2216             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2217         esac
2218         # If we're building with --enable-profiling, we need a frame pointer.
2219         if test -z "$MOZ_PROFILING"; then
2220             MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2221         else
2222             MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-omit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2223         fi
2224         MOZ_DEBUG_FLAGS="-g"
2225     fi
2227     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2229     MOZ_MEMORY=1
2231     case "${target_cpu}" in
2232     alpha*)
2233         CFLAGS="$CFLAGS -mieee"
2234         CXXFLAGS="$CXXFLAGS -mieee"
2235     ;;
2236     i*86)
2237         USE_ELF_DYNSTR_GC=1
2238     ;;
2239     mips*)
2240         MOZ_DEBUG_FLAGS="-g" # We want inlining
2241     ;;
2242     esac
2243     ;;
2245 *-wince*|*-winmo*)
2246     TARGET_COMPILER_ABI=msvc
2247     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2248     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2249     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2250     AR_LIST="$AR -list"
2251     AR_EXTRACT="$AR -extract"
2252     AR_DELETE="$AR d"
2253     AR_FLAGS='-OUT:"$@"'
2254     MOZ_MEMORY=1
2255     NSS_DISABLE_DBM=1
2256     MOZ_OGG=
2257     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2259     if test "$AS_BIN"; then
2260         AS="$AS_BIN"
2261     fi
2262     DSO_CFLAGS=
2263     DSO_PIC_CFLAGS=
2264     DLL_SUFFIX=.dll
2265     BIN_SUFFIX='.exe'
2266     if test -z "$RC"; then 
2267         RC=rc.exe  
2268     fi
2269     # certain versions of cygwin's makedepend barf on the 
2270     # #include <string> vs -I./dist/include/string issue so don't use it
2271     SYSTEM_MAKEDEPEND=
2273     HOST_CC=cl
2274     HOST_CXX=cl
2275     HOST_LD=link
2276     HOST_AR='lib -OUT:$@'
2277     HOST_RANLIB='echo ranlib'
2278     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2279         
2280         
2281     WARNINGS_AS_ERRORS='-WX'
2282     MOZ_OPTIMIZE_FLAGS='-Ox'
2283     AR_FLAGS='-NOLOGO -OUT:"$@"'
2284     ASM_SUFFIX=asm
2285     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2286     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2287     DLL_PREFIX=
2288     DOXYGEN=:
2289     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2290     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2291     GARBAGE=
2292     IMPORT_LIB_SUFFIX=lib
2293     dnl Need to force-link against mozalloc because it's used in the shunt
2294     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2295     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2296     LIB_PREFIX=
2297     LIB_SUFFIX=lib 
2298     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2299     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2300     MKSHLIB_FORCE_ALL=
2301     MKSHLIB_UNFORCE_ALL=
2302     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2303     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2304     MOZ_DEBUG_FLAGS='-Zi'
2305     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2306     MOZ_FIX_LINK_PATHS=
2307     MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2308     MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2309     OBJ_SUFFIX=obj
2310     RANLIB='echo not_ranlib'
2311     STRIP='echo not_strip'
2312     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2313     UNZIP=unzip
2314     XARGS=xargs
2315     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2316     ZIP=zip
2317     MOZ_TREE_FREETYPE=1
2319     AC_DEFINE(HAVE_SNPRINTF)
2320     AC_DEFINE(_WINDOWS)
2321     AC_DEFINE(WIN32)
2322     AC_DEFINE(XP_WIN)
2323     AC_DEFINE(XP_WIN32)
2324     AC_DEFINE(HW_THREADS)
2325     AC_DEFINE(STDC_HEADERS)
2326     AC_DEFINE(NEW_H, <new>)
2327     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2328     AC_DEFINE(HAVE_LOCALTIME_R)
2330     TARGET_MD_ARCH=win32
2331     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2332     BIN_SUFFIX='.exe'
2333     MOZ_USER_DIR="Mozilla"
2335     MOZ_GFX_OPTIMIZE_MOBILE=1
2337     # Sanity check for WINCE_WINDOWS_MOBILE
2338     # XXX disabled until we can fix the mobile tinderbox
2339     ##if test "$WINCE_WINDOWS_MOBILE"; then
2340     ##   AC_CHECK_HEADER(tpcshell.h, [],
2341     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2342     ##fi
2346 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2347     DSO_CFLAGS=
2348     DSO_PIC_CFLAGS=
2349     DLL_SUFFIX=.dll
2350     RC=rc.exe
2351     # certain versions of cygwin's makedepend barf on the 
2352     # #include <string> vs -I./dist/include/string issue so don't use it
2353     SYSTEM_MAKEDEPEND=
2354     if test -n "$GNU_CC"; then
2355         CC="$CC -mno-cygwin"
2356         CXX="$CXX -mno-cygwin"
2357         CPP="$CPP -mno-cygwin"
2358         CFLAGS="$CFLAGS -mms-bitfields"
2359         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2360         DSO_LDOPTS='-shared'
2361         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2362         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2363         RC='$(WINDRES)'
2364         # Use temp file for windres (bug 213281)
2365         RCFLAGS='-O coff --use-temp-file'
2366         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2367         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2368         MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
2369         MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
2370         MOZ_FIX_LINK_PATHS=
2371         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2372         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2373         DLL_PREFIX=
2374         IMPORT_LIB_SUFFIX=dll.a
2375         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2376     else
2377         TARGET_COMPILER_ABI=msvc
2378         HOST_CC='$(CC)'
2379         HOST_CXX='$(CXX)'
2380         HOST_LD='$(LD)'
2381         if test "$AS_BIN"; then
2382             AS="$(basename "$AS_BIN")"
2383         fi
2384         AR='lib -NOLOGO -OUT:"$@"'
2385         AR_FLAGS=
2386         RANLIB='echo not_ranlib'
2387         STRIP='echo not_strip'
2388         PKG_SKIP_STRIP=1
2389         XARGS=xargs
2390         ZIP=zip
2391         UNZIP=unzip
2392         DOXYGEN=:
2393         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2394         ASM_SUFFIX=asm
2395         OBJ_SUFFIX=obj
2396         LIB_SUFFIX=lib
2397         DLL_PREFIX=
2398         LIB_PREFIX=
2399         IMPORT_LIB_SUFFIX=lib
2400         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2401         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2402         MKSHLIB_FORCE_ALL=
2403         MKSHLIB_UNFORCE_ALL=
2404         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2405         _USE_CPP_INCLUDE_FLAG=1
2406         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2407         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2408         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2409         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2410         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2411         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2412         MOZ_DEBUG_FLAGS='-Zi'
2413         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2414         WARNINGS_AS_ERRORS='-WX'
2415         # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
2416         if test -z "$MOZ_PROFILING"; then
2417             MOZ_OPTIMIZE_FLAGS='-O1'
2418         else
2419             MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
2420         fi
2421         MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2422         MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2423         MOZ_FIX_LINK_PATHS=
2424         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2425         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2426         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2427         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2428         if test $_MSC_VER -ge 1400; then
2429             LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2430             dnl For profile-guided optimization
2431             PROFILE_GEN_CFLAGS="-GL"
2432             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2433             dnl XXX: PGO builds can fail with warnings treated as errors,
2434             dnl specifically "no profile data available" appears to be
2435             dnl treated as an error sometimes. This might be a consequence
2436             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2437             dnl with the linker doing most of the work in the whole-program
2438             dnl optimization/PGO case. I think it's probably a compiler bug,
2439             dnl but we work around it here.
2440             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2441             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2442             dnl Probably also a compiler bug, but what can you do?
2443             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2444             LDFLAGS="$LDFLAGS -DYNAMICBASE"
2445         fi
2446     fi
2447     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2448     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2449     AC_DEFINE(HAVE_SNPRINTF)
2450     AC_DEFINE(_WINDOWS)
2451     AC_DEFINE(WIN32)
2452     AC_DEFINE(XP_WIN)
2453     AC_DEFINE(XP_WIN32)
2454     AC_DEFINE(HW_THREADS)
2455     AC_DEFINE(STDC_HEADERS)
2456     AC_DEFINE(NEW_H, <new>)
2457     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2458     TARGET_MD_ARCH=win32
2459     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2460     BIN_SUFFIX='.exe'
2461     MOZ_USER_DIR="Mozilla"
2463     dnl Hardcode to win95 for now - cls
2464     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2466     dnl set NO_X11 defines here as the general check is skipped on win32
2467     no_x=yes
2468     AC_DEFINE(NO_X11)
2470     dnl MinGW/MSYS doesn't provide or need cygpath
2471     case "$host" in
2472     *-mingw*)
2473         CYGPATH_W=echo
2474         CYGPATH_S=cat
2475         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2476         ;;
2477     *-cygwin*|*-msvc*|*-mks*)
2478         CYGPATH_W="cygpath -a -w"
2479         CYGPATH_S="sed -e s|\\\\|/|g"
2480         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2481         ;;
2482     esac
2483     case "$host" in
2484     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2486     if test -z "$MOZ_TOOLS"; then
2487         AC_MSG_ERROR([MOZ_TOOLS is not set])
2488     fi
2490     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2491     if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2492         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2493     fi
2494     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2495     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2496         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2497     fi
2498     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2499     ;;
2500     esac 
2503     case "$host_os" in
2504     cygwin*|msvc*|mks*)
2505         AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
2506         ;;
2508     *)
2509         AC_CHECK_HEADERS(oleacc.idl)
2511         AC_LANG_SAVE
2512         AC_LANG_CPLUSPLUS
2513         AC_CHECK_HEADERS(atlbase.h)
2514         AC_LANG_RESTORE
2515         ;;
2516     esac
2518     case "$target" in
2519     i*86-*)
2520         if test "$HAVE_64BIT_OS"; then
2521             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2522         fi
2524         if test $_MSC_VER -ge 1400; then
2525             LDFLAGS="$LDFLAGS -SAFESEH"
2526         fi
2528         if test -n "$GNU_CC"; then
2529             CFLAGS="$CFLAGS -mstackrealign"
2530             CXXFLAGS="$CXXFLAGS -mstackrealign"
2531         fi
2533         AC_CHECK_HEADERS(mmintrin.h)
2534         AC_DEFINE(_X86_)
2535         ;;
2536     alpha-*)
2537         AC_DEFINE(_ALPHA_)
2538         ;;
2539     mips-*)
2540         AC_DEFINE(_MIPS_)
2541         ;;
2542     x86_64-*)
2543         AC_DEFINE(_AMD64_)
2544         ;;
2545     *)
2546         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2547         ;;
2548     esac
2550     if test "$HAVE_64BIT_OS"; then
2551         AC_DEFINE(_WIN64)
2552     fi
2553     ;;
2555 *-netbsd*)
2556     DSO_CFLAGS=''
2557     CFLAGS="$CFLAGS -Dunix"
2558     CXXFLAGS="$CXXFLAGS -Dunix"
2559     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2560         DLL_SUFFIX=".so"
2561         DSO_PIC_CFLAGS='-fPIC -DPIC'
2562         DSO_LDOPTS='-shared'
2563         BIN_FLAGS='-Wl,--export-dynamic'
2564     else
2565         DSO_PIC_CFLAGS='-fPIC -DPIC'
2566         DLL_SUFFIX=".so.1.0"
2567         DSO_LDOPTS='-shared'
2568     fi
2569     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2570     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2571     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2572     if test "$LIBRUNPATH"; then
2573         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2574     fi
2575     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2576     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2577     ;;
2579 *-nto*) 
2580         AC_DEFINE(NTO)  
2581         AC_DEFINE(_QNX_SOURCE)
2582         AC_DEFINE(_i386)
2583         OS_TARGET=NTO
2584         WARNINGS_AS_ERRORS=''
2585         MOZ_OPTIMIZE_FLAGS="-O"
2586         MOZ_DEBUG_FLAGS="-gstabs"
2587         USE_PTHREADS=1
2588         _PEDANTIC=
2589         LIBS="$LIBS -lsocket -lstdc++"
2590         _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2591         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2592         if test "$with_x" != "yes"
2593         then
2594                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2595             TK_CFLAGS='-I/usr/include/photon'
2596                 TK_LIBS='-lph'
2597         fi
2598         case "${target_cpu}" in
2599         ppc*)
2600         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2601         ;;
2602         esac
2603         case "${host_cpu}" in
2604         i*86)
2605         USE_ELF_DYNSTR_GC=1
2606         ;;
2607         esac
2608         ;;
2610 *-openbsd*)
2611     DLL_SUFFIX=".so.1.0"
2612     DSO_CFLAGS=''
2613     DSO_PIC_CFLAGS='-fPIC'
2614     DSO_LDOPTS='-shared -fPIC'
2615     if test "$LIBRUNPATH"; then
2616         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2617     fi
2618     ;;
2620 *-openvms*) 
2621     AC_DEFINE(NO_PW_GECOS)
2622     AC_DEFINE(NO_UDSOCK)
2623     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2624     USE_PTHREADS=1
2625     MKSHLIB_FORCE_ALL='-all'
2626     MKSHLIB_UNFORCE_ALL='-none'
2627     AS='as'
2628     AS_DASH_C_FLAG='-Wc/names=as_is'
2629     AR_FLAGS='c $@'
2630     DSO_LDOPTS='-shared -auto_symvec'
2631     DSO_PIC_CFLAGS=
2632     MOZ_DEBUG_LDFLAGS='-g'
2633     COMPAQ_CXX=1
2634     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2635     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2636     ;;
2639 *-os2*)
2640     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2641     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2642     AC_DEFINE(OS2)
2643     AC_DEFINE(XP_OS2)
2644     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2645     AC_DEFINE(TCPV40HDRS)
2646     DLL_PREFIX=
2647     LIB_PREFIX=
2648     LIB_SUFFIX=lib
2649     BIN_SUFFIX=".exe"
2650     DLL_SUFFIX=".dll"
2651     IMPORT_LIB_SUFFIX=lib
2652     DSO_PIC_CFLAGS=
2653     AR=emxomfar
2654     AR_FLAGS='r $@'
2655     CFLAGS="$CFLAGS -Zomf"
2656     CXXFLAGS="$CXXFLAGS -Zomf"
2657     DSO_LDOPTS='-Zdll'
2658     BIN_FLAGS='-Zlinker /ST:0x100000'
2659     IMPLIB='emximp -o'
2660     FILTER='true'
2661     LDFLAGS='-Zmap'
2662     WARNINGS_AS_ERRORS='-Werror'
2663     MOZ_DEBUG_FLAGS="-g -fno-inline"
2664     MOZ_OPTIMIZE_FLAGS="-O2"
2665     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2666     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2667     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2668     TARGET_MD_ARCH=os2
2669     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2670     RC=rc.exe
2671     RCFLAGS='-n'
2672     MOZ_USER_DIR="Mozilla"
2674     if test "$MOZTOOLS"; then
2675         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2676     else
2677         AC_MSG_ERROR([MOZTOOLS is not set])
2678     fi
2679     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2680         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2681         LDFLAGS="$LDFLAGS -Zhigh-mem"
2682         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2683         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2684     fi
2686     # GCC for OS/2 currently predefines these, but we don't want them
2687     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2688     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2690     AC_CACHE_CHECK(for __declspec(dllexport),
2691         ac_os2_declspec,
2692         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2693                         [return 0;],
2694                         ac_os2_declspec="yes",
2695                         ac_os2_declspec="no")])
2696     if test "$ac_os2_declspec" != "yes"; then
2697         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2698     fi
2699     ;;
2701 alpha*-*-osf*)
2702     if test "$GNU_CC"; then
2703       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2704       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2706     else
2707         MOZ_DEBUG_FLAGS='-g'
2708         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2709         CFLAGS="$CFLAGS -ieee"
2710         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2711         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2712         DSO_CFLAGS=
2713         DSO_PIC_CFLAGS=
2714         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2715         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2716         MKSHLIB_FORCE_ALL='-all'
2717         MKSHLIB_UNFORCE_ALL='-none'
2718         dnl Might fix the libxpcom.so breakage on this platform as well....
2719         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2720         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2721     fi
2722     if test -z "$GNU_CXX"; then
2723       COMPAQ_CXX=1
2724     fi
2725     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2726     ;;
2728 *-qnx*) 
2729     DIRENT_INO=d_stat.st_ino
2730     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2731     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2732     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2733     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2734     AC_DEFINE(STDC_HEADERS)
2735     if test "$no_x" = "yes"; then
2736             _PLATFORM_DEFAULT_TOOLKIT='photon'
2737             TK_CFLAGS='-I/usr/nto/include/photon'
2738             TK_LIBS='-lphoton -lphrender'
2739     fi
2740     ;;
2742 *-sco*) 
2743     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2744     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2745     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2746     if test ! "$GNU_CC"; then
2747        DSO_LDOPTS='-G'
2748     fi
2749     ;;
2751 *-solaris*) 
2752     AC_DEFINE(SOLARIS)
2753     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2754     SYSTEM_MAKEDEPEND=
2755     MOZ_FIX_LINK_PATHS=
2756     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2757     # libraries one level up (e.g. libnspr4.so)
2758     if test "$SOLARIS_SUNPRO_CC"; then
2759        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2760        LIBS="-lCrun -lCstd -lc $LIBS"
2761        NS_USE_NATIVE=1
2762        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2763        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2764        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2765        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2766        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2767        LDFLAGS="-xildoff $LDFLAGS"
2768        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2769            _SAVE_LDFLAGS=$LDFLAGS
2770            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2771            AC_TRY_LINK([#include <stdio.h>],
2772                        [printf("Hello World\n");],
2773                        ,
2774                        [LDFLAGS=$_SAVE_LDFLAGS])
2775        fi
2776        WARNINGS_AS_ERRORS='-Werror'
2777        MOZ_OPTIMIZE_FLAGS="-xO4"
2778        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2779        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2780        MKSHLIB_FORCE_ALL='-z allextract'
2781        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2782        DSO_LDOPTS='-G'
2783        AR_LIST="$AR t"
2784        AR_EXTRACT="$AR x"
2785        AR_DELETE="$AR d"
2786        AR='$(CXX) -xar'
2787        AR_FLAGS='-o $@'
2788        AS='/usr/ccs/bin/as'
2789        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2790        AS_DASH_C_FLAG=''
2791        TARGET_COMPILER_ABI="sunc"
2792        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2793        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2794        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2795        AC_LANG_SAVE
2796        AC_LANG_CPLUSPLUS
2797        AC_TRY_COMPILE([],
2798            [#if (__SUNPRO_CC < 0x590)
2799            #error "Denied"
2800            #endif],
2801            _BAD_COMPILER=,_BAD_COMPILER=1)
2802        if test -n "$_BAD_COMPILER"; then
2803            _res="no"
2804            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2805        else
2806            _res="yes"
2807        fi
2808        AC_TRY_COMPILE([],
2809            [#if (__SUNPRO_CC >= 0x5100)
2810            #error "Sun C++ 5.10 or above"
2811            #endif],
2812            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2813        if test "$_ABOVE_SS12U1"; then
2814            # disable xannotate
2815            CXXFLAGS="$CXXFLAGS -xannotate=no"
2816        fi
2817        AC_MSG_RESULT([$_res])
2818        AC_LANG_RESTORE
2819     else
2820        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2821        LIBS="-lc $LIBS"
2822        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2823        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2824        ASFLAGS="$ASFLAGS -fPIC"
2825        DSO_LDOPTS='-shared'
2826        _WARNINGS_CFLAGS=''
2827        _WARNINGS_CXXFLAGS=''
2828        if test "$OS_RELEASE" = "5.3"; then
2829            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2830        fi
2831     fi
2832     if test "$OS_RELEASE" = "5.5.1"; then
2833         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2834     fi
2835     ;;
2837 *-sunos*) 
2838     DSO_LDOPTS='-Bdynamic'
2839     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2840     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2841     AC_DEFINE(SUNOS4)
2842     AC_DEFINE(SPRINTF_RETURNS_STRING)
2843     case "$(target_os)" in
2844     sunos4.1*)
2845         DLL_SUFFIX='.so.1.0'
2846         ;;
2847     esac
2848     ;;
2850 *-sysv4.2uw7*) 
2851         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2852     ;;
2854 *-os2*)
2855     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2856     ;;
2858 *-android*)
2859     AC_DEFINE(NO_PW_GECOS)
2860     no_x=yes
2861     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2862     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2864     MOZ_GFX_OPTIMIZE_MOBILE=1
2865     # If we're building with --enable-profiling, we need a frame pointer.
2866     if test -z "$MOZ_PROFILING"; then
2867         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2868     else
2869         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
2870     fi
2871     # The Maemo builders don't know about this flag
2872     MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
2873     ;;
2875 esac
2877 dnl Only one oddball right now (QNX), but this gives us flexibility
2878 dnl if any other platforms need to override this in the future.
2879 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2881 dnl ========================================================
2882 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2883 dnl by now will not have any way to link most binaries (tests
2884 dnl as well as viewer, apprunner, etc.), because some symbols
2885 dnl will be left out of the "composite" .so's by ld as unneeded.
2886 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2887 dnl they can link in the static libs that provide the missing
2888 dnl symbols.
2889 dnl ========================================================
2890 NO_LD_ARCHIVE_FLAGS=
2891 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2892     NO_LD_ARCHIVE_FLAGS=1
2894 case "$target" in
2895 *-os2*)
2896     NO_LD_ARCHIVE_FLAGS=
2897     ;;
2898 *-aix4.3*|*-aix5*)
2899     NO_LD_ARCHIVE_FLAGS=
2900     ;;
2901 *-openvms*)
2902     NO_LD_ARCHIVE_FLAGS=
2903     ;;
2904 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2905     if test -z "$GNU_CC"; then
2906         NO_LD_ARCHIVE_FLAGS=
2907     fi
2908     ;;
2909 esac
2910 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2912 dnl ========================================================
2913 dnl = Flags to strip unused symbols from .so components and
2914 dnl = to export jemalloc symbols when linking a program
2915 dnl ========================================================
2916 case "$target" in
2917     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2918         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2919         MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS='-rdynamic -Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/jemalloc-standalone-linkage-version-script'
2920         ;;
2921     *-solaris*)
2922         if test -z "$GNU_CC"; then
2923          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2924         else
2925          if test -z "$GCC_USE_GNU_LD"; then
2926           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2927          else
2928           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2929          fi
2930         fi
2931         ;;
2932     *-nto*) 
2933         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2934         ;;
2935     *-darwin*)
2936         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2937         ;;
2938     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2939         if test -n "$GNU_CC"; then
2940            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2941         fi
2942         ;;
2943 esac
2945 if test -z "$COMPILE_ENVIRONMENT"; then
2946     SKIP_COMPILER_CHECKS=1
2947     SKIP_LIBRARY_CHECKS=1
2950 if test -z "$SKIP_COMPILER_CHECKS"; then
2951 dnl Checks for typedefs, structures, and compiler characteristics.
2952 dnl ========================================================
2953 AC_HEADER_STDC
2954 AC_C_CONST
2955 AC_TYPE_MODE_T
2956 AC_TYPE_OFF_T
2957 AC_TYPE_PID_T
2958 AC_TYPE_SIZE_T
2959 AC_LANG_CPLUSPLUS
2960 AC_MSG_CHECKING(for __stdcall)
2961 AC_CACHE_VAL(ac_cv___stdcall,
2962  [AC_TRY_COMPILE([template <typename Method> struct foo;
2963                   template <> struct foo<void (*)()> {};
2964                   template <> struct foo<void (__stdcall*)()> {};],
2965                  [],
2966                  [ac_cv___stdcall=true],
2967                  [ac_cv___stdcall=false])])
2968 if test "$ac_cv___stdcall" = true ; then
2969   AC_DEFINE(HAVE_STDCALL)
2970   AC_MSG_RESULT(yes)
2971 else
2972   AC_MSG_RESULT(no)
2974 AC_LANG_C
2975 AC_MSG_CHECKING(for ssize_t)
2976 AC_CACHE_VAL(ac_cv_type_ssize_t,
2977  [AC_TRY_COMPILE([#include <stdio.h>
2978                   #include <sys/types.h>],
2979                  [ssize_t foo = 0;],
2980                  [ac_cv_type_ssize_t=true],
2981                  [ac_cv_type_ssize_t=false])])
2982 if test "$ac_cv_type_ssize_t" = true ; then
2983   AC_DEFINE(HAVE_SSIZE_T)
2984   AC_MSG_RESULT(yes)
2985 else
2986   AC_MSG_RESULT(no)
2988 AC_STRUCT_ST_BLKSIZE
2989 AC_MSG_CHECKING(for siginfo_t)
2990 AC_CACHE_VAL(ac_cv_siginfo_t,
2991  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2992                   #include <signal.h>],
2993                  [siginfo_t* info;],
2994                  [ac_cv_siginfo_t=true],
2995                  [ac_cv_siginfo_t=false])])
2996 if test "$ac_cv_siginfo_t" = true ; then
2997   AC_DEFINE(HAVE_SIGINFO_T)
2998   AC_MSG_RESULT(yes)
2999 else
3000   AC_MSG_RESULT(no)
3003 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
3004 dnl ========================================================
3005 AC_MSG_CHECKING(for int16_t)
3006 AC_CACHE_VAL(ac_cv_int16_t,
3007  [AC_TRY_COMPILE([#include <stdio.h>
3008                   #include <sys/types.h>],
3009                  [int16_t foo = 0;],
3010                  [ac_cv_int16_t=true],
3011                  [ac_cv_int16_t=false])])
3012 if test "$ac_cv_int16_t" = true ; then
3013   AC_DEFINE(HAVE_INT16_T)
3014   AC_MSG_RESULT(yes)
3015 else
3016   AC_MSG_RESULT(no)
3018 AC_MSG_CHECKING(for int32_t)
3019 AC_CACHE_VAL(ac_cv_int32_t,
3020  [AC_TRY_COMPILE([#include <stdio.h>
3021                   #include <sys/types.h>],
3022                  [int32_t foo = 0;],
3023                  [ac_cv_int32_t=true],
3024                  [ac_cv_int32_t=false])])
3025 if test "$ac_cv_int32_t" = true ; then
3026   AC_DEFINE(HAVE_INT32_T)
3027   AC_MSG_RESULT(yes)
3028 else
3029   AC_MSG_RESULT(no)
3031 AC_MSG_CHECKING(for int64_t)
3032 AC_CACHE_VAL(ac_cv_int64_t,
3033  [AC_TRY_COMPILE([#include <stdio.h>
3034                   #include <sys/types.h>],
3035                  [int64_t foo = 0;],
3036                  [ac_cv_int64_t=true],
3037                  [ac_cv_int64_t=false])])
3038 if test "$ac_cv_int64_t" = true ; then
3039   AC_DEFINE(HAVE_INT64_T)
3040   AC_MSG_RESULT(yes)
3041 else
3042   AC_MSG_RESULT(no)
3044 AC_MSG_CHECKING(for int64)
3045 AC_CACHE_VAL(ac_cv_int64,
3046  [AC_TRY_COMPILE([#include <stdio.h>
3047                   #include <sys/types.h>],
3048                  [int64 foo = 0;],
3049                  [ac_cv_int64=true],
3050                  [ac_cv_int64=false])])
3051 if test "$ac_cv_int64" = true ; then
3052   AC_DEFINE(HAVE_INT64)
3053   AC_MSG_RESULT(yes)
3054 else
3055   AC_MSG_RESULT(no)
3057 AC_MSG_CHECKING(for uint)
3058 AC_CACHE_VAL(ac_cv_uint,
3059  [AC_TRY_COMPILE([#include <stdio.h>
3060                   #include <sys/types.h>],
3061                  [uint foo = 0;],
3062                  [ac_cv_uint=true],
3063                  [ac_cv_uint=false])])
3064 if test "$ac_cv_uint" = true ; then
3065   AC_DEFINE(HAVE_UINT)
3066   AC_MSG_RESULT(yes)
3067 else
3068   AC_MSG_RESULT(no)
3070 AC_MSG_CHECKING(for uint_t)
3071 AC_CACHE_VAL(ac_cv_uint_t,
3072  [AC_TRY_COMPILE([#include <stdio.h>
3073                   #include <sys/types.h>],
3074                  [uint_t foo = 0;],
3075                  [ac_cv_uint_t=true],
3076                  [ac_cv_uint_t=false])])
3077 if test "$ac_cv_uint_t" = true ; then
3078   AC_DEFINE(HAVE_UINT_T)
3079   AC_MSG_RESULT(yes)
3080 else
3081   AC_MSG_RESULT(no)
3083 AC_MSG_CHECKING(for uint16_t)
3084 AC_CACHE_VAL(ac_cv_uint16_t,
3085  [AC_TRY_COMPILE([#include <stdio.h>
3086                   #include <sys/types.h>],
3087                  [uint16_t foo = 0;],
3088                  [ac_cv_uint16_t=true],
3089                  [ac_cv_uint16_t=false])])
3090 if test "$ac_cv_uint16_t" = true ; then
3091   AC_DEFINE(HAVE_UINT16_T)
3092   AC_MSG_RESULT(yes)
3093 else
3094   AC_MSG_RESULT(no)
3097 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3098 dnl are defined when compiling C++ but not C.  Since the result of this
3099 dnl test is used only in C++, do it in C++.
3100 AC_LANG_CPLUSPLUS
3102 AC_MSG_CHECKING(for uname.domainname)
3103 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3104     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3105         [ struct utsname *res; char *domain; 
3106             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3107         [ac_cv_have_uname_domainname_field=true],
3108         [ac_cv_have_uname_domainname_field=false])])
3110 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3111     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3112     AC_MSG_RESULT(yes)
3113 else
3114     AC_MSG_RESULT(no)
3117 AC_MSG_CHECKING(for uname.__domainname)
3118 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3119     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3120         [ struct utsname *res; char *domain; 
3121             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3122         [ac_cv_have_uname_us_domainname_field=true],
3123         [ac_cv_have_uname_us_domainname_field=false])])
3125 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3126     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3127     AC_MSG_RESULT(yes)
3128 else
3129     AC_MSG_RESULT(no)
3132 AC_LANG_CPLUSPLUS
3134 dnl Check for usable char16_t (2 bytes, unsigned)
3135 dnl (we might not need the unsignedness check anymore)
3136 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3137     ac_cv_have_usable_char16_t,
3138     [AC_TRY_COMPILE([$configure_static_assert_macros],
3139                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3140                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3141                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3142                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3143                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3144                     ac_cv_have_usable_char16_t="yes",
3145                     ac_cv_have_usable_char16_t="no")])
3146 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3147     AC_DEFINE(HAVE_CPP_CHAR16_T)
3148     HAVE_CPP_CHAR16_T=1
3151 dnl Check for usable wchar_t (2 bytes, unsigned)
3152 dnl (we really don't need the unsignedness check anymore)
3153 dnl ========================================================
3155 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3156     ac_cv_have_usable_wchar_v2,
3157     [AC_TRY_COMPILE([#include <stddef.h>
3158                      $configure_static_assert_macros],
3159                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3160                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3161                     ac_cv_have_usable_wchar_v2="yes",
3162                     ac_cv_have_usable_wchar_v2="no")])
3163 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3164     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3165     HAVE_CPP_2BYTE_WCHAR_T=1
3166 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3167 dnl This is really gcc-only
3168 dnl Do this test using CXX only since some versions of gcc
3169 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3170 dnl only have short-wchar support for c++.
3171 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3173     _SAVE_CXXFLAGS=$CXXFLAGS
3174     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3176     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3177         ac_cv_have_usable_wchar_option_v2,
3178         [AC_TRY_LINK([#include <stddef.h>
3179                       $configure_static_assert_macros],
3180                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3181                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3182                      ac_cv_have_usable_wchar_option_v2="yes",
3183                      ac_cv_have_usable_wchar_option_v2="no")])
3185     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3186         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3187         HAVE_CPP_2BYTE_WCHAR_T=1
3188         if test "$OS_TARGET" = Android; then
3189             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3190             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3191             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3192             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3193         else
3194             WCHAR_CFLAGS="-fshort-wchar"
3195         fi
3196     else    
3197         CXXFLAGS=$_SAVE_CXXFLAGS
3198     fi
3201 AC_LANG_C
3203 dnl Check for .hidden assembler directive and visibility attribute.
3204 dnl Borrowed from glibc configure.in
3205 dnl ===============================================================
3206 if test "$GNU_CC"; then
3207   AC_CACHE_CHECK(for visibility(hidden) attribute,
3208                  ac_cv_visibility_hidden,
3209                  [cat > conftest.c <<EOF
3210                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3212                   ac_cv_visibility_hidden=no
3213                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3214                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3215                       ac_cv_visibility_hidden=yes
3216                     fi
3217                   fi
3218                   rm -f conftest.[cs]
3219                  ])
3220   if test "$ac_cv_visibility_hidden" = "yes"; then
3221     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3223     AC_CACHE_CHECK(for visibility(default) attribute,
3224                    ac_cv_visibility_default,
3225                    [cat > conftest.c <<EOF
3226                     int foo __attribute__ ((visibility ("default"))) = 1;
3228                     ac_cv_visibility_default=no
3229                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3230                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3231                         ac_cv_visibility_default=yes
3232                       fi
3233                     fi
3234                     rm -f conftest.[cs]
3235                    ])
3236     if test "$ac_cv_visibility_default" = "yes"; then
3237       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3239       AC_CACHE_CHECK(for visibility pragma support,
3240                      ac_cv_visibility_pragma,
3241                      [cat > conftest.c <<EOF
3242 #pragma GCC visibility push(hidden)
3243                       int foo_hidden = 1;
3244 #pragma GCC visibility push(default)
3245                       int foo_default = 1;
3247                       ac_cv_visibility_pragma=no
3248                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3249                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3250                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3251                             ac_cv_visibility_pragma=yes
3252                           fi
3253                         fi
3254                       fi
3255                       rm -f conftest.[cs]
3256                     ])
3257       if test "$ac_cv_visibility_pragma" = "yes"; then
3258         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3259                        ac_cv_have_visibility_class_bug,
3260                        [cat > conftest.c <<EOF
3261 #pragma GCC visibility push(hidden)
3262 struct __attribute__ ((visibility ("default"))) TestStruct {
3263   static void Init();
3265 __attribute__ ((visibility ("default"))) void TestFunc() {
3266   TestStruct::Init();
3269                        ac_cv_have_visibility_class_bug=no
3270                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3271                          ac_cv_have_visibility_class_bug=yes
3272                        else
3273                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3274                            ac_cv_have_visibility_class_bug=yes
3275                          fi
3276                        fi
3277                        rm -rf conftest.{c,S}
3278                        ])
3280         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3281                        ac_cv_have_visibility_builtin_bug,
3282                        [cat > conftest.c <<EOF
3283 #pragma GCC visibility push(hidden)
3284 #pragma GCC visibility push(default)
3285 #include <string.h>
3286 #pragma GCC visibility pop
3288 __attribute__ ((visibility ("default"))) void Func() {
3289   char c[[100]];
3290   memset(c, 0, sizeof(c));
3293                        ac_cv_have_visibility_builtin_bug=no
3294                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3295                          ac_cv_have_visibility_builtin_bug=yes
3296                        else
3297                          if test `grep -c "@PLT" conftest.S` = 0; then
3298                            ac_cv_visibility_builtin_bug=yes
3299                          fi
3300                        fi
3301                        rm -f conftest.{c,S}
3302                        ])
3303         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3304                 "$ac_cv_have_visibility_class_bug" = "no"; then
3305           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3306           WRAP_SYSTEM_INCLUDES=1
3307           STL_FLAGS='-I$(DIST)/stl_wrappers'
3308           WRAP_STL_INCLUDES=1
3309         else
3310           VISIBILITY_FLAGS='-fvisibility=hidden'
3311         fi # have visibility pragma bug
3312       fi   # have visibility pragma
3313     fi     # have visibility(default) attribute
3314   fi       # have visibility(hidden) attribute
3315 fi         # GNU_CC
3317 # visibility hidden flag for Sun Studio on Solaris
3318 if test "$SOLARIS_SUNPRO_CC"; then
3319 VISIBILITY_FLAGS='-xldscope=hidden'
3320 fi         # Sun Studio on Solaris
3322 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3323 AC_SUBST(VISIBILITY_FLAGS)
3325 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3326 dnl ========================================================
3327 if test "$GNU_CC"; then
3328   CFLAGS_save="${CFLAGS}"
3329   CFLAGS="${CFLAGS} -Werror"
3330   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3331                  ac_cv_force_align_arg_pointer,
3332                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3333                                  [],
3334                                  ac_cv_force_align_arg_pointer="yes",
3335                                  ac_cv_force_align_arg_pointer="no")])
3336   CFLAGS="${CFLAGS_save}"
3337   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3338     HAVE_GCC_ALIGN_ARG_POINTER=1
3339   else
3340     HAVE_GCC_ALIGN_ARG_POINTER=
3341   fi
3343 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3345 dnl Checks for header files.
3346 dnl ========================================================
3347 AC_HEADER_DIRENT
3348 case "$target_os" in
3349 freebsd*)
3350 # for stuff like -lXshm
3351     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3352     ;;
3353 esac
3354 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3355 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3356 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3357 AC_CHECK_HEADERS(malloc.h)
3358 AC_CHECK_HEADERS(X11/XKBlib.h)
3359 AC_CHECK_HEADERS(io.h)
3361 dnl These are all the places some variant of statfs can be hiding.
3362 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3364 dnl Quota support
3365 AC_CHECK_HEADERS(sys/quota.h)
3366 AC_CHECK_HEADERS(linux/quota.h)
3368 dnl Try for MMX support
3369 dnl NB - later gcc versions require -mmmx for this header to be successfully
3370 dnl included (or another option which implies it, such as -march=pentium-mmx)
3371 AC_CHECK_HEADERS(mmintrin.h)
3373 dnl Check whether the compiler supports the new-style C++ standard
3374 dnl library headers (i.e. <new>) or needs the old "new.h"
3375 AC_LANG_CPLUSPLUS
3376 NEW_H=new.h
3377 AC_CHECK_HEADER(new, [NEW_H=new])
3378 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3379 AC_LANG_C
3381 AC_ARG_ENABLE(dtrace,
3382               [  --enable-dtrace         build with dtrace support if available (default=no)],
3383               [enable_dtrace="yes"],)
3384 if test "x$enable_dtrace" = "xyes"; then
3385   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3386   if test -n "$HAVE_DTRACE"; then
3387       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3388   else
3389       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3390   fi
3392 AC_SUBST(HAVE_DTRACE)
3394 case $target in
3395 *-aix4.3*|*-aix5*)
3396         ;;
3398         AC_CHECK_HEADERS(sys/cdefs.h)
3399         ;;
3400 esac
3402 dnl Checks for libraries.
3403 dnl ========================================================
3404 case $target in
3405 *-hpux11.*)
3406         ;;
3408         AC_CHECK_LIB(c_r, gethostbyname_r)
3409         ;;
3410 esac
3412 dnl We don't want to link with libdl even if it's present on OS X, since
3413 dnl it's not used and not part of the default installation.
3414 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3415 dnl We don't want to link against libm or libpthread on Darwin since
3416 dnl they both are just symlinks to libSystem and explicitly linking
3417 dnl against libSystem causes issues when debugging (see bug 299601).
3418 case $target in
3419 *-darwin*)
3420     ;;
3421 *-beos*)
3422     ;;
3423 *-os2*)
3424     ;;
3426     AC_SEARCH_LIBS(dlopen, dl, 
3427         AC_CHECK_HEADER(dlfcn.h, 
3428         AC_DEFINE(HAVE_DLOPEN)))
3429     ;;
3430 esac
3432 _SAVE_CFLAGS="$CFLAGS"
3433 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3434 AC_CHECK_FUNCS(dladdr)
3435 CFLAGS="$_SAVE_CFLAGS"
3437 if test ! "$GNU_CXX"; then
3439     case $target in
3440     *-aix*)
3441         AC_CHECK_LIB(C_r, demangle)
3442         ;;
3443      *)
3444         AC_CHECK_LIB(C, demangle)
3445         ;;
3446      esac
3449 dnl OS/2 has socket in libc.
3450 case $target in
3451 *-os2*)
3452     ;;
3454     AC_CHECK_LIB(socket, socket)
3455 esac
3457 dnl ========================================================
3458 dnl Check whether we can compile code for Core Text
3459 dnl (available on Mac OS X 10.5 or later)
3460 dnl ========================================================
3461 case "$target" in
3462 *-darwin*)
3463   AC_MSG_CHECKING([for Core Text])
3464   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3465                  [CTLineRef lineRef;],
3466                   ac_cv_have_core_text="yes",
3467                   ac_cv_have_core_text="no")
3468   AC_MSG_RESULT([$ac_cv_have_core_text])
3470   if test "$ac_cv_have_core_text" = "no"; then
3471     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3472   fi
3473   ;;
3474 esac
3476 XLDFLAGS="$X_LIBS"
3477 XLIBS="$X_EXTRA_LIBS"
3479 dnl ========================================================
3480 dnl Checks for X libraries.
3481 dnl Ordering is important.
3482 dnl Xt is dependent upon SM as of X11R6
3483 dnl ========================================================
3484 if test "$no_x" = "yes"; then
3485     AC_DEFINE(NO_X11)
3486 else
3487     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3488         XLIBS="-lX11 $XLIBS"
3489         _SAVE_LDFLAGS="$LDFLAGS"
3490         LDFLAGS="$XLDFLAGS $LDFLAGS"
3491         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3492                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3493         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3494                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3495      
3496         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3497         unset ac_cv_lib_Xt_XtFree
3498             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3499             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3500         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3501                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3502         ])
3504     # AIX needs the motif library linked before libXt to prevent
3505     # crashes in plugins linked against Motif - Bug #98892
3506     case "${target_os}" in
3507     aix*)
3508         XT_LIBS="-lXm $XT_LIBS"
3509         ;;
3510     esac
3512     dnl ========================================================
3513     dnl = Check for XShm
3514     dnl ========================================================
3515     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3516         $XLIBS $XEXT_LIBS)
3517     AC_CHECK_HEADER(X11/extensions/XShm.h)
3518     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3519         test -n "$_HAVE_XSHM_XEXT"; then
3520         AC_DEFINE(HAVE_XSHM)
3521     fi
3523     dnl ========================================================
3524     dnl = Check for Xss
3525     dnl ========================================================
3526     AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
3527         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3528             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3529              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3531     dnl ========================================================
3532     dnl = Check for XIE
3533     dnl ========================================================
3534     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3535         $XLIBS $XEXT_LIBS)
3536     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3538     if test "$MOZ_XIE_LIBS"; then
3539         dnl ====================================================
3540         dnl = If XIE is present and is desired, turn it on
3541         dnl ====================================================
3542         case $target in
3543             *-hpux*)
3544                 ;;
3545             *)
3546                 HAVE_XIE=1
3547                 ;;
3548         esac
3549     fi
3551         LDFLAGS="$_SAVE_LDFLAGS"
3553     dnl ========================================================
3554     dnl = Check for freetype2 and its functionality
3555     dnl ========================================================
3556     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3558     if test "$_HAVE_FREETYPE2"; then
3559         _SAVE_LIBS="$LIBS"
3560         _SAVE_CFLAGS="$CFLAGS"
3561         LIBS="$LIBS $FT2_LIBS"
3562         CFLAGS="$CFLAGS $FT2_CFLAGS"
3564         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3565             ac_cv_member_FT_Bitmap_Size_y_ppem,
3566             [AC_TRY_COMPILE([#include <ft2build.h>
3567                              #include FT_FREETYPE_H],
3568                             [FT_Bitmap_Size s;
3569                              if (sizeof s.y_ppem) return 0;
3570                              return 1],
3571                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3572                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3573         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3574             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3575         else
3576             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3577         fi
3578         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3579                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3580                            [FT_Bitmap_Size structure includes y_ppem field])
3582         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3584         LIBS="$_SAVE_LIBS"
3585         CFLAGS="$_SAVE_CFLAGS"
3586     fi
3588 fi # $no_x
3590 AC_SUBST(XCFLAGS)
3591 AC_SUBST(XLDFLAGS)
3592 AC_SUBST(XLIBS)
3593 AC_SUBST(XEXT_LIBS)
3594 AC_SUBST(XT_LIBS)
3595 AC_SUBST(XSS_LIBS)
3597 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3598 AC_TRY_COMPILE([],
3599                [asm("uqadd8 r1, r1, r2");],
3600                result="yes", result="no")
3601 AC_MSG_RESULT("$result")
3602 if test "$result" = "yes"; then
3603     AC_DEFINE(HAVE_ARM_SIMD)
3604     HAVE_ARM_SIMD=1
3606 AC_SUBST(HAVE_ARM_SIMD)
3608 AC_MSG_CHECKING(for ARM NEON support in compiler)
3609 _SAVE_CFLAGS="$CFLAGS"
3610 if test "$GNU_CC"; then
3611   # gcc needs -mfpu=neon to recognize NEON instructions
3612   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3614 AC_TRY_COMPILE([],
3615                [asm("vadd.i8 d0, d0, d0");],
3616                result="yes", result="no")
3617 AC_MSG_RESULT("$result")
3618 if test "$result" = "yes"; then
3619     AC_DEFINE(HAVE_ARM_NEON)
3620     HAVE_ARM_NEON=1
3622 CFLAGS="$_SAVE_CFLAGS"
3623 AC_SUBST(HAVE_ARM_NEON)
3625 dnl ========================================================
3626 dnl = pthread support
3627 dnl = Start by checking whether the system support pthreads
3628 dnl ========================================================
3629 case "$target_os" in
3630 darwin*)
3631     USE_PTHREADS=1
3632     ;;
3634     MOZ_CHECK_PTHREADS(pthreads,
3635         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3636         MOZ_CHECK_PTHREADS(pthread,
3637             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3638             MOZ_CHECK_PTHREADS(c_r,
3639                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3640                 MOZ_CHECK_PTHREADS(c,
3641                     USE_PTHREADS=1
3642                 )
3643             )
3644         )
3645     )
3646     ;;
3647 esac
3649 dnl ========================================================
3650 dnl Check the command line for --with-pthreads 
3651 dnl ========================================================
3652 MOZ_ARG_WITH_BOOL(pthreads,
3653 [  --with-pthreads         Force use of system pthread library with NSPR ],
3654 [ if test "$USE_PTHREADS"x = x; then
3655     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3656 fi],
3657     USE_PTHREADS=
3658     _PTHREAD_LDFLAGS=
3661 dnl ========================================================
3662 dnl Do the platform specific pthread hackery
3663 dnl ========================================================
3664 if test "$USE_PTHREADS"x != x
3665 then
3666         dnl
3667         dnl See if -pthread is supported.
3668         dnl
3669         rm -f conftest*
3670         ac_cv_have_dash_pthread=no
3671         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3672         echo 'int main() { return 0; }' | cat > conftest.c
3673         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3674         if test $? -eq 0; then
3675                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3676                         ac_cv_have_dash_pthread=yes
3677                 case "$target_os" in
3678                 freebsd*)
3679 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3680                 ;;
3681                 *)
3682                             CFLAGS="$CFLAGS -pthread"
3683                             CXXFLAGS="$CXXFLAGS -pthread"
3684                 ;;
3685                 esac
3686                 fi
3687         fi
3688         rm -f conftest*
3689     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3691         dnl
3692         dnl See if -pthreads is supported.
3693         dnl
3694     ac_cv_have_dash_pthreads=no
3695     if test "$ac_cv_have_dash_pthread" = "no"; then
3696             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3697         echo 'int main() { return 0; }' | cat > conftest.c
3698             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3699         if test $? -eq 0; then
3700                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3701                             ac_cv_have_dash_pthreads=yes
3702                             CFLAGS="$CFLAGS -pthreads"
3703                             CXXFLAGS="$CXXFLAGS -pthreads"
3704                     fi
3705             fi
3706             rm -f conftest*
3707         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3708     fi
3710         case "$target" in
3711             *-*-freebsd*)
3712                         AC_DEFINE(_REENTRANT)
3713                         AC_DEFINE(_THREAD_SAFE)
3714                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3715                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3716                                 _PTHREAD_LDFLAGS="-pthread"
3717                         else
3718                                 _PTHREAD_LDFLAGS="-lc_r"
3719                         fi
3720                         ;;
3722             *-*-openbsd*|*-*-bsdi*)
3723                         AC_DEFINE(_REENTRANT)
3724                         AC_DEFINE(_THREAD_SAFE)
3725                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3726                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3727                 _PTHREAD_LDFLAGS="-pthread"
3728                         fi
3729                         ;;
3731             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3732                         AC_DEFINE(_REENTRANT) 
3733                         ;;
3735             *-*-nto*) 
3736                         AC_DEFINE(_REENTRANT) 
3737                         ;;
3739             *-aix4.3*|*-aix5*)
3740                         AC_DEFINE(_REENTRANT) 
3741                         ;;
3743             *-hpux11.*)
3744                         AC_DEFINE(_REENTRANT) 
3745                         ;;
3747             alpha*-*-osf*)
3748                         AC_DEFINE(_REENTRANT)
3749                         ;;
3751             *-*-solaris*) 
3752                         AC_DEFINE(_REENTRANT)
3753                         if test "$SOLARIS_SUNPRO_CC"; then
3754                                 CFLAGS="$CFLAGS -mt" 
3755                                 CXXFLAGS="$CXXFLAGS -mt" 
3756                         fi
3757                         ;;
3758         esac
3759     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3762 dnl ========================================================
3763 dnl See if mmap sees writes
3764 dnl For cross compiling, just define it as no, which is a safe default
3765 dnl ========================================================
3766 AC_MSG_CHECKING(whether mmap() sees write()s)
3768 changequote(,)
3769 mmap_test_prog='
3770     #include <stdlib.h>
3771     #include <unistd.h>
3772     #include <sys/mman.h>
3773     #include <sys/types.h>
3774     #include <sys/stat.h>
3775     #include <fcntl.h>
3777     char fname[] = "conftest.file";
3778     char zbuff[1024]; /* Fractional page is probably worst case */
3780     int main() {
3781         char *map;
3782         int fd;
3783         int i;
3784         unlink(fname);
3785         fd = open(fname, O_RDWR | O_CREAT, 0660);
3786         if(fd<0) return 1;
3787         unlink(fname);
3788         write(fd, zbuff, sizeof(zbuff));
3789         lseek(fd, 0, SEEK_SET);
3790         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3791         if(map==(char*)-1) return 2;
3792         for(i=0; fname[i]; i++) {
3793             int rc = write(fd, &fname[i], 1);
3794             if(map[i]!=fname[i]) return 4;
3795         }
3796         return 0;
3797     }
3799 changequote([,])
3801 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3803 AC_MSG_RESULT("$result")
3805 if test "$result" = "no"; then
3806     AC_DEFINE(MMAP_MISSES_WRITES)
3810 dnl Checks for library functions.
3811 dnl ========================================================
3812 AC_PROG_GCC_TRADITIONAL
3813 AC_FUNC_MEMCMP
3814 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3815 AC_CHECK_FUNCS(flockfile getpagesize)
3816 AC_CHECK_FUNCS(localtime_r strtok_r)
3818 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3819 _SAVE_LDFLAGS=$LDFLAGS
3820 LDFLAGS="$LDFLAGS -lrt"
3821 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3822                ac_cv_have_clock_monotonic,
3823                [AC_TRY_LINK([#include <time.h>],
3824                             [ struct timespec ts;
3825                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3826                             ac_cv_have_clock_monotonic=yes,
3827                             ac_cv_have_clock_monotonic=no)])
3828 LDFLAGS=$_SAVE_LDFLAGS
3829 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3830     HAVE_CLOCK_MONOTONIC=1
3831     REALTIME_LIBS=-lrt
3832     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3833     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3834     AC_SUBST(REALTIME_LIBS)
3837 dnl check for wcrtomb/mbrtowc
3838 dnl =======================================================================
3839 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3840 AC_LANG_SAVE
3841 AC_LANG_CPLUSPLUS
3842 AC_CACHE_CHECK(for wcrtomb,
3843     ac_cv_have_wcrtomb,
3844     [AC_TRY_LINK([#include <wchar.h>],
3845                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3846                  ac_cv_have_wcrtomb="yes",
3847                  ac_cv_have_wcrtomb="no")])
3848 if test "$ac_cv_have_wcrtomb" = "yes"; then
3849     AC_DEFINE(HAVE_WCRTOMB)
3851 AC_CACHE_CHECK(for mbrtowc,
3852     ac_cv_have_mbrtowc,
3853     [AC_TRY_LINK([#include <wchar.h>],
3854                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3855                  ac_cv_have_mbrtowc="yes",
3856                  ac_cv_have_mbrtowc="no")])
3857 if test "$ac_cv_have_mbrtowc" = "yes"; then
3858     AC_DEFINE(HAVE_MBRTOWC)
3860 AC_LANG_RESTORE
3863 AC_CACHE_CHECK(
3864     [for res_ninit()],
3865     ac_cv_func_res_ninit,
3866     [AC_TRY_LINK([
3867         #ifdef linux
3868         #define _BSD_SOURCE 1
3869         #endif
3870         #include <resolv.h>
3871         ],
3872         [int foo = res_ninit(&_res);],
3873         [ac_cv_func_res_ninit=yes],
3874         [ac_cv_func_res_ninit=no])
3875     ])
3877 if test "$ac_cv_func_res_ninit" = "yes"; then
3878     AC_DEFINE(HAVE_RES_NINIT)
3879 dnl must add the link line we do something as foolish as this... dougt
3880 dnl else
3881 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3882 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3885 AC_LANG_CPLUSPLUS
3886 AC_CACHE_CHECK(
3887     [for gnu_get_libc_version()],
3888     ac_cv_func_gnu_get_libc_version,
3889     [AC_TRY_LINK([
3890         #ifdef HAVE_GNU_LIBC_VERSION_H
3891         #include <gnu/libc-version.h>
3892         #endif
3893         ],
3894         [const char *glibc_version = gnu_get_libc_version();],
3895         [ac_cv_func_gnu_get_libc_version=yes],
3896         [ac_cv_func_gnu_get_libc_version=no] 
3897         )]
3898     )
3900 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3901     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3904 case $target_os in
3905     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3906         ;;
3907     *)
3908     
3909 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3910     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3911         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3912 _SAVE_LIBS=$LIBS
3913 LIBS="$LIBS $_ICONV_LIBS"
3914 AC_CACHE_CHECK(
3915     [for iconv()],
3916     ac_cv_func_iconv,
3917     [AC_TRY_LINK([
3918         #include <stdlib.h>
3919         #include <iconv.h>
3920         ],
3921         [
3922             iconv_t h = iconv_open("", "");
3923             iconv(h, NULL, NULL, NULL, NULL);
3924             iconv_close(h);
3925         ],
3926         [ac_cv_func_iconv=yes],
3927         [ac_cv_func_iconv=no] 
3928         )]
3929     )
3930 if test "$ac_cv_func_iconv" = "yes"; then
3931     AC_DEFINE(HAVE_ICONV)
3932     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3933     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3934     LIBICONV="$_ICONV_LIBS"
3935     AC_CACHE_CHECK(
3936         [for iconv() with const input],
3937         ac_cv_func_const_iconv,
3938         [AC_TRY_COMPILE([
3939             #include <stdlib.h>
3940             #include <iconv.h>
3941             ],
3942             [
3943                 const char *input = "testing";
3944                 iconv_t h = iconv_open("", "");
3945                 iconv(h, &input, NULL, NULL, NULL);
3946                 iconv_close(h);
3947             ],
3948             [ac_cv_func_const_iconv=yes],
3949             [ac_cv_func_const_iconv=no] 
3950             )]
3951         )
3952     if test "$ac_cv_func_const_iconv" = "yes"; then
3953         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3954     fi
3956 LIBS=$_SAVE_LIBS
3958     ;;
3959 esac
3961 AM_LANGINFO_CODESET
3963 AC_LANG_C
3965 dnl **********************
3966 dnl *** va_copy checks ***
3967 dnl **********************
3968 dnl we currently check for all three va_copy possibilities, so we get
3969 dnl all results in config.log for bug reports.
3970 AC_MSG_CHECKING(for an implementation of va_copy())
3971 AC_CACHE_VAL(ac_cv_va_copy,[
3972     AC_TRY_RUN([
3973         #include <stdarg.h>
3974         void f (int i, ...) {
3975             va_list args1, args2;
3976             va_start (args1, i);
3977             va_copy (args2, args1);
3978             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3979                 exit (1);
3980             va_end (args1); va_end (args2);
3981         }
3982         int main() { f (0, 42); return 0; }],
3983         ac_cv_va_copy=yes,
3984         ac_cv_va_copy=no,
3985         ac_cv_va_copy=no
3986     )
3988 AC_MSG_RESULT($ac_cv_va_copy)
3989 AC_MSG_CHECKING(for an implementation of __va_copy())
3990 AC_CACHE_VAL(ac_cv___va_copy,[
3991     AC_TRY_RUN([
3992         #include <stdarg.h>
3993         void f (int i, ...) {
3994             va_list args1, args2;
3995             va_start (args1, i);
3996             __va_copy (args2, args1);
3997             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3998                 exit (1);
3999             va_end (args1); va_end (args2);
4000         }
4001         int main() { f (0, 42); return 0; }],
4002         ac_cv___va_copy=yes,
4003         ac_cv___va_copy=no,
4004         ac_cv___va_copy=no
4005     )
4007 AC_MSG_RESULT($ac_cv___va_copy)
4008 AC_MSG_CHECKING(whether va_lists can be copied by value)
4009 AC_CACHE_VAL(ac_cv_va_val_copy,[
4010     AC_TRY_RUN([
4011         #include <stdarg.h>
4012         void f (int i, ...) {
4013             va_list args1, args2;
4014             va_start (args1, i);
4015             args2 = args1;
4016             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
4017                 exit (1);
4018             va_end (args1); va_end (args2);
4019         }
4020         int main() { f (0, 42); return 0; }],
4021         ac_cv_va_val_copy=yes,
4022         ac_cv_va_val_copy=no,
4023         ac_cv_va_val_copy=yes
4024     )
4026 if test "x$ac_cv_va_copy" = "xyes"; then
4027     AC_DEFINE(VA_COPY, va_copy)
4028     AC_DEFINE(HAVE_VA_COPY)
4029 elif test "x$ac_cv___va_copy" = "xyes"; then
4030     AC_DEFINE(VA_COPY, __va_copy)
4031     AC_DEFINE(HAVE_VA_COPY)
4034 if test "x$ac_cv_va_val_copy" = "xno"; then
4035    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
4037 AC_MSG_RESULT($ac_cv_va_val_copy)
4039 dnl Check for dll-challenged libc's.
4040 dnl This check is apparently only needed for Linux.
4041 case "$target" in
4042         *-linux*)
4043             dnl ===================================================================
4044             _curdir=`pwd`
4045             export _curdir
4046             rm -rf conftest* _conftest
4047             mkdir _conftest
4048             cat >> conftest.C <<\EOF
4049 #include <stdio.h>
4050 #include <link.h>
4051 #include <dlfcn.h>
4052 #ifdef _dl_loaded
4053 void __dump_link_map(void) {
4054   struct link_map *map = _dl_loaded;
4055   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
4057 int main() {
4058   dlopen("./conftest1.so",RTLD_LAZY);
4059   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
4060   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
4061   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
4062   __dump_link_map();
4064 #else
4065 /* _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).*/
4066 int main() { printf("./conftest1.so\n"); }
4067 #endif
4070             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4072             cat >> conftest1.C <<\EOF
4073 #include <stdio.h>
4074 void foo(void) {printf("foo in dll called\n");}
4076             ${CXX-g++} -fPIC -c -g conftest1.C
4077             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4078             ${CXX-g++} -g conftest.C -o conftest -ldl
4079             cp -f conftest1.so conftest _conftest
4080             cd _conftest
4081             if test `./conftest | grep conftest1.so | wc -l` -gt 1
4082             then
4083                 echo
4084                 echo "*** Your libc has a bug that can result in loading the same dynamic"
4085                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
4086                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
4087                 echo "*** will be excessive memory usage at runtime."
4088                 echo
4089             fi
4090             cd ${_curdir}
4091             rm -rf conftest* _conftest
4092             dnl ===================================================================
4093             ;;
4094 esac
4096 dnl ===================================================================
4097 dnl ========================================================
4098 dnl Put your C++ language/feature checks below
4099 dnl ========================================================
4100 AC_LANG_CPLUSPLUS
4102 ARM_ABI_PREFIX=
4103 HAVE_GCC3_ABI=
4104 if test "$GNU_CC"; then
4105   if test "$CPU_ARCH" = "arm" ; then
4106     AC_CACHE_CHECK(for ARM EABI,
4107         ac_cv_gcc_arm_eabi,
4108         [AC_TRY_COMPILE([],
4109                         [
4110 #if defined(__ARM_EABI__)
4111   return 0;
4112 #else
4113 #error Not ARM EABI.
4114 #endif
4115                         ],
4116                         ac_cv_gcc_arm_eabi="yes",
4117                         ac_cv_gcc_arm_eabi="no")])
4118     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4119         HAVE_ARM_EABI=1
4120         ARM_ABI_PREFIX=eabi-
4121     else
4122         ARM_ABI_PREFIX=oabi-
4123     fi
4124   fi
4126   AC_CACHE_CHECK(for gcc 3.0 ABI,
4127       ac_cv_gcc_three_abi,
4128       [AC_TRY_COMPILE([],
4129                       [
4130 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4131   return 0;
4132 #else
4133 #error Not gcc3.
4134 #endif
4135                       ],
4136                       ac_cv_gcc_three_abi="yes",
4137                       ac_cv_gcc_three_abi="no")])
4138   if test "$ac_cv_gcc_three_abi" = "yes"; then
4139       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4140       HAVE_GCC3_ABI=1
4141   else
4142       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4143   fi
4145 AC_SUBST(HAVE_GCC3_ABI)
4148 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4149                ac_cv_cpp_explicit,
4150                [AC_TRY_COMPILE(class X {
4151                                public: explicit X(int i) : i_(i) {}
4152                                private: int i_;
4153                                };,
4154                                X x(3);,
4155                                ac_cv_cpp_explicit=yes,
4156                                ac_cv_cpp_explicit=no)])
4157 if test "$ac_cv_cpp_explicit" = yes ; then
4158    AC_DEFINE(HAVE_CPP_EXPLICIT)
4161 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4162                ac_cv_cpp_typename,
4163                [AC_TRY_COMPILE(class param {
4164                                public:
4165                                    typedef unsigned long num_type;
4166                                };
4168                                template <class T> class tplt {
4169                                public:
4170                                    typedef typename T::num_type t_num_type;
4171                                    t_num_type foo(typename T::num_type num) {
4172                                        return num;
4173                                    }
4174                                };,
4175                                tplt<param> A;
4176                                A.foo(0);,
4177                                ac_cv_cpp_typename=yes,
4178                                ac_cv_cpp_typename=no)])
4179 if test "$ac_cv_cpp_typename" = yes ; then
4180    AC_DEFINE(HAVE_CPP_TYPENAME)
4183 dnl Check for support of modern template specialization syntax
4184 dnl Test code and requirement from scc@netscape.com.
4185 dnl Autoconf cut-and-paste job by waterson@netscape.com
4186 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4187                ac_cv_cpp_modern_specialize_template_syntax,
4188                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4189                                class Y {};
4190                                template <> struct X<Y> { double a; };,
4191                                X<int> int_x;
4192                                X<Y> y_x;,
4193                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4194                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4195 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4196   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4200 dnl Some compilers support only full specialization, and some don't.
4201 AC_CACHE_CHECK(whether partial template specialization works,
4202                ac_cv_cpp_partial_specialization,
4203                [AC_TRY_COMPILE(template <class T> class Foo {};
4204                                template <class T> class Foo<T*> {};,
4205                                return 0;,
4206                                ac_cv_cpp_partial_specialization=yes,
4207                                ac_cv_cpp_partial_specialization=no)])
4208 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4209   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4212 dnl Some compilers have limited support for operators with templates;
4213 dnl specifically, it is necessary to define derived operators when a base
4214 dnl class's operator declaration should suffice.
4215 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4216                ac_cv_need_derived_template_operators,
4217                [AC_TRY_COMPILE([template <class T> class Base { };
4218                                 template <class T>
4219                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4220                                 template <class T> class Derived : public Base<T> { };],
4221                                [Derived<char> a, b;
4222                                 Base<char> c = a + b;
4223                                 return 0;],
4224                                ac_cv_need_derived_template_operators=no,
4225                                ac_cv_need_derived_template_operators=yes)])
4226 if test "$ac_cv_need_derived_template_operators" = yes ; then
4227   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4231 dnl Some compilers have trouble detecting that a template class
4232 dnl that derives from another template is actually an instance
4233 dnl of the base class. This test checks for that.
4234 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4235                ac_cv_need_cpp_template_cast_to_base,
4236                [AC_TRY_COMPILE([template <class T> class Base { };
4237                                 template <class T> class Derived : public Base<T> { };
4238                                 template <class T> int foo(const Base<T>&) { return 0; }],
4239                                [Derived<char> bar; return foo(bar);],
4240                                ac_cv_need_cpp_template_cast_to_base=no,
4241                                ac_cv_need_cpp_template_cast_to_base=yes)])
4242 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4243   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4246 dnl Some compilers have trouble resolving the ambiguity between two
4247 dnl functions whose arguments differ only by cv-qualifications.
4248 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4249                ac_cv_can_resolve_const_ambiguity,
4250                [AC_TRY_COMPILE([
4251                                 template <class T> class ptrClass {
4252                                   public: T* ptr;
4253                                 };
4255                                 template <class T> T* a(ptrClass<T> *arg) {
4256                                   return arg->ptr;
4257                                 }
4259                                 template <class T>
4260                                 const T* a(const ptrClass<T> *arg) {
4261                                   return arg->ptr;
4262                                 }
4263                                ],
4264                                [ ptrClass<int> i;
4265                                  a(&i); ],
4266                                ac_cv_can_resolve_const_ambiguity=yes,
4267                                ac_cv_can_resolve_const_ambiguity=no)])
4268 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4269   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4273 dnl We don't do exceptions on unix.  The only reason this used to be here
4274 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4275 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4276 dnl So im commenting this out until someone writes some artificial 
4277 dnl intelligence to detect not only if the compiler has exceptions, but if 
4278 dnl they are enabled as well.
4279 dnl 
4280 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4281 dnl                ac_cv_cpp_exceptions,
4282 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4283 dnl                                static void F() { throw X(); },
4284 dnl                                try { F(); } catch(X & e) { },
4285 dnl                                ac_cv_cpp_exceptions=yes,
4286 dnl                                ac_cv_cpp_exceptions=no)])
4287 dnl if test $ac_cv_cpp_exceptions = yes ; then
4288 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4289 dnl fi
4291 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4292 dnl supports it well enough to allow us to use it to change access, but not
4293 dnl to resolve ambiguity. The next two tests determine how well the |using|
4294 dnl keyword is supported.
4296 dnl Check to see if we can change access with |using|.  Test both a
4297 dnl legal and an illegal example.
4298 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4299                ac_cv_cpp_access_changing_using2,
4300                [AC_TRY_COMPILE(
4301                    class A { protected: int foo() { return 0; } };
4302                    class B : public A { public: using A::foo; };,
4303                    B b; return b.foo();,
4304                    [AC_TRY_COMPILE(
4305                        class A { public: int foo() { return 1; } };
4306                        class B : public A { private: using A::foo; };,
4307                        B b; return b.foo();,
4308                        ac_cv_cpp_access_changing_using2=no,
4309                        ac_cv_cpp_access_changing_using2=yes)],
4310                    ac_cv_cpp_access_changing_using2=no)])
4311 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4312    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4315 dnl Check to see if we can resolve ambiguity with |using|.
4316 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4317                ac_cv_cpp_ambiguity_resolving_using,
4318                [AC_TRY_COMPILE(class X { 
4319                                  public: int go(const X&) {return 3;}
4320                                          int jo(const X&) {return 3;}
4321                                };
4322                                class Y : public X {
4323                                  public:  int go(int) {return 2;}
4324                                           int jo(int) {return 2;}
4325                                           using X::jo;
4326                                  private: using X::go;
4327                                };,
4328                                X x; Y y; y.jo(x);,
4329                                ac_cv_cpp_ambiguity_resolving_using=yes,
4330                                ac_cv_cpp_ambiguity_resolving_using=no)])
4331 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4332    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4335 dnl Check to see if the |std| namespace is supported. If so, we'll want
4336 dnl to qualify any standard library calls with "std::" to ensure that
4337 dnl those functions can be resolved.
4338 AC_CACHE_CHECK(for \"std::\" namespace,
4339                ac_cv_cpp_namespace_std,
4340                [AC_TRY_COMPILE([#include <algorithm>],
4341                                [return std::min(0, 1);],
4342                                ac_cv_cpp_namespace_std=yes,
4343                                ac_cv_cpp_namespace_std=no)])
4344 if test "$ac_cv_cpp_namespace_std" = yes ; then
4345    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4348 dnl Older compilers are overly ambitious with respect to using the standard
4349 dnl template library's |operator!=()| when |operator==()| is defined. In
4350 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4351 dnl ambiguity at compile-time. This test checks for that case.
4352 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4353                ac_cv_cpp_unambiguous_std_notequal,
4354                [AC_TRY_COMPILE([#include <algorithm>
4355                                 struct T1 {};
4356                                 int operator==(const T1&, const T1&) { return 0; }
4357                                 int operator!=(const T1&, const T1&) { return 0; }],
4358                                [T1 a,b; return a != b;],
4359                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4360                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4361 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4362   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4366 AC_CACHE_CHECK(for C++ reinterpret_cast,
4367                ac_cv_cpp_reinterpret_cast,
4368                [AC_TRY_COMPILE(struct X { int i; };
4369                                struct Y { int i; };,
4370                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4371                                ac_cv_cpp_reinterpret_cast=yes,
4372                                ac_cv_cpp_reinterpret_cast=no)])
4373 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4374    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4377 dnl See if a dynamic_cast to void* gives the most derived object.
4378 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4379                ac_cv_cpp_dynamic_cast_void_ptr,
4380                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4381                             class Y { int j; public: virtual ~Y() { } };
4382                             class Z : public X, public Y { int k; };
4384                             int main() {
4385                                  Z mdo;
4386                                  X *subx = (X*)&mdo;
4387                                  Y *suby = (Y*)&mdo;
4388                                  return !((((void*)&mdo != (void*)subx) &&
4389                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4390                                           (((void*)&mdo != (void*)suby) &&
4391                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4392                             }],
4393                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4394                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4395                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4396 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4397    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4401 dnl note that this one is reversed - if the test fails, then
4402 dnl we require implementations of unused virtual methods. Which
4403 dnl really blows because it means we'll have useless vtable
4404 dnl bloat.
4405 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4406                ac_cv_cpp_unused_required,
4407                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4408                                X x;,
4409                                ac_cv_cpp_unused_required=no,
4410                                ac_cv_cpp_unused_required=yes)])
4411 if test "$ac_cv_cpp_unused_required" = yes ; then
4412    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4416 dnl Some compilers have trouble comparing a constant reference to a templatized
4417 dnl class to zero, and require an explicit operator==() to be defined that takes
4418 dnl an int. This test separates the strong from the weak.
4420 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4421                ac_cv_trouble_comparing_to_zero,
4422                [AC_TRY_COMPILE([#include <algorithm>
4423                                 template <class T> class Foo {};
4424                                 class T2;
4425                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4426                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4427                                [Foo<int> f; return (0 != f);],
4428                                ac_cv_trouble_comparing_to_zero=no,
4429                                ac_cv_trouble_comparing_to_zero=yes)])
4430 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4431   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4434 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4435 _SAVE_LDFLAGS=$LDFLAGS
4436 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4437 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4438                ac_cv_thread_keyword,
4439                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4440                             [return tlsIsMainThread;],
4441                             ac_cv_thread_keyword=yes,
4442                             ac_cv_thread_keyword=no)])
4443 LDFLAGS=$_SAVE_LDFLAGS
4444 if test "$ac_cv_thread_keyword" = yes; then
4445   # mips builds fail with TLS variables because of a binutils bug.
4446   # See bug 528687
4447   case "${target}" in
4448     mips*-*)
4449       :
4450       ;;
4451     *-android*)
4452       :
4453       ;;
4454     *)
4455       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4456       ;;
4457   esac
4460 dnl Check for the existence of various allocation headers/functions
4462 MALLOC_H=
4463 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4464 if test "$MALLOC_H" = ""; then
4465   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4466   if test "$MALLOC_H" = ""; then
4467     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4468   fi
4470 if test "$MALLOC_H" != ""; then
4471    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4474 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4475 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4477 dnl See if compiler supports some gcc-style attributes
4479 AC_CACHE_CHECK(for __attribute__((always_inline)),
4480                ac_cv_attribute_always_inline,
4481                [AC_TRY_COMPILE([],
4482                                [inline void f(void) __attribute__((always_inline));],
4483                                ac_cv_attribute_always_inline=yes,
4484                                ac_cv_attribute_always_inline=no)])
4486 AC_CACHE_CHECK(for __attribute__((malloc)),
4487                ac_cv_attribute_malloc,
4488                [AC_TRY_COMPILE([],
4489                                [void* f(int) __attribute__((malloc));],
4490                                ac_cv_attribute_malloc=yes,
4491                                ac_cv_attribute_malloc=no)])
4493 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4494                ac_cv_attribute_warn_unused,
4495                [AC_TRY_COMPILE([],
4496                                [int f(void) __attribute__((warn_unused_result));],
4497                                ac_cv_attribute_warn_unused=yes,
4498                                ac_cv_attribute_warn_unused=no)])
4500 AC_CACHE_CHECK(for __attribute__((noreturn)),
4501                ac_cv_attribute_noreturn,
4502                [AC_TRY_COMPILE([],
4503                                [void f(void) __attribute__((noreturn));],
4504                                ac_cv_attribute_noreturn=yes,
4505                                ac_cv_attribute_noreturn=no)])
4507 dnl End of C++ language/feature checks
4508 AC_LANG_C
4510 dnl ========================================================
4511 dnl =  Internationalization checks
4512 dnl ========================================================
4514 dnl Internationalization and Locale support is different
4515 dnl on various UNIX platforms.  Checks for specific i18n
4516 dnl features go here.
4518 dnl check for LC_MESSAGES
4519 AC_CACHE_CHECK(for LC_MESSAGES,
4520                 ac_cv_i18n_lc_messages,
4521                 [AC_TRY_COMPILE([#include <locale.h>],
4522                                 [int category = LC_MESSAGES;],
4523                                 ac_cv_i18n_lc_messages=yes,
4524                                 ac_cv_i18n_lc_messages=no)])
4525 if test "$ac_cv_i18n_lc_messages" = yes; then
4526    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4529 AC_HAVE_FUNCS(localeconv)
4531 fi # SKIP_COMPILER_CHECKS
4533 TARGET_XPCOM_ABI=
4534 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4535     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4538 dnl Mozilla specific options
4539 dnl ========================================================
4540 dnl The macros used for command line options
4541 dnl are defined in build/autoconf/altoptions.m4.
4543 dnl If the compiler supports these attributes, define them as
4544 dnl convenience macros.
4545 if test "$ac_cv_attribute_always_inline" = yes ; then
4546   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4547 else
4548   AC_DEFINE(NS_ALWAYS_INLINE,)
4551 if test "$ac_cv_attribute_malloc" = yes ; then
4552   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4553 else
4554   AC_DEFINE(NS_ATTR_MALLOC,)
4557 if test "$ac_cv_attribute_warn_unused" = yes ; then
4558   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4559 else
4560   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4563 if test "$ac_cv_attribute_noreturn" = yes ; then
4564   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4565 else
4566   AC_DEFINE(NS_NORETURN,)
4569 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4570 dnl features that Windows actually does support.
4572 if test -n "$SKIP_COMPILER_CHECKS"; then
4573    dnl Windows has malloc.h
4574    AC_DEFINE(MALLOC_H, [<malloc.h>])
4575    AC_DEFINE(HAVE_FORCEINLINE)
4576    AC_DEFINE(HAVE_LOCALECONV)
4577 fi # SKIP_COMPILER_CHECKS
4579 dnl ========================================================
4580 dnl =
4581 dnl = Check for external package dependencies
4582 dnl =
4583 dnl ========================================================
4584 MOZ_ARG_HEADER(External Packages)
4586 MOZ_ENABLE_LIBXUL=1
4588 MOZ_ARG_WITH_STRING(libxul-sdk,
4589 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4590   LIBXUL_SDK_DIR=$withval)
4592 if test "$LIBXUL_SDK_DIR" = "yes"; then
4593     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4594 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4595     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4597     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4598         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4599     fi
4601     MOZ_ENABLE_LIBXUL=1
4603 AC_SUBST(LIBXUL_SDK)
4605 if test -n "$LIBXUL_SDK"; then
4606     LIBXUL_DIST="$LIBXUL_SDK"
4607 else
4608     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4610 AC_SUBST(LIBXUL_DIST)
4612 SYSTEM_LIBXUL=
4614 MOZ_ARG_WITH_BOOL(system-libxul,
4615 [  --with-system-libxul    Use system installed libxul SDK],
4616     SYSTEM_LIBXUL=1)
4618 if test -n "$SYSTEM_LIBXUL" -a -z "$MOZ_ENABLE_LIBXUL"; then
4619     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4622 dnl ========================================================
4623 dnl = If NSPR was not detected in the system, 
4624 dnl = use the one in the source tree (mozilla/nsprpub)
4625 dnl ========================================================
4626 MOZ_ARG_WITH_BOOL(system-nspr,
4627 [  --with-system-nspr      Use system installed NSPR],
4628     _USE_SYSTEM_NSPR=1 )
4630 if test -n "$_USE_SYSTEM_NSPR"; then
4631     AM_PATH_NSPR(4.8.7, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
4634 if test -n "$MOZ_NATIVE_NSPR"; then
4635     _SAVE_CFLAGS=$CFLAGS
4636     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4637     AC_TRY_COMPILE([#include "prtypes.h"],
4638                 [#ifndef PR_STATIC_ASSERT
4639                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4640                  #endif],
4641                 [MOZ_NATIVE_NSPR=1],
4642                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4643     CFLAGS=$_SAVE_CFLAGS
4644 else
4645     if test "$OS_ARCH" = "WINCE"; then
4646         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4647         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4648     elif test "$OS_ARCH" = "WINNT"; then
4649         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4650         if test -n "$GNU_CC"; then
4651             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4652         else
4653             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4654         fi
4655     else
4656         NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4657         NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4658     fi
4661 dnl system libevent Support
4662 dnl ========================================================
4663 MOZ_ARG_WITH_STRING(system-libevent,
4664 [  --with-system-libevent=[PFX]
4665                           Use system libevent [installed at prefix PFX]],
4666     LIBEVENT_DIR=$withval)
4668 _SAVE_CFLAGS=$CFLAGS
4669 _SAVE_LDFLAGS=$LDFLAGS
4670 _SAVE_LIBS=$LIBS
4671 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4672     MOZ_NATIVE_LIBEVENT=
4673 else
4674     if test "${LIBEVENT_DIR}" = "yes"; then
4675         LIBEVENT_DIR=/usr
4676     fi
4677     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4678     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4679     AC_CHECK_HEADER(event.h,
4680                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4681                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4682                      fi],
4683                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4684     AC_CHECK_LIB(event, event_init,
4685                  [MOZ_NATIVE_LIBEVENT=1
4686                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4687                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4688                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4690 CFLAGS=$_SAVE_CFLAGS
4691 LDFLAGS=$_SAVE_LDFLAGS
4692 LIBS=$_SAVE_LIBS
4694 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4695 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4696 AC_SUBST(MOZ_LIBEVENT_LIBS)
4698 dnl ========================================================
4699 dnl = If NSS was not detected in the system, 
4700 dnl = use the one in the source tree (mozilla/security/nss)
4701 dnl ========================================================
4703 MOZ_ARG_WITH_BOOL(system-nss,
4704 [  --with-system-nss       Use system installed NSS],
4705     _USE_SYSTEM_NSS=1 )
4707 if test -n "$_USE_SYSTEM_NSS"; then
4708     AM_PATH_NSS(3.12.9, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
4711 if test -n "$MOZ_NATIVE_NSS"; then
4712    NSS_LIBS="$NSS_LIBS -lcrmf"
4713 else
4714    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4715    NSS_DEP_LIBS="\
4716         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4717         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4718         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4719         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4720         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4722    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4723        NSS_LIBS="\
4724         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4725         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4726         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4727         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4728         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4729    else
4730        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4731    fi
4734 dnl ======================
4735 dnl Detect yasm
4736 dnl ======================
4738 AC_MSG_CHECKING([for YASM assembler])
4739 AC_CHECK_PROGS(YASM, yasm, "")
4741 if test -n "$YASM"; then
4742   dnl Pull out yasm's version string
4743   changequote(,)
4744   _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
4745   changequote([,])
4747   YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4748   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4749   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4750   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4751   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4754 if test -z "$SKIP_LIBRARY_CHECKS"; then
4755 dnl system JPEG support
4756 dnl ========================================================
4757 MOZ_ARG_WITH_STRING(system-jpeg,
4758 [  --with-system-jpeg[=PFX]
4759                           Use system libjpeg [installed at prefix PFX]],
4760     JPEG_DIR=$withval)
4762 _SAVE_CFLAGS=$CFLAGS
4763 _SAVE_LDFLAGS=$LDFLAGS
4764 _SAVE_LIBS=$LIBS
4765 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4766     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4767     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4769 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4770     SYSTEM_JPEG=
4771 else
4772     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4775 if test "$SYSTEM_JPEG" = 1; then
4776     LIBS="$JPEG_LIBS $LIBS"
4777     AC_TRY_COMPILE([ #include <stdio.h>
4778                      #include <sys/types.h>
4779                      #include <jpeglib.h> ],
4780                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4781                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4782                      #endif ],
4783                    SYSTEM_JPEG=1,
4784                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4785 fi 
4786 CFLAGS=$_SAVE_CFLAGS
4787 LDFLAGS=$_SAVE_LDFLAGS
4788 LIBS=$_SAVE_LIBS
4790 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4791     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4792     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4795 dnl system ZLIB support
4796 dnl ========================================================
4797 MOZ_ARG_WITH_STRING(system-zlib,
4798 [  --with-system-zlib[=PFX]
4799                           Use system libz [installed at prefix PFX]],
4800     ZLIB_DIR=$withval)
4802 _SAVE_CFLAGS=$CFLAGS
4803 _SAVE_LDFLAGS=$LDFLAGS
4804 _SAVE_LIBS=$LIBS
4805 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4806     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4807     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4809 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4810     SYSTEM_ZLIB=
4811 else
4812     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4813         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4815 if test "$SYSTEM_ZLIB" = 1; then
4816     LIBS="$ZLIB_LIBS $LIBS"
4817     AC_TRY_COMPILE([ #include <stdio.h>
4818                      #include <string.h>
4819                      #include <zlib.h> ],
4820                    [ #if ZLIB_VERNUM < $MOZZLIB 
4821                      #error "Insufficient zlib version ($MOZZLIB required)."
4822                      #endif ],
4823                    SYSTEM_ZLIB=1,
4824                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4826 CFLAGS=$_SAVE_CFLAGS
4827 LDFLAGS=$_SAVE_LDFLAGS
4828 LIBS=$_SAVE_LIBS
4830 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4831     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4832     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4835 dnl system BZIP2 Support
4836 dnl ========================================================
4837 MOZ_ARG_WITH_STRING(system-bz2,
4838 [  --with-system-bz2[=PFX]
4839                           Use system libbz2 [installed at prefix PFX]],
4840     BZ2_DIR=$withval)
4842 _SAVE_CFLAGS=$CFLAGS
4843 _SAVE_LDFLAGS=$LDFLAGS
4844 _SAVE_LIBS=$LIBS
4845 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4846     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4847     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4849 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4850     SYSTEM_BZ2=
4851 else
4852     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4853         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4855 CFLAGS=$_SAVE_CFLAGS
4856 LDFLAGS=$_SAVE_LDFLAGS
4857 LIBS=$_SAVE_LIBS
4859 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4860     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4861     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4864 dnl system PNG Support
4865 dnl ========================================================
4866 MOZ_ARG_WITH_STRING(system-png, 
4867 [  --with-system-png[=PFX]
4868                           Use system libpng [installed at prefix PFX]],
4869     PNG_DIR=$withval)
4871 _SAVE_CFLAGS=$CFLAGS
4872 _SAVE_LDFLAGS=$LDFLAGS
4873 _SAVE_LIBS=$LIBS
4874 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4875 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4876 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4877     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4878     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4880 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4881     SYSTEM_PNG=
4882 else
4883     _SAVE_PNG_LIBS=$PNG_LIBS
4884     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4885                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4886                  $PNG_LIBS)
4887     AC_CHECK_LIB(png, png_get_acTL, ,
4888                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4889                  $_SAVE_PNG_LIBS)
4891 if test "$SYSTEM_PNG" = 1; then
4892     LIBS="$PNG_LIBS $LIBS"
4893     AC_TRY_COMPILE([ #include <stdio.h>
4894                      #include <sys/types.h>
4895                      #include <png.h> ],
4896                    [ #if PNG_LIBPNG_VER < $MOZPNG
4897                      #error "Insufficient libpng version ($MOZPNG required)."
4898                      #endif
4899                      #ifndef PNG_UINT_31_MAX
4900                      #error "Insufficient libpng version."
4901                      #endif ],
4902                    SYSTEM_PNG=1,
4903                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4905 CFLAGS=$_SAVE_CFLAGS
4906 LDFLAGS=$_SAVE_LDFLAGS
4907 LIBS=$_SAVE_LIBS
4909 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4910     PNG_CFLAGS="-I${PNG_DIR}/include"
4911     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4914 fi # SKIP_LIBRARY_CHECKS
4916 dnl system HunSpell Support
4917 dnl ========================================================
4918 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4919 [  --enable-system-hunspell
4920                           Use system hunspell (located with pkgconfig)],
4921     SYSTEM_HUNSPELL=1 )
4923 if test -n "$SYSTEM_HUNSPELL"; then
4924     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4927 AC_SUBST(SYSTEM_HUNSPELL)
4929 dnl ========================================================
4930 dnl Java SDK support
4931 dnl ========================================================
4932 JAVA_INCLUDE_PATH=
4933 MOZ_ARG_WITH_STRING(java-include-path,
4934 [  --with-java-include-path=dir
4935                           Location of Java SDK headers],
4936     JAVA_INCLUDE_PATH=$withval)
4938 JAVA_BIN_PATH=
4939 MOZ_ARG_WITH_STRING(java-bin-path,
4940 [  --with-java-bin-path=dir
4941                           Location of Java binaries (java, javac, jar)],
4942     JAVA_BIN_PATH=$withval)
4944 dnl ========================================================
4945 dnl =
4946 dnl = Application
4947 dnl =
4948 dnl ========================================================
4950 MOZ_ARG_HEADER(Application)
4952 BUILD_STATIC_LIBS=
4953 ENABLE_TESTS=1
4954 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4955 MOZ_BRANDING_DIRECTORY=
4956 MOZ_OFFICIAL_BRANDING=
4957 MOZ_FEEDS=1
4958 MOZ_INSTALLER=1
4959 MOZ_IPC=1
4960 MOZ_JAVAXPCOM=
4961 MOZ_JSDEBUGGER=1
4962 MOZ_JSLOADER=1
4963 MOZ_MATHML=1
4964 MOZ_MORK=
4965 MOZ_MORKREADER=1
4966 MOZ_AUTH_EXTENSION=1
4967 MOZ_NO_ACTIVEX_SUPPORT=1
4968 MOZ_NO_FAST_LOAD=
4969 MOZ_OGG=1
4970 MOZ_RAW=
4971 MOZ_SYDNEYAUDIO=
4972 MOZ_VORBIS=
4973 MOZ_TREMOR=
4974 MOZ_WAVE=1
4975 MOZ_MEDIA=
4976 MOZ_WEBM=1
4977 VPX_AS=
4978 VPX_ASFLAGS=
4979 VPX_AS_DASH_C_FLAG=
4980 VPX_AS_CONVERSION=
4981 VPX_ASM_SUFFIX=
4982 VPX_X86_ASM=
4983 VPX_ARM_ASM=
4984 MOZ_PANGO=1
4985 MOZ_PERMISSIONS=1
4986 MOZ_PLACES=1
4987 MOZ_PLAINTEXT_EDITOR_ONLY=
4988 MOZ_PLUGINS=1
4989 MOZ_PREF_EXTENSIONS=1
4990 MOZ_PROFILELOCKING=1
4991 MOZ_PSM=1
4992 MOZ_RDF=1
4993 MOZ_REFLOW_PERF=
4994 MOZ_SAFE_BROWSING=
4995 MOZ_FASTSTART=
4996 MOZ_HELP_VIEWER=
4997 MOZ_SPELLCHECK=1
4998 MOZ_SPLASHSCREEN=
4999 MOZ_STORAGE=1
5000 MOZ_SVG=1
5001 MOZ_THUMB2=
5002 MOZ_TIMELINE=
5003 MOZ_TOOLKIT_SEARCH=1
5004 MOZ_UI_LOCALE=en-US
5005 MOZ_UNIVERSALCHARDET=1
5006 MOZ_URL_CLASSIFIER=
5007 MOZ_USE_NATIVE_UCONV=
5008 MOZ_VIEW_SOURCE=1
5009 MOZ_XSLT_STANDALONE=
5010 MOZ_XTF=1
5011 MOZ_XUL=1
5012 MOZ_ZIPWRITER=1
5013 NS_PRINTING=1
5014 MOZ_PDF_PRINTING=
5015 MOZ_DISABLE_DOMCRYPTO=
5016 NSS_DISABLE_DBM=
5017 NECKO_WIFI=1
5018 NECKO_COOKIES=1
5019 NECKO_DISK_CACHE=1
5020 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource wyciwyg"
5021 USE_ARM_KUSER=
5022 BUILD_CTYPES=1
5023 XPC_IDISPATCH_SUPPORT=
5026 case "${target}" in
5027 *android*|*darwin*|*wince*|*winmo*)
5028     ACCESSIBILITY=
5029     ;;
5031     ACCESSIBILITY=1
5032     ;;
5033 esac
5035 case "$target_os" in
5036     msvc*|mks*|cygwin*|mingw*)
5037         NS_ENABLE_TSF=1
5038         if test -z "$GNU_CC"; then 
5039             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
5040                 NS_ENABLE_TSF=
5041             fi
5042         fi
5043         if test -n "$NS_ENABLE_TSF"; then
5044             AC_DEFINE(NS_ENABLE_TSF)
5045         fi
5046         ;;
5047 esac
5049 case "${target}" in
5050     arm-android-eabi)
5051         NSS_DISABLE_DBM=1
5052         USE_ARM_KUSER=1
5053         MOZ_INSTALLER=
5054         NECKO_WIFI=
5055         MOZ_THUMB2=1
5056         MOZ_THEME_FASTSTRIPE=1
5057         MOZ_TREE_FREETYPE=1
5058         MOZ_MEMORY=1
5059         ;;
5060 esac
5062 MOZ_ARG_ENABLE_STRING(application,
5063 [  --enable-application=APP
5064                           Options include:
5065                             browser (Firefox)
5066                             xulrunner
5067                             content/xslt (Standalone Transformiix XSLT)
5068                             netwerk (Standalone Necko)
5069                             tools/update-packaging (AUS-related packaging tools)
5070                             standalone (use this for standalone
5071                               xpcom/xpconnect or to manually drive a build)],
5072 [ MOZ_BUILD_APP=$enableval ] )
5074 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5075 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
5076   XULRUNNER_STUB_NAME=$withval)
5078 if test -z "$XULRUNNER_STUB_NAME"; then
5079   case "$target_os" in
5080   darwin*)
5081     XULRUNNER_STUB_NAME=xulrunner
5082     ;;
5083   *)
5084     XULRUNNER_STUB_NAME=xulrunner-stub
5085   esac
5087 AC_SUBST(XULRUNNER_STUB_NAME)
5089 if test -z "$MOZ_BUILD_APP"; then
5090   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5091 else
5092   # We have a valid application only if it has a build.mk file in its top
5093   # directory.
5094   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5095     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5096   fi
5099 # Allow the application to influence configure with a confvars.sh script.
5101 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5102 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5103   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5104   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5105 else
5106   AC_MSG_RESULT([no])
5109 # Now is a good time to test for logic errors, define mismatches, etc.
5110 case "$MOZ_BUILD_APP" in
5111 xulrunner)
5112   if test "$LIBXUL_SDK"; then
5113     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5114   fi
5115   ;;
5116 esac
5118 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5119 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5120 # MOZ_BUILD_APP.
5121 case "$MOZ_BUILD_APP" in
5122 browser)
5123   AC_DEFINE(MOZ_PHOENIX)
5124   ;;
5126 xulrunner)
5127   AC_DEFINE(MOZ_XULRUNNER)
5128   ;;
5130 content/xslt)
5131   AC_DEFINE(TX_EXE)
5132   ;;
5134 standalone) 
5135   MOZ_APP_NAME=mozilla
5136   MOZ_APP_DISPLAYNAME=Mozilla
5137   MOZ_APP_VERSION=$MOZILLA_VERSION
5138   ;;
5140 esac
5142 AC_SUBST(MOZ_BUILD_APP)
5143 AC_SUBST(MOZ_PHOENIX)
5144 AC_SUBST(MOZ_XULRUNNER)
5146 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5148 dnl ========================================================
5149 dnl = 
5150 dnl = Toolkit Options
5151 dnl = 
5152 dnl ========================================================
5153 MOZ_ARG_HEADER(Toolkit Options)
5155     dnl ========================================================
5156     dnl = Select the default toolkit
5157     dnl ========================================================
5158         MOZ_ARG_ENABLE_STRING(default-toolkit,
5159         [  --enable-default-toolkit=TK
5160                           Select default toolkit
5161                           Platform specific defaults:
5162                             BeOS - cairo-beos
5163                             Mac OS X - cairo-cocoa
5164                             Neutrino/QNX - photon
5165                             OS/2 - cairo-os2
5166                             Win32/WinCE - cairo-windows
5167                             Gtk2 with DirectFB - cairo-gtk2-dfb
5168                             * - cairo-gtk2
5169                             * - cairo-qt],
5170     [ _DEFAULT_TOOLKIT=$enableval ],
5171     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5173     if test "$_DEFAULT_TOOLKIT" = "photon" \
5174         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5175         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5176         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5177         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5178         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5179         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5180         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5181         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5182         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5183     then
5184         dnl nglayout only supports building with one toolkit,
5185         dnl so ignore everything after the first comma (",").
5186         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5187     else
5188         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5189     fi
5191 dnl ========================================================
5192 dnl = Enable the toolkit as needed                         =
5193 dnl ========================================================
5195 case "$MOZ_WIDGET_TOOLKIT" in
5196 photon)
5197         MOZ_ENABLE_PHOTON=1
5198         AC_DEFINE(MOZ_WIDGET_PHOTON)
5199     ;;
5201 cairo-windows)
5202     MOZ_WIDGET_TOOLKIT=windows
5203     MOZ_WEBGL=1
5204     case "${target}" in
5205     *-wince*)
5206         NS_PRINTING=
5207         ;;
5208     esac
5209     MOZ_PDF_PRINTING=1
5210     ;;
5212 cairo-gtk2|cairo-gtk2-x11)
5213     MOZ_WIDGET_TOOLKIT=gtk2
5214     MOZ_ENABLE_GTK2=1
5215     MOZ_ENABLE_XREMOTE=1
5216     MOZ_WEBGL=1
5217     MOZ_WEBGL_GLX=1
5219     AC_DEFINE(MOZ_X11)
5220     MOZ_X11=1
5221     USE_FC_FREETYPE=1
5223     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5224     TK_LIBS='$(MOZ_GTK2_LIBS)'
5225     AC_DEFINE(MOZ_WIDGET_GTK2)
5226     MOZ_PDF_PRINTING=1
5227     ;;
5229 cairo-gtk2-dfb)
5230     MOZ_WIDGET_TOOLKIT=gtk2
5231     MOZ_ENABLE_GTK2=1
5232     MOZ_WEBGL=
5234     AC_DEFINE(MOZ_DFB)
5235     MOZ_DFB=1
5237     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5238     TK_LIBS='$(MOZ_GTK2_LIBS)'
5239     AC_DEFINE(MOZ_WIDGET_GTK2)
5240     if test "$no_x" != "yes"; then
5241         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5242         no_x=yes
5243     fi
5244     MOZ_PDF_PRINTING=1
5245     ;;
5247 cairo-qt)
5248     MOZ_WIDGET_TOOLKIT=qt
5249     MOZ_ENABLE_QT=1
5250     MOZ_ENABLE_XREMOTE=1
5251     MOZ_WEBGL=1
5252     MOZ_WEBGL_GLX=1
5253     USE_ELF_DYNSTR_GC=
5255     AC_DEFINE(MOZ_X11)
5256     MOZ_X11=1
5257     USE_FC_FREETYPE=1
5259     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5260     TK_LIBS='$(MOZ_QT_LIBS)'
5261     AC_DEFINE(MOZ_WIDGET_QT)
5262     MOZ_PDF_PRINTING=1
5263     ;;
5265 cairo-beos)
5266     MOZ_WIDGET_TOOLKIT=beos
5267     USE_FC_FREETYPE=1
5268     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5269     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5270     ;;
5272 cairo-os2)
5273     MOZ_WIDGET_TOOLKIT=os2
5274     USE_FC_FREETYPE=1
5275     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5276     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5277     MOZ_PDF_PRINTING=1
5278     ;;
5280 cairo-cocoa)
5281     MOZ_WIDGET_TOOLKIT=cocoa
5282     AC_DEFINE(MOZ_WIDGET_COCOA)
5283     MOZ_USER_DIR="Mozilla"
5284     AC_DEFINE(XP_MACOSX)
5285     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5286     TK_CFLAGS="-DNO_X11"
5287     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5288     CFLAGS="$CFLAGS $TK_CFLAGS"
5289     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5290     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5291     MOZ_FS_LAYOUT=bundle
5292     MOZ_WEBGL=1
5293     ;;
5295 cairo-android)
5296     AC_DEFINE(MOZ_WIDGET_ANDROID)
5297     MOZ_WIDGET_TOOLKIT=android
5298     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5299     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5300     MOZ_WEBGL=1
5301     MOZ_PDF_PRINTING=1
5302     ;;
5304 esac
5306 AC_SUBST(MOZ_PDF_PRINTING)
5307 if test "$MOZ_PDF_PRINTING"; then
5308    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
5309    AC_DEFINE(MOZ_PDF_PRINTING)
5312 if test "$MOZ_ENABLE_XREMOTE"; then
5313     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5316 if test "$COMPILE_ENVIRONMENT"; then
5317   if test "$MOZ_ENABLE_GTK2"; then
5318     if test "$MOZ_X11"; then
5319       GDK_PACKAGES=gdk-x11-2.0
5320     elif test "$MOZ_DFB"; then
5321       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5322       GDK_PACKAGES=directfb
5323     fi
5325     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5326   fi
5328 fi # COMPILE_ENVIRONMENT
5330 AC_SUBST(MOZ_FS_LAYOUT)
5332 dnl ========================================================
5333 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5334 dnl their usage and use them in spidermonkey.
5335 dnl ========================================================
5336 MOZ_ARG_WITH_BOOL(arm-kuser,
5337 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5338     USE_ARM_KUSER=1,)
5339 if test -n "$USE_ARM_KUSER"; then
5340    AC_DEFINE(USE_ARM_KUSER)
5343 dnl ========================================================
5344 dnl = startup-notification support module
5345 dnl ========================================================
5347 if test "$MOZ_ENABLE_GTK2"
5348 then
5349     MOZ_ENABLE_STARTUP_NOTIFICATION=
5351     MOZ_ARG_ENABLE_BOOL(startup-notification,
5352     [  --enable-startup-notification
5353                           Enable startup-notification support (default: disabled) ],
5354         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5355         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5356     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5357     then
5358         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5359                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5360         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5361             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5362             then
5363                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5364             fi
5365             MOZ_ENABLE_STARTUP_NOTIFICATION=
5366         ])
5367     fi
5369     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5370         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5371     fi
5373     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5375 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5376 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5377 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5379 dnl ========================================================
5380 dnl = QT support
5381 dnl ========================================================
5382 if test "$MOZ_ENABLE_QT"
5383 then
5384     MOZ_ARG_WITH_STRING(qtdir,
5385     [  --with-qtdir=\$dir       Specify Qt directory ],
5386     [ QTDIR=$withval])
5388     if test -z "$QTDIR"; then
5389         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5390         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5391     else
5392         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5394         MOZ_QT_CFLAGS="-DQT_SHARED"
5395         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5396         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5397         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5398         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5399         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5400         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5401         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5402         HOST_MOC="$QTDIR/bin/moc"
5403     fi
5404     if test -z "$HOST_MOC"; then
5405         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5406 incorrect])
5407     fi
5408     MOC=$HOST_MOC
5410     MOZ_ENABLE_QTNETWORK=
5411     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5412                       MOZ_ENABLE_QTNETWORK=1,
5413                       MOZ_ENABLE_QTNETWORK=)
5415     if test "$MOZ_ENABLE_QTNETWORK"; then
5416       MOZ_ENABLE_QTNETWORK=1
5417       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5418     fi
5421 AC_SUBST(GTK_CONFIG)
5422 AC_SUBST(TK_CFLAGS)
5423 AC_SUBST(TK_LIBS)
5425 AC_SUBST(MOZ_ENABLE_GTK2)
5426 AC_SUBST(MOZ_ENABLE_PHOTON)
5427 AC_SUBST(MOZ_ENABLE_QT)
5428 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5429 AC_SUBST(MOZ_ENABLE_XREMOTE)
5430 AC_SUBST(MOZ_GTK2_CFLAGS)
5431 AC_SUBST(MOZ_GTK2_LIBS)
5432 AC_SUBST(MOZ_QT_CFLAGS)
5433 AC_SUBST(MOZ_QT_LIBS)
5435 AC_SUBST(MOC)
5437 AC_SUBST(MOZ_DFB)
5438 AC_SUBST(MOZ_X11)
5440 dnl ========================================================
5441 dnl =
5442 dnl = Components & Features
5443 dnl = 
5444 dnl ========================================================
5445 MOZ_ARG_HEADER(Components and Features)
5447 dnl ========================================================
5448 dnl = Localization
5449 dnl ========================================================
5450 MOZ_ARG_ENABLE_STRING(ui-locale,
5451 [  --enable-ui-locale=ab-CD
5452                           Select the user interface locale (default: en-US)],
5453     MOZ_UI_LOCALE=$enableval )
5454 AC_SUBST(MOZ_UI_LOCALE)
5456 dnl ========================================================
5457 dnl = Trademarked Branding 
5458 dnl ========================================================
5459 MOZ_ARG_ENABLE_BOOL(official-branding,
5460 [  --enable-official-branding
5461                           Enable Official mozilla.org Branding
5462                           Do not distribute builds with
5463                           --enable-official-branding unless you have
5464                           permission to use trademarks per
5465                           http://www.mozilla.org/foundation/trademarks/ .],
5467   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5468     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5469   else
5470     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5471     MOZ_OFFICIAL_BRANDING=1
5472   fi
5473 ], MOZ_OFFICIAL_BRANDING=)
5475 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5476 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5477   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5480 MOZ_ARG_WITH_STRING(branding,
5481 [  --with-branding=dir     Use branding from the specified directory.],
5482     MOZ_BRANDING_DIRECTORY=$withval)
5484 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5485 if test -z "$REAL_BRANDING_DIRECTORY"; then
5486   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5489 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5490   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5493 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5495 dnl ========================================================
5496 dnl = Distribution ID
5497 dnl ========================================================
5498 MOZ_ARG_WITH_STRING(distribution-id,
5499 [  --with-distribution-id=ID
5500                           Set distribution-specific id (default=org.mozilla)],
5501 [ val=`echo $withval`
5502     MOZ_DISTRIBUTION_ID="$val"])
5504 if test -z "$MOZ_DISTRIBUTION_ID"; then
5505    MOZ_DISTRIBUTION_ID="org.mozilla"
5508 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5509 AC_SUBST(MOZ_DISTRIBUTION_ID)
5512 dnl ========================================================
5513 dnl complex text support off by default
5514 dnl ========================================================
5515 MOZ_ARG_DISABLE_BOOL(pango,
5516 [  --disable-pango         Disable usage of Pango ],
5517     MOZ_PANGO=,
5518     MOZ_PANGO=1)
5520 dnl ========================================================
5521 dnl = Pango
5522 dnl ========================================================
5523 if test "$MOZ_ENABLE_GTK2"
5524 then
5525     AC_SUBST(MOZ_PANGO)
5527     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5529     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5530     AC_SUBST(MOZ_PANGO_CFLAGS)
5531     AC_SUBST(MOZ_PANGO_LIBS)
5532     if test "$MOZ_PANGO"
5533     then
5534         AC_DEFINE(MOZ_PANGO)
5535     else
5536         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5537         AC_SUBST(FT2_CFLAGS)
5538         AC_SUBST(FT2_LIBS)
5539     fi
5542 if test "$MOZ_ENABLE_QT"
5543 then
5544     if test "$MOZ_PANGO"
5545     then
5546         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5547         [
5548             AC_SUBST(MOZ_PANGO_CFLAGS)
5549             AC_SUBST(MOZ_PANGO_LIBS)
5550             AC_DEFINE(MOZ_PANGO)
5551         ],
5552         [
5553             echo "Pango library not found, will use FT2 font engine"
5554             MOZ_PANGO=
5555         ])
5556     fi
5557     AC_SUBST(MOZ_PANGO)
5560 dnl ========================================================
5561 dnl = GnomeVFS, GIO and GConf support module
5562 dnl ========================================================
5564 if test "$MOZ_X11"
5565 then
5566     dnl build the gnomevfs extension by default only when the
5567     dnl GTK2 toolkit is in use.
5568     if test "$MOZ_ENABLE_GTK2"
5569     then
5570         MOZ_ENABLE_GNOMEVFS=1
5571         MOZ_ENABLE_GCONF=1
5572     fi
5574     dnl ========================================================
5575     dnl = GnomeVFS support module
5576     dnl ========================================================
5577     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5578     [  --disable-gnomevfs      Disable GnomeVFS support ],
5579         MOZ_ENABLE_GNOMEVFS=,
5580         MOZ_ENABLE_GNOMEVFS=force)
5582     if test "$MOZ_ENABLE_GNOMEVFS"
5583     then
5584         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5585             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5586             MOZ_ENABLE_GNOMEVFS=1
5587             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5588         ],[
5589             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5590             then
5591                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5592             fi
5593             MOZ_ENABLE_GNOMEVFS=
5594         ])
5595     else
5596         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5597             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5598               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5599             ])
5600         fi
5601     fi
5603     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5604     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5605     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5607     dnl ========================================================
5608     dnl = GIO support module
5609     dnl ========================================================
5610     MOZ_ARG_ENABLE_BOOL(gio,
5611     [  --enable-gio            Enable GIO support (default: disabled)],
5612         MOZ_ENABLE_GIO=force,
5613         MOZ_ENABLE_GIO=)
5615     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5616     then
5617         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5618             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5619             MOZ_ENABLE_GIO=1
5620             AC_DEFINE(MOZ_ENABLE_GIO)
5621         ],[
5622             if test "$MOZ_ENABLE_GIO" = "force"
5623             then
5624                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5625             fi
5626             MOZ_ENABLE_GIO=
5627         ])
5628     fi
5630     AC_SUBST(MOZ_ENABLE_GIO)
5631     AC_SUBST(MOZ_GIO_CFLAGS)
5632     AC_SUBST(MOZ_GIO_LIBS)
5633    
5634     dnl ========================================================
5635     dnl = GConf support module
5636     dnl ========================================================
5637     if test "$MOZ_ENABLE_GCONF"
5638     then
5639         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5640             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5641             MOZ_ENABLE_GCONF=1
5642         ],[
5643             if test "$MOZ_ENABLE_GCONF" = "force"
5644             then
5645                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5646             fi
5647             MOZ_ENABLE_GCONF=
5648         ])
5649     fi
5651     if test "$MOZ_ENABLE_GCONF"; then
5652         AC_DEFINE(MOZ_ENABLE_GCONF)
5653     fi
5655     AC_SUBST(MOZ_ENABLE_GCONF)
5656     AC_SUBST(MOZ_GCONF_CFLAGS)
5657     AC_SUBST(MOZ_GCONF_LIBS)
5660 dnl ========================================================
5661 dnl = libproxy support
5662 dnl ========================================================
5664 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5665 then
5666     MOZ_ENABLE_LIBPROXY=
5668     MOZ_ARG_ENABLE_BOOL(libproxy,
5669     [  --enable-libproxy         Enable libproxy support ],
5670     MOZ_ENABLE_LIBPROXY=1,
5671     MOZ_ENABLE_LIBPROXY=)
5673     if test "$MOZ_ENABLE_LIBPROXY"
5674     then
5675         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5676         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5677     fi
5679 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5680 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5681 AC_SUBST(MOZ_LIBPROXY_LIBS)
5683 dnl ========================================================
5684 dnl = libnotify support
5685 dnl ========================================================
5687 if test "$MOZ_ENABLE_GTK2"
5688 then
5689     MOZ_ENABLE_LIBNOTIFY=1
5691     MOZ_ARG_DISABLE_BOOL(libnotify,
5692     [  --disable-libnotify     Disable libnotify support ],
5693     MOZ_ENABLE_LIBNOTIFY=,
5694     MOZ_ENABLE_LIBNOTIFY=1)
5696     if test "$MOZ_ENABLE_LIBNOTIFY"
5697     then
5698         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5699     fi
5702 if test -z "$SKIP_LIBRARY_CHECKS"
5703 then
5704     if test "$MOZ_ENABLE_GTK2"
5705     then
5706         if test "$MOZ_ENABLE_LIBNOTIFY"
5707         then
5708             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5709         fi
5710     fi
5712 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5713 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5714 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5716 dnl ========================================================
5717 dnl = GNOME component (mozgnome)
5718 dnl ========================================================
5720 # The GNOME component is built if one of 
5721 # gnome-vfs, gio, gconf or libnotify is available.
5722 if test "$MOZ_ENABLE_GCONF" -o \
5723    "$MOZ_ENABLE_GNOMEVFS" -o \
5724    "$MOZ_ENABLE_GIO" -o \
5725    "$MOZ_ENABLE_LIBNOTIFY"; then
5726     MOZ_ENABLE_GNOME_COMPONENT=1
5727 else
5728     MOZ_ENABLE_GNOME_COMPONENT=
5730 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5732 dnl ========================================================
5733 dnl = libgnomeui support module
5734 dnl ========================================================
5736 if test "$MOZ_ENABLE_GTK2"
5737 then
5738     MOZ_ENABLE_GNOMEUI=1
5740     MOZ_ARG_DISABLE_BOOL(gnomeui,
5741     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5742         MOZ_ENABLE_GNOMEUI=,
5743         MOZ_ENABLE_GNOMEUI=force)
5745     if test "$MOZ_ENABLE_GNOMEUI"
5746     then
5747         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5748         [
5749             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5750             MOZ_ENABLE_GNOMEUI=1
5751         ],[
5752             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5753             then
5754                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5755             fi
5756             MOZ_ENABLE_GNOMEUI=
5757         ])
5758     fi
5760     if test "$MOZ_ENABLE_GNOMEUI"; then
5761         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5762     fi
5765 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5766 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5767 AC_SUBST(MOZ_GNOMEUI_LIBS)
5769 dnl ========================================================
5770 dnl = dbus support
5771 dnl ========================================================
5773 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5774 then
5775     MOZ_ENABLE_DBUS=1
5777     MOZ_ARG_DISABLE_BOOL(dbus,
5778     [  --disable-dbus          Disable dbus support ],
5779         MOZ_ENABLE_DBUS=,
5780         MOZ_ENABLE_DBUS=1)
5782     if test "$MOZ_ENABLE_DBUS"
5783     then
5784         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5785         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5786         AC_DEFINE(MOZ_ENABLE_DBUS)
5787     fi
5789 AC_SUBST(MOZ_ENABLE_DBUS)
5790 AC_SUBST(MOZ_DBUS_CFLAGS)
5791 AC_SUBST(MOZ_DBUS_LIBS)
5792 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5793 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5795 dnl ========================================================
5796 dnl = Build Personal Security Manager
5797 dnl ========================================================
5798 MOZ_ARG_DISABLE_BOOL(crypto,
5799 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5800     MOZ_PSM=,
5801     MOZ_PSM=1 )
5803 dnl ========================================================
5804 dnl = JS Debugger XPCOM component (js/jsd)
5805 dnl ========================================================
5806 MOZ_ARG_DISABLE_BOOL(jsd,
5807 [  --disable-jsd           Disable JavaScript debug library],
5808     MOZ_JSDEBUGGER=,
5809     MOZ_JSDEBUGGER=1)
5812 dnl ========================================================
5813 dnl = Disable IPC support for tabs and plugins
5814 dnl ========================================================
5815 MOZ_ARG_DISABLE_BOOL(ipc,
5816 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5817     MOZ_IPC=,
5818     MOZ_IPC=1)
5820 if test -n "$MOZ_IPC"; then
5821     AC_DEFINE(MOZ_IPC)
5824 AC_SUBST(MOZ_IPC)
5826 dnl ========================================================
5827 dnl = Enable IPDL's "expensive" unit tests
5828 dnl ========================================================
5829 MOZ_IPDL_TESTS=
5831 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5832 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5833     MOZ_IPDL_TESTS=1,
5834     MOZ_IPDL_TESTS=)
5836 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5837     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5840 if test -n "$MOZ_IPDL_TESTS"; then
5841     AC_DEFINE(MOZ_IPDL_TESTS)
5844 AC_SUBST(MOZ_IPDL_TESTS)
5846 dnl ========================================================
5847 dnl = Disable plugin support
5848 dnl ========================================================
5849 MOZ_ARG_DISABLE_BOOL(plugins,
5850 [  --disable-plugins       Disable plugins support],
5851     MOZ_PLUGINS=,
5852     MOZ_PLUGINS=1)
5854 dnl ========================================================
5855 dnl = Disable building dbm
5856 dnl ========================================================
5857 MOZ_ARG_DISABLE_BOOL(dbm,
5858 [  --disable-dbm           Disable building dbm],
5859     NSS_DISABLE_DBM=1,
5860     NSS_DISABLE_DBM=)
5862 dnl bi-directional support always on
5863 IBMBIDI=1
5864 AC_DEFINE(IBMBIDI)
5866 dnl ========================================================
5867 dnl view source support on by default
5868 dnl ========================================================
5869 if test "$MOZ_VIEW_SOURCE"; then
5870     AC_DEFINE(MOZ_VIEW_SOURCE)
5873 dnl ========================================================
5874 dnl accessibility support on by default on all platforms 
5875 dnl except OS X.
5876 dnl ========================================================
5877 MOZ_ARG_DISABLE_BOOL(accessibility,
5878 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5879     ACCESSIBILITY=,
5880     ACCESSIBILITY=1 )
5881 if test "$ACCESSIBILITY"; then
5882     AC_DEFINE(ACCESSIBILITY)
5885 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5886 case "$target" in
5887 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5888     if test "$ac_cv_header_atlbase_h" = "no"; then
5889         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.])
5890     fi
5891     if test "$ac_cv_header_oleacc_idl" = "no"; then
5892         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.])
5893     fi
5894     ;;
5895 esac
5898 dnl ========================================================
5899 dnl xpcom js loader support on by default
5900 dnl ========================================================
5901 if test "$MOZ_JSLOADER"; then
5902     AC_DEFINE(MOZ_JSLOADER)
5905 dnl ========================================================
5906 dnl Disable printing
5907 dnl ========================================================
5908 MOZ_ARG_DISABLE_BOOL(printing,
5909 [  --disable-printing      Disable printing support],
5910     NS_PRINTING=,
5911     NS_PRINTING=1)
5913 if test "$NS_PRINTING"; then
5914     AC_DEFINE(NS_PRINTING)
5915     AC_DEFINE(NS_PRINT_PREVIEW)
5917 dnl ========================================================
5918 dnl use native unicode converters
5919 dnl ========================================================
5920 MOZ_ARG_ENABLE_BOOL(native-uconv,
5921 [  --enable-native-uconv   Enable iconv support],
5922     MOZ_USE_NATIVE_UCONV=1,
5923     MOZ_USE_NATIVE_UCONV= )
5924 if test "$MOZ_USE_NATIVE_UCONV"; then
5925     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5927 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5928     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5932 dnl ========================================================
5933 dnl Libeditor can be build as plaintext-only,
5934 dnl or as a full html and text editing component.
5935 dnl We build both by default.
5936 dnl ========================================================
5937 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5938 [  --enable-plaintext-editor-only
5939                           Allow only plaintext editing],
5940     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5941     MOZ_PLAINTEXT_EDITOR_ONLY= )
5942 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5943 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5945 dnl ========================================================
5946 dnl = Disable Fast Load
5947 dnl ========================================================
5948 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5949 [  --disable-xpcom-fastload
5950                           Disable XPCOM fastload support],
5951     MOZ_NO_FAST_LOAD=1,
5952     MOZ_NO_FAST_LOAD=)
5954 AC_SUBST(MOZ_NO_FAST_LOAD)
5956 if test -n "$MOZ_NO_FAST_LOAD"; then
5957     AC_DEFINE(MOZ_NO_FAST_LOAD)
5960 dnl ========================================================
5961 dnl = Enable Raw Codecs
5962 dnl ========================================================
5963 MOZ_ARG_ENABLE_BOOL(raw,
5964 [  --enable-raw           Enable support for RAW media],
5965     MOZ_RAW=1,
5966     MOZ_RAW=)
5968 if test -n "$MOZ_RAW"; then
5969     AC_DEFINE(MOZ_RAW)
5970     MOZ_MEDIA=1
5973 AC_SUBST(MOZ_RAW)
5975 dnl ========================================================
5976 dnl = Disable Ogg Codecs
5977 dnl ========================================================
5978 MOZ_ARG_DISABLE_BOOL(ogg,
5979 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5980     MOZ_OGG=,
5981     MOZ_OGG=1)
5983 if test -n "$MOZ_OGG"; then
5984     AC_DEFINE(MOZ_OGG)
5985     MOZ_SYDNEYAUDIO=1
5986     MOZ_MEDIA=1
5987     case "$target_cpu" in
5988     arm*)
5989         MOZ_TREMOR=1
5990     ;;
5991     *)
5992         MOZ_VORBIS=1
5993     ;;
5994     esac
5996     dnl Checks for __attribute__(aligned()) directive
5997     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5998         [ac_cv_c_attribute_aligned],
5999         [ac_cv_c_attribute_aligned=0
6000          CFLAGS_save="${CFLAGS}"
6001          CFLAGS="${CFLAGS} -Werror"
6002          for ac_cv_c_attr_align_try in 64 32 16 8; do
6003            echo "trying $ac_cv_c_attr_align_try"
6004            AC_TRY_COMPILE([],
6005                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
6006                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
6007            if test "$ac_cv_c_attribute_aligned" != 0; then
6008              break;
6009            fi
6010          done
6011            CFLAGS="${CFLAGS_save}"])
6012     if test "${ac_cv_c_attribute_aligned}" != "0"; then
6013       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
6014                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
6015     fi
6018 dnl ========================================================
6019 dnl = Disable VP8 decoder support
6020 dnl ========================================================
6021 MOZ_ARG_DISABLE_BOOL(webm,
6022 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
6023     MOZ_WEBM=,
6024     MOZ_WEBM=1)
6026 dnl system libvpx Support
6027 dnl ========================================================
6028 MOZ_ARG_WITH_STRING(system-libvpx,
6029 [  --with-system-libvpx=[PFX]
6030                           Use system libvpx [installed at prefix PFX]],
6031     LIBVPX_DIR=$withval)
6033 MOZ_NATIVE_LIBVPX=
6034 MOZ_LIBVPX_INCLUDES=
6035 MOZ_LIBVPX_LIBS=
6037 if test -n "$MOZ_WEBM"; then
6038     AC_DEFINE(MOZ_WEBM)
6040     if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
6041         _SAVE_CFLAGS=$CFLAGS
6042         _SAVE_LDFLAGS=$LDFLAGS
6043         _SAVE_LIBS=$LIBS
6044         if test "${LIBVPX_DIR}" = "yes"; then
6045             LIBVPX_DIR=/usr
6046         fi
6047         CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
6048         LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
6049         AC_CHECK_HEADER(vpx/vpx_decoder.h,
6050                         [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
6051                              AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
6052                          fi],
6053                         AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
6054         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
6055                      [MOZ_NATIVE_LIBVPX=1
6056                       MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
6057                       MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
6058                      ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
6059         CFLAGS=$_SAVE_CFLAGS
6060         LDFLAGS=$_SAVE_LDFLAGS
6061         LIBS=$_SAVE_LIBS
6062     fi
6065 AC_SUBST(MOZ_NATIVE_LIBVPX)
6066 AC_SUBST(MOZ_LIBVPX_INCLUDES)
6067 AC_SUBST(MOZ_LIBVPX_LIBS)
6069 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
6070     MOZ_SYDNEYAUDIO=1
6071     MOZ_MEDIA=1
6072     case "$target_cpu" in
6073     arm*)
6074         MOZ_TREMOR=1
6075     ;;
6076     *)
6077         MOZ_VORBIS=1
6078     ;;
6079     esac
6082     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
6083     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
6084     dnl We currently require gcc on all arm platforms.
6085     VPX_AS=$YASM
6086     VPX_ASM_SUFFIX=asm
6088     dnl See if we have assembly on this platform.  
6089     case "$OS_ARCH:$CPU_ARCH" in
6090     Linux:x86)
6091       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6092       VPX_X86_ASM=1
6093     ;;
6094     Linux:x86_64)
6095       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6096       VPX_X86_ASM=1
6097     ;;
6098     SunOS:x86)
6099       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6100       VPX_X86_ASM=1
6101     ;;
6102     SunOS:x86_64)
6103       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6104       VPX_X86_ASM=1
6105     ;;
6106     Darwin:x86)
6107       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
6108       VPX_X86_ASM=1
6109     ;;
6110     Darwin:x86_64)
6111       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
6112       VPX_X86_ASM=1
6113     ;;
6114     WINNT:x86_64)
6115       if test -z "$GNU_CC"; then
6116         VPX_ASFLAGS="-f x64 -rnasm -pnasm"
6117         VPX_X86_ASM=1
6118       fi
6119     ;;
6120     WINNT:x86)
6121       if test -z "$GNU_CC"; then
6122         dnl Check for yasm 1.1 or greater.
6123         if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
6124           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.])
6125         elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6126           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.])
6127         else
6128           VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
6129           VPX_X86_ASM=1
6130         fi
6131       fi
6132     ;;
6133     *:arm*)
6134       if test -n "$GNU_AS" ; then
6135         VPX_AS=$AS
6136         dnl These flags are a lie; they're just used to enable the requisite
6137         dnl opcodes; actual arch detection is done at runtime.
6138         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
6139         VPX_DASH_C_FLAG="-c"
6140         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
6141         VPX_ASM_SUFFIX="$ASM_SUFFIX"
6142         VPX_ARM_ASM=1
6143       fi
6144     esac
6146     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
6147       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.])
6148     fi
6150     if test -n "$VPX_X86_ASM"; then
6151       AC_DEFINE(VPX_X86_ASM)
6152     elif test -n "$VPX_ARM_ASM"; then
6153       AC_DEFINE(VPX_ARM_ASM)
6154     else
6155       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
6156     fi
6159 dnl ========================================================
6160 dnl = Disable Wave decoder support
6161 dnl ========================================================
6162 MOZ_ARG_DISABLE_BOOL(wave,
6163 [  --disable-wave          Disable Wave decoder support],
6164     MOZ_WAVE=,
6165     MOZ_WAVE=1)
6167 if test -n "$MOZ_WAVE"; then
6168     AC_DEFINE(MOZ_WAVE)
6169     MOZ_SYDNEYAUDIO=1
6170     MOZ_MEDIA=1
6173 dnl ========================================================
6174 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
6175 dnl ========================================================
6177 if test -n "$MOZ_SYDNEYAUDIO"; then
6178     AC_DEFINE(MOZ_SYDNEYAUDIO)
6181 if test -n "$MOZ_MEDIA"; then
6182     AC_DEFINE(MOZ_MEDIA)
6185 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
6186     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/])
6189 if test -n "$MOZ_VORBIS"; then
6190     AC_DEFINE(MOZ_VORBIS)
6193 if test -n "$MOZ_TREMOR"; then
6194     AC_DEFINE(MOZ_TREMOR)
6197 dnl ========================================================
6198 dnl = Check alsa availability on Linux if using sydneyaudio
6199 dnl ========================================================
6201 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6202 if test -n "$MOZ_SYDNEYAUDIO"; then
6203    case "$target_os" in
6204 linux*)
6205       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6206          [echo "$MOZ_ALSA_PKG_ERRORS"
6207           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.)])])
6208       ;;
6209    esac
6212 dnl ========================================================
6213 dnl Splashscreen
6214 dnl ========================================================
6215 AC_ARG_ENABLE(splashscreen,
6216               [  --enable-splashscreen   display splashscreen while loading (default=no)],
6217               [enable_splash="yes"],[enable_splash=""])
6218 if test "x$enable_splash" = "xyes"; then
6219   MOZ_SPLASHSCREEN=1
6220   AC_DEFINE(MOZ_SPLASHSCREEN)
6222 AC_SUBST(MOZ_SPLASHSCREEN)
6224 dnl ========================================================
6225 dnl Permissions System
6226 dnl ========================================================
6227 MOZ_ARG_DISABLE_BOOL(permissions,
6228 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
6229     MOZ_PERMISSIONS=,
6230     MOZ_PERMISSIONS=1
6233 dnl ========================================================
6234 dnl NegotiateAuth
6235 dnl ========================================================
6236 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6237 [  --disable-negotiateauth Disable GSS-API negotiation ],
6238     MOZ_AUTH_EXTENSION=,
6239     MOZ_AUTH_EXTENSION=1 )
6241 dnl ========================================================
6242 dnl XTF
6243 dnl ========================================================
6244 MOZ_ARG_DISABLE_BOOL(xtf,
6245 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
6246     MOZ_XTF=,
6247     MOZ_XTF=1 )
6248 if test "$MOZ_XTF"; then
6249   AC_DEFINE(MOZ_XTF)
6252 dnl ========================================================
6253 dnl Pref extensions (autoconfig and system-pref)
6254 dnl ========================================================
6255 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6256 [  --disable-pref-extensions
6257                           Disable pref extensions such as autoconfig and
6258                           system-pref],
6259   MOZ_PREF_EXTENSIONS=,
6260   MOZ_PREF_EXTENSIONS=1 )
6262 dnl ========================================================
6263 dnl = Universalchardet
6264 dnl ========================================================
6265 MOZ_ARG_DISABLE_BOOL(universalchardet,
6266 [  --disable-universalchardet
6267                           Disable universal encoding detection],
6268   MOZ_UNIVERSALCHARDET=,
6269   MOZ_UNIVERSALCHARDET=1 )
6271 dnl ========================================================
6272 dnl JavaXPCOM
6273 dnl ========================================================
6274 case "${target}" in
6275 *-wince*)
6276     MOZ_JAVAXPCOM=
6277     ;;
6278 esac
6280 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6281 [  --enable-javaxpcom
6282                           Enable Java-XPCOM bridge],
6283     MOZ_JAVAXPCOM=1,
6284     MOZ_JAVAXPCOM=)
6286 case "$host_os" in
6287   cygwin*|msvc*|mks*)
6288     if test -n "$JAVA_HOME"; then
6289       JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6290     fi
6291     ;;
6292   *mingw*)
6293     if test -n "$JAVA_HOME"; then
6294       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6295     fi
6296     ;;
6297 esac
6299 if test -n "${JAVA_BIN_PATH}"; then
6300   dnl Look for javac and jar in the specified path.
6301   JAVA_PATH="$JAVA_BIN_PATH"
6302 else
6303   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6304   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6307 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6308 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6309 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6311 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6312   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6313     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}])
6314   fi
6317 if test -n "${MOZ_JAVAXPCOM}"; then
6318   if test -n "${JAVA_INCLUDE_PATH}"; then
6319     dnl Make sure jni.h exists in the given include path.
6320     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6321       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6322     fi
6323   else
6324     case "$target_os" in
6325       darwin*)
6326         dnl Default to java system location
6327         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6328         ;;
6329       *)
6330         dnl Try $JAVA_HOME
6331         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6332         ;;
6333     esac
6334     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6335       AC_MSG_ERROR([The header jni.h was not found.  Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
6336     fi
6337   fi
6340 dnl ========================================================
6341 dnl = ANGLE OpenGL->D3D translator for WebGL
6342 dnl = * only applies to win32
6343 dnl = * enabled by default (shipping build); requires explicit --disable to disable
6344 dnl ========================================================
6345 MOZ_ANGLE=
6346 MOZ_DIRECTX_SDK_PATH=
6347 MOZ_DIRECTX_SDK_CPU_SUFFIX=
6348 MOZ_D3DX9_VERSION=
6349 MOZ_D3DX9_CAB=
6350 MOZ_D3DCOMPILER_CAB=
6351 MOZ_D3DX9_DLL=
6352 MOZ_D3DCOMPILER_DLL=
6353 case "$target_os" in
6354     *msvc*|*mks*|*cygwin*|*mingw*)
6355         MOZ_ANGLE=1
6356         ;;
6357 esac
6359 # The DirectX SDK libraries are split into x86 and x64 sub-directories
6360 case "${target_cpu}" in
6361 i*86)
6362   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
6363   ;;
6364 x86_64)
6365   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
6366   # currently we disable ANGLE in 64bit builds
6367   MOZ_ANGLE=
6368   ;;
6369 esac
6371 if test -n "$MOZ_ANGLE"; then
6372 MOZ_ARG_DISABLE_BOOL(angle,
6373 [  --disable-angle     Disable building of ANGLE for WebGL->D3D translation],
6374     MOZ_ANGLE=,
6375     MOZ_ANGLE=1)
6377 if test -n "$MOZ_ANGLE"; then
6378   if test -z "$_WIN32_MSVC"; then
6379     AC_MSG_ERROR([Building ANGLE requires MSVC.  To build without ANGLE, reconfigure with --disable-angle.])
6380   fi
6382   # Get the SDK path from the registry.
6383   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
6384   MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's,  *, ,g' | cut -d' ' -f4-`
6386   MOZ_ANGLE=
6388   if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
6389     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
6390       AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
6391       MOZ_ANGLE=1
6392     fi
6393   fi
6395   if test -z "$MOZ_ANGLE" ; then
6396     AC_MSG_WARN([Couldn't find the DirectX SDK, needed for ANGLE. Please install it (February 2010 or newer). To explicitly build without ANGLE, reconfigure with --disable-angle.])
6397     AC_MSG_WARN([This will become an error in the future.])
6398   fi
6400   if test -n "$MOZ_ANGLE" ; then
6401     # Get the SDK numeric version (e.g. 42 or 43) by looking at the dependencies of d3dx9.lib
6402     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'`
6404     if test -z "$MOZ_D3DX9_VERSION" ; then
6405       MOZ_ANGLE=
6406       AC_MSG_WARN([Couldn't determine the D3DX9 version! Disabling ANGLE.])
6407       AC_MSG_WARN([This will become an error in the future.])
6408     fi
6410     if test -n "$MOZ_ANGLE" ; then
6411       MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6412       MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6414       MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
6415       MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
6416     fi
6417   fi
6421 dnl ========================================================
6422 dnl = Breakpad crash reporting (on by default on supported platforms)
6423 dnl ========================================================
6425 case $target in
6426 i?86-*-mingw*|x86_64-*-mingw*)
6427   MOZ_CRASHREPORTER=1
6428   ;;
6429 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6430   MOZ_CRASHREPORTER=1
6431   ;;
6432 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6433   if test "$MOZ_ENABLE_GTK2"; then
6434     MOZ_CRASHREPORTER=1
6435   fi
6436   ;;
6437 arm-android-eabi)
6438   MOZ_CRASHREPORTER=1
6439   ;;
6440 *solaris*)
6441   MOZ_CRASHREPORTER=1
6442   ;;
6443 esac
6445 MOZ_ARG_DISABLE_BOOL(crashreporter,
6446 [  --disable-crashreporter Disable breakpad crash reporting],
6447     MOZ_CRASHREPORTER=,
6448     MOZ_CRASHREPORTER=1)
6450 if test -n "$MOZ_CRASHREPORTER"; then
6451    AC_DEFINE(MOZ_CRASHREPORTER)
6453   if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6454     test -z "$SKIP_LIBRARY_CHECKS"; then
6455     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6456     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6457     AC_SUBST(MOZ_GTHREAD_LIBS)
6459     AC_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])])
6460   fi
6463 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6464 [  --with-crashreporter-enable-percent=NN
6465                           Enable sending crash reports by default on NN% of users. (default=100)],
6466 [ val=`echo $withval | sed 's/[^0-9]//g'`
6467     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6469 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6470    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6472 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6474 dnl ========================================================
6475 dnl = Enable compilation of specific extension modules
6476 dnl ========================================================
6478 MOZ_ARG_ENABLE_STRING(extensions,
6479 [  --enable-extensions     Enable extensions],
6480 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6481     if test "$option" = "yes" -o "$option" = "all"; then
6482         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6483     elif test "$option" = "no" -o "$option" = "none"; then
6484         MOZ_EXTENSIONS=""
6485     elif test "$option" = "default"; then
6486         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6487     elif test `echo "$option" | grep -c \^-` != 0; then
6488         option=`echo $option | sed 's/^-//'`
6489         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6490     else
6491         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6492     fi
6493 done],
6494     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6496 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6497     # Suppress warning on non-X11 platforms
6498     if test -n "$MOZ_X11"; then
6499         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6500     fi
6501     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6504 dnl Do not build gnomevfs with libxul based apps
6505 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6506     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6509 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6510     # Suppress warning on non-X11 platforms
6511     if test -n "$MOZ_X11"; then
6512         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6513     fi
6514     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6517 dnl Do not build gio with libxul based apps
6518 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6519     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6522 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6523     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6524     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6527 dnl This might be temporary: build tridentprofile only on Windows
6528 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6529     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6530     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6533 dnl cookie must be built before tridentprofile. put it at list's end.
6534 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6535   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6536   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6539 dnl xforms requires xtf
6540 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6541     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6542     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6545 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6546     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6547     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6550 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6551     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6552     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6555 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6556     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6557     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6560 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6561     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6562     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6565 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6566     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6567     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6570 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6571     AC_MSG_WARN([spellcheck is no longer an extension.])
6572     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6575 dnl Remove dupes
6576 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6578 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6579 dnl when trying to build a nonexistent extension.
6580 for extension in $MOZ_EXTENSIONS; do
6581     if test ! -d "${srcdir}/extensions/${extension}"; then
6582         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6583     fi
6584 done
6586 dnl ========================================================
6587 dnl MathML on by default
6588 dnl ========================================================
6589 MOZ_ARG_DISABLE_BOOL(mathml,
6590 [  --disable-mathml        Disable MathML support],
6591     MOZ_MATHML=,
6592     MOZ_MATHML=1 )
6593 if test "$MOZ_MATHML"; then
6594   AC_DEFINE(MOZ_MATHML)
6597 dnl ========================================================
6598 dnl Keeping AC_DEFINE(MOZ_SVG) for the moment in case of something needs it.
6599 dnl ========================================================
6600 AC_DEFINE(MOZ_SVG)
6602 dnl ========================================================
6603 dnl SMIL
6604 dnl ========================================================
6605 MOZ_SMIL=1
6606 MOZ_ARG_DISABLE_BOOL(smil,
6607 [  --disable-smil          Disable SMIL animation support],
6608     MOZ_SMIL=,
6609     MOZ_SMIL=1 )
6610 if test -n "$MOZ_SMIL"; then
6611   AC_DEFINE(MOZ_SMIL)
6614 dnl ========================================================
6615 dnl Build Freetype in the tree
6616 dnl ========================================================
6617 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6618 [  --enable-tree-freetype  Enable Tree FreeType],
6619     MOZ_TREE_FREETYPE=1,
6620     MOZ_TREE_FREETYPE= )
6621 if test -n "$MOZ_TREE_FREETYPE"; then
6622    if test -n "$_WIN32_MSVC"; then
6623       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6624    fi
6625    AC_DEFINE(MOZ_TREE_FREETYPE)
6626    AC_SUBST(MOZ_TREE_FREETYPE)
6627    MOZ_ENABLE_CAIRO_FT=1       
6628    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6629    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6630    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6631    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6632    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6633    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6634    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6635    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6636    AC_SUBST(CAIRO_FT_CFLAGS)
6640 dnl ========================================================
6641 dnl Installer
6642 dnl ========================================================
6643 case "$target_os" in
6644     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6645         MOZ_INSTALLER=1
6646         ;;
6647 esac
6649 MOZ_ARG_DISABLE_BOOL(installer,
6650 [  --disable-installer     Disable building of installer],
6651     MOZ_INSTALLER=,
6652     MOZ_INSTALLER=1)
6653 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6654     # Disable installer for Windows builds that use the new toolkit if the
6655     # required major version and minimum minor version of Unicode NSIS isn't in
6656     # the path.
6657     REQ_NSIS_MAJOR_VER=2
6658     MIN_NSIS_MINOR_VER=33
6659     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6660     if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6661         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.])
6662     fi
6663     changequote(,)
6664     MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6665     changequote([,])
6666     if test ! "$MAKENSISU_VER" = ""; then
6667         MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6668         MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6669     fi
6670     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6671     if test "$MAKENSISU_VER" = "" ||
6672        test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6673             ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6674         AC_MSG_RESULT([no])
6675         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.])
6676     fi
6677     AC_MSG_RESULT([yes])
6678     MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6681 AC_SUBST(MOZ_INSTALLER)
6683 AC_MSG_CHECKING([for tar archiver])
6684 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6685 if test -z "$TAR"; then
6686     AC_MSG_ERROR([no tar archiver found in \$PATH])
6688 AC_MSG_RESULT([$TAR])
6689 AC_SUBST(TAR)
6691 AC_MSG_CHECKING([for wget])
6692 AC_CHECK_PROGS(WGET, wget, "")
6693 AC_MSG_RESULT([$WGET])
6694 AC_SUBST(WGET)
6696 dnl ========================================================
6697 dnl Updater
6698 dnl ========================================================
6700 MOZ_ARG_DISABLE_BOOL(updater,
6701 [  --disable-updater       Disable building of updater],
6702     MOZ_UPDATER=,
6703     MOZ_UPDATER=1 )
6705 if test -n "$MOZ_UPDATER"; then
6706     AC_DEFINE(MOZ_UPDATER)
6709 # app update channel is 'default' when not supplied.
6710 MOZ_ARG_ENABLE_STRING([update-channel],
6711 [  --enable-update-channel=CHANNEL
6712                           Select application update channel (default=default)],
6713     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6715 if test -z "$MOZ_UPDATE_CHANNEL"; then
6716     MOZ_UPDATE_CHANNEL=default
6718 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6719 AC_SUBST(MOZ_UPDATE_CHANNEL)
6721 # tools/update-packaging is not checked out by default.
6722 MOZ_ARG_ENABLE_BOOL(update-packaging,
6723 [  --enable-update-packaging
6724                           Enable tools/update-packaging],
6725     MOZ_UPDATE_PACKAGING=1,
6726     MOZ_UPDATE_PACKAGING= )
6727 AC_SUBST(MOZ_UPDATE_PACKAGING)
6729 dnl ========================================================
6730 dnl ActiveX
6731 dnl ========================================================
6733 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6734 [  --disable-xpconnect-idispatch
6735                           Disable building of xpconnect support for IDispatch
6736                           (win32 only)],
6737     XPC_IDISPATCH_SUPPORT=,
6738     XPC_IDISPATCH_SUPPORT=1)
6739 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6741 MOZ_ARG_DISABLE_BOOL(activex,
6742 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6743     MOZ_NO_ACTIVEX_SUPPORT=1,
6744     MOZ_NO_ACTIVEX_SUPPORT= )
6745 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6747 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6748 [  --enable-activex-scripting
6749                           Enable building of ActiveX scripting support (win32)],
6750     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6751     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6752 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6754 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6755 then
6756     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6759 if test "$COMPILE_ENVIRONMENT" = "1"; then
6760 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6761 case "$target" in
6762 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6763     if test "$ac_cv_header_atlbase_h" = "no"; then
6764         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.])
6765     fi
6766     ;;
6767 esac
6771 dnl ========================================================
6772 dnl leaky
6773 dnl ========================================================
6774 MOZ_ARG_ENABLE_BOOL(leaky,
6775 [  --enable-leaky          Build leaky memory tool],
6776     MOZ_LEAKY=1,
6777     MOZ_LEAKY=)
6780 dnl ========================================================
6781 dnl build the tests by default
6782 dnl ========================================================
6783 MOZ_ARG_DISABLE_BOOL(tests,
6784 [  --disable-tests         Do not build test libraries & programs],
6785     ENABLE_TESTS=,
6786     ENABLE_TESTS=1 )
6788 dnl ========================================================
6789 dnl parental controls (for Windows Vista)
6790 dnl ========================================================
6791 MOZ_ARG_DISABLE_BOOL(parental-controls,
6792 [  --disable-parental-controls
6793                           Do not build parental controls],
6794    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6795    MOZ_DISABLE_PARENTAL_CONTROLS=)
6796 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6797     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6800 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6802 dnl ========================================================
6803 dnl = Disable DOMCrypto
6804 dnl ========================================================
6805 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6806     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6809 dnl ========================================================
6810 dnl =
6811 dnl = Module specific options
6812 dnl =
6813 dnl ========================================================
6814 MOZ_ARG_HEADER(Individual module options)
6816 dnl ========================================================
6817 dnl = Disable feed handling components
6818 dnl ========================================================
6819 MOZ_ARG_DISABLE_BOOL(feeds,
6820 [  --disable-feeds         Disable feed handling and processing components],
6821     MOZ_FEEDS=,
6822     MOZ_FEEDS=1 )
6823 if test -n "$MOZ_FEEDS"; then
6824     AC_DEFINE(MOZ_FEEDS)
6825 else
6826     if test "$MOZ_BUILD_APP" = "browser"; then
6827         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6828     fi
6831 dnl ========================================================
6832 dnl = Enable mozStorage
6833 dnl ========================================================
6834 dnl Implicitly enabled by default if building calendar or places
6835 MOZ_ARG_ENABLE_BOOL(storage,
6836 [  --enable-storage        Enable mozStorage module and related components],
6837     MOZ_STORAGE=1,
6838     MOZ_STORAGE= )
6839 if test -n "$MOZ_STORAGE"; then
6840     AC_DEFINE(MOZ_STORAGE)
6843 dnl ========================================================
6844 dnl Check for sqlite
6845 dnl ========================================================
6847 MOZ_NATIVE_SQLITE=
6848 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6849 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6850 MOZ_NATIVE_SQLITE=1,
6851 MOZ_NATIVE_SQLITE= )
6853 if test -z "$MOZ_NATIVE_SQLITE"
6854 then
6855     SQLITE_CFLAGS=
6856     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6857 else
6858     dnl ============================
6859     dnl === SQLite Version check ===
6860     dnl ============================
6861     dnl Check to see if the system SQLite package is new enough.
6862     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6864     dnl ==================================
6865     dnl === SQLITE_SECURE_DELETE check ===
6866     dnl ==================================
6867     dnl Check to see if the system SQLite package is compiled with
6868     dnl SQLITE_SECURE_DELETE enabled.
6869     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6870     _SAVE_CFLAGS="$CFLAGS"
6871     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6872     _SAVE_LIBS="$LIBS"
6873     LIBS="$LIBS $SQLITE_LIBS"
6874     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6875         AC_TRY_RUN([
6876             #include "sqlite3.h"
6878             int main(int argc, char **argv){
6879               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6880             }],
6881             ac_cv_sqlite_secure_delete=yes,
6882             ac_cv_sqlite_secure_delete=no,
6883             ac_cv_sqlite_secure_delete=no
6884         )
6885     ])
6886     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6887     CFLAGS="$_SAVE_CFLAGS"
6888     LIBS="$_SAVE_LIBS"
6889     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6890         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6891     fi
6893     dnl ===============================
6894     dnl === SQLITE_THREADSAFE check ===
6895     dnl ===============================
6896     dnl Check to see if the system SQLite package is compiled with
6897     dnl SQLITE_THREADSAFE enabled.
6898     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6899     _SAVE_CFLAGS="$CFLAGS"
6900     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6901     _SAVE_LIBS="$LIBS"
6902     LIBS="$LIBS $SQLITE_LIBS"
6903     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6904         AC_TRY_RUN([
6905             #include "sqlite3.h"
6907             int main(int argc, char **argv){
6908               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6909             }],
6910             ac_cv_sqlite_threadsafe=yes,
6911             ac_cv_sqlite_threadsafe=no,
6912             ac_cv_sqlite_threadsafe=no
6913         )
6914     ])
6915     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6916     CFLAGS="$_SAVE_CFLAGS"
6917     LIBS="$_SAVE_LIBS"
6918     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6919         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6920     fi
6922     dnl ================================
6923     dnl === SQLITE_ENABLE_FTS3 check ===
6924     dnl ================================
6925     dnl check to see if the system SQLite package is compiled with
6926     dnl SQLITE_ENABLE_FTS3 enabled.
6927     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6928     _SAVE_CFLAGS="$CFLAGS"
6929     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6930     _SAVE_LIBS="$LIBS"
6931     LIBS="$LIBS $SQLITE_LIBS"
6932     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6933         AC_TRY_RUN([
6934             #include "sqlite3.h"
6936             int main(int argc, char **argv){
6937               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6938             }],
6939             ac_cv_sqlite_enable_fts3=yes,
6940             ac_cv_sqlite_enable_fts3=no,
6941             ac_cv_sqlite_enable_fts3=no
6942         )
6943     ])
6944     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6945     CFLAGS="$_SAVE_CFLAGS"
6946     LIBS="$_SAVE_LIBS"
6947     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6948         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6949     fi
6951     dnl =========================================
6952     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6953     dnl =========================================
6954     dnl check to see if the system SQLite package is compiled with
6955     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6956     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6957     _SAVE_CFLAGS="$CFLAGS"
6958     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6959     _SAVE_LIBS="$LIBS"
6960     LIBS="$LIBS $SQLITE_LIBS"
6961     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6962         AC_TRY_RUN([
6963             #include "sqlite3.h"
6965             int main(int argc, char **argv){
6966               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6967             }],
6968             ac_cv_sqlite_enable_unlock_notify=yes,
6969             ac_cv_sqlite_enable_unlock_notify=no,
6970             ac_cv_sqlite_enable_unlock_notify=no
6971         )
6972     ])
6973     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6974     CFLAGS="$_SAVE_CFLAGS"
6975     LIBS="$_SAVE_LIBS"
6976     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6977         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6978     fi
6981 AC_SUBST(MOZ_NATIVE_SQLITE)
6983 dnl ========================================================
6984 dnl = Enable help viewer (off by default)
6985 dnl ========================================================
6986 if test -n "$MOZ_HELP_VIEWER"; then
6987      dnl Do this if defined in confvars.sh
6988      AC_DEFINE(MOZ_HELP_VIEWER)
6991 dnl ========================================================
6992 dnl = Enable safe browsing (anti-phishing)
6993 dnl ========================================================
6994 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6995 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6996     MOZ_SAFE_BROWSING=1,
6997     MOZ_SAFE_BROWSING= )
6998 if test -n "$MOZ_SAFE_BROWSING"; then
6999     AC_DEFINE(MOZ_SAFE_BROWSING)
7001 AC_SUBST(MOZ_SAFE_BROWSING)
7003 dnl ========================================================
7004 dnl = Enable faststart component
7005 dnl ========================================================
7006 MOZ_ARG_ENABLE_BOOL(faststart,
7007 [  --enable-faststart      Enable the faststart component],
7008     MOZ_FASTSTART=1,
7009     MOZ_FASTSTART= )
7010 if test -n "$MOZ_FASTSTART"; then
7011     AC_DEFINE(MOZ_FASTSTART)
7013 AC_SUBST(MOZ_FASTSTART)
7015 dnl ========================================================
7016 dnl = Enable url-classifier
7017 dnl ========================================================
7018 dnl Implicitly enabled by default if building with safe-browsing
7019 if test -n "$MOZ_SAFE_BROWSING"; then
7020     MOZ_URL_CLASSIFIER=1
7022 MOZ_ARG_ENABLE_BOOL(url-classifier,
7023 [  --enable-url-classifier Enable url classifier module],
7024     MOZ_URL_CLASSIFIER=1,
7025     MOZ_URL_CLASSIFIER= )
7026 if test -n "$MOZ_URL_CLASSIFIER"; then
7027     AC_DEFINE(MOZ_URL_CLASSIFIER)
7029 AC_SUBST(MOZ_URL_CLASSIFIER)
7031 dnl ========================================================
7032 dnl = Disable zipwriter
7033 dnl ========================================================
7034 MOZ_ARG_DISABLE_BOOL(zipwriter,
7035 [  --disable-zipwriter     Disable zipwriter component],
7036     MOZ_ZIPWRITER=,
7037     MOZ_ZIPWRITER=1 )
7038 AC_SUBST(MOZ_ZIPWRITER)
7040 dnl ========================================================
7041 dnl = libconic
7042 dnl ========================================================
7043 dnl superseded by QtNetwork starting from 4.7
7044 MOZ_ENABLE_LIBCONIC=1
7046 if test -n "$MOZ_ENABLE_QT"; then
7047   if test "$MOZ_ENABLE_QTNETWORK"; then
7048     MOZ_ENABLE_LIBCONIC=
7049   fi
7052 MOZ_ARG_DISABLE_BOOL(libconic,
7053 [  --disable-libconic      Disable libconic],
7054     MOZ_ENABLE_LIBCONIC=,
7055     MOZ_ENABLE_LIBCONIC=1 )
7057 if test -n "$MOZ_ENABLE_LIBCONIC"; then
7058     PKG_CHECK_MODULES(LIBCONIC, conic,
7059                       MOZ_ENABLE_LIBCONIC=1,
7060                       MOZ_ENABLE_LIBCONIC=)
7062 if test "$MOZ_ENABLE_LIBCONIC"; then
7063     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
7066 AC_SUBST(MOZ_ENABLE_LIBCONIC)
7067 AC_SUBST(LIBCONIC_CFLAGS)
7068 AC_SUBST(LIBCONIC_LIBS)
7070 dnl ========================================================
7071 dnl = Maemo checks
7072 dnl ========================================================
7074 MAEMO_SDK_TARGET_VER=-1
7076 MOZ_ARG_WITH_STRING(maemo-version,
7077 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
7078                           Maemo SDK Version],
7079   MAEMO_SDK_TARGET_VER=$withval)
7081 case "$MAEMO_SDK_TARGET_VER" in
7083     MOZ_PLATFORM_MAEMO=5
7084     ;;
7087     MOZ_PLATFORM_MAEMO=6
7088     ;;
7091     dnl We aren't compiling for Maemo, move on.
7092     ;;
7094     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
7095     ;;
7096 esac
7098 if test $MOZ_PLATFORM_MAEMO; then
7099    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
7101    if test -z "$MOZ_ENABLE_DBUS"; then
7102        AC_MSG_ERROR([DBus is required when building for Maemo])
7103    fi
7105    MOZ_GFX_OPTIMIZE_MOBILE=1
7106    MOZ_WEBGL_GLX=
7107    MOZ_MAEMO_LIBLOCATION=
7109    if test $MOZ_PLATFORM_MAEMO = 5; then
7110       dnl if we have Xcomposite we should also have Xdamage and Xfixes
7111       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
7112                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
7113       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
7114                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
7116       AC_SUBST(XCOMPOSITE_LIBS)
7118       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
7119       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
7120       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
7121       if test -z "$_LIB_FOUND"; then
7122          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
7123       fi
7126       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
7127       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
7128       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
7129       if test -z "$_LIB_FOUND"; then
7130          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
7131       fi
7133       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
7134       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
7135       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
7136       if test -z "$_LIB_FOUND"; then
7137          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
7138       fi
7140    fi
7141    if test $MOZ_PLATFORM_MAEMO = 6; then
7142       dnl ========================================================
7143       dnl = Enable meego libcontentaction
7144       dnl ========================================================
7145       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
7146       [  --enable-meegocontentaction           Enable meegocontentaction support],
7147          MOZ_MEEGOCONTENTACTION=1,
7148          MOZ_MEEGOCONTENTACTION=)
7150       if test -n "$MOZ_MEEGOCONTENTACTION"; then
7152          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
7153          if test "$_LIB_FOUND"; then
7154             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
7155             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
7156             MOZ_ENABLE_CONTENTACTION=1
7157             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
7158             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
7159          fi
7160       fi
7162       MOZ_THUMB2=1
7163    fi
7165    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
7166    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
7167    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
7168    if test "$_LIB_FOUND"; then
7169       MOZ_MAEMO_LIBLOCATION=1
7170       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
7171    else
7172       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
7173    fi
7174    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
7176    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
7177    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
7178    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
7179    if test "$_LIB_FOUND"; then
7180       MOZ_ENABLE_MEEGOTOUCHSHARE=1
7181       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
7182    else
7183       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
7184    fi
7185    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
7187    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
7188    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
7191 dnl Setup default CPU arch for arm target
7192 case "$target_cpu" in
7193   arm*)
7194     MOZ_ARM_ARCH=armv7
7195   ;;
7196 esac
7197 dnl ========================================================
7198 dnl = Enable building the Thumb2 instruction set
7199 dnl ========================================================
7200 MOZ_ARG_ENABLE_BOOL(thumb2,
7201  [  --enable-thumb2         Enable Thumb2 instruction set (implies ARMv7)],
7202     MOZ_THUMB2=1,
7203     MOZ_THUMB2=)
7204 if test -n "$MOZ_THUMB2"; then
7205   MOZ_ARM_ARCH=armv7
7208 dnl ========================================================
7209 dnl = Enable building for ARM specific CPU features
7210 dnl ========================================================
7211 MOZ_ARG_WITH_STRING(cpu-arch,
7212 [  --with-cpu-arch=arch      Use specific arm architecture CPU features, default armv7],
7213     MOZ_ARM_ARCH=$withval)
7215 if test -n "$MOZ_THUMB2"; then
7216   case "$target_cpu" in
7217     arm*)
7218       if test "$MOZ_ARM_ARCH" != "armv7"; then
7219         AC_MSG_ERROR([--enable-thumb2 is not compatible with cpu-arch=$MOZ_ARM_ARCH])
7220       fi
7221       if test "$GNU_CC"; then
7222         AC_DEFINE(MOZ_THUMB2)
7223         AC_DEFINE(MOZ_ARM_ARCH)
7224         CFLAGS="$CFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7225         CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7226         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7227       else
7228         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
7229       fi
7230     ;;
7231     *)
7232       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
7233     ;;
7234   esac
7235 elif test "$MOZ_ARM_ARCH" = "armv7"; then
7236   case "$target_cpu" in
7237     arm*)
7238       if test "$GNU_CC"; then
7239         AC_DEFINE(MOZ_ARM_ARCH)
7240         CFLAGS="$CFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7241         CXXFLAGS="$CXXFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7242         ASFLAGS="$ASFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7243       else
7244         AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-GNU toolchains])
7245       fi
7246     ;;
7247     *)
7248       AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-ARM CPU architectures])
7249     ;;
7250   esac
7251 else
7252   case "$target_cpu" in
7253     arm*)
7254       if test "$GNU_CC"; then
7255         CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -msoft-float"
7256         CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -msoft-float"
7257         ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork -msoft-float"
7258       fi
7259       ;;
7260   esac
7263 AC_SUBST(MOZ_THUMB2)
7264 AC_SUBST(MOZ_ARM_ARCH)
7266 dnl ========================================================
7267 dnl = faststripe theme
7268 dnl ========================================================
7269 MOZ_ARG_ENABLE_BOOL(faststripe,
7270 [  --enable-faststripe     Use faststripe theme],
7271     MOZ_THEME_FASTSTRIPE=1,
7272     MOZ_THEME_FASTSTRIPE= )
7273 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7275 dnl ========================================================
7276 dnl =
7277 dnl = Feature options that require extra sources to be pulled
7278 dnl =
7279 dnl ========================================================
7280 dnl MOZ_ARG_HEADER(Features that require extra sources)
7282 dnl ========================================================
7283 dnl =
7284 dnl = Debugging Options
7285 dnl = 
7286 dnl ========================================================
7287 MOZ_ARG_HEADER(Debugging and Optimizations)
7289 dnl ========================================================
7290 dnl = Disable building with debug info.
7291 dnl = Debugging is OFF by default
7292 dnl ========================================================
7293 if test -z "$MOZ_DEBUG_FLAGS"; then
7294   MOZ_DEBUG_FLAGS="-g"
7297 MOZ_ARG_ENABLE_STRING(debug,
7298 [  --enable-debug[=DBG]    Enable building with developer debug info
7299                            (using compiler flags DBG)],
7300 [ if test "$enableval" != "no"; then
7301     MOZ_DEBUG=1
7302     if test -n "$enableval" -a "$enableval" != "yes"; then
7303         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7304         _MOZ_DEBUG_FLAGS_SET=1
7305     fi
7306   else
7307     MOZ_DEBUG=
7308   fi ],
7309   MOZ_DEBUG=)
7311 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7312 MOZ_ARG_WITH_STRING(debug-label,
7313 [  --with-debug-label=LABELS
7314                           Define DEBUG_<value> for each comma-separated
7315                           value given.],
7316 [ for option in `echo $withval | sed 's/,/ /g'`; do
7317     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7318 done])
7320 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7322 if test -n "$MOZ_DEBUG"; then
7323     AC_MSG_CHECKING([for valid debug flags])
7324     _SAVE_CFLAGS=$CFLAGS
7325     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7326     AC_TRY_COMPILE([#include <stdio.h>], 
7327         [printf("Hello World\n");],
7328         _results=yes,
7329         _results=no)
7330     AC_MSG_RESULT([$_results])
7331     if test "$_results" = "no"; then
7332         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7333     fi
7334     CFLAGS=$_SAVE_CFLAGS
7337 dnl ========================================================
7338 dnl enable mobile optimizations
7339 dnl ========================================================
7340 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7341 [  --enable-mobile-optimize
7342                           Enable mobile optimizations],
7343     MOZ_GFX_OPTIMIZE_MOBILE=1)
7345 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7347 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7348     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7351 dnl ========================================================
7352 dnl = Enable code optimization. ON by default.
7353 dnl ========================================================
7354 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7355         MOZ_OPTIMIZE_FLAGS="-O"
7358 MOZ_ARG_ENABLE_STRING(optimize,
7359 [  --disable-optimize      Disable compiler optimization
7360   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7361 [ if test "$enableval" != "no"; then
7362     MOZ_OPTIMIZE=1
7363     if test -n "$enableval" -a "$enableval" != "yes"; then
7364         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7365         MOZ_OPTIMIZE=2
7366     fi
7367 else
7368     MOZ_OPTIMIZE=
7369 fi ], MOZ_OPTIMIZE=1)
7371 if test "$COMPILE_ENVIRONMENT"; then
7372 if test -n "$MOZ_OPTIMIZE"; then
7373     AC_MSG_CHECKING([for valid optimization flags])
7374     _SAVE_CFLAGS=$CFLAGS
7375     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7376     AC_TRY_COMPILE([#include <stdio.h>], 
7377         [printf("Hello World\n");],
7378         _results=yes,
7379         _results=no)
7380     AC_MSG_RESULT([$_results])
7381     if test "$_results" = "no"; then
7382         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7383     fi
7384     CFLAGS=$_SAVE_CFLAGS
7386 fi # COMPILE_ENVIRONMENT
7388 AC_SUBST(MOZ_OPTIMIZE)
7389 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7390 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7391 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7393 dnl ========================================================
7394 dnl = (Deprecated) generation of debugger info for specific modules
7395 dnl ========================================================
7396 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7397 [  --enable-debugger-info-modules
7398                           Enable/disable debugger info for specific modules],
7399 [ if test "$enableval" != "no"; then
7400     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7401     MOZ_DEBUG_SYMBOLS=1
7402   fi ])
7404 dnl ========================================================
7405 dnl = Enable generation of debug symbols
7406 dnl ========================================================
7407 MOZ_ARG_ENABLE_STRING(debug-symbols,
7408 [  --enable-debug-symbols[=DBG]
7409                           Enable debugging symbols (using compiler flags DBG)],
7410 [ if test "$enableval" != "no"; then
7411       MOZ_DEBUG_SYMBOLS=1
7412       if test -n "$enableval" -a "$enableval" != "yes"; then
7413           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7414               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7415           else
7416               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7417           fi
7418       fi
7419   fi ])
7421 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7422     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7423     export MOZ_DEBUG_SYMBOLS
7426 dnl ========================================================
7427 dnl = Disable any treating of compile warnings as errors
7428 dnl ========================================================
7429 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7430 [  --disable-warnings-as-errors
7431                           Disable treating of warnings as errors],
7432     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7433     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7434 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7435    WARNINGS_AS_ERRORS=''
7438 dnl ========================================================
7439 dnl = Disable runtime logging checks
7440 dnl ========================================================
7441 MOZ_ARG_DISABLE_BOOL(logging,
7442 [  --disable-logging       Disable logging facilities],
7443     NS_DISABLE_LOGGING=1,
7444     NS_DISABLE_LOGGING= )
7445 if test "$NS_DISABLE_LOGGING"; then
7446     AC_DEFINE(NS_DISABLE_LOGGING)
7447 else
7448     AC_DEFINE(MOZ_LOGGING)
7451 dnl ========================================================
7452 dnl = This will enable logging of addref, release, ctor, dtor.
7453 dnl ========================================================
7454 _ENABLE_LOGREFCNT=42
7455 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7456 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7457     _ENABLE_LOGREFCNT=1,
7458     _ENABLE_LOGREFCNT= )
7459 if test "$_ENABLE_LOGREFCNT" = "1"; then
7460     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7461 elif test -z "$_ENABLE_LOGREFCNT"; then
7462     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7465 dnl ========================================================
7466 dnl = Enable trace malloc
7467 dnl ========================================================
7468 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7469 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7470 [  --enable-trace-malloc   Enable malloc tracing],
7471     NS_TRACE_MALLOC=1,
7472     NS_TRACE_MALLOC= )
7473 if test "$NS_TRACE_MALLOC"; then
7474   # Please, Mr. Linker Man, don't take away our symbol names
7475   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7476   USE_ELF_DYNSTR_GC=
7477   AC_DEFINE(NS_TRACE_MALLOC)
7479 AC_SUBST(NS_TRACE_MALLOC)
7481 dnl ========================================================
7482 dnl = Enable jemalloc
7483 dnl ========================================================
7484 MOZ_ARG_ENABLE_BOOL(jemalloc,
7485 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7486     MOZ_MEMORY=1,
7487     MOZ_MEMORY=)
7489 if test "$NS_TRACE_MALLOC"; then
7490     MOZ_MEMORY=
7493 if test "$MOZ_MEMORY"; then
7495   dnl Don't try to run compiler tests on Windows  
7496   if test "$OS_ARCH" = "WINNT"; then
7497     if test -z "$HAVE_64BIT_OS"; then
7498       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7499     else
7500       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7501     fi
7502   else
7503     AC_CHECK_SIZEOF([int *], [4])
7504     case "${ac_cv_sizeof_int_p}" in
7505     4)
7506       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7507       ;;
7508     8)
7509       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7510       ;;
7511     *)
7512       AC_MSG_ERROR([Unexpected pointer size])
7513       ;;
7514     esac
7515   fi
7517   AC_DEFINE(MOZ_MEMORY)
7518   if test "x$MOZ_DEBUG" = "x1"; then
7519     AC_DEFINE(MOZ_MEMORY_DEBUG)
7520   fi
7521   dnl The generic feature tests that determine how to compute ncpus are long and
7522   dnl complicated.  Therefore, simply define special cpp variables for the
7523   dnl platforms we have special knowledge of.
7524   case "${target}" in
7525   *-darwin*)
7526     AC_DEFINE(MOZ_MEMORY_DARWIN)
7527     ;;
7528   *-*freebsd*)
7529     AC_DEFINE(MOZ_MEMORY_BSD)
7530     ;;
7531   *-*linux*)
7532     AC_DEFINE(MOZ_MEMORY_LINUX)
7533     ;;
7534   *-netbsd*)
7535     AC_DEFINE(MOZ_MEMORY_BSD)
7536     ;;
7537   *-solaris*)
7538     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7539     ;;
7540   *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7541     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7542     dnl This is sort of awful. Will revisit if we add support for more versions
7543     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7544         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7545     fi
7546     if test -z "$WIN32_CRT_SRC_DIR"; then
7547       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7548         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).])
7549       else
7550         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7551       fi
7552     fi
7553     dnl cpu check
7554     case "${target_cpu}" in
7555     i*86)
7556       MOZ_CRT_CPU_ARCH=intel
7557       ;;
7558     x86_64)
7559       MOZ_CRT_CPU_ARCH=amd64
7560       ;;
7561     *)
7562       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7563       ;;
7564     esac
7566     AC_SUBST(MOZ_CRT_CPU_ARCH)
7568     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7569       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7570     fi
7571     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7572     _objdir_win=`pwd -W`
7573     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7574     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7575     dnl Also pass this to NSPR/NSS
7576     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7577     export DLLFLAGS
7578     ;;
7579   *-*wince)
7580     AC_DEFINE(MOZ_MEMORY_WINCE)
7581     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7582     if test -z "$WINCE_WINDOWS_MOBILE"; then
7583       AC_DEFINE(MOZ_MEMORY_WINCE6)
7584     fi
7585     ;;
7586   *-*winmo)
7587     AC_DEFINE(MOZ_MEMORY_WINCE)
7588     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7589     ;;
7590   *-android*)
7591     AC_DEFINE(MOZ_MEMORY_LINUX)
7592     AC_DEFINE(MOZ_MEMORY_ANDROID)
7593     _WRAP_MALLOC=1
7594     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
7595     WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
7596     ;;
7597   *)
7598     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7599     ;;
7600   esac
7602   if test "$OS_ARCH" != "Darwin"; then
7603     dnl NB: this must be kept in sync with jemalloc.h
7604     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7605     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7606     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7607   fi
7609 AC_SUBST(MOZ_MEMORY)
7610 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7611 AC_SUBST(WIN32_CRT_SRC_DIR)
7612 dnl Need to set this for make because NSS doesn't have configure
7613 AC_SUBST(DLLFLAGS)
7615 dnl ========================================================
7616 dnl = Use malloc wrapper lib
7617 dnl ========================================================
7618 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7619 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7620     _WRAP_MALLOC=1,
7621     _WRAP_MALLOC= )
7623 if test -n "$_WRAP_MALLOC"; then
7624     if test "$GNU_CC"; then
7625     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"
7626     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7627     MKCSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7628     fi
7631 dnl ========================================================
7632 dnl = Location of malloc wrapper lib
7633 dnl ========================================================
7634 MOZ_ARG_WITH_STRING(wrap-malloc,
7635 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7636     WRAP_MALLOC_LIB=$withval)
7638 dnl ========================================================
7639 dnl = Use JS Call tracing
7640 dnl ========================================================
7641 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7642 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7643     MOZ_TRACE_JSCALLS=1,
7644     MOZ_TRACE_JSCALLS= )
7645 if test -n "$MOZ_TRACE_JSCALLS"; then
7646     AC_DEFINE(MOZ_TRACE_JSCALLS)
7649 dnl ========================================================
7650 dnl = Use TraceVis
7651 dnl ========================================================
7652 MOZ_ARG_ENABLE_BOOL(tracevis,
7653 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7654     MOZ_TRACEVIS=1,
7655     MOZ_TRACEVIS= )
7656 if test -n "$MOZ_TRACEVIS"; then
7657     AC_DEFINE(MOZ_TRACEVIS)
7660 dnl ========================================================
7661 dnl = Use GCTimer
7662 dnl ========================================================
7663 MOZ_ARG_ENABLE_BOOL(gctimer,
7664 [  --enable-gctimer        Enable GC timer (default=no)],
7665     MOZ_GCTIMER=1,
7666     MOZ_GCTIMER= )
7667 if test -n "$MOZ_GCTIMER"; then
7668     AC_DEFINE(MOZ_GCTIMER)
7671 dnl ========================================================
7672 dnl = Use Valgrind
7673 dnl ========================================================
7674 MOZ_ARG_ENABLE_BOOL(valgrind,
7675 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7676     MOZ_VALGRIND=1,
7677     MOZ_VALGRIND= )
7678 if test -n "$MOZ_VALGRIND"; then
7679     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7680         AC_MSG_ERROR(
7681             [--enable-valgrind specified but Valgrind is not installed]))
7682     AC_DEFINE(MOZ_VALGRIND)
7685 dnl ========================================================
7686 dnl jprof
7687 dnl ========================================================
7688 MOZ_ARG_ENABLE_BOOL(jprof,
7689 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
7690     MOZ_JPROF=1,
7691     MOZ_JPROF= )
7692 if test -n "$MOZ_JPROF"; then
7693     MOZ_PROFILING=1
7694     AC_DEFINE(MOZ_JPROF)
7697 dnl ========================================================
7698 dnl shark
7699 dnl ========================================================
7700 MOZ_ARG_ENABLE_BOOL(shark,
7701 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
7702     MOZ_SHARK=1,
7703     MOZ_SHARK= )
7704 if test -n "$MOZ_SHARK"; then
7705     MOZ_PROFILING=1
7706     AC_DEFINE(MOZ_SHARK)
7709 dnl ========================================================
7710 dnl callgrind
7711 dnl ========================================================
7712 MOZ_ARG_ENABLE_BOOL(callgrind,
7713 [  --enable-callgrind      Enable callgrind profiling],
7714     MOZ_CALLGRIND=1,
7715     MOZ_CALLGRIND= )
7716 if test -n "$MOZ_CALLGRIND"; then
7717     AC_DEFINE(MOZ_CALLGRIND)
7720 dnl ========================================================
7721 dnl vtune
7722 dnl ========================================================
7723 MOZ_ARG_ENABLE_BOOL(vtune,
7724 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
7725     MOZ_VTUNE=1,
7726     MOZ_VTUNE= )
7727 if test -n "$MOZ_VTUNE"; then
7728     MOZ_PROFILING=1
7729     AC_DEFINE(MOZ_VTUNE)
7732 dnl ========================================================
7733 dnl Profiling
7734 dnl ========================================================
7735 if test -n "$MOZ_PROFILING"; then
7736     AC_DEFINE(MOZ_PROFILING)
7739 dnl ========================================================
7740 dnl Zealous JavaScript GC
7741 dnl ========================================================
7742 MOZ_ARG_ENABLE_BOOL(gczeal,
7743 [  --enable-gczeal         Enable zealous JavaScript GCing],
7744     JS_GC_ZEAL=1,
7745     JS_GC_ZEAL= )
7746 if test -n "$JS_GC_ZEAL"; then
7747     AC_DEFINE(JS_GC_ZEAL)
7750 dnl ======================================================
7751 dnl = Enable compiling with ccache
7752 dnl ======================================================
7753 MOZ_ARG_WITH_STRING(ccache,
7754 [  --with-ccache[=path/to/ccache]
7755                           Enable compiling with ccache],
7756     CCACHE=$withval, CCACHE="no")
7758 if test "$CCACHE" != "no"; then
7759     if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7760         CCACHE=
7761     else
7762         if test ! -e "$CCACHE"; then
7763             AC_MSG_ERROR([$CCACHE not found])
7764         fi
7765     fi
7766     MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7767     if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7768         AC_MSG_ERROR([ccache not found])
7769     elif test -x "$CCACHE"; then
7770         CC="$CCACHE $CC"
7771         CXX="$CCACHE $CXX"
7772     else
7773         AC_MSG_ERROR([$CCACHE is not executable])
7774     fi
7777 dnl ========================================================
7778 dnl = Enable static checking using gcc-dehydra
7779 dnl ========================================================
7781 MOZ_ARG_WITH_STRING(static-checking,
7782 [  --with-static-checking=path/to/gcc_dehydra.so
7783                           Enable static checking of code using GCC-dehydra],
7784     DEHYDRA_PATH=$withval,
7785     DEHYDRA_PATH= )
7787 if test -n "$DEHYDRA_PATH"; then
7788     if test ! -f "$DEHYDRA_PATH"; then
7789         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7790     fi
7791     AC_DEFINE(NS_STATIC_CHECKING)
7793 AC_SUBST(DEHYDRA_PATH)
7795 dnl ========================================================
7796 dnl = Enable stripping of libs & executables
7797 dnl ========================================================
7798 MOZ_ARG_ENABLE_BOOL(strip,
7799 [  --enable-strip          Enable stripping of libs & executables ],
7800     ENABLE_STRIP=1,
7801     ENABLE_STRIP= )
7803 dnl ========================================================
7804 dnl = Enable stripping of libs & executables when packaging
7805 dnl ========================================================
7806 MOZ_ARG_ENABLE_BOOL(install-strip,
7807 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7808     PKG_SKIP_STRIP= ,
7809     PKG_SKIP_STRIP=1)
7811 dnl ========================================================
7812 dnl = --enable-elf-dynstr-gc
7813 dnl ========================================================
7814 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7815 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7816     USE_ELF_DYNSTR_GC=1,
7817     USE_ELF_DYNSTR_GC= )
7819 dnl ========================================================
7820 dnl = --disable-elf-hack
7821 dnl ========================================================
7823 USE_ELF_HACK=1
7824 MOZ_ARG_DISABLE_BOOL(elf-hack,
7825 [  --disable-elf-hack      Disable elf hacks],
7826     USE_ELF_HACK=,
7827     USE_ELF_HACK=1)
7829 dnl ========================================================
7830 dnl = 
7831 dnl = Profiling and Instrumenting
7832 dnl = 
7833 dnl ========================================================
7834 MOZ_ARG_HEADER(Profiling and Instrumenting)
7836 dnl ========================================================
7837 dnl = Enable timeline service, which provides lightweight
7838 dnl = instrumentation of mozilla for performance measurement.
7839 dnl = Timeline is off by default.
7840 dnl ========================================================
7841 MOZ_ARG_ENABLE_BOOL(timeline,
7842 [  --enable-timeline       Enable timeline services ],
7843     MOZ_TIMELINE=1,
7844     MOZ_TIMELINE= )
7845 if test -n "$MOZ_TIMELINE"; then
7846     AC_DEFINE(MOZ_TIMELINE)
7849 dnl ========================================================
7850 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7851 dnl = timing for identifying code bottlenecks 
7852 dnl = NS_FUNCTION_TIMER is off by default.
7853 dnl ========================================================
7854 MOZ_ARG_ENABLE_BOOL(functiontimer,
7855 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7856     NS_FUNCTION_TIMER=1,
7857     NS_FUNCTION_TIMER= )
7858 if test -n "$NS_FUNCTION_TIMER"; then
7859     AC_DEFINE(NS_FUNCTION_TIMER)
7862 dnl ========================================================
7863 dnl Turn on reflow counting
7864 dnl ========================================================
7865 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7866 [  --enable-reflow-perf    Enable reflow performance tracing],
7867     MOZ_REFLOW_PERF=1,
7868     MOZ_REFLOW_PERF= )
7869 if test -n "$MOZ_REFLOW_PERF"; then
7870     AC_DEFINE(MOZ_REFLOW_PERF)
7873 dnl ========================================================
7874 dnl Enable code size metrics.
7875 dnl ========================================================
7876 MOZ_ARG_ENABLE_BOOL(codesighs,
7877 [  --enable-codesighs      Enable code size analysis tools],
7878     _ENABLE_CODESIGHS=1,
7879     _ENABLE_CODESIGHS= )
7880 if test -n "$_ENABLE_CODESIGHS"; then
7881     if test -d $srcdir/tools/codesighs; then 
7882         MOZ_MAPINFO=1
7883     else
7884         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7885     fi
7888 dnl ========================================================
7889 dnl = Support for Quantify (Windows)
7890 dnl ========================================================
7891 MOZ_ARG_ENABLE_BOOL(quantify,
7892 [  --enable-quantify       Enable Quantify support (Windows only) ],
7893     MOZ_QUANTIFY=1,
7894     MOZ_QUANTIFY= )
7896 dnl ========================================================
7897 dnl = Support for demangling undefined symbols
7898 dnl ========================================================
7899 if test -z "$SKIP_LIBRARY_CHECKS"; then
7900     AC_LANG_SAVE
7901     AC_LANG_CPLUSPLUS
7902     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7903     AC_LANG_RESTORE
7906 # Demangle only for debug or trace-malloc builds
7907 MOZ_DEMANGLE_SYMBOLS=
7908 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7909     MOZ_DEMANGLE_SYMBOLS=1
7910     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7912 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7914 dnl ========================================================
7915 dnl = Support for gcc stack unwinding (from gcc 3.3)
7916 dnl ========================================================
7917 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7918     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7921 dnl ========================================================
7922 dnl =
7923 dnl = Misc. Options
7924 dnl = 
7925 dnl ========================================================
7926 MOZ_ARG_HEADER(Misc. Options)
7928 dnl ========================================================
7929 dnl update xterm title
7930 dnl ========================================================
7931 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7932 [  --enable-xterm-updates  Update XTERM titles with current command.],
7933     MOZ_UPDATE_XTERM=1,
7934     MOZ_UPDATE_XTERM= )
7936 dnl =========================================================
7937 dnl = Chrome format
7938 dnl =========================================================
7939 MOZ_ARG_ENABLE_STRING([chrome-format],
7940 [  --enable-chrome-format=jar|flat|both|symlink|omni
7941                           Select FORMAT of chrome files (default=jar)],
7942     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7944 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7945     MOZ_CHROME_FILE_FORMAT=jar
7948 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7949     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7950     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7951     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7952     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7953     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7956 dnl =========================================================
7957 dnl Omnijar packaging (bug 552121)
7958 dnl =========================================================
7959 dnl Omnijar packaging is compatible with flat packaging.
7960 dnl In unpackaged builds, omnijar looks for files as if
7961 dnl things were flat packaged. After packaging, all files
7962 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7963 dnl is set to flat since putting files into jars is only
7964 dnl done during packaging with omnijar.
7965 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7966     MOZ_OMNIJAR=1
7967     AC_DEFINE(MOZ_OMNIJAR)
7968     MOZ_CHROME_FILE_FORMAT=flat
7969 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7970     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7973 AC_SUBST(MOZ_OMNIJAR)
7975 dnl ========================================================
7976 dnl = Define default location for MOZILLA_FIVE_HOME
7977 dnl ========================================================
7978 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7979 [  --with-default-mozilla-five-home
7980                           Set the default value for MOZILLA_FIVE_HOME],
7981 [ val=`echo $withval`
7982   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7984 dnl ========================================================
7985 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7986 dnl ========================================================
7987 MOZ_ARG_WITH_STRING(user-appdir,
7988 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7989 [ val=`echo $withval`
7990 if echo "$val" | grep "\/" >/dev/null; then
7991     AC_MSG_ERROR("Homedir must be single relative path.")
7992 else 
7993     MOZ_USER_DIR="$val"
7994 fi])
7996 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7998 dnl ========================================================
7999 dnl = Doxygen configuration
8000 dnl ========================================================
8001 dnl Use commas to specify multiple dirs to this arg
8002 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
8003 MOZ_ARG_WITH_STRING(doc-input-dirs,
8004 [  --with-doc-input-dirs=DIRS
8005                           Header/idl dirs to create docs from],
8006 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
8007 AC_SUBST(MOZ_DOC_INPUT_DIRS)
8009 dnl Use commas to specify multiple dirs to this arg
8010 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
8011 MOZ_ARG_WITH_STRING(doc-include-dirs,
8012 [  --with-doc-include-dirs=DIRS  
8013                           Include dirs to preprocess doc headers],
8014 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
8015 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
8017 MOZ_DOC_OUTPUT_DIR='./dist/docs'
8018 MOZ_ARG_WITH_STRING(doc-output-dir,
8019 [  --with-doc-output-dir=DIR
8020                           Dir to generate docs into],
8021 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
8022 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
8024 if test -z "$SKIP_COMPILER_CHECKS"; then
8025 dnl ========================================================
8026 dnl =
8027 dnl = Compiler Options
8028 dnl = 
8029 dnl ========================================================
8030 MOZ_ARG_HEADER(Compiler Options)
8032 dnl ========================================================
8033 dnl Check for gcc -pipe support
8034 dnl ========================================================
8035 AC_MSG_CHECKING([for gcc -pipe support])
8036 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
8037     echo '#include <stdio.h>' > dummy-hello.c
8038     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
8039     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
8040     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
8041     if test $? = 0; then
8042         _res_as_stdin="yes"
8043     else
8044         _res_as_stdin="no"
8045     fi
8046     if test "$_res_as_stdin" = "yes"; then
8047         _SAVE_CFLAGS=$CFLAGS
8048         CFLAGS="$CFLAGS -pipe"
8049         AC_TRY_COMPILE( [ #include <stdio.h> ],
8050             [printf("Hello World\n");],
8051             [_res_gcc_pipe="yes"],
8052             [_res_gcc_pipe="no"] )
8053         CFLAGS=$_SAVE_CFLAGS
8054     fi
8055     if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
8056         _res="yes";
8057         CFLAGS="$CFLAGS -pipe"
8058         CXXFLAGS="$CXXFLAGS -pipe"
8059     else
8060         _res="no"
8061     fi
8062     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
8063     AC_MSG_RESULT([$_res])
8064 else
8065     AC_MSG_RESULT([no])
8068 dnl ========================================================
8069 dnl Profile guided optimization
8070 dnl ========================================================
8071 dnl Test for profiling options
8072 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
8074 dnl Provide a switch to disable PGO even when called via profiledbuild.
8075 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
8076 [  --disable-profile-guided-optimization
8077                           Don't build with PGO even if called via make profiledbuild],
8078 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
8079 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
8081 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
8083 _SAVE_CFLAGS="$CFLAGS"
8084 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
8086 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
8087 AC_TRY_COMPILE([], [return 0;],
8088                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
8089                  result="yes" ], result="no")
8090 AC_MSG_RESULT([$result])
8092 if test $result = "yes"; then
8093   PROFILE_GEN_LDFLAGS="-fprofile-generate"
8094   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
8095   PROFILE_USE_LDFLAGS="-fprofile-use"
8098 CFLAGS="$_SAVE_CFLAGS"
8100 if test -n "$INTEL_CC"; then
8101   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
8102   PROFILE_GEN_LDFLAGS=
8103   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
8104   PROFILE_USE_LDFLAGS=
8107 dnl Sun Studio on Solaris
8108 if test "$SOLARIS_SUNPRO_CC"; then
8109   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
8110   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
8111   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
8112   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
8115 AC_SUBST(PROFILE_GEN_CFLAGS)
8116 AC_SUBST(PROFILE_GEN_LDFLAGS)
8117 AC_SUBST(PROFILE_USE_CFLAGS)
8118 AC_SUBST(PROFILE_USE_LDFLAGS)
8120 AC_LANG_CPLUSPLUS
8122 dnl ========================================================
8123 dnl Test for -pedantic bustage
8124 dnl ========================================================
8125 MOZ_ARG_DISABLE_BOOL(pedantic,
8126 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
8127 _PEDANTIC= )
8128 if test "$_PEDANTIC"; then
8129     _SAVE_CXXFLAGS=$CXXFLAGS
8130     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8131     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
8132     AC_TRY_COMPILE([$configure_static_assert_macros],
8133                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
8134                    result="no", result="yes" )
8135     AC_MSG_RESULT([$result])
8136     CXXFLAGS="$_SAVE_CXXFLAGS"
8138     case "$result" in
8139     no)
8140         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8141         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8142         ;;
8143     yes)
8144         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
8145         ;;
8146     esac
8149 dnl ========================================================
8150 dnl Test for correct temporary object destruction order
8151 dnl ========================================================
8152 dnl We want to make sure the compiler follows the C++ spec here as 
8153 dnl xpcom and the string classes depend on it (bug 235381).
8154 AC_MSG_CHECKING([for correct temporary object destruction order])
8155 AC_TRY_RUN([ class A {
8156              public:  A(int& x) : mValue(x) {}
8157                       ~A() { mValue--; }
8158                       operator char**() { return 0; }
8159              private:  int& mValue;
8160              };
8161              void func(char **arg) {}
8162              int m=2;
8163              void test() {
8164                   func(A(m));
8165                   if (m==1) m = 0;
8166              }
8167              int main() {
8168                  test();
8169                  return(m);
8170              }
8171              ],
8172      result="yes", result="no", result="maybe")
8173 AC_MSG_RESULT([$result])
8175 if test "$result" = "no"; then
8176     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
8179 dnl ========================================================
8180 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
8181 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
8182 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
8183 dnl ========================================================
8184 _SAVE_CXXFLAGS=$CXXFLAGS
8185 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
8186 AC_CACHE_CHECK(for correct overload resolution with const and templates,
8187     ac_nscap_nonconst_opeq_bug,
8188     [AC_TRY_COMPILE([
8189                       template <class T>
8190                       class Pointer
8191                         {
8192                         public:
8193                           T* myPtr;
8194                         };
8195                       
8196                       template <class T, class U>
8197                       int operator==(const Pointer<T>& rhs, U* lhs)
8198                         {
8199                           return rhs.myPtr == lhs;
8200                         }
8201                       
8202                       template <class T, class U>
8203                       int operator==(const Pointer<T>& rhs, const U* lhs)
8204                         {
8205                           return rhs.myPtr == lhs;
8206                         }
8207                     ],
8208                     [
8209                       Pointer<int> foo;
8210                       const int* bar;
8211                       return foo == bar;
8212                     ],
8213                     ac_nscap_nonconst_opeq_bug="no",
8214                     ac_nscap_nonconst_opeq_bug="yes")])
8215 CXXFLAGS="$_SAVE_CXXFLAGS"
8217 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8218     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8220 fi # SKIP_COMPILER_CHECKS
8222 dnl ========================================================
8223 dnl C++ rtti
8224 dnl Should be smarter and check that the compiler does indeed have rtti
8225 dnl ========================================================
8227 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
8228 [  --enable-cpp-rtti       Enable C++ RTTI ],
8229 [ _MOZ_USE_RTTI=1 ],
8230 [ _MOZ_USE_RTTI= ])
8232 if test "$_MOZ_USE_RTTI"; then
8233    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
8234 else
8235    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
8238 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
8240 dnl ========================================================
8241 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
8242 dnl Should be smarter and check that the compiler does indeed have exceptions
8243 dnl ========================================================
8244 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
8245 [  --enable-cpp-exceptions Enable C++ exceptions ],
8246 [ _MOZ_CPP_EXCEPTIONS=1 ],
8247 [ _MOZ_CPP_EXCEPTIONS= ])
8249 if test "$_MOZ_CPP_EXCEPTIONS"; then
8250     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
8251     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
8252 else
8253     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
8256 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
8258 # Irix & OSF native compilers do not like exception declarations 
8259 # when exceptions are disabled
8260 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
8261     AC_DEFINE(CPP_THROW_NEW, [])
8262 else
8263     AC_DEFINE(CPP_THROW_NEW, [throw()])
8265 AC_LANG_C
8267 dnl ========================================================
8268 dnl =
8269 dnl = Build depencency options
8270 dnl =
8271 dnl ========================================================
8272 MOZ_ARG_HEADER(Build dependencies)
8274 dnl ========================================================
8275 dnl = Do not auto generate dependency info
8276 dnl ========================================================
8277 MOZ_AUTO_DEPS=1
8278 MOZ_ARG_DISABLE_BOOL(auto-deps,
8279 [  --disable-auto-deps     Do not automatically generate dependency info],
8280     MOZ_AUTO_DEPS=,
8281     MOZ_AUTO_DEPS=1)
8283 if test -n "$MOZ_AUTO_DEPS"; then
8284 dnl ========================================================
8285 dnl = Use mkdepend instead of $CC -MD for dependency generation
8286 dnl ========================================================
8287 _cpp_md_flag=
8288 MOZ_ARG_DISABLE_BOOL(md,
8289 [  --disable-md            Do not use compiler-based dependencies ],
8290   [_cpp_md_flag=],
8291   [_cpp_md_flag=1],
8292   [dnl Default is to turn on -MD if using GNU-compatible compilers
8293    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
8294      _cpp_md_flag=1
8295    fi
8296   dnl Default is to use -xM if using Sun Studio on Solaris
8297    if test "$SOLARIS_SUNPRO_CC"; then
8298      _cpp_md_flag=1
8299    fi])
8300 if test "$_cpp_md_flag"; then
8301   COMPILER_DEPEND=1
8302   if test "$OS_ARCH" = "OpenVMS"; then
8303     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
8304   else
8305     _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8306   fi
8307   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8308   if test "$SOLARIS_SUNPRO_CC"; then
8309     _DEPEND_CFLAGS=
8310   fi
8311 else
8312   COMPILER_DEPEND=
8313   dnl Don't override this for MSVC
8314   if test -z "$_WIN32_MSVC"; then
8315     _USE_CPP_INCLUDE_FLAG=
8316     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8317     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8318   else
8319     echo '#include <stdio.h>' > dummy-hello.c
8320     changequote(,)
8321     CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8322     changequote([,])
8323     if test -z "$CL_INCLUDES_PREFIX"; then
8324         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8325     fi
8326     AC_SUBST(CL_INCLUDES_PREFIX)
8327     rm -f dummy-hello.c
8328     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8329     dnl cl.py provides dependency generation for MSVC
8330     CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8331     CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8332     COMPILER_DEPEND=1
8333   fi
8335 fi # MOZ_AUTO_DEPS
8336 MDDEPDIR='.deps'
8337 AC_SUBST(MOZ_AUTO_DEPS)
8338 AC_SUBST(COMPILER_DEPEND)
8339 AC_SUBST(MDDEPDIR)
8340 AC_SUBST(CC_WRAPPER)
8341 AC_SUBST(CXX_WRAPPER)
8344 dnl ========================================================
8345 dnl =
8346 dnl = Static Build Options
8347 dnl =
8348 dnl ========================================================
8349 MOZ_ARG_HEADER(Static build options)
8351 MOZ_ARG_ENABLE_BOOL(static,
8352 [  --enable-static         Enable building of internal static libs],
8353     BUILD_STATIC_LIBS=1,
8354     BUILD_STATIC_LIBS=)
8356 MOZ_ARG_ENABLE_BOOL(libxul,
8357 [  --enable-libxul         Enable building of libxul],
8358     MOZ_ENABLE_LIBXUL=1,
8359     MOZ_ENABLE_LIBXUL=)
8361 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8362 if test "$OS_ARCH" = "WINNT"; then
8363   ENABLE_SHARED_JS=1
8366 MOZ_ARG_ENABLE_BOOL(shared-js,
8367 [  --enable-shared-js
8368                           Create a shared JavaScript library.],
8369     ENABLE_SHARED_JS=1,
8370     ENABLE_SHARED_JS=)
8372 if test -z "$MOZ_ENABLE_LIBXUL"; then
8373   dnl --disable-libxul implies shared js
8374   ENABLE_SHARED_JS=1
8377 if test -n "$ENABLE_SHARED_JS"; then
8378   JS_SHARED_LIBRARY=1
8379   MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
8380 else
8381   MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
8382   AC_DEFINE(MOZ_STATIC_JS)
8384 AC_SUBST(JS_SHARED_LIBRARY)
8386 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8387         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
8390 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8391         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8394 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
8395     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
8398 if test -z "$MOZ_ENABLE_LIBXUL" -a -n "$MOZ_OMNIJAR"; then
8399     AC_MSG_ERROR([Omnijar packaging is incompatible with --disable-libxul. Please either --enable-libxul or --enable-chrome-format=jar|flat|symlink]);
8402 AC_SUBST(LIBXUL_LIBS)
8404 if test -n "$MOZ_ENABLE_LIBXUL"; then
8405     XPCOM_LIBS="$LIBXUL_LIBS"
8406     AC_DEFINE(MOZ_ENABLE_LIBXUL)
8407 else
8408     if test -n "$BUILD_STATIC_LIBS"; then
8409         AC_DEFINE(MOZ_STATIC_BUILD)
8410     fi
8411     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
8414 dnl ========================================================
8415 dnl =
8416 dnl = Standalone module options
8417 dnl = 
8418 dnl ========================================================
8419 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8421 dnl Check for GLib and libIDL.
8422 dnl ========================================================
8423 SKIP_IDL_CHECK="no"
8425 if test -z "$COMPILE_ENVIRONMENT"; then
8426     SKIP_IDL_CHECK="yes"
8429 dnl = Allow users to disable libIDL checking for standalone modules
8430 MOZ_ARG_WITHOUT_BOOL(libIDL,
8431 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
8432         SKIP_IDL_CHECK="yes")
8434 if test -z "$CROSS_COMPILE"; then
8435     if test -z "$HOST_LIBIDL_CONFIG"; then
8436         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8437     fi
8438     if test -z "$HOST_LIBIDL_PREFIX"; then
8439         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8440     fi
8443 if test "$SKIP_IDL_CHECK" = "no"
8444 then
8445     _LIBIDL_FOUND=
8446     case "$host" in
8447     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8448         if test -n "$GLIB_PREFIX"; then
8449             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8450             if test "$?" = "0"; then
8451                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8452                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8453                 fi
8454                 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8455             else
8456                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8457             fi
8458         else
8459             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8460         fi
8461         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8462             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8463         fi
8464         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8465         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8466             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8467         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8468             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8469         else
8470             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8471         fi
8473         if test -n "$HOST_LIBIDL_PREFIX"; then
8474             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8475             if test "$?" = "0"; then
8476                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8477                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8478                 fi
8479                 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8480             else
8481                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8482             fi
8483         else
8484             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8485         fi        
8486         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8487             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8488         fi
8489         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8490         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8491             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8492             STATIC_LIBIDL=1
8493         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8494             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8495         else
8496             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8497         fi
8498         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8499         _LIBIDL_FOUND=1
8500         ;;
8501     esac
8503     if test -z "$_LIBIDL_FOUND"; then
8504         if test "$MACOS_SDK_DIR"; then 
8505             dnl xpidl, and therefore libIDL, is only needed on the build host.
8506             dnl Don't build it against the SDK, as that causes problems.
8507             _MACSAVE_CFLAGS="$CFLAGS"
8508             _MACSAVE_LIBS="$LIBS"
8509             _MACSAVE_LDFLAGS="$LDFLAGS"
8510             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8511           changequote(,)
8512           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"`
8513           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8514           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8515           changequote([,])
8516           unset NEXT_ROOT
8517         fi
8519         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8520     fi
8522     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8523     dnl to either libIDL1 or libIDL2.
8524     if test -z "$_LIBIDL_FOUND"; then
8525         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8526         if test -z "$_LIBIDL_FOUND"; then
8527             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8528         fi
8529     fi
8530     dnl
8531     dnl If we don't have a libIDL config program & not cross-compiling, 
8532     dnl     look for orbit-config instead.
8533     dnl
8534     if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8535         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8536         if test -n "$ORBIT_CONFIG"; then
8537             AC_MSG_CHECKING([for ORBit libIDL usability])
8538                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8539             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8540             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8541             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8542             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8543             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8544             HOST_LIBIDL_CONFIG=
8545             _SAVE_CFLAGS="$CFLAGS"
8546             _SAVE_LIBS="$LIBS"
8547             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8548             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8549             AC_TRY_RUN([
8550 #include <stdlib.h>
8551 #include <libIDL/IDL.h>
8552 int main() {
8553   char *s;
8554   s=strdup(IDL_get_libver_string());
8555   if(s==NULL) {
8556     exit(1);
8557   }
8558   exit(0);
8560             ], [_LIBIDL_FOUND=1
8561                 result="yes"],
8562                [HOST_LIBIDL_CFLAGS=
8563                 HOST_LIBIDL_LIBS=
8564                 result="no"],
8565                [_LIBIDL_FOUND=1
8566                 result="maybe"] )
8567             AC_MSG_RESULT($result)
8568             CFLAGS="$_SAVE_CFLAGS"
8569             LIBS="$_SAVE_LIBS"
8570         fi
8571     fi
8572     if test -z "$_LIBIDL_FOUND"; then
8573         AC_MSG_ERROR([libIDL not found.
8574         libIDL $LIBIDL_VERSION or higher is required.])
8575     fi
8576     if test "$MACOS_SDK_DIR"; then
8577       CFLAGS="$_MACSAVE_CFLAGS"
8578       LIBS="$_MACSAVE_LIBS"
8579       LDFLAGS="$_MACSAVE_LDFLAGS"
8580       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8581         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8582       fi
8583     fi
8586 if test -n "$CROSS_COMPILE"; then
8587     case "$target" in
8588     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8589         if test -n "$GLIB_PREFIX"; then
8590             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8591             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8592                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8593             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8594                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8595             else
8596                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8597             fi
8598         fi
8600         if test -n "$LIBIDL_PREFIX"; then
8601             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8602             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8603                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8604                 STATIC_LIBIDL=1
8605             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8606                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8607             else
8608                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8609             fi
8610         fi
8611         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8612         ;;
8613     *)
8614         if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8615             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8616             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8617         fi
8618         ;;
8619     esac
8620 else
8621     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8622     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8625 if test -z "$SKIP_PATH_CHECKS"; then
8626 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8627     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8628         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8629     else
8630         AM_PATH_GLIB(${GLIB_VERSION})
8631     fi
8635 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8636     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8639 AC_SUBST(LIBIDL_CFLAGS)
8640 AC_SUBST(LIBIDL_LIBS)
8641 AC_SUBST(STATIC_LIBIDL)
8642 AC_SUBST(GLIB_CFLAGS)
8643 AC_SUBST(GLIB_LIBS)
8644 AC_SUBST(GLIB_GMODULE_LIBS)
8645 AC_SUBST(HOST_LIBIDL_CONFIG)
8646 AC_SUBST(HOST_LIBIDL_CFLAGS)
8647 AC_SUBST(HOST_LIBIDL_LIBS)
8649 dnl ========================================================
8650 dnl Check for cairo
8651 dnl ========================================================
8652 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8654 MOZ_TREE_CAIRO=1
8655 MOZ_ARG_ENABLE_BOOL(system-cairo,
8656 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8657 MOZ_TREE_CAIRO=,
8658 MOZ_TREE_CAIRO=1 )
8660 MOZ_TREE_PIXMAN=1
8661 MOZ_ARG_ENABLE_BOOL(system-pixman,
8662 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8663 MOZ_TREE_PIXMAN=,
8664 MOZ_TREE_PIXMAN=1 )
8666 # Check for headers defining standard int types.
8667 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8669 if test "$MOZ_TREE_CAIRO"; then
8670     AC_DEFINE(MOZ_TREE_CAIRO)
8672     # For now we assume that we will have a uint64_t available through
8673     # one of the above headers or mozstdint.h.
8674     AC_DEFINE(HAVE_UINT64_T)
8676     # Define macros for cairo-features.h
8677     if test "$MOZ_X11"; then
8678         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8679         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8680         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8681         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8682         MOZ_ENABLE_CAIRO_FT=1
8683         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8684     fi
8685     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8686         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8687     fi
8688     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8689         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8690         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8691         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8692     fi
8693     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8694         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8695         if test -z "$WINCE"; then
8696             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8697             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8698                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8699                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8700                 MOZ_ENABLE_D2D_SURFACE=1
8701                 MOZ_ENABLE_DWRITE_FONT=1
8702             else
8703                 WIN32_DWRITE_FONT_FEATURE=
8704                 WIN32_D2D_SURFACE_FEATURE=
8705             fi
8706         else
8707             WIN32_FONT_FEATURE=
8708             WIN32_DWRITE_FONT_FEATURE=
8709             WIN32_D2D_SURFACE_FEATURE=
8710         fi
8712         AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8714         dnl D3D10 Layers depend on D2D Surfaces.
8715         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8716           AC_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8717         fi
8719     fi
8720     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8721         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8722         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8723         MOZ_ENABLE_CAIRO_FT=1
8724         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8725         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8726     fi
8727     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8728         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8729         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8730         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8731         MOZ_ENABLE_CAIRO_FT=1
8732     fi
8733     if test "$USE_FC_FREETYPE"; then
8734         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8735     fi
8736     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8737     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8738     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8739     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8740     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8741     AC_SUBST(CAIRO_FT_CFLAGS)
8742     AC_SUBST(HAS_OGLES)
8744     if test "$MOZ_DEBUG"; then
8745       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8746     else
8747       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8748     fi
8750     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8752     AC_SUBST(PS_SURFACE_FEATURE)
8753     AC_SUBST(PDF_SURFACE_FEATURE)
8754     AC_SUBST(SVG_SURFACE_FEATURE)
8755     AC_SUBST(XLIB_SURFACE_FEATURE)
8756     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8757     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8758     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8759     AC_SUBST(XCB_SURFACE_FEATURE)
8760     AC_SUBST(WIN32_SURFACE_FEATURE)
8761     AC_SUBST(OS2_SURFACE_FEATURE)
8762     AC_SUBST(BEOS_SURFACE_FEATURE)
8763     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8764     AC_SUBST(FT_FONT_FEATURE)
8765     AC_SUBST(FC_FONT_FEATURE)
8766     AC_SUBST(WIN32_FONT_FEATURE)
8767     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8768     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8769     AC_SUBST(QUARTZ_FONT_FEATURE)
8770     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8771     AC_SUBST(QT_SURFACE_FEATURE)
8773     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8775     if test "$MOZ_TREE_PIXMAN"; then
8776         AC_DEFINE(MOZ_TREE_PIXMAN)
8777         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8778     else
8779         PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8780         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8781         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8782     fi
8784     if test "$MOZ_X11"; then
8785         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8786     fi
8788     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8789     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8791 else
8792    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8793    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8794    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8795    PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8796    if test "$MOZ_X11"; then
8797         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8798         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8799         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8800    fi
8803 AC_SUBST(MOZ_TREE_CAIRO)
8804 AC_SUBST(MOZ_CAIRO_CFLAGS)
8805 AC_SUBST(MOZ_CAIRO_LIBS)
8806 AC_SUBST(MOZ_TREE_PIXMAN)
8808 dnl ========================================================
8809 dnl qcms
8810 dnl ========================================================
8812 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8813 AC_SUBST(QCMS_LIBS)
8815 dnl ========================================================
8816 dnl HarfBuzz
8817 dnl ========================================================
8818 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8819 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8821 dnl ========================================================
8822 dnl OTS
8823 dnl ========================================================
8824 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8825 AC_SUBST(MOZ_OTS_LIBS)
8827 dnl ========================================================
8828 dnl disable xul
8829 dnl ========================================================
8830 MOZ_ARG_DISABLE_BOOL(xul,
8831 [  --disable-xul           Disable XUL],
8832     MOZ_XUL= )
8833 if test "$MOZ_XUL"; then
8834   AC_DEFINE(MOZ_XUL)
8835 else
8836   dnl remove extensions that require XUL
8837   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8840 AC_SUBST(MOZ_XUL)
8842 dnl ========================================================
8843 dnl disable profile locking
8844 dnl   do no use this in applications that can have more than
8845 dnl   one process accessing the profile directory.
8846 dnl ========================================================
8847 MOZ_ARG_DISABLE_BOOL(profilelocking,
8848 [  --disable-profilelocking
8849                           Disable profile locking],
8850     MOZ_PROFILELOCKING=,
8851     MOZ_PROFILELOCKING=1 )
8852 if test "$MOZ_PROFILELOCKING"; then
8853   AC_DEFINE(MOZ_PROFILELOCKING)
8856 dnl ========================================================
8857 dnl disable rdf services
8858 dnl ========================================================
8859 MOZ_ARG_DISABLE_BOOL(rdf,
8860 [  --disable-rdf           Disable RDF],
8861     MOZ_RDF= )
8862 if test "$MOZ_RDF"; then
8863   AC_DEFINE(MOZ_RDF)
8866 AC_SUBST(MOZ_RDF)
8868 dnl ========================================================
8869 dnl necko configuration options
8870 dnl ========================================================
8873 dnl option to disable various necko protocols
8875 MOZ_ARG_ENABLE_STRING(necko-protocols,
8876 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8877                           Enable/disable specific protocol handlers],
8878 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8879     if test "$option" = "yes" -o "$option" = "all"; then
8880         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8881     elif test "$option" = "no" -o "$option" = "none"; then
8882         NECKO_PROTOCOLS=""
8883     elif test "$option" = "default"; then
8884         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8885     elif test `echo "$option" | grep -c \^-` != 0; then
8886         option=`echo $option | sed 's/^-//'`
8887         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8888     else
8889         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8890     fi
8891 done],
8892     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8893 dnl Remove dupes
8894 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8895 AC_SUBST(NECKO_PROTOCOLS)
8896 for p in $NECKO_PROTOCOLS; do
8897     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8898 done
8901 dnl option to disable necko's disk cache
8903 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8904 [  --disable-necko-disk-cache
8905                           Disable necko disk cache],
8906     NECKO_DISK_CACHE=,
8907     NECKO_DISK_CACHE=1)
8908 AC_SUBST(NECKO_DISK_CACHE)
8909 if test "$NECKO_DISK_CACHE"; then
8910     AC_DEFINE(NECKO_DISK_CACHE)
8914 dnl option to disable necko's wifi scanner
8916 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8917 [  --disable-necko-wifi    Disable necko wifi scanner],
8918     NECKO_WIFI=,
8919     NECKO_WIFI=1)
8921 if test "$OS_ARCH" = "OS2"; then
8922   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8923   NECKO_WIFI=
8925 if test "$NECKO_WIFI" -a \
8926         "$OS_ARCH" != "Linux" -a \
8927         "$OS_ARCH" != "Darwin" -a \
8928         "$OS_ARCH" != "SunOS" -a \
8929         "$OS_ARCH" != "WINNT" -a \
8930         "$OS_ARCH" != "WINCE"; then
8931   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8934 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8935 then
8936   AC_CHECK_HEADER([iwlib.h])
8937   if test "$ac_cv_header_iwlib_h" != "yes"; then
8938     AC_MSG_ERROR([Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora)); use --disable-necko-wifi to disable])
8939   fi
8942 if test "$NECKO_WIFI"; then
8943   AC_DEFINE(NECKO_WIFI)
8945 AC_SUBST(NECKO_WIFI)
8948 dnl option to disable cookies
8950 MOZ_ARG_DISABLE_BOOL(cookies,
8951 [  --disable-cookies       Disable cookie support],
8952     NECKO_COOKIES=,
8953     NECKO_COOKIES=1)
8954 AC_SUBST(NECKO_COOKIES)
8955 if test "$NECKO_COOKIES"; then
8956     AC_DEFINE(NECKO_COOKIES)
8960 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8962 MOZ_ARG_DISABLE_BOOL(ctypes,
8963 [  --disable-ctypes        Disable js-ctypes],
8964     BUILD_CTYPES=,
8965     BUILD_CTYPES=1)
8966 AC_SUBST(BUILD_CTYPES)
8967 if test "$BUILD_CTYPES"; then
8968   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8969     # Disable ctypes for arm/wince.
8970     BUILD_CTYPES=
8971   else
8972     AC_DEFINE(BUILD_CTYPES)
8973   fi
8976 dnl NECKO_ configuration options are not global
8977 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8979 dnl Only build Mork if it's required
8980 AC_SUBST(MOZ_MORK)
8981 if test "$MOZ_MORK"; then
8982   AC_DEFINE(MOZ_MORK)
8985 dnl Build the lightweight Mork reader if required
8986 AC_SUBST(MOZ_MORKREADER)
8987 if test "$MOZ_MORKREADER"; then
8988   AC_DEFINE(MOZ_MORKREADER)
8991 dnl Build Places if required
8992 if test "$MOZ_PLACES"; then
8993   AC_DEFINE(MOZ_PLACES)
8996 dnl Build Sync Services if required
8997 AC_SUBST(MOZ_SERVICES_SYNC)
8998 if test -n "$MOZ_SERVICES_SYNC"; then
8999   AC_DEFINE(MOZ_SERVICES_SYNC)
9002 dnl ========================================================
9003 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
9004     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
9007 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
9008   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
9011 dnl ========================================================
9012 dnl =
9013 dnl = Maintainer debug option (no --enable equivalent)
9014 dnl =
9015 dnl ========================================================
9017 AC_SUBST(AR)
9018 AC_SUBST(AR_FLAGS)
9019 AC_SUBST(AR_LIST)
9020 AC_SUBST(AR_EXTRACT)
9021 AC_SUBST(AR_DELETE)
9022 AC_SUBST(AS)
9023 AC_SUBST(ASFLAGS)
9024 AC_SUBST(AS_DASH_C_FLAG)
9025 AC_SUBST(LD)
9026 AC_SUBST(RC)
9027 AC_SUBST(RCFLAGS)
9028 AC_SUBST(WINDRES)
9029 AC_SUBST(IMPLIB)
9030 AC_SUBST(FILTER)
9031 AC_SUBST(BIN_FLAGS)
9032 AC_SUBST(NS_USE_NATIVE)
9033 AC_SUBST(MOZ_WIDGET_TOOLKIT)
9034 AC_SUBST(MOZ_UPDATE_XTERM)
9035 AC_SUBST(MINIMO)
9036 AC_SUBST(MOZ_PLATFORM_MAEMO)
9037 AC_SUBST(MOZ_AUTH_EXTENSION)
9038 AC_SUBST(MOZ_MATHML)
9039 AC_SUBST(MOZ_PERMISSIONS)
9040 AC_SUBST(MOZ_XTF)
9041 AC_SUBST(MOZ_PREF_EXTENSIONS)
9042 AC_SUBST(MOZ_SVG)
9043 AC_SUBST(MOZ_SMIL)
9044 AC_SUBST(MOZ_XSLT_STANDALONE)
9045 AC_SUBST(MOZ_JS_LIBS)
9046 AC_SUBST(MOZ_PSM)
9047 AC_SUBST(MOZ_DEBUG)
9048 AC_SUBST(MOZ_DEBUG_SYMBOLS)
9049 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
9050 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
9051 AC_SUBST(MOZ_DEBUG_FLAGS)
9052 AC_SUBST(MOZ_DEBUG_LDFLAGS)
9053 AC_SUBST(WARNINGS_AS_ERRORS)
9054 AC_SUBST(MOZ_EXTENSIONS)
9055 AC_SUBST(MOZ_JSDEBUGGER)
9056 AC_SUBST(MOZ_PLUGINS)
9057 AC_SUBST(MOZ_LOG_REFCNT)
9058 AC_SUBST(MOZ_LEAKY)
9059 AC_SUBST(MOZ_JPROF)
9060 AC_SUBST(MOZ_SHARK)
9061 AC_SUBST(MOZ_CALLGRIND)
9062 AC_SUBST(MOZ_VTUNE)
9063 AC_SUBST(MOZ_PROFILING)
9064 AC_SUBST(MOZ_JSLOADER)
9065 AC_SUBST(MOZ_USE_NATIVE_UCONV)
9066 AC_SUBST(MOZ_QUANTIFY)
9067 AC_SUBST(LIBICONV)
9068 AC_SUBST(MOZ_PLACES)
9069 AC_SUBST(MOZ_PLACES_BOOKMARKS)
9070 AC_SUBST(MOZ_STORAGE)
9071 AC_SUBST(MOZ_TOOLKIT_SEARCH)
9072 AC_SUBST(MOZ_FEEDS)
9073 AC_SUBST(NS_PRINTING)
9074 AC_SUBST(MOZ_WEBGL)
9075 AC_SUBST(MOZ_HELP_VIEWER)
9077 AC_SUBST(MOZ_JAVAXPCOM)
9078 AC_SUBST(JAVA_INCLUDE_PATH)
9079 AC_SUBST(JAVA)
9080 AC_SUBST(JAVAC)
9081 AC_SUBST(JAR)
9083 AC_SUBST(MOZ_PROFILELOCKING)
9085 AC_SUBST(HAVE_XIE)
9086 AC_SUBST(MOZ_XIE_LIBS)
9088 AC_SUBST(BUILD_STATIC_LIBS)
9089 AC_SUBST(MOZ_ENABLE_LIBXUL)
9090 AC_SUBST(ENABLE_TESTS)
9091 AC_SUBST(IBMBIDI)
9092 AC_SUBST(MOZ_UNIVERSALCHARDET)
9093 AC_SUBST(ACCESSIBILITY)
9094 AC_SUBST(MOZ_VIEW_SOURCE)
9095 AC_SUBST(MOZ_SPELLCHECK)
9096 AC_SUBST(MOZ_USER_DIR)
9097 AC_SUBST(MOZ_CRASHREPORTER)
9098 AC_SUBST(MOZ_UPDATER)
9099 AC_SUBST(MOZ_ANGLE)
9100 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
9101 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
9102 AC_SUBST(MOZ_D3DX9_VERSION)
9103 AC_SUBST(MOZ_D3DX9_CAB)
9104 AC_SUBST(MOZ_D3DCOMPILER_CAB)
9105 AC_SUBST(MOZ_D3DX9_DLL)
9106 AC_SUBST(MOZ_D3DCOMPILER_DLL)
9108 AC_SUBST(ENABLE_STRIP)
9109 AC_SUBST(PKG_SKIP_STRIP)
9110 AC_SUBST(USE_ELF_DYNSTR_GC)
9111 AC_SUBST(USE_ELF_HACK)
9112 AC_SUBST(INCREMENTAL_LINKER)
9113 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
9114 AC_SUBST(MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS)
9115 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
9117 AC_SUBST(MOZ_FIX_LINK_PATHS)
9118 AC_SUBST(XPCOM_LIBS)
9119 AC_SUBST(XPCOM_FROZEN_LDOPTS)
9120 AC_SUBST(XPCOM_GLUE_LDOPTS)
9121 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
9123 AC_SUBST(USE_DEPENDENT_LIBS)
9125 AC_SUBST(MOZ_BUILD_ROOT)
9126 AC_SUBST(MOZ_OS2_TOOLS)
9128 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
9129 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
9130 AC_SUBST(MOZ_TIMELINE)
9131 AC_SUBST(OGLES_SDK_DIR)
9133 AC_SUBST(MOZ_APP_NAME)
9134 AC_SUBST(MOZ_APP_DISPLAYNAME)
9135 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
9136 AC_SUBST(MOZ_APP_UA_NAME)
9137 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
9138 AC_SUBST(MOZ_APP_VERSION)
9139 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
9140 AC_SUBST(MOZ_UA_FIREFOX_VERSION)
9141 AC_SUBST(FIREFOX_VERSION)
9142 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
9143 AC_SUBST(MOZ_UA_BUILDID)
9145 AC_SUBST(MOZ_PKG_SPECIAL)
9147 AC_SUBST(MOZILLA_OFFICIAL)
9149 dnl win32 options
9150 AC_SUBST(MOZ_MAPINFO)
9151 AC_SUBST(MOZ_BROWSE_INFO)
9152 AC_SUBST(MOZ_TOOLS_DIR)
9153 AC_SUBST(CYGWIN_WRAPPER)
9154 AC_SUBST(AS_PERL)
9155 AC_SUBST(WIN32_REDIST_DIR)
9156 AC_SUBST(PYTHON)
9157 AC_SUBST(MAKENSISU)
9159 AC_SUBST(WINCE)
9160 AC_SUBST(WINCE_SDK_DIR)
9161 AC_SUBST(WINCE_WINDOWS_MOBILE)
9163 dnl Echo the CFLAGS to remove extra whitespace.
9164 CFLAGS=`echo \
9165         $_WARNINGS_CFLAGS \
9166         $CFLAGS`
9168 CXXFLAGS=`echo \
9169         $_MOZ_RTTI_FLAGS \
9170         $_MOZ_EXCEPTIONS_FLAGS \
9171         $_WARNINGS_CXXFLAGS \
9172         $CXXFLAGS`
9174 COMPILE_CFLAGS=`echo \
9175     $_DEFINES_CFLAGS \
9176         $_DEPEND_CFLAGS \
9177     $COMPILE_CFLAGS`
9179 COMPILE_CXXFLAGS=`echo \
9180     $_DEFINES_CXXFLAGS \
9181         $_DEPEND_CFLAGS \
9182     $COMPILE_CXXFLAGS`
9184 AC_SUBST(SYSTEM_MAKEDEPEND)
9185 AC_SUBST(SYSTEM_LIBXUL)
9186 AC_SUBST(SYSTEM_JPEG)
9187 AC_SUBST(SYSTEM_PNG)
9188 AC_SUBST(SYSTEM_ZLIB)
9189 AC_SUBST(SYSTEM_BZ2)
9191 AC_SUBST(JPEG_CFLAGS)
9192 AC_SUBST(JPEG_LIBS)
9193 AC_SUBST(ZLIB_CFLAGS)
9194 AC_SUBST(ZLIB_LIBS)
9195 AC_SUBST(BZ2_CFLAGS)
9196 AC_SUBST(BZ2_LIBS)
9197 AC_SUBST(PNG_CFLAGS)
9198 AC_SUBST(PNG_LIBS)
9200 AC_SUBST(MOZ_JPEG_CFLAGS)
9201 AC_SUBST(MOZ_JPEG_LIBS)
9202 AC_SUBST(MOZ_ZLIB_CFLAGS)
9203 AC_SUBST(MOZ_ZLIB_LIBS)
9204 AC_SUBST(MOZ_BZ2_CFLAGS)
9205 AC_SUBST(MOZ_BZ2_LIBS)
9206 AC_SUBST(MOZ_PNG_CFLAGS)
9207 AC_SUBST(MOZ_PNG_LIBS)
9209 AC_SUBST(NSPR_CFLAGS)
9210 AC_SUBST(NSPR_LIBS)
9211 AC_SUBST(MOZ_NATIVE_NSPR)
9213 AC_SUBST(NSS_CFLAGS)
9214 AC_SUBST(NSS_LIBS)
9215 AC_SUBST(NSS_DEP_LIBS)
9216 AC_SUBST(MOZ_NATIVE_NSS)
9217 AC_SUBST(NSS_DISABLE_DBM)
9219 AC_SUBST(CFLAGS)
9220 AC_SUBST(CXXFLAGS)
9221 AC_SUBST(CPPFLAGS)
9222 AC_SUBST(COMPILE_CFLAGS)
9223 AC_SUBST(COMPILE_CXXFLAGS)
9224 AC_SUBST(LDFLAGS)
9225 AC_SUBST(LIBS)
9226 AC_SUBST(CROSS_COMPILE)
9227 AC_SUBST(WCHAR_CFLAGS)
9229 AC_SUBST(HOST_CC)
9230 AC_SUBST(HOST_CXX)
9231 AC_SUBST(HOST_CFLAGS)
9232 AC_SUBST(HOST_CXXFLAGS)
9233 AC_SUBST(HOST_LDFLAGS)
9234 AC_SUBST(HOST_OPTIMIZE_FLAGS)
9235 AC_SUBST(HOST_AR)
9236 AC_SUBST(HOST_AR_FLAGS)
9237 AC_SUBST(HOST_LD)
9238 AC_SUBST(HOST_RANLIB)
9239 AC_SUBST(HOST_NSPR_MDCPUCFG)
9240 AC_SUBST(HOST_BIN_SUFFIX)
9241 AC_SUBST(HOST_OS_ARCH)
9243 AC_SUBST(TARGET_CPU)
9244 AC_SUBST(TARGET_VENDOR)
9245 AC_SUBST(TARGET_OS)
9246 AC_SUBST(TARGET_NSPR_MDCPUCFG)
9247 AC_SUBST(TARGET_MD_ARCH)
9248 AC_SUBST(TARGET_XPCOM_ABI)
9249 AC_SUBST(OS_TARGET)
9250 AC_SUBST(OS_ARCH)
9251 AC_SUBST(OS_RELEASE)
9252 AC_SUBST(OS_TEST)
9253 AC_SUBST(CPU_ARCH)
9254 AC_SUBST(INTEL_ARCHITECTURE)
9256 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
9257 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
9259 AC_SUBST(WRAP_MALLOC_CFLAGS)
9260 AC_SUBST(WRAP_MALLOC_LIB)
9261 AC_SUBST(MKSHLIB)
9262 AC_SUBST(MKCSHLIB)
9263 AC_SUBST(MKSHLIB_FORCE_ALL)
9264 AC_SUBST(MKSHLIB_UNFORCE_ALL)
9265 AC_SUBST(DSO_CFLAGS)
9266 AC_SUBST(DSO_PIC_CFLAGS)
9267 AC_SUBST(DSO_LDOPTS)
9268 AC_SUBST(LIB_PREFIX)
9269 AC_SUBST(DLL_PREFIX)
9270 AC_SUBST(DLL_SUFFIX)
9271 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
9272 AC_SUBST(LIB_SUFFIX)
9273 AC_SUBST(OBJ_SUFFIX)
9274 AC_SUBST(BIN_SUFFIX)
9275 AC_SUBST(ASM_SUFFIX)
9276 AC_SUBST(IMPORT_LIB_SUFFIX)
9277 AC_SUBST(USE_N32)
9278 AC_SUBST(CC_VERSION)
9279 AC_SUBST(CXX_VERSION)
9280 AC_SUBST(MSMANIFEST_TOOL)
9281 AC_SUBST(NS_ENABLE_TSF)
9282 AC_SUBST(MOZ_NSS_PATCH)
9283 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9284 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9286 AC_SUBST(MOZ_MEDIA)
9287 AC_SUBST(MOZ_SYDNEYAUDIO)
9288 AC_SUBST(MOZ_WAVE)
9289 AC_SUBST(MOZ_VORBIS)
9290 AC_SUBST(MOZ_TREMOR)
9291 AC_SUBST(MOZ_WEBM)
9292 AC_SUBST(MOZ_OGG)
9293 AC_SUBST(MOZ_ALSA_LIBS)
9294 AC_SUBST(VPX_AS)
9295 AC_SUBST(VPX_ASFLAGS)
9296 AC_SUBST(VPX_DASH_C_FLAG)
9297 AC_SUBST(VPX_AS_CONVERSION)
9298 AC_SUBST(VPX_ASM_SUFFIX)
9299 AC_SUBST(VPX_X86_ASM)
9300 AC_SUBST(VPX_ARM_ASM)
9302 if test "$USING_HCC"; then
9303    CC='${topsrcdir}/build/hcc'
9304    CC="$CC '$_OLDCC'"
9305    CXX='${topsrcdir}/build/hcpp'
9306    CXX="$CXX '$_OLDCXX'"
9307    AC_SUBST(CC)
9308    AC_SUBST(CXX)
9311 AC_MSG_CHECKING([for posix_fallocate])       
9312 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9313   #include <fcntl.h>],
9314                  [posix_fallocate(0, 0, 0);],
9315                  [ac_cv___posix_fallocate=true],
9316                  [ac_cv___posix_fallocate=false])
9318 if test "$ac_cv___posix_fallocate" = true ; then
9319   AC_DEFINE(HAVE_POSIX_FALLOCATE)
9320   AC_MSG_RESULT(yes)
9321 else
9322   AC_MSG_RESULT(no)
9325 dnl Check for missing components
9326 if test "$COMPILE_ENVIRONMENT"; then
9327 if test "$MOZ_X11"; then
9328     dnl ====================================================
9329     dnl = Check if X headers exist
9330     dnl ====================================================
9331     _SAVE_CFLAGS=$CFLAGS
9332     CFLAGS="$CFLAGS $XCFLAGS"
9333     AC_TRY_COMPILE([
9334         #include <stdio.h>
9335         #include <stdlib.h>
9336         #include <X11/Xlib.h>
9337         #include <X11/Intrinsic.h>
9338     ],
9339     [
9340         Display *dpy = 0;
9341         if ((dpy = XOpenDisplay(NULL)) == NULL) {
9342             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9343             exit(1);
9344         }
9345     ], [], 
9346     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9347     CFLAGS="$_SAVE_CFLAGS"
9349     if test ! -z "$MISSING_X"; then
9350         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9351     fi
9353 fi # MOZ_X11
9355 dnl Check for headers, etc. needed by WebGL.
9356 if test -n "$MOZ_WEBGL_GLX"; then
9357     AC_CHECK_HEADER(GL/glx.h)
9358     if test "$ac_cv_header_GL_glx_h" != "yes"; then
9359         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
9360     fi
9361 fi # MOZ_WEBGL_GLX
9362 fi # COMPILE_ENVIRONMENT
9364 if test "$USE_FC_FREETYPE"; then
9365     if test "$COMPILE_ENVIRONMENT"; then
9366         _SAVE_CPPFLAGS="$CPPFLAGS"
9367         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
9368         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
9369             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
9370         CPPFLAGS="$_SAVE_CPPFLAGS"
9371     else
9372         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
9373     fi
9376 dnl Set various defines and substitutions
9377 dnl ========================================================
9379 if test "$OS_ARCH" = "BeOS"; then
9380   AC_DEFINE(XP_BEOS)
9381 elif test "$OS_ARCH" = "Darwin"; then
9382   AC_DEFINE(XP_UNIX)
9383   AC_DEFINE(UNIX_ASYNC_DNS)
9384 elif test "$OS_ARCH" = "OpenVMS"; then
9385   AC_DEFINE(XP_UNIX)
9386 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
9387   AC_DEFINE(XP_UNIX)
9388   AC_DEFINE(UNIX_ASYNC_DNS)
9391 if test "$MOZ_DEBUG"; then
9392     AC_DEFINE(MOZ_REFLOW_PERF)
9393     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9396 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9397     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9398     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9399     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9400     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9401     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9402     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9403     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9404     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9407 dnl ========================================================
9408 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
9409 dnl ========================================================
9410 case "$host_os" in
9411 mingw*)
9412     WIN_TOP_SRC=`cd $srcdir; pwd -W`
9413     ;;
9414 cygwin*|msvc*|mks*)
9415     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
9416     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
9417     CC="\$(CYGWIN_WRAPPER) $CC"
9418     CXX="\$(CYGWIN_WRAPPER) $CXX"
9419     CPP="\$(CYGWIN_WRAPPER) $CPP"
9420     LD="\$(CYGWIN_WRAPPER) $LD"
9421     AS="\$(CYGWIN_WRAPPER) $AS"
9422     RC="\$(CYGWIN_WRAPPER) $RC"
9423     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
9424     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
9425     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
9426     ;;
9427 esac
9429 AC_SUBST(CYGDRIVE_MOUNT)
9430 AC_SUBST(WIN_TOP_SRC)
9432 AC_SUBST(MOZILLA_VERSION)
9434 AC_SUBST(ac_configure_args)
9436 dnl Spit out some output
9437 dnl ========================================================
9439 dnl The following defines are used by xpcom
9440 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9441 CPP_THROW_NEW
9442 HAVE_CPP_2BYTE_WCHAR_T
9443 HAVE_CPP_ACCESS_CHANGING_USING
9444 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9445 HAVE_CPP_BOOL
9446 HAVE_CPP_CHAR16_T
9447 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9448 HAVE_CPP_EXPLICIT
9449 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9450 HAVE_CPP_NAMESPACE_STD
9451 HAVE_CPP_NEW_CASTS
9452 HAVE_CPP_PARTIAL_SPECIALIZATION
9453 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9454 HAVE_CPP_TYPENAME
9455 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9456 HAVE_STATVFS
9457 NEED_CPP_UNUSED_IMPLEMENTATIONS
9458 NEW_H
9459 HAVE_GETPAGESIZE
9460 HAVE_ICONV
9461 HAVE_ICONV_WITH_CONST_INPUT
9462 HAVE_MBRTOWC
9463 HAVE_SYS_MOUNT_H
9464 HAVE_SYS_VFS_H
9465 HAVE_WCRTOMB
9468 AC_CONFIG_HEADER(
9469 netwerk/necko-config.h
9470 xpcom/xpcom-config.h
9471 xpcom/xpcom-private.h
9474 # Save the defines header file before autoconf removes it.
9475 # (Do not add AC_DEFINE calls after this line.)
9476   _CONFIG_TMP=confdefs-tmp.h
9477   _CONFIG_DEFS_H=mozilla-config.h
9479   cat > $_CONFIG_TMP <<\EOF
9480 /* List of defines generated by configure. Included with preprocessor flag,
9481  * -include, to avoid long list of -D defines on the compile command-line.
9482  * Do not edit.
9483  */
9485 #ifndef _MOZILLA_CONFIG_H_
9486 #define _MOZILLA_CONFIG_H_
9489 _EGREP_PATTERN='^#define ('
9490 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9491     for f in $_NON_GLOBAL_ACDEFINES; do
9492         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9493     done
9495 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9497   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9499   cat >> $_CONFIG_TMP <<\EOF
9501 #endif /* _MOZILLA_CONFIG_H_ */
9505   # Only write mozilla-config.h when something changes (or it doesn't exist)
9506   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9507     rm $_CONFIG_TMP
9508   else
9509     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9510     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9512     echo ==== $_CONFIG_DEFS_H =================================
9513     cat $_CONFIG_DEFS_H
9514   fi
9516 dnl Probably shouldn't call this manually but we always want the output of DEFS
9517 rm -f confdefs.h.save
9518 mv confdefs.h confdefs.h.save
9519 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9520 AC_OUTPUT_MAKE_DEFS()
9521 MOZ_DEFINES=$DEFS
9522 AC_SUBST(MOZ_DEFINES)
9523 rm -f confdefs.h
9524 mv confdefs.h.save confdefs.h
9526 dnl Load the list of Makefiles to generate.
9527 dnl   To add new Makefiles, edit allmakefiles.sh.
9528 dnl   allmakefiles.sh sets the variable, MAKEFILES.
9529 . ${srcdir}/allmakefiles.sh
9530 dnl 
9531 dnl Run a perl script to quickly create the makefiles.
9532 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9533 dnl   for the files it cannot handle correctly. This way, config.status
9534 dnl   will handle these files.
9535 dnl If it fails, nothing is set and config.status will run as usual.
9537 dnl This does not change the $MAKEFILES variable.
9539 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9541 if test -z "${AS_PERL}"; then
9542 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9543 else
9544 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9546 . ./conftest.sh
9547 rm conftest.sh
9549 echo $MAKEFILES > unallmakefiles
9551 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9553 AC_OUTPUT($MAKEFILES)
9555 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9556 if test "$CAIRO_FEATURES_H"; then
9557   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9558     echo "$CAIRO_FEATURES_H is unchanged"
9559     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9560   else
9561     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9562   fi
9565 # Run freetype configure script
9567 if test "$MOZ_TREE_FREETYPE"; then
9568    export CFLAGS="$CFLAGS -std=c99"
9569    export CPPFLAGS="$CPPFLAGS"
9570    export CXXFLAGS="$CXXFLAGS"
9571    export LDFLAGS="$LDFLAGS"
9572    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9573    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9574    AC_OUTPUT_SUBDIRS(modules/freetype2)
9577 dnl ========================================================
9578 dnl = Setup a nice relatively clean build environment for
9579 dnl = sub-configures.
9580 dnl ========================================================
9581 CC="$_SUBDIR_CC" 
9582 CXX="$_SUBDIR_CXX" 
9583 CFLAGS="$_SUBDIR_CFLAGS" 
9584 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9585 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9586 LDFLAGS="$_SUBDIR_LDFLAGS"
9587 HOST_CC="$_SUBDIR_HOST_CC" 
9588 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9589 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9592 unset MAKEFILES
9593 unset CONFIG_FILES
9595 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9596 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9598 if test -n "$MOZ_THUMB2"; then
9599   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9601 if test -n "$MOZ_ARM_ARCH"; then
9602   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --with-cpu-arch=$MOZ_ARM_ARCH"
9604 if test -n "$_WRAP_MALLOC"; then
9605   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9608 if test -z "$MOZ_NATIVE_NSPR"; then
9609     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9610     if test -z "$MOZ_DEBUG"; then
9611         ac_configure_args="$ac_configure_args --disable-debug"
9612     fi
9613     if test "$MOZ_OPTIMIZE" = "1"; then
9614         ac_configure_args="$ac_configure_args --enable-optimize"
9615     fi
9616     if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9617        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9618     fi
9619     if test -n "$HAVE_64BIT_OS"; then
9620         ac_configure_args="$ac_configure_args --enable-64bit"
9621     fi
9622     if test -n "$USE_ARM_KUSER"; then
9623         ac_configure_args="$ac_configure_args --with-arm-kuser"
9624     fi
9625     AC_OUTPUT_SUBDIRS(nsprpub)
9626     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9629 if test -z "$MOZ_NATIVE_NSPR"; then
9630     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9631     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9632     if test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
9633        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9634        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9635        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9636        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9637     fi
9638     rm -f config/autoconf.mk.bak
9641 # Run the SpiderMonkey 'configure' script.
9642 dist=$MOZ_BUILD_ROOT/dist
9643 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9644 ac_configure_args="$ac_configure_args --enable-threadsafe"
9645 if test "$BUILD_CTYPES"; then
9646     # Build js-ctypes on the platforms we can.
9647     ac_configure_args="$ac_configure_args --enable-ctypes"
9649 if test -z "$JS_SHARED_LIBRARY" ; then
9650     ac_configure_args="$ac_configure_args --disable-shared-js"
9652 if test -z "$MOZ_NATIVE_NSPR"; then
9653     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9654     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9656 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9657 ac_configure_args="$ac_configure_args --prefix=$dist"
9658 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9659 if test "$MOZ_MEMORY"; then
9660    ac_configure_args="$ac_configure_args --enable-jemalloc"
9661    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9662      export MOZ_MEMORY_LDFLAGS
9663    fi
9665 AC_OUTPUT_SUBDIRS(js/src)
9666 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9668 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9670 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9671 dnl Needs to be at the end to respect possible changes from NSPR configure
9672 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9673   echo "config/autoconf.mk is unchanged"
9674   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9675 else
9676   rm -f config/autoconf.mk.orig 2> /dev/null