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