Bug 474152 - [SeaMonkey] TUnit toolkit/.../test_contentAreaUtils.js fails now; (Av1...
[mozilla-central.git] / configure.in
blob9caa407ea1f29246e51c51cf7840952ba8cd7ed9
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
46 dnl Alternatively, the contents of this file may be used under the terms of
47 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
48 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
49 dnl in which case the provisions of the GPL or the LGPL are applicable instead
50 dnl of those above. If you wish to allow use of your version of this file only
51 dnl under the terms of either the GPL or the LGPL, and not to allow others to
52 dnl use your version of this file under the terms of the MPL, indicate your
53 dnl decision by deleting the provisions above and replace them with the notice
54 dnl and other provisions required by the GPL or the LGPL. If you do not delete
55 dnl the provisions above, a recipient may use your version of this file under
56 dnl the terms of any one of the MPL, the GPL or the LGPL.
57 dnl
58 dnl ***** END LICENSE BLOCK *****
60 dnl Process this file with autoconf to produce a configure script.
61 dnl ========================================================
63 AC_PREREQ(2.13)
64 AC_INIT(config/config.mk)
65 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
66 AC_CANONICAL_SYSTEM
67 TARGET_CPU="${target_cpu}"
68 TARGET_VENDOR="${target_vendor}"
69 TARGET_OS="${target_os}"
72 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1` 
73 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
77 dnl =
78 dnl = Don't change the following two lines.  Doing so breaks:
79 dnl =
80 dnl = CFLAGS="-foo" ./configure
81 dnl =
82 dnl ========================================================
83 CFLAGS="${CFLAGS=}"
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
86 LDFLAGS="${LDFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
96 _SUBDIR_CC="$CC"
97 _SUBDIR_CXX="$CXX"
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
110 MOZJPEG=62
111 MOZPNG=10217
112 MOZZLIB=0x1230
113 NSPR_VERSION=4
114 NSS_VERSION=3
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
118 GLIB_VERSION=1.2.0
119 LIBIDL_VERSION=0.6.3
120 PERL_VERSION=5.006
121 PYTHON_VERSION=2.4
122 CAIRO_VERSION=1.6.0
123 PANGO_VERSION=1.14.0
124 GTK2_VERSION=2.10.0
125 WINDRES_VERSION=2.14.90
126 W32API_VERSION=3.8
127 GNOMEVFS_VERSION=2.0
128 GNOMEUI_VERSION=2.2.0
129 GCONF_VERSION=1.2.1
130 LIBGNOME_VERSION=2.0
131 STARTUP_NOTIFICATION_VERSION=0.8
132 DBUS_VERSION=0.60
133 SQLITE_VERSION=3.6.10
134 LIBNOTIFY_VERSION=0.4
136 MSMANIFEST_TOOL=
138 dnl Set various checks
139 dnl ========================================================
140 MISSING_X=
141 AC_PROG_AWK
143 dnl Initialize the Pthread test variables early so they can be
144 dnl  overridden by each platform.
145 dnl ========================================================
146 USE_PTHREADS=
147 _PTHREAD_LDFLAGS=""
149 dnl Do not allow a separate objdir build if a srcdir build exists.
150 dnl ==============================================================
151 _topsrcdir=`cd \`dirname $0\`; pwd`
152 _objdir=`pwd`
154 if test "$_topsrcdir" != "$_objdir"
155 then
156   # Check for a couple representative files in the source tree
157   _conflict_files=
158   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
159     if test -f $file; then
160       _conflict_files="$_conflict_files $file"
161     fi
162   done
163   if test "$_conflict_files"; then
164     echo "***"
165     echo "*   Your source tree contains these files:"
166     for file in $_conflict_files; do
167       echo "*         $file"
168     done
169     cat 1>&2 <<-EOF
170         *   This indicates that you previously built in the source tree.
171         *   A source tree build can confuse the separate objdir build.
172         *
173         *   To clean up the source tree:
174         *     1. cd $_topsrcdir
175         *     2. gmake distclean
176         ***
177         EOF
178     exit 1
179     break
180   fi
182 MOZ_BUILD_ROOT=`pwd`
184 dnl Default to MSVC for win32
185 dnl ==============================================================
186 if test -z "$CROSS_COMPILE"; then
187 case "$target" in
188 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
189     if test -z "$CC"; then CC=cl; fi
190     if test -z "$CXX"; then CXX=cl; fi
191     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
192     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
193     if test -z "$LD"; then LD=link; fi
194     if test -z "$AS"; then AS=ml; fi
195     if test -z "$MIDL"; then MIDL=midl; fi
196     ;;
197 esac
200 COMPILE_ENVIRONMENT=1
201 MOZ_ARG_ENABLE_BOOL(compile-environment,
202 [  --disable-compile-environment
203                            Disable compiler/library checks.],
204     COMPILE_ENVIRONMENT=1,
205     COMPILE_ENVIRONMENT= )
207 MOZ_ARG_WITH_STRING(l10n-base,
208 [  --with-l10n-base=DIR     path to l10n repositories],
209     L10NBASEDIR=$withval)
210 if test ! -z "$L10NBASEDIR"; then
211     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
212         AC_MSG_ERROR([--with-l10n-base must specify a path])
213     elif test -d "$L10NBASEDIR"; then
214         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
215     else
216         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
217     fi
219 AC_SUBST(L10NBASEDIR)
221 dnl Check for Perl first -- needed for win32 SDK checks
222 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
223 if test -z "$PERL" || test "$PERL" = ":"; then
224     AC_MSG_ERROR([perl not found in \$PATH])
227 dnl ========================================================
228 dnl Checks for compilers.
229 dnl ========================================================
230 dnl Set CROSS_COMPILE in the environment when running configure
231 dnl to use the cross-compile setup for now
232 dnl ========================================================
234 if test "$COMPILE_ENVIRONMENT"; then
236 dnl Do some special WinCE toolchain stuff
237 case "$target" in
238 *wince)
240     MOZ_ARG_WITH_STRING(wince-sdk,
241     [  --with-wince-sdk=WINCE_SDK_DIR
242                         The path to the Windows CE SDK],
243     WINCE_SDK_DIR=$withval)
245     dnl Default to Windows Mobile components enabled
246     WINCE_WINDOWS_MOBILE=1
248     MOZ_ARG_DISABLE_BOOL(windows-mobile-components,
249     [  --disable-windows-mobile-components
250          Disable Windows Mobile specific components from CE build],
251     WINCE_WINDOWS_MOBILE=,
252     WINCE_WINDOWS_MOBILE=1)
254     if test "$WINCE_WINDOWS_MOBILE"; then
255         AC_DEFINE(WINCE_WINDOWS_MOBILE)
256     fi
258     AC_DEFINE(WINCE)
259     
260     export WINCE=1
262     echo -----------------------------------------------------------------------------
263     echo Building Windows CE Shunt Library and Tool Chain
264     echo Using SDK in:
265     echo $WINCE_SDK_DIR
267     ac_exeext=.exe
269     _pwdw=`pwd -W`
270     _pwd=`pwd`
271     make WINCE_SDK_DIR="$WINCE_SDK_DIR" TOPSRCDIR="$_topsrcdir" OBJDIR="$_pwdw" -C $srcdir/build/wince/tools
273     CC="$_pwd/dist/sdk/bin/arm-wince-gcc"
274     CXX="$_pwd/dist/sdk/bin/arm-wince-gcc"
275     CPP="$_pwd/dist/sdk/bin/arm-wince-gcc -E -nologo"
276     CXXCPP="$_pwd/dist/sdk/bin/arm-wince-gcc -TP -E -nologo"
277     LD="$_pwd/dist/sdk/bin/arm-wince-link"
278     AR="$_pwd/dist/sdk/bin/arm-wince-lib"
279     AS="$_pwd/dist/sdk/bin/arm-wince-as"
280     RC="$_pwd/dist/sdk/bin/arm-wince-res"
283     echo -----------------------------------------------------------------------------
285     ;;
286 esac
288 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
289     echo "cross compiling from $host to $target"
290     cross_compiling=yes
292     _SAVE_CC="$CC"
293     _SAVE_CFLAGS="$CFLAGS"
294     _SAVE_LDFLAGS="$LDFLAGS"
296     AC_MSG_CHECKING([for host c compiler])
297     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
298     if test -z "$HOST_CC"; then
299         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
300     fi
301     AC_MSG_RESULT([$HOST_CC])
302     AC_MSG_CHECKING([for host c++ compiler])
303     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
304     if test -z "$HOST_CXX"; then
305         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
306     fi
307     AC_MSG_RESULT([$HOST_CXX])
309     if test -z "$HOST_CFLAGS"; then
310         HOST_CFLAGS="$CFLAGS"
311     fi
312     if test -z "$HOST_CXXFLAGS"; then
313         HOST_CXXFLAGS="$CXXFLAGS"
314     fi
315     if test -z "$HOST_LDFLAGS"; then
316         HOST_LDFLAGS="$LDFLAGS"
317     fi
318     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
319     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
320     CC="$HOST_CC"
321     CFLAGS="$HOST_CFLAGS"
322     LDFLAGS="$HOST_LDFLAGS"
324     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
325     AC_TRY_COMPILE([], [return(0);], 
326         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
327         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
329     CC="$HOST_CXX"
330     CFLAGS="$HOST_CXXFLAGS"
332     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
333     AC_TRY_COMPILE([], [return(0);], 
334         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
335         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
336     
337     CC=$_SAVE_CC
338     CFLAGS=$_SAVE_CFLAGS
339     LDFLAGS=$_SAVE_LDFLAGS
341     case "$build:$target" in
342       powerpc-apple-darwin8*:i?86-apple-darwin*)
343         dnl The Darwin cross compiler doesn't necessarily point itself at a
344         dnl root that has libraries for the proper architecture, it defaults
345         dnl to the system root.  The libraries in the system root on current
346         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
347         dnl checks will fail.  Fake a working SDK in that case.
348         _SAVE_CFLAGS=$CFLAGS
349         _SAVE_CXXFLAGS=$CXXLAGS
350         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
351         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
352         ;;
353     esac
355     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
356     unset ac_cv_prog_CC
357     AC_PROG_CC
358     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
359     unset ac_cv_prog_CXX
360     AC_PROG_CXX
362     case "$build:$target" in
363       powerpc-apple-darwin8*:i?86-apple-darwin*)
364         dnl Revert the changes made above.  From this point on, the target
365         dnl compiler will never be used without applying the SDK to CFLAGS
366         dnl (see --with-macos-sdk below).
367         CFLAGS=$_SAVE_CFLAGS
368         CXXFLAGS=$_SAVE_CXXFLAGS
369         ;;
370     esac
372     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
373     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
374     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
375     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
376     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
377     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
378     AC_DEFINE(CROSS_COMPILE)
379 else
380     AC_PROG_CC
381     AC_PROG_CXX
382     AC_PROG_RANLIB
383     MOZ_PATH_PROGS(AS, $AS as, $CC)
384     AC_CHECK_PROGS(AR, ar, :)
385     AC_CHECK_PROGS(LD, ld, :)
386     AC_CHECK_PROGS(STRIP, strip, :)
387     AC_CHECK_PROGS(WINDRES, windres, :)
388     if test -z "$HOST_CC"; then
389         HOST_CC="$CC"
390     fi
391     if test -z "$HOST_CFLAGS"; then
392         HOST_CFLAGS="$CFLAGS"
393     fi
394     if test -z "$HOST_CXX"; then
395         HOST_CXX="$CXX"
396     fi
397     if test -z "$HOST_CXXFLAGS"; then
398         HOST_CXXFLAGS="$CXXFLAGS"
399     fi
400     if test -z "$HOST_LDFLAGS"; then
401         HOST_LDFLAGS="$LDFLAGS"
402     fi
403     if test -z "$HOST_RANLIB"; then
404         HOST_RANLIB="$RANLIB"
405     fi
406     if test -z "$HOST_AR"; then
407        HOST_AR="$AR"
408     fi
411 GNU_AS=
412 GNU_LD=
413 GNU_CC=
414 GNU_CXX=
415 CC_VERSION='N/A'
416 CXX_VERSION='N/A'
417 if test "$GCC" = "yes"; then
418     GNU_CC=1
419     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
421 if test "$GXX" = "yes"; then
422     GNU_CXX=1
423     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
425 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
426     GNU_AS=1
428 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
429     GNU_LD=1
431 if test "$GNU_CC"; then
432     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
433         GCC_USE_GNU_LD=1
434     fi
437 INTEL_CC=
438 INTEL_CXX=
439 if test "$GCC" = yes; then
440    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
441      INTEL_CC=1
442    fi
445 if test "$GXX" = yes; then
446    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
447      INTEL_CXX=1
448    fi
451 dnl Special win32 checks
452 dnl ========================================================
453 case "$target" in
454 *-wince)
455     WINVER=500
456     ;;
458     if test -n "$GNU_CC"; then  
459         WINVER=501
460     else    
461         WINVER=500
462     fi
463     ;;
464 esac
466 dnl Target the Windows Vista SDK by default
467 WINSDK_TARGETVER=600
469 MOZ_ARG_WITH_STRING(windows-version,
470 [  --with-windows-version=WINSDK_TARGETVER
471                           Highest Windows version to target using this SDK
472                               502: Windows Server 2003
473                               600: Windows Vista
474                               601: Windows 7],
475   WINSDK_TARGETVER=$withval)
477 case "$WINSDK_TARGETVER" in
478 502|600|601)
479     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
480     ;;
483     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
484     ;;
486 esac
488 dnl Vista SDK specific api (deprecated)
489 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
490 [  --disable-vista-sdk-requirements
491                            Do not build Vista SDK specific code],
492    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
493    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
494 if test -n "$COMPILE_ENVIRONMENT"; then
495 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
496     AC_MSG_WARN([--disable-vista-sdk-requirements is deprecated, use --with-windows-version=502 instead])
497     MOZ_WINSDK_TARGETVER=05020000
500 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
501     MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
502     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
503     # We can't build parental controls either
504     MOZ_DISABLE_PARENTAL_CONTROLS=1
508 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
510 case "$target" in
511 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
512     if test "$GCC" != "yes"; then
513         # Check to see if we are really running in a msvc environemnt
514         _WIN32_MSVC=1
515         AC_CHECK_PROGS(MIDL, midl)
517         # Make sure compilers are valid
518         CFLAGS="$CFLAGS -TC -nologo"
519         CXXFLAGS="$CXXFLAGS -TP -nologo"
520         AC_LANG_SAVE
521         AC_LANG_C
522         AC_TRY_COMPILE([#include <stdio.h>],
523             [ printf("Hello World\n"); ],,
524             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
526         AC_LANG_CPLUSPLUS
527         AC_TRY_COMPILE([#include <new.h>],
528             [ unsigned *test = new unsigned(42); ],,
529             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
530         AC_LANG_RESTORE
531         
532         changequote(,)
533         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
534         changequote([,])
535         
536         # Determine compiler version
537         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
538         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
539         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
540         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
541         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
542         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
544         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
545         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
547         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
548             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
549         fi
550         if test "$_CC_MAJOR_VERSION" = "12"; then
551             _CC_SUITE=6
552         elif test "$_CC_MAJOR_VERSION" = "13"; then
553             _CC_SUITE=7
554         elif test "$_CC_MAJOR_VERSION" = "14"; then
555             _CC_SUITE=8
556             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
557             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
558             dnl so be very specific here!
559             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
560             if test $_CC_RELEASE -gt 50727; then
561                _USE_DYNAMICBASE=1
562             elif test $_CC_BUILD -ge 762; then
563                _USE_DYNAMICBASE=1
564             fi
565             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
566             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
567         elif test "$_CC_MAJOR_VERSION" = "15"; then
568             _CC_SUITE=9
569             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
570             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
571             _USE_DYNAMICBASE=1
572             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
573             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
574         else
575             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
576         fi
578         _MOZ_RTTI_FLAGS_ON='-GR'
579         _MOZ_RTTI_FLAGS_OFF='-GR-'
580         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
581         _MOZ_EXCEPTIONS_FLAGS_OFF=''
583         if test -n "$WIN32_REDIST_DIR"; then
584             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
585         fi
586         
587         # bug #249782
588         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
589         if test "$_CC_SUITE" -ge "8"; then
590                 changequote(,)
591                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
592                 changequote([,])
594                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
595                 if test -n "$MSMT_TOOL"; then
596                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
597                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
598                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
599                         fi
600                         MSMANIFEST_TOOL=1
601                         unset MSMT_TOOL
602                 else
603                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
604                 fi
605         fi
607         # Check linker version
608         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
609         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
610         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
611             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
612         fi
613         INCREMENTAL_LINKER=1
615         # Check midl version
616         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
617         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
618         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
619         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
620         # Add flags if necessary
621         AC_MSG_CHECKING([for midl flags])
622         case "$target" in
623         i*86-*)
624             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
625                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
626                 # MIDL version 7.00.0500 or later has no problem.
627                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
628                 AC_MSG_RESULT([need -env win32])
629             else
630                 AC_MSG_RESULT([none needed])
631             fi
632             ;;
633         *)
634             AC_MSG_RESULT([none needed])
635             ;;
636         esac
638         # Identify which version of the SDK we're building with
639         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
640         # from there
641         AC_CHECK_HEADERS([winsdkver.h])
642         if test "$ac_cv_header_winsdkver_h" = "yes"; then
643             # Get the highest _WIN32_WINNT and NTDDI versions supported
644             # Take the higher of the two
645             # This is done because the Windows 7 beta SDK reports its
646             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
647             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
648                            ac_cv_winsdk_maxver,
649                            [cat > conftest.h <<EOF
650 #include <winsdkver.h>
651 #include <sdkddkver.h>
653 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
654 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
655 #else
656 #define WINSDK_MAXVER NTDDI_MAXVER
657 #endif
659 WINSDK_MAXVER
661                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
662                             rm -f conftest.h
663                            ])
664             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
665         else
666             # The Vista SDK is the only one to have sdkddkver.h but not
667             # WinSDKVer.h
668             AC_CHECK_HEADERS([sdkddkver.h])
669             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
670                 MOZ_WINSDK_MAXVER=0x06000000
671             else
672                 # Assume the Server 2003 Platform SDK
673                 MOZ_WINSDK_MAXVER=0x05020000
674             fi
675         fi
677         unset _MSVC_VER_FILTER
679     else
680         # Check w32api version
681         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
682         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
683         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
684         AC_TRY_COMPILE([#include <w32api.h>],
685             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
686                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
687                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
688                 #error "test failed."
689             #endif
690             , [ res=yes ], [ res=no ])
691         AC_MSG_RESULT([$res])
692         if test "$res" != "yes"; then
693             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
694         fi
695         # Check windres version
696         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
697         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
698         AC_MSG_RESULT([$_WINDRES_VERSION])
699         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
700         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
701         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
702         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
703         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
704         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
705         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
706                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
707                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
708                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
709                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
710                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
711         then
712             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
713         fi
715         # Server 2003 is the highest version supported
716         MOZ_WINSDK_MAXVER=0x05020000
717     fi # !GNU_CC
719     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
720     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
721     # Require OS features provided by IE 5.0
722     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
724     # If the maximum version supported by this SDK is lower than the target
725     # version, error out
726     AC_MSG_CHECKING([for Windows SDK being recent enough])
727     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
728         AC_MSG_RESULT("yes")
729     else
730         AC_MSG_RESULT("no")
731         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. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
732     fi
734     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
735     # Definitions matching sdkddkver.h
736     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
737     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
738     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
739     ;;
740 esac
742 dnl Test breaks icc on OS/2 && MSVC
743 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
744     AC_PROG_CC_C_O
745     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
746         USING_HCC=1
747         _OLDCC=$CC
748         _OLDCXX=$CXX
749         CC="${srcdir}/build/hcc '$CC'"
750         CXX="${srcdir}/build/hcpp '$CXX'"
751     fi
754 AC_PROG_CPP
755 AC_PROG_CXXCPP
757 if test -n "$_WIN32_MSVC"; then
758     SKIP_PATH_CHECKS=1
759     SKIP_COMPILER_CHECKS=1
760     SKIP_LIBRARY_CHECKS=1
762     # Since we're skipping compiler and library checks, hard-code
763     # some facts here.
764     case "$target" in
765     *-wince)
766         ;;
767     *)
768         AC_DEFINE(HAVE_IO_H)
769         AC_DEFINE(HAVE_SETBUF)
770         AC_DEFINE(HAVE_ISATTY)
771         ;;
772     esac
775 fi # COMPILE_ENVIRONMENT
777 AC_SUBST(MIDL_FLAGS)
778 AC_SUBST(_MSC_VER)
780 AC_SUBST(GNU_AS)
781 AC_SUBST(GNU_LD)
782 AC_SUBST(GNU_CC)
783 AC_SUBST(GNU_CXX)
784 AC_SUBST(INTEL_CC)
785 AC_SUBST(INTEL_CXX)
787 dnl ========================================================
788 dnl Checks for programs.
789 dnl ========================================================
790 AC_PROG_INSTALL
791 AC_PROG_LN_S
793 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
794 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
795 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
796 _perl_res=$?
797 AC_MSG_RESULT([$_perl_version])
799 if test "$_perl_res" != 0; then
800     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
804 AC_MSG_CHECKING([for full perl installation])
805 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
806 _perl_res=$?
807 if test "$_perl_res" != 0; then
808     AC_MSG_RESULT([no])
809     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
810 else
811     AC_MSG_RESULT([yes])    
814 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.5 python2.4 python)
815 if test -z "$PYTHON"; then
816     AC_MSG_ERROR([python was not found in \$PATH])
819 MOZ_PATH_PROGS(NSINSTALL_BIN, nsinstall )
820 if test -z "$COMPILE_ENVIRONMENT"; then
821 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
822     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
825 AC_SUBST(NSINSTALL_BIN)
827 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
828 MOZ_PATH_PROG(WHOAMI, whoami, :)
829 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
830 MOZ_PATH_PROG(UNZIP, unzip, :)
831 MOZ_PATH_PROGS(ZIP, zip)
832 if test -z "$ZIP" || test "$ZIP" = ":"; then
833     AC_MSG_ERROR([zip not found in \$PATH])
835 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
836 MOZ_PATH_PROG(XARGS, xargs)
837 if test -z "$XARGS" || test "$XARGS" = ":"; then
838     AC_MSG_ERROR([xargs not found in \$PATH .])
841 if test "$COMPILE_ENVIRONMENT"; then
843 dnl ========================================================
844 dnl = Mac OS X toolchain support
845 dnl ========================================================
847 case "$target_os" in
848 darwin*)
849     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
850     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
851     dnl the environment and includedir purposes (when using an SDK, below),
852     dnl but remember the full version number for the libdir (SDK).
853     changequote(,)
854     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
855     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
856     changequote([,])
857     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
858         dnl Bug 280479, but this keeps popping up in bug 292530 too because
859         dnl 4.0.0/4061 is the default compiler in Tiger.
860         changequote(,)
861         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
862         changequote([,])
863         if test "$GCC_BUILD" = "4061" ; then
864             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
865 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
866 from building Mozilla. Upgrade to Xcode 2.1 or later.])
867         fi
868     fi
870     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
871     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
872     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
873     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
875     case "$PBBUILD" in
876       *xcodebuild*)
877         changequote(,)
878         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
879         changequote([,])
880         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
881           HAS_XCODE_2_1=1;
882         fi
883       ;;
884     esac
886     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
887     dnl it has moved into /usr/bin.
888     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
889     ;;
890 esac
892 AC_SUBST(GCC_VERSION)
893 AC_SUBST(XCODEBUILD_VERSION)
894 AC_SUBST(HAS_XCODE_2_1)
896 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
897 dnl that a universal binary is being produced.
898 AC_SUBST(UNIVERSAL_BINARY)
900 dnl ========================================================
901 dnl Check for MacOS deployment target version
902 dnl ========================================================
904 MOZ_ARG_ENABLE_STRING(macos-target,
905                       [  --enable-macos-target=VER (default=10.4)
906                           Set the minimum MacOS version needed at runtime],
907                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
909 case "$target" in
910 *-darwin*)
911     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
912         dnl Use the specified value
913         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
914         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
915     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
916         dnl No value specified on the command line or in the environment,
917         dnl use architecture minimum.
918         case "${target_cpu}" in
919           x86_64)
920             export MACOSX_DEPLOYMENT_TARGET=10.5
921             ;;
922           *)
923             export MACOSX_DEPLOYMENT_TARGET=10.4
924             ;;
925         esac
926     fi
927     ;;
928 esac
930 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
932 dnl ========================================================
933 dnl = Mac OS X SDK support
934 dnl ========================================================
935 MACOS_SDK_DIR=
936 NEXT_ROOT=
937 MOZ_ARG_WITH_STRING(macos-sdk,
938 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
939     MACOS_SDK_DIR=$withval)
941 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
942 dnl NEXT_ROOT will be set and exported only if it's needed.
943 AC_SUBST(MACOS_SDK_DIR)
944 AC_SUBST(NEXT_ROOT)
946 if test "$MACOS_SDK_DIR"; then
947   dnl Sync this section with the ones in NSPR and NSS.
948   dnl Changes to the cross environment here need to be accounted for in
949   dnl the libIDL checks (below) and xpidl build.
951   if test ! -d "$MACOS_SDK_DIR"; then
952     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
953 specify a valid SDK.  SDKs are installed when the optional cross-development
954 tools are selected during the Xcode/Developer Tools installation.])
955   fi
957   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
958   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
959     SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include -F${MACOS_SDK_DIR}/System/Library/Frameworks"
960     if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
961       SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
962     fi
963     SDK_CXX_INCLUDE="-I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++ -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/ppc-darwin -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/backward"
965     CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
966     CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
968     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
969     CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
970     CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
972     dnl ld support for -syslibroot is compiler-agnostic, but only available
973     dnl on Tiger.  Although it's possible to switch on the build host's
974     dnl OS release to use ld -syslibroot when available, ld -syslibroot will
975     dnl cause warnings as long as NEXT_ROOT is set.  NEXT_ROOT should be
976     dnl set because both the compiler and linker use it.
977     LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib $LIBS"
978     export NEXT_ROOT=$MACOS_SDK_DIR
980     if test -n "$CROSS_COMPILE" ; then
981       dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
982       dnl the build host.  HOST_CXX is presently unused.
983       HOST_CC="NEXT_ROOT= $HOST_CC"
984       HOST_CXX="NEXT_ROOT= $HOST_CXX"
985     fi
986   else
987     dnl gcc >= 4.0 uses different paths than above, but knows how to find
988     dnl them itself.
989     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
990     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
992     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
993     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
994     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
996     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
997       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
998       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
999       dnl be ignored and cause warnings when -syslibroot is specified.
1000       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1001       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1002       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1003     fi
1004   fi
1006   AC_LANG_SAVE
1007   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1008   AC_LANG_CPLUSPLUS
1009   AC_TRY_COMPILE([#include <new>
1010                  int main() { return 0; }],
1011    result=yes,
1012    result=no)
1013   AC_LANG_RESTORE
1014   AC_MSG_RESULT($result)
1016   if test "$result" = "no" ; then
1017     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1018   fi
1021 fi # COMPILE_ENVIRONMENT
1023 dnl Be sure the make we use is GNU make.
1024 dnl on win32, gmake.exe is the generally the wrong version
1025 if test -n "$MAKE"; then
1026   if test `echo $MAKE | grep -c make.py` != 1; then
1027      NOT_PYMAKE=$MAKE
1028   fi
1031 case "$host_os" in
1032 cygwin*|mingw*|mks*|msvc*)
1033     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1034     ;;
1036     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1037     ;;
1038 esac
1039 if test "$GMAKE" = ":"; then
1040    AC_MSG_ERROR([GNU make not found])
1042 AC_SUBST(GMAKE)
1044 if test "$COMPILE_ENVIRONMENT"; then
1046 AC_PATH_XTRA
1048 dnl Check in X11 include directory too.
1049 if test "$no_x" != "yes"; then
1050     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1053 XCFLAGS="$X_CFLAGS"
1055 fi # COMPILE_ENVIRONMENT
1057 dnl ========================================================
1058 dnl set the defaults first
1059 dnl ========================================================
1060 AS_BIN=$AS
1061 AR_FLAGS='cr $@'
1062 AR_LIST='$(AR) t'
1063 AR_EXTRACT='$(AR) x'
1064 AR_DELETE='$(AR) d'
1065 AS='$(CC)'
1066 AS_DASH_C_FLAG='-c'
1067 DLL_PREFIX=lib
1068 LIB_PREFIX=lib
1069 DLL_SUFFIX=.so
1070 OBJ_SUFFIX=o
1071 LIB_SUFFIX=a
1072 ASM_SUFFIX=s
1073 IMPORT_LIB_SUFFIX=
1074 TARGET_MD_ARCH=unix
1075 DIRENT_INO=d_ino
1076 CYGWIN_WRAPPER=
1077 WIN_TOP_SRC=
1078 MOZ_USER_DIR=".mozilla"
1079 HOST_AR='$(AR)'
1080 HOST_AR_FLAGS='$(AR_FLAGS)'
1082 MOZ_JPEG_CFLAGS=
1083 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1084 MOZ_ZLIB_CFLAGS=
1085 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1086 MOZ_BZ2_CFLAGS=
1087 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1088 MOZ_PNG_CFLAGS=
1089 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1091 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1092 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
1093 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1094 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
1095 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1096 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1097 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1099 MOZ_FS_LAYOUT=unix
1101 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1102 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
1104 USE_DEPENDENT_LIBS=1
1106 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1107 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
1109 MOZ_ENABLE_POSTSCRIPT=1 
1111 if test -n "$CROSS_COMPILE"; then
1112     OS_TARGET="${target_os}"
1113     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1114     OS_RELEASE=
1115     case "${target_os}" in
1116         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1117         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1118         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1119         mingw*)       OS_ARCH=WINNT ;;
1120         wince*)       OS_ARCH=WINCE ;;
1121         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1122     esac
1123 else
1124     OS_TARGET=`uname -s`
1125     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1126     OS_RELEASE=`uname -r`
1129 # Before this used `uname -m` when not cross compiling
1130 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1131 OS_TEST="${target_cpu}"
1133 _COMPILER_PREFIX=
1135 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1137 #######################################################################
1138 # Master "Core Components" macros for getting the OS target           #
1139 #######################################################################
1142 # Note: OS_TARGET should be specified on the command line for gmake.
1143 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
1144 # The difference between the Win95 target and the WinNT target is that
1145 # the WinNT target uses Windows NT specific features not available
1146 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
1147 # at lesser performance (the Win95 target uses threads; the WinNT target
1148 # uses fibers).
1150 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1151 # cross-compilation.
1155 # The following hack allows one to build on a WIN95 machine (as if
1156 # s/he were cross-compiling on a WINNT host for a WIN95 target).
1157 # It also accomodates for MKS's uname.exe.  If you never intend
1158 # to do development on a WIN95 machine, you don't need this hack.
1160 case "$OS_ARCH" in
1161 WIN95)
1162     OS_ARCH=WINNT
1163     OS_TARGET=WIN95
1164     ;;
1165 Windows_95)
1166     OS_ARCH=Windows_NT
1167     OS_TARGET=WIN95
1168     ;;
1169 Windows_98)
1170     OS_ARCH=Windows_NT
1171     OS_TARGET=WIN95
1172     ;;
1173 CYGWIN_9*|CYGWIN_ME*)
1174     OS_ARCH='CYGWIN_NT-4.0'
1175     OS_TARGET=WIN95
1176     ;;
1177 esac
1180 # Define and override various archtecture-specific variables, including
1181 # HOST_OS_ARCH
1182 # OS_ARCH
1183 # OS_TEST
1184 # OS_TARGET
1185 # OS_RELEASE
1186 # OS_MINOR_RELEASE
1189 case "$HOST_OS_ARCH" in
1190 cygwin*|mingw*|mks*|msvc*)
1191     HOST_OS_ARCH=WINNT
1192     ;;
1193 linux*)
1194     HOST_OS_ARCH=Linux
1195     ;;
1196 solaris*)
1197     HOST_OS_ARCH=SunOS
1198     SOLARIS_SUNPRO_CC=
1199     SOLARIS_SUNPRO_CXX=
1200     if test -z "$GNU_CC"; then
1201         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1202             SOLARIS_SUNPRO_CC=1
1203        fi
1204     fi
1206     if test -z "$GNU_CXX"; then
1207        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1208            SOLARIS_SUNPRO_CXX=1
1209        fi
1210     fi
1211     AC_SUBST(SOLARIS_SUNPRO_CC)
1212     AC_SUBST(SOLARIS_SUNPRO_CXX)
1213     ;;
1214 BSD_386)
1215     HOST_OS_ARCH=BSD
1216     ;;
1217 dgux)
1218     HOST_OS_ARCH=DGUX
1219     ;;
1220 IRIX64)
1221     HOST_OS_ARCH=IRIX
1222     ;;
1223 UNIX_SV)
1224     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1225         HOST_OS_ARCH=NCR
1226     else
1227         HOST_OS_ARCH=UNIXWARE
1228     fi
1229     ;;
1230 ncr)
1231     HOST_OS_ARCH=NCR
1232     ;;
1233 UNIX_SYSTEM_V)
1234     HOST_OS_ARCH=NEC
1235     ;;
1236 OSF1)
1237     ;;
1238 *OpenVMS*)
1239     HOST_OS_ARCH=OpenVMS
1240     ;;
1241 OS_2)
1242     HOST_OS_ARCH=OS2
1243     ;;
1244 QNX)
1245     ;;
1246 SCO_SV)
1247     HOST_OS_ARCH=SCOOS
1248     ;;
1249 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1250     HOST_OS_ARCH=SINIX
1251     ;;
1252 UnixWare)
1253     HOST_OS_ARCH=UNIXWARE
1254     ;;
1255 esac
1257 case "$OS_ARCH" in
1258 WINNT)
1259     OS_TEST=`uname -p`
1260     ;;
1261 Windows_NT)
1263 # If uname -s returns "Windows_NT", we assume that we are using
1264 # the uname.exe in MKS toolkit.
1266 # The -r option of MKS uname only returns the major version number.
1267 # So we need to use its -v option to get the minor version number.
1268 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1270     OS_ARCH=WINNT
1271     OS_TARGET=WINNT
1272     OS_MINOR_RELEASE=`uname -v`
1273     if test "$OS_MINOR_RELEASE" = "00"; then
1274         OS_MINOR_RELEASE=0
1275     fi
1276     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1277     ;;
1278 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1280 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1281 # the uname.exe in the Cygwin tools.
1282 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1283 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1284 # the uname.exe in the GNU-Win32 tools.
1285 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1286 # the uname.exe in the MSYS tools.
1288     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1289     OS_ARCH=WINNT
1290     OS_TARGET=WINNT
1291     ;;
1292 AIX)
1293     OS_RELEASE=`uname -v`.`uname -r`
1294     OS_TEST=${target_cpu}
1295     ;;
1296 BSD_386)
1297     OS_ARCH=BSD
1298     ;;
1299 dgux)
1300     OS_ARCH=DGUX
1301     ;;
1302 IRIX64)
1303     OS_ARCH=IRIX
1304     ;;
1305 UNIX_SV)
1306     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1307         OS_ARCH=NCR
1308     else
1309         OS_ARCH=UNIXWARE
1310         OS_RELEASE=`uname -v`
1311     fi
1312     ;;
1313 ncr)
1314     OS_ARCH=NCR
1315     ;;
1316 UNIX_SYSTEM_V)
1317     OS_ARCH=NEC
1318     ;;
1319 OSF1)
1320     case `uname -v` in
1321     148)
1322         OS_RELEASE=V3.2C
1323         ;;
1324     564)
1325         OS_RELEASE=V4.0B
1326         ;;
1327     878)
1328         OS_RELEASE=V4.0D
1329         ;;
1330     esac
1331     ;;
1332 *OpenVMS*)
1333     OS_ARCH=OpenVMS
1334     OS_RELEASE=`uname -v`
1335     OS_TEST=`uname -p`
1336     ;;
1337 OS_2)
1338     OS_ARCH=OS2
1339     OS_TARGET=OS2
1340     OS_RELEASE=`uname -v`
1341     ;;
1342 QNX)
1343     if test "$OS_TARGET" != "NTO"; then
1344         changequote(,)
1345         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1346         changequote([,])
1347     fi
1348     OS_TEST=x86
1349     ;;
1350 SCO_SV)
1351     OS_ARCH=SCOOS
1352     OS_RELEASE=5.0
1353     ;;
1354 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1355     OS_ARCH=SINIX
1356     OS_TEST=`uname -p`
1357     ;;
1358 UnixWare)
1359     OS_ARCH=UNIXWARE
1360     OS_RELEASE=`uname -v`
1361     ;;
1362 WINCE)
1363     OS_ARCH=WINCE
1364     OS_TARGET=WINCE
1365     ;;
1366 Darwin)
1367     case "${target_cpu}" in
1368     powerpc*)
1369         OS_TEST=ppc
1370         ;;
1371     i*86*)
1372         OS_TEST=i386 
1373         ;;
1374     x86_64)
1375         OS_TEST=x86_64
1376         ;;
1377     *)
1378         if test -z "$CROSS_COMPILE" ; then
1379             OS_TEST=`uname -p`
1380         fi
1381         ;;
1382     esac
1383     ;;
1384 esac
1386 if test "$OS_ARCH" = "NCR"; then
1387     changequote(,)
1388     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1389     changequote([,])
1392 # Only set CPU_ARCH if we recognize the value of OS_TEST
1394 case "$OS_TEST" in
1395 *86 | i86pc)
1396     CPU_ARCH=x86
1397     ;;
1399 powerpc* | ppc | rs6000)
1400     CPU_ARCH=ppc
1401     ;;
1403 Alpha | alpha | ALPHA)
1404     CPU_ARCH=Alpha
1405     ;;
1407 hppa* | parisc)
1408     CPU_ARCH=hppa
1409     ;;
1411 sun4u | sparc*)
1412     CPU_ARCH=sparc
1413     ;;
1415 x86_64 | ia64)
1416     CPU_ARCH="$OS_TEST"
1417     ;;
1418 esac
1420 if test -z "$OS_TARGET"; then
1421     OS_TARGET=$OS_ARCH
1423 if test "$OS_TARGET" = "WIN95"; then
1424     OS_RELEASE="4.0"
1426 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1428 dnl ========================================================
1429 dnl GNU specific defaults
1430 dnl ========================================================
1431 if test "$GNU_CC"; then
1432     # FIXME: Let us build with strict aliasing. bug 414641.
1433     CFLAGS="$CFLAGS -fno-strict-aliasing"
1434     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1435     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1436     DSO_LDOPTS='-shared'
1437     if test "$GCC_USE_GNU_LD"; then
1438         # Don't allow undefined symbols in libraries
1439         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1440     fi
1441     WARNINGS_AS_ERRORS='-Werror'
1442     DSO_CFLAGS=''
1443     DSO_PIC_CFLAGS='-fPIC'
1444     ASFLAGS="$ASFLAGS -fPIC"
1445     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1446     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1447     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1448     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1450     # Turn on GNU specific features
1451     # -Wall - turn on all warnings
1452     # -pedantic - make compiler warn about non-ANSI stuff, and
1453     #             be a little bit stricter
1454     # Warnings slamm took out for now (these were giving more noise than help):
1455     # -Wbad-function-cast - warns when casting a function to a new return type
1456     # -Wshadow - removed because it generates more noise than help --pete
1457     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1458     if test -z "$INTEL_CC"; then
1459        # Don't use -Wcast-align with ICC
1460        case "$CPU_ARCH" in
1461            # And don't use it on hppa, ia64, sparc, since it's noisy there
1462            hppa | ia64 | sparc)
1463            ;;
1464            *)
1465         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1466            ;;
1467        esac
1468     fi
1470     dnl Turn pedantic on but disable the warnings for long long
1471     _PEDANTIC=1
1473     if test -z "$INTEL_CC"; then
1474       _IGNORE_LONG_LONG_WARNINGS=1
1475       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1476     else
1477       _IGNORE_LONG_LONG_WARNINGS=
1478     fi
1481     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1482     _USE_CPP_INCLUDE_FLAG=1
1483 elif test "$SOLARIS_SUNPRO_CC"; then
1484     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1485     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1487     DSO_LDOPTS='-shared'
1488     if test "$GNU_LD"; then
1489         # Don't allow undefined symbols in libraries
1490         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1491     fi
1493     DSO_CFLAGS=''
1494     if test "$CPU_ARCH" = "sparc"; then
1495         # for Sun Studio on Solaris/SPARC
1496         DSO_PIC_CFLAGS='-xcode=pic32'
1497     else
1498         DSO_PIC_CFLAGS='-KPIC'
1499     fi
1500     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1501 else
1502     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1503     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1505     DSO_LDOPTS='-shared'
1506     if test "$GNU_LD"; then
1507         # Don't allow undefined symbols in libraries
1508         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1509     fi
1511     DSO_CFLAGS=''
1512     DSO_PIC_CFLAGS='-KPIC'
1513     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1516 if test "$GNU_CXX"; then
1517     # FIXME: Let us build with strict aliasing. bug 414641.
1518     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1519     # Turn on GNU specific features
1520     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1521     if test -z "$INTEL_CC"; then
1522        # Don't use -Wcast-align with ICC
1523        case "$CPU_ARCH" in
1524            # And don't use it on hppa, ia64, sparc, since it's noisy there
1525            hppa | ia64 | sparc)
1526            ;;
1527            *)
1528         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1529            ;;
1530        esac
1531     fi
1533     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1534     _USE_CPP_INCLUDE_FLAG=1
1536     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1537                    ac_has_wno_invalid_offsetof,
1538         [
1539             AC_LANG_SAVE
1540             AC_LANG_CPLUSPLUS
1541             _SAVE_CXXFLAGS="$CXXFLAGS"
1542             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1543             AC_TRY_COMPILE([],
1544                            [return(0);],
1545                            ac_has_wno_invalid_offsetof="yes",
1546                            ac_has_wno_invalid_offsetof="no")
1547             CXXFLAGS="$_SAVE_CXXFLAGS"
1548             AC_LANG_RESTORE
1549         ])
1550     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1551         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1552     fi
1553 else
1554     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1557 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1558 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1559 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1560 dnl normal behavior.
1561 dnl ========================================================
1562 MKSHLIB_FORCE_ALL=
1563 MKSHLIB_UNFORCE_ALL=
1565 if test "$COMPILE_ENVIRONMENT"; then
1566 if test "$GNU_CC"; then
1567   AC_MSG_CHECKING(whether ld has archive extraction flags)
1568   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1569    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1570     ac_cv_mkshlib_force_and_unforce="no"
1571     exec 3<&0 <<LOOP_INPUT
1572         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1573         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1574         force="-Wl,-all";              unforce="-Wl,-none"
1575 LOOP_INPUT
1576     while read line
1577     do
1578       eval $line
1579       LDFLAGS=$force
1580       LIBS=$unforce
1581       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1582     done
1583     exec 0<&3 3<&-
1584     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1585    ])
1586   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1587     AC_MSG_RESULT(no)
1588   else
1589     AC_MSG_RESULT(yes)
1590     eval $ac_cv_mkshlib_force_and_unforce
1591     MKSHLIB_FORCE_ALL=$force
1592     MKSHLIB_UNFORCE_ALL=$unforce
1593   fi
1594 fi # GNU_CC
1595 fi # COMPILE_ENVIRONMENT
1597 dnl =================================================================
1598 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1599 dnl which is bad when cross compiling.
1600 dnl =================================================================
1601 if test "$COMPILE_ENVIRONMENT"; then
1602 configure_static_assert_macros='
1603 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1604 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1605 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1608 dnl test that the macros actually work:
1609 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1610 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1611  [AC_LANG_SAVE
1612   AC_LANG_C
1613   ac_cv_static_assertion_macros_work="yes"
1614   AC_TRY_COMPILE([$configure_static_assert_macros],
1615                  [CONFIGURE_STATIC_ASSERT(1)],
1616                  ,
1617                  ac_cv_static_assertion_macros_work="no")
1618   AC_TRY_COMPILE([$configure_static_assert_macros],
1619                  [CONFIGURE_STATIC_ASSERT(0)],
1620                  ac_cv_static_assertion_macros_work="no",
1621                  )
1622   AC_LANG_CPLUSPLUS
1623   AC_TRY_COMPILE([$configure_static_assert_macros],
1624                  [CONFIGURE_STATIC_ASSERT(1)],
1625                  ,
1626                  ac_cv_static_assertion_macros_work="no")
1627   AC_TRY_COMPILE([$configure_static_assert_macros],
1628                  [CONFIGURE_STATIC_ASSERT(0)],
1629                  ac_cv_static_assertion_macros_work="no",
1630                  )
1631   AC_LANG_RESTORE
1632  ])
1633 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1634 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1635     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1637 fi # COMPILE_ENVIRONMENT
1639 dnl ========================================================
1640 dnl Checking for 64-bit OS
1641 dnl ========================================================
1642 if test "$COMPILE_ENVIRONMENT"; then
1643 AC_LANG_SAVE
1644 AC_LANG_C
1645 AC_MSG_CHECKING(for 64-bit OS)
1646 AC_TRY_COMPILE([$configure_static_assert_macros],
1647                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1648                result="yes", result="no")
1649 AC_MSG_RESULT("$result")
1650 if test "$result" = "yes"; then
1651     AC_DEFINE(HAVE_64BIT_OS)
1652     HAVE_64BIT_OS=1
1654 AC_SUBST(HAVE_64BIT_OS)
1655 AC_LANG_RESTORE
1656 fi # COMPILE_ENVIRONMENT
1658 dnl ========================================================
1659 dnl Enable high-memory support on OS/2 by default.
1660 dnl ========================================================
1661 MOZ_OS2_HIGH_MEMORY=1
1662 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1663 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1664     MOZ_OS2_HIGH_MEMORY=,
1665     MOZ_OS2_HIGH_MEMORY=1 )
1666 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1668 dnl ========================================================
1669 dnl System overrides of the defaults for host
1670 dnl ========================================================
1671 case "$host" in
1672 *-beos*)
1673     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1674     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1675     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1676     ;;
1678 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1679     # we need Python 2.5 on Windows
1680     PYTHON_VERSION=2.5
1681     if test -n "$_WIN32_MSVC"; then
1682         HOST_AR=lib
1683         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1684         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1685         HOST_RANLIB='echo ranlib'
1686     else
1687         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1688     fi
1689     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1690     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1691     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1692     HOST_BIN_SUFFIX=.exe
1693     case "$host" in
1694     *mingw*)
1695     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1696         ;;
1697     *)
1698         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1699         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1700             _pwd=`pwd`
1701             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1702         fi
1703         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1704             AS_PERL=1
1705             PERL="${CYGWIN_WRAPPER} $PERL"
1706         fi
1708         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1709             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1710         fi
1711         ;;
1712     esac
1713     ;;
1715 *-darwin*)
1716     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1717     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1718     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1719     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1720     ;;
1722 *-linux*|*-kfreebsd*-gnu)
1723     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1724     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1725     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1726     ;;
1728 *os2*)
1729     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1730     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1731     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1732     HOST_BIN_SUFFIX=.exe
1733     MOZ_FIX_LINK_PATHS=
1734     ;;
1736 *-osf*)
1737     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1738     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1739     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1740     ;;
1743     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1744     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1745     ;;
1746 esac
1748 dnl We require version 2.4 or newer of Python to build,
1749 dnl and 2.5 or newer on Windows.
1750 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1751 changequote(,)
1752 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1753 _python_res=$?
1754 changequote([,])
1755 if test "$_python_res" != 0; then
1756     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1758 AC_MSG_RESULT([yes])
1760 dnl Get mozilla version from central milestone file
1761 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1763 dnl Get version of various core apps from the version files.
1764 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1766 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1767 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1769 dnl ========================================================
1770 dnl System overrides of the defaults for target
1771 dnl ========================================================
1773 case "$target" in
1774 *-aix*)
1775     AC_DEFINE(AIX)
1776     if test ! "$GNU_CC"; then
1777         if test ! "$HAVE_64BIT_OS"; then
1778             # Compiling with Visual Age C++ object model compat is the
1779             # default. To compile with object model ibm, add 
1780             # AIX_OBJMODEL=ibm to .mozconfig.
1781             if test "$AIX_OBJMODEL" = "ibm"; then
1782                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1783             else
1784                 AIX_OBJMODEL=compat
1785             fi
1786         else
1787             AIX_OBJMODEL=compat
1788         fi
1789         AC_SUBST(AIX_OBJMODEL)
1790         DSO_LDOPTS='-qmkshrobj=1'
1791         DSO_CFLAGS='-qflag=w:w'
1792         DSO_PIC_CFLAGS=
1793         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1794         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1795         MOZ_FIX_LINK_PATHS=
1796         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1797         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1798         if test "$COMPILE_ENVIRONMENT"; then
1799             AC_LANG_SAVE
1800             AC_LANG_CPLUSPLUS
1801             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1802             AC_TRY_COMPILE([],
1803                 [#if (__IBMCPP__ < 600)
1804                  #error "Bad compiler"
1805                  #endif],
1806                 _BAD_COMPILER=,_BAD_COMPILER=1)
1807             if test -n "$_BAD_COMPILER"; then
1808                 AC_MSG_RESULT([no])    
1809                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1810             else
1811                 AC_MSG_RESULT([yes])    
1812             fi
1813             AC_LANG_RESTORE
1814             TARGET_COMPILER_ABI="ibmc"
1815             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1816             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1817         fi
1818     fi
1819     case "${target_os}" in
1820     aix4.1*)
1821         DLL_SUFFIX='_shr.a'
1822         ;;
1823     esac
1824     if test "$COMPILE_ENVIRONMENT"; then
1825         AC_CHECK_HEADERS(sys/inttypes.h)
1826     fi
1827     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1828     ;;
1830 *-beos*)
1831     no_x=yes
1832     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1833     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1834     DSO_LDOPTS='-nostart'
1835     TK_LIBS='-lbe -lroot'
1836     LIBS="$LIBS -lbe"
1837     if test "$COMPILE_ENVIRONMENT"; then
1838         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1839         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1840     fi
1841     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1842     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1843     _MOZ_USE_RTTI=1
1844     USE_DEPENDENT_LIBS=
1845     MOZ_USER_DIR="Mozilla"
1846     ;;
1848 *-bsdi*)
1849     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1850     _PEDANTIC=
1851     _IGNORE_LONG_LONG_WARNINGS=
1852     case $OS_RELEASE in
1853         4.*|5.*)
1854             STRIP="$STRIP -d"
1855             ;;
1856         *)
1857             DSO_CFLAGS=''
1858             DSO_LDOPTS='-r'
1859             _WARNINGS_CFLAGS="-Wall"
1860             _WARNINGS_CXXFLAGS="-Wall"
1861             # The test above doesn't work properly, at least on 3.1.
1862             MKSHLIB_FORCE_ALL=''
1863             MKSHLIB_UNFORCE_ALL=''
1864         ;;
1865     esac
1866     ;;
1868 *-darwin*) 
1869     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1870     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1871     MOZ_OPTIMIZE_FLAGS="-O3"
1872     _PEDANTIC=
1873     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1874     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1875     DLL_SUFFIX=".dylib"
1876     DSO_LDOPTS=''
1877     STRIP="$STRIP -x -S"
1878     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1879     MOZ_ENABLE_POSTSCRIPT=
1880     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1881     # The ExceptionHandling framework is needed for Objective-C exception
1882     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1883     # builds.
1884     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1886     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1887     dnl ===================================================================
1888     if test "x$enable_dtrace" = "xyes"; then
1889         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1890     else
1891         dnl check for the presence of the -dead_strip linker flag
1892         AC_MSG_CHECKING([for -dead_strip option to ld])
1893         _SAVE_LDFLAGS=$LDFLAGS
1894         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1895         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1896         if test -n "$_HAVE_DEAD_STRIP" ; then
1897             AC_MSG_RESULT([yes])
1898             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1899         else
1900             AC_MSG_RESULT([no])
1901         fi
1902         
1903         LDFLAGS=$_SAVE_LDFLAGS
1904     fi
1905     ;;
1907 *-freebsd*)
1908     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1909         DLL_SUFFIX=".so.1.0"
1910         DSO_LDOPTS="-shared"
1911     fi
1912     if test ! "$GNU_CC"; then
1913         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1914     fi
1915 # Can't have force w/o an unforce.
1916 #    # Hack for FreeBSD 2.2
1917 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1918 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1919 #       MKSHLIB_UNFORCE_ALL=''
1920 #    fi
1921     ;; 
1923 *-hpux*)
1924     DLL_SUFFIX=".sl"
1925     if test ! "$GNU_CC"; then
1926         DSO_LDOPTS='-b -Wl,+s'
1927         DSO_CFLAGS=""
1928         DSO_PIC_CFLAGS="+Z"
1929         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1930         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1931         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1932     else
1933         DSO_LDOPTS='-b -E +s'
1934         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1935         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1936     fi
1937     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1938     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1939     ;;
1941 *-irix5*)
1942     AC_DEFINE(IRIX)
1943     DSO_LDOPTS='-elf -shared'
1945     if test "$GNU_CC"; then
1946        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1947        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1948        MKSHLIB_FORCE_ALL='-Wl,-all'
1949        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1950        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1951     else
1952        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1953        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1954        MKSHLIB_FORCE_ALL='-all'
1955        MKSHLIB_UNFORCE_ALL='-none'
1956     fi
1957     ;;
1959 *-irix6*)
1960     AC_DEFINE(IRIX)
1961     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1962     dnl compile and link using -n32
1963     USE_N32=1
1964     TARGET_COMPILER_ABI=n32
1965     DSO_LDOPTS='-elf -shared'
1966     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1967     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1968     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1969     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1970     if test "$GNU_CC"; then
1971        MKSHLIB_FORCE_ALL='-Wl,-all'
1972        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1973        _WARNINGS_CFLAGS="-Wall"
1974        _WARNINGS_CXXFLAGS="-Wall"
1975        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1976     else
1977        MKSHLIB_FORCE_ALL='-all'
1978        MKSHLIB_UNFORCE_ALL='-none'
1979            AR_LIST="$AR t"
1980            AR_EXTRACT="$AR x"
1981            AR_DELETE="$AR d"
1982            AR='$(CXX) -ar'
1983            AR_FLAGS='-o $@'
1984        CFLAGS="$CFLAGS -woff 3262 -G 4"
1985        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1986        if test -n "$USE_N32"; then
1987            ASFLAGS="$ASFLAGS -n32"
1988            CFLAGS="$CFLAGS -n32"
1989            CXXFLAGS="$CXXFLAGS -n32"
1990            LDFLAGS="$LDFLAGS -n32"
1991        fi
1992        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1993        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1994        MOZ_FIX_LINK_PATHS=
1995     fi
1996     if test -z "$GNU_CXX"; then
1997       MIPSPRO_CXX=1
1998     fi
1999     ;;
2001 *-*linux*)
2002     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2003     # Similarly for GNU_CXX and INTEL_CXX.
2004     if test "$INTEL_CC" || test "$INTEL_CXX"; then
2005         # -Os has been broken on Intel's C/C++ compilers for quite a
2006         # while; Intel recommends against using it.
2007         MOZ_OPTIMIZE_FLAGS="-O2"
2008         MOZ_DEBUG_FLAGS="-g -fno-inline"
2009     elif test "$GNU_CC" || test "$GNU_CXX"; then
2010         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2011         case $GCC_VERSION in
2012         4.1.*|4.2.*)
2013             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
2014             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2015         esac
2016         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
2017         MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
2018                                           # and that combo is not yet good at
2019                                           # debugging inlined functions (even
2020                                           # when using DWARF2 as the debugging
2021                                           # format)
2022     fi
2024     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2026     MOZ_MEMORY=1
2028     case "${target_cpu}" in
2029     alpha*)
2030         CFLAGS="$CFLAGS -mieee"
2031         CXXFLAGS="$CXXFLAGS -mieee"
2032     ;;
2033     i*86)
2034         USE_ELF_DYNSTR_GC=1
2035         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
2036     ;;
2037     mips*)
2038         MOZ_DEBUG_FLAGS="-g" # We want inlining
2039     ;;
2040     esac
2041     ;;
2043 *-wince*)
2045     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
2046     AR_LIST="$AR -list"
2047     AR_EXTRACT="$AR -extract"
2048     AR_DELETE="$AR d"
2049     AR_FLAGS='-OUT:"$@"'
2051     if test "$AS_BIN"; then
2052         AS="$AS_BIN"
2053     fi
2054     DSO_CFLAGS=
2055     DSO_PIC_CFLAGS=
2056     DLL_SUFFIX=.dll
2057     BIN_SUFFIX='.exe'
2058     if test -z "$RC"; then 
2059         RC=rc.exe  
2060     fi
2061     # certain versions of cygwin's makedepend barf on the 
2062     # #include <string> vs -I./dist/include/string issue so don't use it
2063     SYSTEM_MAKEDEPEND=
2065     HOST_CC=cl
2066     HOST_CXX=cl
2067     HOST_LD=link
2068     HOST_AR='lib -OUT:$@'
2069     HOST_RANLIB='echo ranlib'
2070     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2071         
2072         
2073     WARNINGS_AS_ERRORS='-WX'
2074     MOZ_OPTIMIZE_FLAGS='-Ox'
2075     AR_FLAGS='-NOLOGO -OUT:"$@"'
2076     ASM_SUFFIX=asm
2077     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2078     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2079     DLL_PREFIX=
2080     DOXYGEN=:
2081     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2082     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2083     GARBAGE=
2084     IMPORT_LIB_SUFFIX=lib
2085     LIBS="$LIBS"
2086     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2087     LIB_PREFIX=
2088     LIB_SUFFIX=lib 
2089     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2090     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2091     MKSHLIB_FORCE_ALL=
2092     MKSHLIB_UNFORCE_ALL=
2093     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2094     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2095     MOZ_DEBUG_FLAGS='-Zi'
2096     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2097     MOZ_FIX_LINK_PATHS=
2098     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2099     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2100     OBJ_SUFFIX=obj
2101     RANLIB='echo not_ranlib'
2102     STRIP='echo not_strip'
2103     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2104     UNZIP=unzip
2105     XARGS=xargs
2106     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2107     ZIP=zip
2108     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2109     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2110     STATIC_LIBIDL=1
2111     MOZ_TREE_FREETYPE=1
2113     AC_DEFINE(HAVE_SNPRINTF)
2114     AC_DEFINE(_WINDOWS)
2115     AC_DEFINE(_WIN32)
2116     AC_DEFINE(WIN32)
2117     AC_DEFINE(XP_WIN)
2118     AC_DEFINE(XP_WIN32)
2119     AC_DEFINE(HW_THREADS)
2120     AC_DEFINE(STDC_HEADERS)
2121     AC_DEFINE(NEW_H, <new>)
2122     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2123     AC_DEFINE(HAVE_LOCALTIME_R)
2125     TARGET_MD_ARCH=win32
2126     _PLATFORM_DEFAULT_TOOLKIT='windows'
2127     BIN_SUFFIX='.exe'
2128     USE_SHORT_LIBNAME=1
2129     MOZ_ENABLE_POSTSCRIPT=
2130     MOZ_USER_DIR="Mozilla"
2132     MOZ_GFX_OPTIMIZE_MOBILE=1
2134     # Sanity check for WINCE_WINDOWS_MOBILE
2135     # XXX disabled until we can fix the mobile tinderbox
2136     ##if test "$WINCE_WINDOWS_MOBILE"; then
2137     ##   AC_CHECK_HEADER(tpcshell.h, [],
2138     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2139     ##fi
2143 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2144     DSO_CFLAGS=
2145     DSO_PIC_CFLAGS=
2146     DLL_SUFFIX=.dll
2147     RC=rc.exe
2148     # certain versions of cygwin's makedepend barf on the 
2149     # #include <string> vs -I./dist/include/string issue so don't use it
2150     SYSTEM_MAKEDEPEND=
2151     if test -n "$GNU_CC"; then
2152         CC="$CC -mno-cygwin"
2153         CXX="$CXX -mno-cygwin"
2154         CPP="$CPP -mno-cygwin"
2155         CFLAGS="$CFLAGS -mms-bitfields"
2156         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2157         DSO_LDOPTS='-shared'
2158         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2159         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2160         RC='$(WINDRES)'
2161         # Use temp file for windres (bug 213281)
2162         RCFLAGS='-O coff --use-temp-file'
2163         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2164         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
2165         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
2166         MOZ_FIX_LINK_PATHS=
2167         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
2168         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
2169         DLL_PREFIX=
2170         IMPORT_LIB_SUFFIX=dll.a
2171     else
2172         TARGET_COMPILER_ABI=msvc
2173         HOST_CC='$(CC)'
2174         HOST_CXX='$(CXX)'
2175         HOST_LD='$(LD)'
2176         AR='lib -NOLOGO -OUT:"$@"'
2177         AR_FLAGS=
2178         RANLIB='echo not_ranlib'
2179         STRIP='echo not_strip'
2180         XARGS=xargs
2181         ZIP=zip
2182         UNZIP=unzip
2183         DOXYGEN=:
2184         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2185         OBJ_SUFFIX=obj
2186         LIB_SUFFIX=lib
2187         DLL_PREFIX=
2188         LIB_PREFIX=
2189         IMPORT_LIB_SUFFIX=lib
2190         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2191         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2192         MKSHLIB_FORCE_ALL=
2193         MKSHLIB_UNFORCE_ALL=
2194         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2195         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2196         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2197         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2198         MOZ_DEBUG_FLAGS='-Zi'
2199         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2200         WARNINGS_AS_ERRORS='-WX'
2201         MOZ_OPTIMIZE_FLAGS='-O1'
2202         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2203         MOZ_FIX_LINK_PATHS=
2204         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2205         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2206         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2207         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2208         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2209         if test $_MSC_VER -ge 1400; then
2210             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2211             dnl For profile-guided optimization
2212             PROFILE_GEN_CFLAGS="-GL"
2213             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2214             dnl XXX: PGO builds can fail with warnings treated as errors,
2215             dnl specifically "no profile data available" appears to be
2216             dnl treated as an error sometimes. This might be a consequence
2217             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2218             dnl with the linker doing most of the work in the whole-program
2219             dnl optimization/PGO case. I think it's probably a compiler bug,
2220             dnl but we work around it here.
2221             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2222             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2223             dnl Probably also a compiler bug, but what can you do?
2224             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2225             if test -n "$_USE_DYNAMICBASE"; then
2226                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2227             fi
2228         fi
2229     fi
2230     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2231     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2232     AC_DEFINE(HAVE_SNPRINTF)
2233     AC_DEFINE(_WINDOWS)
2234     AC_DEFINE(_WIN32)
2235     AC_DEFINE(WIN32)
2236     AC_DEFINE(XP_WIN)
2237     AC_DEFINE(XP_WIN32)
2238     AC_DEFINE(HW_THREADS)
2239     AC_DEFINE(STDC_HEADERS)
2240     AC_DEFINE(NEW_H, <new>)
2241     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2242     TARGET_MD_ARCH=win32
2243     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2244     BIN_SUFFIX='.exe'
2245     USE_SHORT_LIBNAME=1
2246     MOZ_ENABLE_POSTSCRIPT=
2247     MOZ_USER_DIR="Mozilla"
2249     dnl Hardcode to win95 for now - cls
2250     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2252     dnl set NO_X11 defines here as the general check is skipped on win32
2253     no_x=yes
2254     AC_DEFINE(NO_X11)
2256     dnl MinGW/MSYS doesn't provide or need cygpath
2257     case "$host" in
2258     *-mingw*)
2259         CYGPATH_W=echo
2260         CYGPATH_S=cat
2261         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2262         ;;
2263     *-cygwin*|*-msvc*|*-mks*)
2264         CYGPATH_W="cygpath -a -w"
2265         CYGPATH_S="sed -e s|\\\\|/|g"
2266         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2267         ;;
2268     esac
2269     case "$host" in
2270     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2272     if test -z "$MOZ_TOOLS"; then
2273         AC_MSG_ERROR([MOZ_TOOLS is not set])
2274     fi
2276     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2277     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2278         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2279     fi
2280     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2281     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2282         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2283     fi
2284     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2286     if test -n "$GLIB_PREFIX"; then
2287         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2288         if test "$?" = "0"; then
2289             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2290                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2291             fi
2292             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2293         else
2294             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2295         fi
2296     else
2297         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2298     fi
2299     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2300         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2301     fi
2302     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2303     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2304         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2305     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2306         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2307     else
2308         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2309     fi
2311     if test -n "$LIBIDL_PREFIX"; then
2312         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2313         if test "$?" = "0"; then
2314             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2315                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2316             fi
2317             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2318         else
2319             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2320         fi
2321     else
2322         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2323     fi        
2324     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2325         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2326     fi
2327     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2328     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2329         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2330         STATIC_LIBIDL=1
2331     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2332         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2333     else
2334         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2335     fi
2336     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2337     ;;
2339     *) # else cross-compiling
2340         if test -n "$GLIB_PREFIX"; then
2341             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2342             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2343                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2344             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2345                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2346             else
2347                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2348             fi
2349         fi
2350         if test -n "$LIBIDL_PREFIX"; then
2351             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2352             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2353                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2354                 STATIC_LIBIDL=1
2355             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2356                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2357             else
2358                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2359             fi
2360         fi
2361         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2362         ;;
2363     esac 
2366     case "$host_os" in
2367     cygwin*|msvc*|mks*)
2368         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])
2369         ;;
2371     *)
2372         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2374         AC_LANG_SAVE
2375         AC_LANG_CPLUSPLUS
2376         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2377         AC_LANG_RESTORE
2378         ;;
2379     esac
2381     case "$target" in
2382     i*86-*)
2383         AC_DEFINE(_X86_)
2384         ;;
2385     alpha-*)
2386         AC_DEFINE(_ALPHA_)
2387         ;;
2388     mips-*)
2389         AC_DEFINE(_MIPS_)
2390         ;;
2391     *)
2392         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2393         ;;
2394     esac
2395     ;;
2397 *-netbsd*)
2398     DSO_CFLAGS=''
2399     CFLAGS="$CFLAGS -Dunix"
2400     CXXFLAGS="$CXXFLAGS -Dunix"
2401     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2402         DLL_SUFFIX=".so"
2403         DSO_PIC_CFLAGS='-fPIC -DPIC'
2404         DSO_LDOPTS='-shared'
2405         BIN_FLAGS='-Wl,--export-dynamic'
2406     else
2407         DSO_PIC_CFLAGS='-fPIC -DPIC'
2408         DLL_SUFFIX=".so.1.0"
2409         DSO_LDOPTS='-shared'
2410     fi
2411     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2412     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2413     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2414     if test "$LIBRUNPATH"; then
2415         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2416     fi
2417     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2418     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2419     ;;
2421 *-nto*) 
2422         AC_DEFINE(NTO)  
2423         AC_DEFINE(_QNX_SOURCE)
2424         AC_DEFINE(_i386)
2425         OS_TARGET=NTO
2426         WARNINGS_AS_ERRORS=''
2427         MOZ_OPTIMIZE_FLAGS="-O"
2428         MOZ_DEBUG_FLAGS="-gstabs"
2429         USE_PTHREADS=1
2430         _PEDANTIC=
2431         LIBS="$LIBS -lsocket -lstdc++"
2432         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2433         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2434         if test "$with_x" != "yes"
2435         then
2436                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2437             TK_CFLAGS='-I/usr/include/photon'
2438                 TK_LIBS='-lph'
2439         fi
2440         case "${target_cpu}" in
2441         ppc*)
2442         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2443         ;;
2444         esac
2445         case "${host_cpu}" in
2446         i*86)
2447         USE_ELF_DYNSTR_GC=1
2448         ;;
2449         esac
2450         ;;
2452 *-openbsd*)
2453     DLL_SUFFIX=".so.1.0"
2454     DSO_CFLAGS=''
2455     DSO_PIC_CFLAGS='-fPIC'
2456     DSO_LDOPTS='-shared -fPIC'
2457     if test "$LIBRUNPATH"; then
2458         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2459     fi
2460     ;;
2462 *-openvms*) 
2463     AC_DEFINE(NO_PW_GECOS)
2464     AC_DEFINE(NO_UDSOCK)
2465     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2466     USE_PTHREADS=1
2467     MKSHLIB_FORCE_ALL='-all'
2468     MKSHLIB_UNFORCE_ALL='-none'
2469     AS='as'
2470     AS_DASH_C_FLAG='-Wc/names=as_is'
2471     AR_FLAGS='c $@'
2472     DSO_LDOPTS='-shared -auto_symvec'
2473     DSO_PIC_CFLAGS=
2474     MOZ_DEBUG_LDFLAGS='-g'
2475     COMPAQ_CXX=1
2476     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2477     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2478     ;;
2481 *-os2*)
2482     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2483     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2484     AC_DEFINE(OS2)
2485     AC_DEFINE(XP_OS2)
2486     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2487     AC_DEFINE(TCPV40HDRS)
2488     USE_SHORT_LIBNAME=1
2489     DLL_PREFIX=
2490     LIB_PREFIX=
2491     LIB_SUFFIX=lib
2492     BIN_SUFFIX=".exe"
2493     DLL_SUFFIX=".dll"
2494     IMPORT_LIB_SUFFIX=lib
2495     DSO_PIC_CFLAGS=
2496     AR=emxomfar
2497     AR_FLAGS='r $@'
2498     CFLAGS="$CFLAGS -Zomf"
2499     CXXFLAGS="$CXXFLAGS -Zomf"
2500     DSO_LDOPTS='-Zdll'
2501     BIN_FLAGS='-Zlinker /ST:0x100000'
2502     IMPLIB='emximp -o'
2503     FILTER='emxexp -o'
2504     LDFLAGS='-Zmap'
2505     WARNINGS_AS_ERRORS='-Werror'
2506     MOZ_DEBUG_FLAGS="-g -fno-inline"
2507     MOZ_OPTIMIZE_FLAGS="-O2"
2508     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2509     MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2510     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2511     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2512     TARGET_MD_ARCH=os2
2513     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2514     MOZ_ENABLE_POSTSCRIPT=
2515     RC=rc.exe
2516     RCFLAGS='-n'
2517     MOZ_USER_DIR="Mozilla"
2519     if test "$MOZTOOLS"; then
2520         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2521     else
2522         AC_MSG_ERROR([MOZTOOLS is not set])
2523     fi
2524     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2525         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2526         LDFLAGS="$LDFLAGS -Zhigh-mem"
2527         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2528         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2529     fi
2531     # GCC for OS/2 currently predefines these, but we don't want them
2532     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2533     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2535     AC_CACHE_CHECK(for __declspec(dllexport),
2536         ac_os2_declspec,
2537         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2538                         [return 0;],
2539                         ac_os2_declspec="yes",
2540                         ac_os2_declspec="no")])
2541     if test "$ac_os2_declspec" = "yes"; then
2542         FILTER='true'
2543         MOZ_OS2_USE_DECLSPEC='1'
2544     fi
2545     ;;
2547 alpha*-*-osf*)
2548     if test "$GNU_CC"; then
2549       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2550       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2552     else
2553         MOZ_DEBUG_FLAGS='-g'
2554         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2555         CFLAGS="$CFLAGS -ieee"
2556         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2557         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2558         DSO_CFLAGS=
2559         DSO_PIC_CFLAGS=
2560         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2561         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2562         MKSHLIB_FORCE_ALL='-all'
2563         MKSHLIB_UNFORCE_ALL='-none'
2564         dnl Might fix the libxpcom.so breakage on this platform as well....
2565         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2566         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2567     fi
2568     if test -z "$GNU_CXX"; then
2569       COMPAQ_CXX=1
2570     fi
2571     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2572     ;;
2574 *-qnx*) 
2575     DIRENT_INO=d_stat.st_ino
2576     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2577     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2578     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2579     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2580     AC_DEFINE(STDC_HEADERS)
2581     if test "$no_x" = "yes"; then
2582             _PLATFORM_DEFAULT_TOOLKIT='photon'
2583             TK_CFLAGS='-I/usr/nto/include/photon'
2584             TK_LIBS='-lphoton -lphrender'
2585     fi
2586     ;;
2588 *-sco*) 
2589     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2590     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2591     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2592     if test ! "$GNU_CC"; then
2593        DSO_LDOPTS='-G'
2594     fi
2595     ;;
2597 dnl the qsort routine under solaris is faulty
2598 *-solaris*) 
2599     AC_DEFINE(SOLARIS)
2600     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2601     SYSTEM_MAKEDEPEND=
2602     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2603     # libraries one level up (e.g. libnspr4.so)
2604     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2605     MOZ_MEMORY=1
2606     if test "$SOLARIS_SUNPRO_CC"; then
2607        LIBS="-lCrun -lCstd $LIBS"
2608        NS_USE_NATIVE=1
2609        MOZ_FIX_LINK_PATHS=
2610        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2611        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2612        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2613        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2614        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2615            _SAVE_LDFLAGS=$LDFLAGS
2616            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2617            AC_TRY_LINK([#include <stdio.h>],
2618                        [printf("Hello World\n");],
2619                        ,
2620                        [LDFLAGS=$_SAVE_LDFLAGS])
2621        fi
2622        WARNINGS_AS_ERRORS='-Werror'
2623        MOZ_OPTIMIZE_FLAGS="-xO4"
2624        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2625        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2626        MKSHLIB_FORCE_ALL='-z allextract'
2627        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2628        DSO_LDOPTS='-G -z muldefs'
2629        AR_LIST="$AR t"
2630        AR_EXTRACT="$AR x"
2631        AR_DELETE="$AR d"
2632        AR='$(CXX) -xar'
2633        AR_FLAGS='-o $@'
2634        AS='/usr/ccs/bin/as'
2635        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2636        AS_DASH_C_FLAG=''
2637        TARGET_COMPILER_ABI="sunc"
2638        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2639        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2640        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2641        AC_LANG_SAVE
2642        AC_LANG_CPLUSPLUS
2643        AC_TRY_COMPILE([],
2644            [#if (__SUNPRO_CC < 0x590)
2645            #error "Denied"
2646            #endif],
2647            _BAD_COMPILER=,_BAD_COMPILER=1)
2648         if test -n "$_BAD_COMPILER"; then
2649             _res="no"
2650             AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2651         else
2652             _res="yes"
2653         fi
2654         AC_MSG_RESULT([$_res])
2655         AC_LANG_RESTORE
2656     else
2657        ASFLAGS="$ASFLAGS -fPIC"
2658        DSO_LDOPTS='-G'
2659        _WARNINGS_CFLAGS=''
2660        _WARNINGS_CXXFLAGS=''
2661        if test "$OS_RELEASE" = "5.3"; then
2662           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2663        fi
2664     fi
2665     if test "$OS_RELEASE" = "5.5.1"; then
2666        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2667     fi
2668     ;;
2670 *-sunos*) 
2671     DSO_LDOPTS='-Bdynamic'
2672     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2673     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2674     AC_DEFINE(SUNOS4)
2675     AC_DEFINE(SPRINTF_RETURNS_STRING)
2676     case "$(target_os)" in
2677     sunos4.1*)
2678         DLL_SUFFIX='.so.1.0'
2679         ;;
2680     esac
2681     ;;
2683 *-sysv4.2uw7*) 
2684         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2685     ;;
2687 *-os2*)
2688     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2689     ;;
2691 esac
2693 dnl Only one oddball right now (QNX), but this gives us flexibility
2694 dnl if any other platforms need to override this in the future.
2695 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2697 dnl ========================================================
2698 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2699 dnl by now will not have any way to link most binaries (tests
2700 dnl as well as viewer, apprunner, etc.), because some symbols
2701 dnl will be left out of the "composite" .so's by ld as unneeded.
2702 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2703 dnl they can link in the static libs that provide the missing
2704 dnl symbols.
2705 dnl ========================================================
2706 NO_LD_ARCHIVE_FLAGS=
2707 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2708     NO_LD_ARCHIVE_FLAGS=1
2710 case "$target" in
2711 *-os2*)
2712     NO_LD_ARCHIVE_FLAGS=
2713     ;;
2714 *-aix4.3*|*-aix5*)
2715     NO_LD_ARCHIVE_FLAGS=
2716     ;;
2717 *-openvms*)
2718     NO_LD_ARCHIVE_FLAGS=
2719     ;;
2720 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2721     if test -z "$GNU_CC"; then
2722         NO_LD_ARCHIVE_FLAGS=
2723     fi
2724     ;;
2725 esac
2726 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2728 dnl ========================================================
2729 dnl = Flags to strip unused symbols from .so components
2730 dnl ========================================================
2731 case "$target" in
2732     *-linux*|*-kfreebsd*-gnu)
2733         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2734         ;;
2735     *-solaris*)
2736         if test -z "$GNU_CC"; then
2737          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2738         else
2739          if test -z "$GCC_USE_GNU_LD"; then
2740           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2741          else
2742           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2743          fi
2744         fi
2745         ;;
2746     *-nto*) 
2747         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2748         ;;
2749     *-darwin*)
2750         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2751         ;;
2752     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2753         if test -n "$GNU_CC"; then
2754            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2755         fi
2756         ;;
2757 esac
2759 if test -z "$COMPILE_ENVIRONMENT"; then
2760     SKIP_COMPILER_CHECKS=1
2761     SKIP_LIBRARY_CHECKS=1
2764 if test -z "$SKIP_COMPILER_CHECKS"; then
2765 dnl Checks for typedefs, structures, and compiler characteristics.
2766 dnl ========================================================
2767 AC_LANG_C
2768 AC_HEADER_STDC
2769 AC_C_CONST
2770 AC_TYPE_MODE_T
2771 AC_TYPE_OFF_T
2772 AC_TYPE_PID_T
2773 AC_TYPE_SIZE_T
2774 AC_STRUCT_ST_BLKSIZE
2775 AC_MSG_CHECKING(for siginfo_t)
2776 AC_CACHE_VAL(ac_cv_siginfo_t,
2777  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2778                   #include <signal.h>],
2779                  [siginfo_t* info;],
2780                  [ac_cv_siginfo_t=true],
2781                  [ac_cv_siginfo_t=false])])
2782 if test "$ac_cv_siginfo_t" = true ; then
2783   AC_DEFINE(HAVE_SIGINFO_T)
2784   AC_MSG_RESULT(yes)
2785 else
2786   AC_MSG_RESULT(no)
2789 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2790 dnl ========================================================
2791 AC_MSG_CHECKING(for int16_t)
2792 AC_CACHE_VAL(ac_cv_int16_t,
2793  [AC_TRY_COMPILE([#include <stdio.h>
2794                   #include <sys/types.h>],
2795                  [int16_t foo = 0;],
2796                  [ac_cv_int16_t=true],
2797                  [ac_cv_int16_t=false])])
2798 if test "$ac_cv_int16_t" = true ; then
2799   AC_DEFINE(HAVE_INT16_T)
2800   AC_MSG_RESULT(yes)
2801 else
2802   AC_MSG_RESULT(no)
2804 AC_MSG_CHECKING(for int32_t)
2805 AC_CACHE_VAL(ac_cv_int32_t,
2806  [AC_TRY_COMPILE([#include <stdio.h>
2807                   #include <sys/types.h>],
2808                  [int32_t foo = 0;],
2809                  [ac_cv_int32_t=true],
2810                  [ac_cv_int32_t=false])])
2811 if test "$ac_cv_int32_t" = true ; then
2812   AC_DEFINE(HAVE_INT32_T)
2813   AC_MSG_RESULT(yes)
2814 else
2815   AC_MSG_RESULT(no)
2817 AC_MSG_CHECKING(for int64_t)
2818 AC_CACHE_VAL(ac_cv_int64_t,
2819  [AC_TRY_COMPILE([#include <stdio.h>
2820                   #include <sys/types.h>],
2821                  [int64_t foo = 0;],
2822                  [ac_cv_int64_t=true],
2823                  [ac_cv_int64_t=false])])
2824 if test "$ac_cv_int64_t" = true ; then
2825   AC_DEFINE(HAVE_INT64_T)
2826   AC_MSG_RESULT(yes)
2827 else
2828   AC_MSG_RESULT(no)
2830 AC_MSG_CHECKING(for int64)
2831 AC_CACHE_VAL(ac_cv_int64,
2832  [AC_TRY_COMPILE([#include <stdio.h>
2833                   #include <sys/types.h>],
2834                  [int64 foo = 0;],
2835                  [ac_cv_int64=true],
2836                  [ac_cv_int64=false])])
2837 if test "$ac_cv_int64" = true ; then
2838   AC_DEFINE(HAVE_INT64)
2839   AC_MSG_RESULT(yes)
2840 else
2841   AC_MSG_RESULT(no)
2843 AC_MSG_CHECKING(for uint)
2844 AC_CACHE_VAL(ac_cv_uint,
2845  [AC_TRY_COMPILE([#include <stdio.h>
2846                   #include <sys/types.h>],
2847                  [uint foo = 0;],
2848                  [ac_cv_uint=true],
2849                  [ac_cv_uint=false])])
2850 if test "$ac_cv_uint" = true ; then
2851   AC_DEFINE(HAVE_UINT)
2852   AC_MSG_RESULT(yes)
2853 else
2854   AC_MSG_RESULT(no)
2856 AC_MSG_CHECKING(for uint_t)
2857 AC_CACHE_VAL(ac_cv_uint_t,
2858  [AC_TRY_COMPILE([#include <stdio.h>
2859                   #include <sys/types.h>],
2860                  [uint_t foo = 0;],
2861                  [ac_cv_uint_t=true],
2862                  [ac_cv_uint_t=false])])
2863 if test "$ac_cv_uint_t" = true ; then
2864   AC_DEFINE(HAVE_UINT_T)
2865   AC_MSG_RESULT(yes)
2866 else
2867   AC_MSG_RESULT(no)
2869 AC_MSG_CHECKING(for uint16_t)
2870 AC_CACHE_VAL(ac_cv_uint16_t,
2871  [AC_TRY_COMPILE([#include <stdio.h>
2872                   #include <sys/types.h>],
2873                  [uint16_t foo = 0;],
2874                  [ac_cv_uint16_t=true],
2875                  [ac_cv_uint16_t=false])])
2876 if test "$ac_cv_uint16_t" = true ; then
2877   AC_DEFINE(HAVE_UINT16_T)
2878   AC_MSG_RESULT(yes)
2879 else
2880   AC_MSG_RESULT(no)
2883 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2884 dnl are defined when compiling C++ but not C.  Since the result of this
2885 dnl test is used only in C++, do it in C++.
2886 AC_LANG_CPLUSPLUS
2888 AC_MSG_CHECKING(for uname.domainname)
2889 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2890     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2891         [ struct utsname *res; char *domain; 
2892             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2893         [ac_cv_have_uname_domainname_field=true],
2894         [ac_cv_have_uname_domainname_field=false])])
2896 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2897     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2898     AC_MSG_RESULT(yes)
2899 else
2900     AC_MSG_RESULT(no)
2903 AC_MSG_CHECKING(for uname.__domainname)
2904 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2905     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2906         [ struct utsname *res; char *domain; 
2907             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2908         [ac_cv_have_uname_us_domainname_field=true],
2909         [ac_cv_have_uname_us_domainname_field=false])])
2911 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2912     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2913     AC_MSG_RESULT(yes)
2914 else
2915     AC_MSG_RESULT(no)
2918 AC_LANG_C
2920 dnl Check for usable wchar_t (2 bytes, unsigned)
2921 dnl (we really don't need the unsignedness check anymore)
2922 dnl ========================================================
2924 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2925     ac_cv_have_usable_wchar_v2,
2926     [AC_TRY_COMPILE([#include <stddef.h>
2927                      $configure_static_assert_macros],
2928                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2929                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2930                     ac_cv_have_usable_wchar_v2="yes",
2931                     ac_cv_have_usable_wchar_v2="no")])
2932 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2933     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2934     HAVE_CPP_2BYTE_WCHAR_T=1
2935 else
2936 dnl This is really gcc-only
2937 dnl Do this test using CXX only since some versions of gcc
2938 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2939 dnl only have short-wchar support for c++.
2940 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2942     AC_LANG_SAVE
2943     AC_LANG_CPLUSPLUS
2944     _SAVE_CXXFLAGS=$CXXFLAGS
2945     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2947     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2948         ac_cv_have_usable_wchar_option_v2,
2949         [AC_TRY_LINK([#include <stddef.h>
2950                       $configure_static_assert_macros],
2951                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2952                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2953                      ac_cv_have_usable_wchar_option_v2="yes",
2954                      ac_cv_have_usable_wchar_option_v2="no")])
2956     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2957         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2958         HAVE_CPP_2BYTE_WCHAR_T=1
2959         WCHAR_CFLAGS="-fshort-wchar"
2960     else    
2961         CXXFLAGS=$_SAVE_CXXFLAGS
2962     fi
2963     AC_LANG_RESTORE
2966 dnl Check for .hidden assembler directive and visibility attribute.
2967 dnl Borrowed from glibc configure.in
2968 dnl ===============================================================
2969 if test "$GNU_CC"; then
2970   AC_CACHE_CHECK(for visibility(hidden) attribute,
2971                  ac_cv_visibility_hidden,
2972                  [cat > conftest.c <<EOF
2973                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2975                   ac_cv_visibility_hidden=no
2976                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2977                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2978                       ac_cv_visibility_hidden=yes
2979                     fi
2980                   fi
2981                   rm -f conftest.[cs]
2982                  ])
2983   if test "$ac_cv_visibility_hidden" = "yes"; then
2984     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2986     AC_CACHE_CHECK(for visibility(default) attribute,
2987                    ac_cv_visibility_default,
2988                    [cat > conftest.c <<EOF
2989                     int foo __attribute__ ((visibility ("default"))) = 1;
2991                     ac_cv_visibility_default=no
2992                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2993                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2994                         ac_cv_visibility_default=yes
2995                       fi
2996                     fi
2997                     rm -f conftest.[cs]
2998                    ])
2999     if test "$ac_cv_visibility_default" = "yes"; then
3000       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3002       AC_CACHE_CHECK(for visibility pragma support,
3003                      ac_cv_visibility_pragma,
3004                      [cat > conftest.c <<EOF
3005 #pragma GCC visibility push(hidden)
3006                       int foo_hidden = 1;
3007 #pragma GCC visibility push(default)
3008                       int foo_default = 1;
3010                       ac_cv_visibility_pragma=no
3011                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3012                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3013                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3014                             ac_cv_visibility_pragma=yes
3015                           fi
3016                         fi
3017                       fi
3018                       rm -f conftest.[cs]
3019                     ])
3020       if test "$ac_cv_visibility_pragma" = "yes"; then
3021         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3022                        ac_cv_have_visibility_class_bug,
3023                        [cat > conftest.c <<EOF
3024 #pragma GCC visibility push(hidden)
3025 struct __attribute__ ((visibility ("default"))) TestStruct {
3026   static void Init();
3028 __attribute__ ((visibility ("default"))) void TestFunc() {
3029   TestStruct::Init();
3032                        ac_cv_have_visibility_class_bug=no
3033                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3034                          ac_cv_have_visibility_class_bug=yes
3035                        else
3036                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3037                            ac_cv_have_visibility_class_bug=yes
3038                          fi
3039                        fi
3040                        rm -rf conftest.{c,S}
3041                        ])
3043         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3044                        ac_cv_have_visibility_builtin_bug,
3045                        [cat > conftest.c <<EOF
3046 #pragma GCC visibility push(hidden)
3047 #pragma GCC visibility push(default)
3048 #include <string.h>
3049 #pragma GCC visibility pop
3051 __attribute__ ((visibility ("default"))) void Func() {
3052   char c[[100]];
3053   memset(c, 0, sizeof(c));
3056                        ac_cv_have_visibility_builtin_bug=no
3057                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3058                          ac_cv_have_visibility_builtin_bug=yes
3059                        else
3060                          if test `grep -c "@PLT" conftest.S` = 0; then
3061                            ac_cv_visibility_builtin_bug=yes
3062                          fi
3063                        fi
3064                        rm -f conftest.{c,S}
3065                        ])
3066         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3067                 "$ac_cv_have_visibility_class_bug" = "no"; then
3068           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3069           WRAP_SYSTEM_INCLUDES=1
3070         else
3071           VISIBILITY_FLAGS='-fvisibility=hidden'
3072         fi # have visibility pragma bug
3073       fi   # have visibility pragma
3074     fi     # have visibility(default) attribute
3075   fi       # have visibility(hidden) attribute
3076 fi         # GNU_CC
3078 # visibility hidden flag for Sun Studio on Solaris
3079 if test "$SOLARIS_SUNPRO_CC"; then
3080 VISIBILITY_FLAGS='-xldscope=hidden'
3081 fi         # Sun Studio on Solaris
3083 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3084 AC_SUBST(VISIBILITY_FLAGS)
3086 dnl Checks for header files.
3087 dnl ========================================================
3088 AC_HEADER_DIRENT
3089 case "$target_os" in
3090 freebsd*)
3091 # for stuff like -lXshm
3092     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3093     ;;
3094 esac
3095 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3096 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3097 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3098 AC_CHECK_HEADERS(malloc.h)
3099 AC_CHECK_HEADERS(X11/XKBlib.h)
3100 AC_CHECK_HEADERS(io.h)
3102 dnl These are all the places some variant of statfs can be hiding.
3103 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3105 dnl Try for MMX support
3106 dnl NB - later gcc versions require -mmmx for this header to be successfully
3107 dnl included (or another option which implies it, such as -march=pentium-mmx)
3108 AC_CHECK_HEADERS(mmintrin.h)
3110 dnl Check whether the compiler supports the new-style C++ standard
3111 dnl library headers (i.e. <new>) or needs the old "new.h"
3112 AC_LANG_CPLUSPLUS
3113 NEW_H=new.h
3114 AC_CHECK_HEADER(new, [NEW_H=new])
3115 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3116 AC_LANG_C
3118 AC_ARG_ENABLE(dtrace,
3119               [  --enable-dtrace         build with dtrace support if available (default=no)],
3120               [enable_dtrace="yes"],)
3121 if test "x$enable_dtrace" = "xyes"; then
3122   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3123   if test -n "$HAVE_DTRACE"; then
3124       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3125   else
3126       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3127   fi
3129 AC_SUBST(HAVE_DTRACE)
3131 case $target in
3132 *-aix4.3*|*-aix5*)
3133         ;;
3135         AC_CHECK_HEADERS(sys/cdefs.h)
3136         ;;
3137 esac
3139 dnl Checks for libraries.
3140 dnl ========================================================
3141 case $target in
3142 *-hpux11.*)
3143         ;;
3145         AC_CHECK_LIB(c_r, gethostbyname_r)
3146         ;;
3147 esac
3149 dnl We don't want to link with libdl even if it's present on OS X, since
3150 dnl it's not used and not part of the default installation.
3151 dnl The same goes for BeOS.
3152 dnl We don't want to link against libm or libpthread on Darwin since
3153 dnl they both are just symlinks to libSystem and explicitly linking
3154 dnl against libSystem causes issues when debugging (see bug 299601).
3155 case $target in
3156 *-darwin*)
3157     ;;
3158 *-beos*)
3159     ;;
3161     AC_CHECK_LIB(m, atan)
3162     AC_CHECK_LIB(dl, dlopen,
3163     AC_CHECK_HEADER(dlfcn.h, 
3164         LIBS="-ldl $LIBS"
3165         AC_DEFINE(HAVE_LIBDL)))
3166     ;;
3167 esac
3169 _SAVE_CFLAGS="$CFLAGS"
3170 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3171 AC_CHECK_FUNCS(dladdr)
3172 CFLAGS="$_SAVE_CFLAGS"
3174 if test ! "$GNU_CXX"; then
3176     case $target in
3177     *-aix*)
3178         AC_CHECK_LIB(C_r, demangle)
3179         ;;
3180      *)
3181         AC_CHECK_LIB(C, demangle)
3182         ;;
3183      esac
3185 AC_CHECK_LIB(socket, socket)
3187 dnl ========================================================
3188 dnl Check whether we can compile code for Core Text
3189 dnl (Mac OS X 10.5 or later)
3190 dnl ========================================================
3191 case "$target" in
3192 *-darwin*)
3193   AC_MSG_CHECKING([for Core Text])
3194   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3195                  [CTLineRef lineRef;],
3196                   ac_cv_have_core_text="yes",
3197                   ac_cv_have_core_text="no")
3198   AC_MSG_RESULT([$ac_cv_have_core_text])
3200   case "${target_cpu}" in
3201   x86_64)
3202     MOZ_CORETEXT=1
3203     ;;
3204   esac
3206   MOZ_ARG_ENABLE_BOOL(coretext,
3207 [  --enable-coretext      Use CoreText instead of ATSUI for text rendering],
3208     MOZ_CORETEXT=1,
3209     MOZ_CORETEXT=)
3211   if test -n "$MOZ_CORETEXT"; then
3212     if test "$ac_cv_have_core_text" = "no"; then
3213       AC_MSG_ERROR([--enable-coretext requires MacOS SDK 10.5 or newer])
3214      fi
3215      AC_DEFINE(MOZ_CORETEXT)
3216   fi
3217   ;;
3218 esac
3220 AC_SUBST(MOZ_CORETEXT)
3222 XLDFLAGS="$X_LIBS"
3223 XLIBS="$X_EXTRA_LIBS"
3225 dnl ========================================================
3226 dnl Checks for X libraries.
3227 dnl Ordering is important.
3228 dnl Xt is dependent upon SM as of X11R6
3229 dnl ========================================================
3230 if test "$no_x" = "yes"; then
3231     AC_DEFINE(NO_X11)
3232 else
3233     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3234         XLIBS="-lX11 $XLIBS"
3235         _SAVE_LDFLAGS="$LDFLAGS"
3236         LDFLAGS="$XLDFLAGS $LDFLAGS"
3237         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3238                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3239         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3240                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3241     echo "green"
3242      
3243         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3244         unset ac_cv_lib_Xt_XtFree
3245             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3246             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3247         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3248                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3249         ])
3251     # AIX needs the motif library linked before libXt to prevent
3252     # crashes in plugins linked against Motif - Bug #98892
3253     case "${target_os}" in
3254     aix*)
3255         XT_LIBS="-lXm $XT_LIBS"
3256         ;;
3257     esac
3259     dnl ========================================================
3260     dnl = Check for XShm
3261     dnl ========================================================
3262     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3263         $XLIBS $XEXT_LIBS)
3264     AC_CHECK_HEADER(X11/extensions/XShm.h)
3265     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3266         test -n "$_HAVE_XSHM_XEXT"; then
3267         AC_DEFINE(HAVE_XSHM)
3268     fi
3270     dnl ========================================================
3271     dnl = Check for XIE
3272     dnl ========================================================
3273     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3274         $XLIBS $XEXT_LIBS)
3275     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3277     if test "$MOZ_XIE_LIBS"; then
3278         dnl ====================================================
3279         dnl = If XIE is present and is desired, turn it on
3280         dnl ====================================================
3281         case $target in
3282             *-hpux*)
3283                 ;;
3284             *)
3285                 HAVE_XIE=1
3286                 ;;
3287         esac
3288     fi
3290         LDFLAGS="$_SAVE_LDFLAGS"
3292     dnl ========================================================
3293     dnl = Check for freetype2 and its functionality
3294     dnl ========================================================
3295     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3297     if test "$_HAVE_FREETYPE2"; then
3298         _SAVE_LIBS="$LIBS"
3299         _SAVE_CFLAGS="$CFLAGS"
3300         LIBS="$LIBS $FT2_LIBS"
3301         CFLAGS="$CFLAGS $FT2_CFLAGS"
3303         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3304             ac_cv_member_FT_Bitmap_Size_y_ppem,
3305             [AC_TRY_COMPILE([#include <ft2build.h>
3306                              #include FT_FREETYPE_H],
3307                             [FT_Bitmap_Size s;
3308                              if (sizeof s.y_ppem) return 0;
3309                              return 1],
3310                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3311                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3312         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3313             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3314         else
3315             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3316         fi
3317         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3318                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3319                            [FT_Bitmap_Size structure includes y_ppem field])
3321         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3323         LIBS="$_SAVE_LIBS"
3324         CFLAGS="$_SAVE_CFLAGS"
3325     fi
3327 fi # $no_x
3329 AC_SUBST(XCFLAGS)
3330 AC_SUBST(XLDFLAGS)
3331 AC_SUBST(XLIBS)
3332 AC_SUBST(XEXT_LIBS)
3333 AC_SUBST(XT_LIBS)
3335 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3336 AC_TRY_COMPILE([],
3337                [asm("uqadd8 r1, r1, r2");],
3338                result="yes", result="no")
3339 AC_MSG_RESULT("$result")
3340 if test "$result" = "yes"; then
3341     AC_DEFINE(HAVE_ARM_SIMD)
3342     HAVE_ARM_SIMD=1
3344 AC_SUBST(HAVE_ARM_SIMD)
3346 AC_MSG_CHECKING(for ARM NEON support in compiler)
3347 _SAVE_CFLAGS="$CFLAGS"
3348 if test "$GNU_CC"; then
3349   # gcc needs -mfpu=neon to recognize NEON instructions
3350   CFLAGS="$CFLAGS -mfpu=neon"
3352 AC_TRY_COMPILE([],
3353                [asm("vadd.i8 d0, d0, d0");],
3354                result="yes", result="no")
3355 AC_MSG_RESULT("$result")
3356 if test "$result" = "yes"; then
3357     AC_DEFINE(HAVE_ARM_NEON)
3358     HAVE_ARM_NEON=1
3360 CFLAGS="$_SAVE_CFLAGS"
3361 AC_SUBST(HAVE_ARM_NEON)
3363 dnl ========================================================
3364 dnl = pthread support
3365 dnl = Start by checking whether the system support pthreads
3366 dnl ========================================================
3367 case "$target_os" in
3368 darwin*)
3369     USE_PTHREADS=1
3370     ;;
3372     MOZ_CHECK_PTHREADS(pthreads,
3373         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3374         MOZ_CHECK_PTHREADS(pthread,
3375             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3376             MOZ_CHECK_PTHREADS(c_r,
3377                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3378                 MOZ_CHECK_PTHREADS(c,
3379                     USE_PTHREADS=1
3380                 )
3381             )
3382         )
3383     )
3384     ;;
3385 esac
3387 dnl ========================================================
3388 dnl Check the command line for --with-pthreads 
3389 dnl ========================================================
3390 MOZ_ARG_WITH_BOOL(pthreads,
3391 [  --with-pthreads         Force use of system pthread library with NSPR ],
3392 [ if test "$USE_PTHREADS"x = x; then
3393     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3394 fi],
3395     USE_PTHREADS=
3396     _PTHREAD_LDFLAGS=
3399 dnl ========================================================
3400 dnl Do the platform specific pthread hackery
3401 dnl ========================================================
3402 if test "$USE_PTHREADS"x != x
3403 then
3404         dnl
3405         dnl See if -pthread is supported.
3406         dnl
3407         rm -f conftest*
3408         ac_cv_have_dash_pthread=no
3409         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3410         echo 'int main() { return 0; }' | cat > conftest.c
3411         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3412         if test $? -eq 0; then
3413                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3414                         ac_cv_have_dash_pthread=yes
3415                 case "$target_os" in
3416                 freebsd*)
3417 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3418                 ;;
3419                 *)
3420                             CFLAGS="$CFLAGS -pthread"
3421                             CXXFLAGS="$CXXFLAGS -pthread"
3422                 ;;
3423                 esac
3424                 fi
3425         fi
3426         rm -f conftest*
3427     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3429         dnl
3430         dnl See if -pthreads is supported.
3431         dnl
3432     ac_cv_have_dash_pthreads=no
3433     if test "$ac_cv_have_dash_pthread" = "no"; then
3434             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3435         echo 'int main() { return 0; }' | cat > conftest.c
3436             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3437         if test $? -eq 0; then
3438                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3439                             ac_cv_have_dash_pthreads=yes
3440                             CFLAGS="$CFLAGS -pthreads"
3441                             CXXFLAGS="$CXXFLAGS -pthreads"
3442                     fi
3443             fi
3444             rm -f conftest*
3445         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3446     fi
3448         case "$target" in
3449             *-*-freebsd*)
3450                         AC_DEFINE(_REENTRANT)
3451                         AC_DEFINE(_THREAD_SAFE)
3452                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3453                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3454                                 _PTHREAD_LDFLAGS="-pthread"
3455                         else
3456                                 _PTHREAD_LDFLAGS="-lc_r"
3457                         fi
3458                         ;;
3460             *-*-openbsd*|*-*-bsdi*)
3461                         AC_DEFINE(_REENTRANT)
3462                         AC_DEFINE(_THREAD_SAFE)
3463                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3464                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3465                 _PTHREAD_LDFLAGS="-pthread"
3466                         fi
3467                         ;;
3469             *-*-linux*|*-*-kfreebsd*-gnu)
3470                         AC_DEFINE(_REENTRANT) 
3471                         ;;
3473             *-*-nto*) 
3474                         AC_DEFINE(_REENTRANT) 
3475                         ;;
3477             *-aix4.3*|*-aix5*)
3478                         AC_DEFINE(_REENTRANT) 
3479                         ;;
3481             *-hpux11.*)
3482                         AC_DEFINE(_REENTRANT) 
3483                         ;;
3485             alpha*-*-osf*)
3486                         AC_DEFINE(_REENTRANT)
3487                         ;;
3489             *-*-solaris*) 
3490                         AC_DEFINE(_REENTRANT)
3491                         if test "$SOLARIS_SUNPRO_CC"; then
3492                                 CFLAGS="$CFLAGS -mt" 
3493                                 CXXFLAGS="$CXXFLAGS -mt" 
3494                         fi
3495                         ;;
3496         esac
3497     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3500 dnl ========================================================
3501 dnl See if mmap sees writes
3502 dnl For cross compiling, just define it as no, which is a safe default
3503 dnl ========================================================
3504 AC_MSG_CHECKING(whether mmap() sees write()s)
3506 changequote(,)
3507 mmap_test_prog='
3508     #include <stdlib.h>
3509     #include <unistd.h>
3510     #include <sys/mman.h>
3511     #include <sys/types.h>
3512     #include <sys/stat.h>
3513     #include <fcntl.h>
3515     char fname[] = "conftest.file";
3516     char zbuff[1024]; /* Fractional page is probably worst case */
3518     int main() {
3519         char *map;
3520         int fd;
3521         int i;
3522         unlink(fname);
3523         fd = open(fname, O_RDWR | O_CREAT, 0660);
3524         if(fd<0) return 1;
3525         unlink(fname);
3526         write(fd, zbuff, sizeof(zbuff));
3527         lseek(fd, 0, SEEK_SET);
3528         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3529         if(map==(char*)-1) return 2;
3530         for(i=0; fname[i]; i++) {
3531             int rc = write(fd, &fname[i], 1);
3532             if(map[i]!=fname[i]) return 4;
3533         }
3534         return 0;
3535     }
3537 changequote([,])
3539 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3541 AC_MSG_RESULT("$result")
3543 if test "$result" = "no"; then
3544     AC_DEFINE(MMAP_MISSES_WRITES)
3548 dnl Checks for library functions.
3549 dnl ========================================================
3550 AC_PROG_GCC_TRADITIONAL
3551 AC_FUNC_MEMCMP
3552 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3553 AC_CHECK_FUNCS(flockfile getpagesize)
3554 AC_CHECK_FUNCS(localtime_r strtok_r)
3556 dnl check for wcrtomb/mbrtowc
3557 dnl =======================================================================
3558 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3559 AC_LANG_SAVE
3560 AC_LANG_CPLUSPLUS
3561 AC_CACHE_CHECK(for wcrtomb,
3562     ac_cv_have_wcrtomb,
3563     [AC_TRY_LINK([#include <wchar.h>],
3564                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3565                  ac_cv_have_wcrtomb="yes",
3566                  ac_cv_have_wcrtomb="no")])
3567 if test "$ac_cv_have_wcrtomb" = "yes"; then
3568     AC_DEFINE(HAVE_WCRTOMB)
3570 AC_CACHE_CHECK(for mbrtowc,
3571     ac_cv_have_mbrtowc,
3572     [AC_TRY_LINK([#include <wchar.h>],
3573                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3574                  ac_cv_have_mbrtowc="yes",
3575                  ac_cv_have_mbrtowc="no")])
3576 if test "$ac_cv_have_mbrtowc" = "yes"; then
3577     AC_DEFINE(HAVE_MBRTOWC)
3579 AC_LANG_RESTORE
3582 AC_CACHE_CHECK(
3583     [for res_ninit()],
3584     ac_cv_func_res_ninit,
3585     [AC_TRY_LINK([
3586         #ifdef linux
3587         #define _BSD_SOURCE 1
3588         #endif
3589         #include <resolv.h>
3590         ],
3591         [int foo = res_ninit(&_res);],
3592         [ac_cv_func_res_ninit=yes],
3593         [ac_cv_func_res_ninit=no])
3594     ])
3596 if test "$ac_cv_func_res_ninit" = "yes"; then
3597     AC_DEFINE(HAVE_RES_NINIT)
3598 dnl must add the link line we do something as foolish as this... dougt
3599 dnl else
3600 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3601 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3604 AC_LANG_CPLUSPLUS
3605 AC_CACHE_CHECK(
3606     [for gnu_get_libc_version()],
3607     ac_cv_func_gnu_get_libc_version,
3608     [AC_TRY_LINK([
3609         #ifdef HAVE_GNU_LIBC_VERSION_H
3610         #include <gnu/libc-version.h>
3611         #endif
3612         ],
3613         [const char *glibc_version = gnu_get_libc_version();],
3614         [ac_cv_func_gnu_get_libc_version=yes],
3615         [ac_cv_func_gnu_get_libc_version=no] 
3616         )]
3617     )
3619 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3620     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3623 case $target_os in
3624     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3625         ;;
3626     *)
3627     
3628 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3629     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3630         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3631 _SAVE_LIBS=$LIBS
3632 LIBS="$LIBS $_ICONV_LIBS"
3633 AC_CACHE_CHECK(
3634     [for iconv()],
3635     ac_cv_func_iconv,
3636     [AC_TRY_LINK([
3637         #include <stdlib.h>
3638         #include <iconv.h>
3639         ],
3640         [
3641             iconv_t h = iconv_open("", "");
3642             iconv(h, NULL, NULL, NULL, NULL);
3643             iconv_close(h);
3644         ],
3645         [ac_cv_func_iconv=yes],
3646         [ac_cv_func_iconv=no] 
3647         )]
3648     )
3649 if test "$ac_cv_func_iconv" = "yes"; then
3650     AC_DEFINE(HAVE_ICONV)
3651     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3652     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3653     LIBICONV="$_ICONV_LIBS"
3654     AC_CACHE_CHECK(
3655         [for iconv() with const input],
3656         ac_cv_func_const_iconv,
3657         [AC_TRY_COMPILE([
3658             #include <stdlib.h>
3659             #include <iconv.h>
3660             ],
3661             [
3662                 const char *input = "testing";
3663                 iconv_t h = iconv_open("", "");
3664                 iconv(h, &input, NULL, NULL, NULL);
3665                 iconv_close(h);
3666             ],
3667             [ac_cv_func_const_iconv=yes],
3668             [ac_cv_func_const_iconv=no] 
3669             )]
3670         )
3671     if test "$ac_cv_func_const_iconv" = "yes"; then
3672         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3673     fi
3675 LIBS=$_SAVE_LIBS
3677     ;;
3678 esac
3680 AM_LANGINFO_CODESET
3682 AC_LANG_C
3684 dnl **********************
3685 dnl *** va_copy checks ***
3686 dnl **********************
3687 dnl we currently check for all three va_copy possibilities, so we get
3688 dnl all results in config.log for bug reports.
3689 AC_MSG_CHECKING(for an implementation of va_copy())
3690 AC_CACHE_VAL(ac_cv_va_copy,[
3691     AC_TRY_RUN([
3692         #include <stdarg.h>
3693         void f (int i, ...) {
3694             va_list args1, args2;
3695             va_start (args1, i);
3696             va_copy (args2, args1);
3697             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3698                 exit (1);
3699             va_end (args1); va_end (args2);
3700         }
3701         int main() { f (0, 42); return 0; }],
3702         ac_cv_va_copy=yes,
3703         ac_cv_va_copy=no,
3704         ac_cv_va_copy=no
3705     )
3707 AC_MSG_RESULT($ac_cv_va_copy)
3708 AC_MSG_CHECKING(for an implementation of __va_copy())
3709 AC_CACHE_VAL(ac_cv___va_copy,[
3710     AC_TRY_RUN([
3711         #include <stdarg.h>
3712         void f (int i, ...) {
3713             va_list args1, args2;
3714             va_start (args1, i);
3715             __va_copy (args2, args1);
3716             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3717                 exit (1);
3718             va_end (args1); va_end (args2);
3719         }
3720         int main() { f (0, 42); return 0; }],
3721         ac_cv___va_copy=yes,
3722         ac_cv___va_copy=no,
3723         ac_cv___va_copy=no
3724     )
3726 AC_MSG_RESULT($ac_cv___va_copy)
3727 AC_MSG_CHECKING(whether va_lists can be copied by value)
3728 AC_CACHE_VAL(ac_cv_va_val_copy,[
3729     AC_TRY_RUN([
3730         #include <stdarg.h>
3731         void f (int i, ...) {
3732             va_list args1, args2;
3733             va_start (args1, i);
3734             args2 = args1;
3735             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3736                 exit (1);
3737             va_end (args1); va_end (args2);
3738         }
3739         int main() { f (0, 42); return 0; }],
3740         ac_cv_va_val_copy=yes,
3741         ac_cv_va_val_copy=no,
3742         ac_cv_va_val_copy=yes
3743     )
3745 if test "x$ac_cv_va_copy" = "xyes"; then
3746     AC_DEFINE(VA_COPY, va_copy)
3747     AC_DEFINE(HAVE_VA_COPY)
3748 elif test "x$ac_cv___va_copy" = "xyes"; then
3749     AC_DEFINE(VA_COPY, __va_copy)
3750     AC_DEFINE(HAVE_VA_COPY)
3753 if test "x$ac_cv_va_val_copy" = "xno"; then
3754    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3756 AC_MSG_RESULT($ac_cv_va_val_copy)
3758 dnl Check for dll-challenged libc's.
3759 dnl This check is apparently only needed for Linux.
3760 case "$target" in
3761         *-linux*)
3762             dnl ===================================================================
3763             _curdir=`pwd`
3764             export _curdir
3765             rm -rf conftest* _conftest
3766             mkdir _conftest
3767             cat >> conftest.C <<\EOF
3768 #include <stdio.h>
3769 #include <link.h>
3770 #include <dlfcn.h>
3771 #ifdef _dl_loaded
3772 void __dump_link_map(void) {
3773   struct link_map *map = _dl_loaded;
3774   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3776 int main() {
3777   dlopen("./conftest1.so",RTLD_LAZY);
3778   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3779   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3780   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3781   __dump_link_map();
3783 #else
3784 /* _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).*/
3785 int main() { printf("./conftest1.so\n"); }
3786 #endif
3789             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3791             cat >> conftest1.C <<\EOF
3792 #include <stdio.h>
3793 void foo(void) {printf("foo in dll called\n");}
3795             ${CXX-g++} -fPIC -c -g conftest1.C
3796             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3797             ${CXX-g++} -g conftest.C -o conftest -ldl
3798             cp -f conftest1.so conftest _conftest
3799             cd _conftest
3800             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3801             then
3802                 echo
3803                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3804                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3805                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3806                 echo "*** will be excessive memory usage at runtime."
3807                 echo
3808             fi
3809             cd ${_curdir}
3810             rm -rf conftest* _conftest
3811             dnl ===================================================================
3812             ;;
3813 esac
3815 dnl ===================================================================
3816 dnl ========================================================
3817 dnl By default, turn rtti and exceptions off on g++/egcs
3818 dnl ========================================================
3819 if test "$GNU_CXX"; then
3821   AC_MSG_CHECKING(for C++ exceptions flag)
3823   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3824   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3825   [echo "int main() { return 0; }" | cat > conftest.C
3827   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3829   if egrep "warning.*renamed" conftest.out >/dev/null; then
3830     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3831   else
3832     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3833   fi
3835   rm -f conftest*])
3837   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3838   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3839   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3842 dnl ========================================================
3843 dnl Put your C++ language/feature checks below
3844 dnl ========================================================
3845 AC_LANG_CPLUSPLUS
3847 HAVE_GCC3_ABI=
3848 if test "$GNU_CC"; then
3849   AC_CACHE_CHECK(for gcc 3.0 ABI,
3850       ac_cv_gcc_three_abi,
3851       [AC_TRY_COMPILE([],
3852                       [
3853 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3854   return 0;
3855 #else
3856 #error Not gcc3.
3857 #endif
3858                       ],
3859                       ac_cv_gcc_three_abi="yes",
3860                       ac_cv_gcc_three_abi="no")])
3861   if test "$ac_cv_gcc_three_abi" = "yes"; then
3862       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3863       HAVE_GCC3_ABI=1
3864   else
3865       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3866   fi
3868 AC_SUBST(HAVE_GCC3_ABI)
3871 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3872                ac_cv_cpp_explicit,
3873                [AC_TRY_COMPILE(class X {
3874                                public: explicit X(int i) : i_(i) {}
3875                                private: int i_;
3876                                };,
3877                                X x(3);,
3878                                ac_cv_cpp_explicit=yes,
3879                                ac_cv_cpp_explicit=no)])
3880 if test "$ac_cv_cpp_explicit" = yes ; then
3881    AC_DEFINE(HAVE_CPP_EXPLICIT)
3884 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3885                ac_cv_cpp_typename,
3886                [AC_TRY_COMPILE(class param {
3887                                public:
3888                                    typedef unsigned long num_type;
3889                                };
3891                                template <class T> class tplt {
3892                                public:
3893                                    typedef typename T::num_type t_num_type;
3894                                    t_num_type foo(typename T::num_type num) {
3895                                        return num;
3896                                    }
3897                                };,
3898                                tplt<param> A;
3899                                A.foo(0);,
3900                                ac_cv_cpp_typename=yes,
3901                                ac_cv_cpp_typename=no)])
3902 if test "$ac_cv_cpp_typename" = yes ; then
3903    AC_DEFINE(HAVE_CPP_TYPENAME)
3906 dnl Check for support of modern template specialization syntax
3907 dnl Test code and requirement from scc@netscape.com.
3908 dnl Autoconf cut-and-paste job by waterson@netscape.com
3909 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3910                ac_cv_cpp_modern_specialize_template_syntax,
3911                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3912                                class Y {};
3913                                template <> struct X<Y> { double a; };,
3914                                X<int> int_x;
3915                                X<Y> y_x;,
3916                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3917                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3918 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3919   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3923 dnl Some compilers support only full specialization, and some don't.
3924 AC_CACHE_CHECK(whether partial template specialization works,
3925                ac_cv_cpp_partial_specialization,
3926                [AC_TRY_COMPILE(template <class T> class Foo {};
3927                                template <class T> class Foo<T*> {};,
3928                                return 0;,
3929                                ac_cv_cpp_partial_specialization=yes,
3930                                ac_cv_cpp_partial_specialization=no)])
3931 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3932   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3935 dnl Some compilers have limited support for operators with templates;
3936 dnl specifically, it is necessary to define derived operators when a base
3937 dnl class's operator declaration should suffice.
3938 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3939                ac_cv_need_derived_template_operators,
3940                [AC_TRY_COMPILE([template <class T> class Base { };
3941                                 template <class T>
3942                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3943                                 template <class T> class Derived : public Base<T> { };],
3944                                [Derived<char> a, b;
3945                                 Base<char> c = a + b;
3946                                 return 0;],
3947                                ac_cv_need_derived_template_operators=no,
3948                                ac_cv_need_derived_template_operators=yes)])
3949 if test "$ac_cv_need_derived_template_operators" = yes ; then
3950   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3954 dnl Some compilers have trouble detecting that a template class
3955 dnl that derives from another template is actually an instance
3956 dnl of the base class. This test checks for that.
3957 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3958                ac_cv_need_cpp_template_cast_to_base,
3959                [AC_TRY_COMPILE([template <class T> class Base { };
3960                                 template <class T> class Derived : public Base<T> { };
3961                                 template <class T> int foo(const Base<T>&) { return 0; }],
3962                                [Derived<char> bar; return foo(bar);],
3963                                ac_cv_need_cpp_template_cast_to_base=no,
3964                                ac_cv_need_cpp_template_cast_to_base=yes)])
3965 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3966   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3969 dnl Some compilers have trouble resolving the ambiguity between two
3970 dnl functions whose arguments differ only by cv-qualifications.
3971 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3972                ac_cv_can_resolve_const_ambiguity,
3973                [AC_TRY_COMPILE([
3974                                 template <class T> class ptrClass {
3975                                   public: T* ptr;
3976                                 };
3978                                 template <class T> T* a(ptrClass<T> *arg) {
3979                                   return arg->ptr;
3980                                 }
3982                                 template <class T>
3983                                 const T* a(const ptrClass<T> *arg) {
3984                                   return arg->ptr;
3985                                 }
3986                                ],
3987                                [ ptrClass<int> i;
3988                                  a(&i); ],
3989                                ac_cv_can_resolve_const_ambiguity=yes,
3990                                ac_cv_can_resolve_const_ambiguity=no)])
3991 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3992   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3996 dnl We don't do exceptions on unix.  The only reason this used to be here
3997 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3998 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3999 dnl So im commenting this out until someone writes some artificial 
4000 dnl intelligence to detect not only if the compiler has exceptions, but if 
4001 dnl they are enabled as well.
4002 dnl 
4003 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4004 dnl                ac_cv_cpp_exceptions,
4005 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4006 dnl                                static void F() { throw X(); },
4007 dnl                                try { F(); } catch(X & e) { },
4008 dnl                                ac_cv_cpp_exceptions=yes,
4009 dnl                                ac_cv_cpp_exceptions=no)])
4010 dnl if test $ac_cv_cpp_exceptions = yes ; then
4011 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4012 dnl fi
4014 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4015 dnl supports it well enough to allow us to use it to change access, but not
4016 dnl to resolve ambiguity. The next two tests determine how well the |using|
4017 dnl keyword is supported.
4019 dnl Check to see if we can change access with |using|.  Test both a
4020 dnl legal and an illegal example.
4021 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4022                ac_cv_cpp_access_changing_using2,
4023                [AC_TRY_COMPILE(
4024                    class A { protected: int foo() { return 0; } };
4025                    class B : public A { public: using A::foo; };,
4026                    B b; return b.foo();,
4027                    [AC_TRY_COMPILE(
4028                        class A { public: int foo() { return 1; } };
4029                        class B : public A { private: using A::foo; };,
4030                        B b; return b.foo();,
4031                        ac_cv_cpp_access_changing_using2=no,
4032                        ac_cv_cpp_access_changing_using2=yes)],
4033                    ac_cv_cpp_access_changing_using2=no)])
4034 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4035    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4038 dnl Check to see if we can resolve ambiguity with |using|.
4039 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4040                ac_cv_cpp_ambiguity_resolving_using,
4041                [AC_TRY_COMPILE(class X { 
4042                                  public: int go(const X&) {return 3;}
4043                                          int jo(const X&) {return 3;}
4044                                };
4045                                class Y : public X {
4046                                  public:  int go(int) {return 2;}
4047                                           int jo(int) {return 2;}
4048                                           using X::jo;
4049                                  private: using X::go;
4050                                };,
4051                                X x; Y y; y.jo(x);,
4052                                ac_cv_cpp_ambiguity_resolving_using=yes,
4053                                ac_cv_cpp_ambiguity_resolving_using=no)])
4054 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4055    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4058 dnl Check to see if the |std| namespace is supported. If so, we'll want
4059 dnl to qualify any standard library calls with "std::" to ensure that
4060 dnl those functions can be resolved.
4061 AC_CACHE_CHECK(for \"std::\" namespace,
4062                ac_cv_cpp_namespace_std,
4063                [AC_TRY_COMPILE([#include <algorithm>],
4064                                [return std::min(0, 1);],
4065                                ac_cv_cpp_namespace_std=yes,
4066                                ac_cv_cpp_namespace_std=no)])
4067 if test "$ac_cv_cpp_namespace_std" = yes ; then
4068    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4071 dnl Older compilers are overly ambitious with respect to using the standard
4072 dnl template library's |operator!=()| when |operator==()| is defined. In
4073 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4074 dnl ambiguity at compile-time. This test checks for that case.
4075 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4076                ac_cv_cpp_unambiguous_std_notequal,
4077                [AC_TRY_COMPILE([#include <algorithm>
4078                                 struct T1 {};
4079                                 int operator==(const T1&, const T1&) { return 0; }
4080                                 int operator!=(const T1&, const T1&) { return 0; }],
4081                                [T1 a,b; return a != b;],
4082                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4083                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4084 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4085   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4089 AC_CACHE_CHECK(for C++ reinterpret_cast,
4090                ac_cv_cpp_reinterpret_cast,
4091                [AC_TRY_COMPILE(struct X { int i; };
4092                                struct Y { int i; };,
4093                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4094                                ac_cv_cpp_reinterpret_cast=yes,
4095                                ac_cv_cpp_reinterpret_cast=no)])
4096 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4097    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4100 dnl See if a dynamic_cast to void* gives the most derived object.
4101 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4102                ac_cv_cpp_dynamic_cast_void_ptr,
4103                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4104                             class Y { int j; public: virtual ~Y() { } };
4105                             class Z : public X, public Y { int k; };
4107                             int main() {
4108                                  Z mdo;
4109                                  X *subx = (X*)&mdo;
4110                                  Y *suby = (Y*)&mdo;
4111                                  return !((((void*)&mdo != (void*)subx) &&
4112                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4113                                           (((void*)&mdo != (void*)suby) &&
4114                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4115                             }],
4116                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4117                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4118                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4119 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4120    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4124 dnl note that this one is reversed - if the test fails, then
4125 dnl we require implementations of unused virtual methods. Which
4126 dnl really blows because it means we'll have useless vtable
4127 dnl bloat.
4128 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4129                ac_cv_cpp_unused_required,
4130                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4131                                X x;,
4132                                ac_cv_cpp_unused_required=no,
4133                                ac_cv_cpp_unused_required=yes)])
4134 if test "$ac_cv_cpp_unused_required" = yes ; then
4135    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4139 dnl Some compilers have trouble comparing a constant reference to a templatized
4140 dnl class to zero, and require an explicit operator==() to be defined that takes
4141 dnl an int. This test separates the strong from the weak.
4143 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4144                ac_cv_trouble_comparing_to_zero,
4145                [AC_TRY_COMPILE([#include <algorithm>
4146                                 template <class T> class Foo {};
4147                                 class T2;
4148                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4149                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4150                                [Foo<int> f; return (0 != f);],
4151                                ac_cv_trouble_comparing_to_zero=no,
4152                                ac_cv_trouble_comparing_to_zero=yes)])
4153 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4154   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4159 dnl End of C++ language/feature checks
4160 AC_LANG_C
4162 dnl ========================================================
4163 dnl =  Internationalization checks
4164 dnl ========================================================
4166 dnl Internationalization and Locale support is different
4167 dnl on various UNIX platforms.  Checks for specific i18n
4168 dnl features go here.
4170 dnl check for LC_MESSAGES
4171 AC_CACHE_CHECK(for LC_MESSAGES,
4172                 ac_cv_i18n_lc_messages,
4173                 [AC_TRY_COMPILE([#include <locale.h>],
4174                                 [int category = LC_MESSAGES;],
4175                                 ac_cv_i18n_lc_messages=yes,
4176                                 ac_cv_i18n_lc_messages=no)])
4177 if test "$ac_cv_i18n_lc_messages" = yes; then
4178    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4179 fi      
4181 fi # SKIP_COMPILER_CHECKS
4183 TARGET_XPCOM_ABI=
4184 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4185     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4188 dnl Mozilla specific options
4189 dnl ========================================================
4190 dnl The macros used for command line options
4191 dnl are defined in build/autoconf/altoptions.m4.
4194 dnl ========================================================
4195 dnl =
4196 dnl = Check for external package dependencies
4197 dnl =
4198 dnl ========================================================
4199 MOZ_ARG_HEADER(External Packages)
4201 MOZ_ENABLE_LIBXUL=
4203 MOZ_ARG_WITH_STRING(libxul-sdk,
4204 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4205   LIBXUL_SDK_DIR=$withval)
4207 if test "$LIBXUL_SDK_DIR" = "yes"; then
4208     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4209 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4210     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4212     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4213         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4214     fi
4216     MOZ_ENABLE_LIBXUL=1
4218 AC_SUBST(LIBXUL_SDK)
4220 if test -n "$LIBXUL_SDK"; then
4221     LIBXUL_DIST="$LIBXUL_SDK"
4222 else
4223     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4225 AC_SUBST(LIBXUL_DIST)
4227 SYSTEM_LIBXUL=
4229 MOZ_ARG_WITH_BOOL(system-libxul,
4230 [  --with-system-libxul   Use system installed libxul SDK],
4231     SYSTEM_LIBXUL=1)
4233 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4234     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4237 dnl ========================================================
4238 dnl = If NSPR was not detected in the system, 
4239 dnl = use the one in the source tree (mozilla/nsprpub)
4240 dnl ========================================================
4241 MOZ_ARG_WITH_BOOL(system-nspr,
4242 [  --with-system-nspr      Use system installed NSPR],
4243     _USE_SYSTEM_NSPR=1 )
4245 if test -n "$_USE_SYSTEM_NSPR"; then
4246     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4249 if test -n "$MOZ_NATIVE_NSPR"; then
4250     _SAVE_CFLAGS=$CFLAGS
4251     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4252     AC_TRY_COMPILE([#include "prlog.h"],
4253                 [#ifndef PR_STATIC_ASSERT
4254                  #error PR_STATIC_ASSERT not defined
4255                  #endif],
4256                 [MOZ_NATIVE_NSPR=1],
4257                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4258     CFLAGS=$_SAVE_CFLAGS
4259 else
4260     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4261     if test "$OS_ARCH" = "WINCE"; then
4262         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4263         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4264     elif test "$OS_ARCH" = "WINNT"; then
4265         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4266         if test -n "$GNU_CC"; then
4267             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4268         else
4269             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4270         fi
4271     else
4272         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4273     fi
4276 dnl ========================================================
4277 dnl = If NSS was not detected in the system, 
4278 dnl = use the one in the source tree (mozilla/security/nss)
4279 dnl ========================================================
4281 MOZ_ARG_WITH_BOOL(system-nss,
4282 [  --with-system-nss      Use system installed NSS],
4283     _USE_SYSTEM_NSS=1 )
4285 if test -n "$_USE_SYSTEM_NSS"; then
4286     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4289 if test -n "$MOZ_NATIVE_NSS"; then
4290    NSS_LIBS="$NSS_LIBS -lcrmf"
4291 else
4292    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4293    NSS_DEP_LIBS="\
4294         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4295         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4296         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4297         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4298         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4299         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4301    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4302        NSS_LIBS="\
4303         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4304         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4305         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4306         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4307         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4308         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4309    else
4310        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4311    fi
4314 if test -z "$SKIP_LIBRARY_CHECKS"; then
4315 dnl system JPEG support
4316 dnl ========================================================
4317 MOZ_ARG_WITH_STRING(system-jpeg,
4318 [  --with-system-jpeg[=PFX]
4319                           Use system libjpeg [installed at prefix PFX]],
4320     JPEG_DIR=$withval)
4322 _SAVE_CFLAGS=$CFLAGS
4323 _SAVE_LDFLAGS=$LDFLAGS
4324 _SAVE_LIBS=$LIBS
4325 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4326     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4327     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4329 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4330     SYSTEM_JPEG=
4331 else
4332     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4335 if test "$SYSTEM_JPEG" = 1; then
4336     LIBS="$JPEG_LIBS $LIBS"
4337     AC_TRY_COMPILE([ #include <stdio.h>
4338                      #include <sys/types.h>
4339                      #include <jpeglib.h> ],
4340                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4341                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4342                      #endif ],
4343                    SYSTEM_JPEG=1,
4344                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4345 fi 
4346 CFLAGS=$_SAVE_CFLAGS
4347 LDFLAGS=$_SAVE_LDFLAGS
4348 LIBS=$_SAVE_LIBS
4350 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4351     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4352     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4355 dnl system ZLIB support
4356 dnl ========================================================
4357 MOZ_ARG_WITH_STRING(system-zlib,
4358 [  --with-system-zlib[=PFX]
4359                           Use system libz [installed at prefix PFX]],
4360     ZLIB_DIR=$withval)
4362 _SAVE_CFLAGS=$CFLAGS
4363 _SAVE_LDFLAGS=$LDFLAGS
4364 _SAVE_LIBS=$LIBS
4365 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4366     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4367     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4369 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4370     SYSTEM_ZLIB=
4371 else
4372     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4373         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4375 if test "$SYSTEM_ZLIB" = 1; then
4376     LIBS="$ZLIB_LIBS $LIBS"
4377     AC_TRY_COMPILE([ #include <stdio.h>
4378                      #include <string.h>
4379                      #include <zlib.h> ],
4380                    [ #if ZLIB_VERNUM < $MOZZLIB 
4381                      #error "Insufficient zlib version ($MOZZLIB required)."
4382                      #endif ],
4383                    SYSTEM_ZLIB=1,
4384                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4386 CFLAGS=$_SAVE_CFLAGS
4387 LDFLAGS=$_SAVE_LDFLAGS
4388 LIBS=$_SAVE_LIBS
4390 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4391     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4392     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4395 dnl system BZIP2 Support
4396 dnl ========================================================
4397 MOZ_ARG_WITH_STRING(system-bz2,
4398 [  --with-system-bz2[=PFX]
4399                           Use system libbz2 [installed at prefix PFX]],
4400     BZ2_DIR=$withval)
4402 _SAVE_CFLAGS=$CFLAGS
4403 _SAVE_LDFLAGS=$LDFLAGS
4404 _SAVE_LIBS=$LIBS
4405 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4406     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4407     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4409 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4410     SYSTEM_BZ2=
4411 else
4412     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4413         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4415 CFLAGS=$_SAVE_CFLAGS
4416 LDFLAGS=$_SAVE_LDFLAGS
4417 LIBS=$_SAVE_LIBS
4419 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4420     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4421     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4424 dnl system PNG Support
4425 dnl ========================================================
4426 MOZ_ARG_WITH_STRING(system-png, 
4427 [  --with-system-png[=PFX]
4428                           Use system libpng [installed at prefix PFX]],
4429     PNG_DIR=$withval)
4431 _SAVE_CFLAGS=$CFLAGS
4432 _SAVE_LDFLAGS=$LDFLAGS
4433 _SAVE_LIBS=$LIBS
4434 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4435 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4436 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4437     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4438     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4440 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4441     SYSTEM_PNG=
4442 else
4443     _SAVE_PNG_LIBS=$PNG_LIBS
4444     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4445                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4446                  $PNG_LIBS)
4447     AC_CHECK_LIB(png, png_get_acTL, ,
4448                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4449                  $_SAVE_PNG_LIBS)
4451 if test "$SYSTEM_PNG" = 1; then
4452     LIBS="$PNG_LIBS $LIBS"
4453     AC_TRY_COMPILE([ #include <stdio.h>
4454                      #include <sys/types.h>
4455                      #include <png.h> ],
4456                    [ #if PNG_LIBPNG_VER < $MOZPNG
4457                      #error "Insufficient libpng version ($MOZPNG required)."
4458                      #endif
4459                      #ifndef PNG_UINT_31_MAX
4460                      #error "Insufficient libpng version."
4461                      #endif ],
4462                    SYSTEM_PNG=1,
4463                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4465 CFLAGS=$_SAVE_CFLAGS
4466 LDFLAGS=$_SAVE_LDFLAGS
4467 LIBS=$_SAVE_LIBS
4469 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4470     PNG_CFLAGS="-I${PNG_DIR}/include"
4471     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4474 fi # SKIP_LIBRARY_CHECKS
4476 dnl system HunSpell Support
4477 dnl ========================================================
4478 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4479 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4480     SYSTEM_HUNSPELL=1 )
4482 if test -n "$SYSTEM_HUNSPELL"; then
4483     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4486 AC_SUBST(SYSTEM_HUNSPELL)
4488 dnl ========================================================
4489 dnl Java SDK support
4490 dnl ========================================================
4491 JAVA_INCLUDE_PATH=
4492 MOZ_ARG_WITH_STRING(java-include-path,
4493 [  --with-java-include-path=dir   Location of Java SDK headers],
4494     JAVA_INCLUDE_PATH=$withval)
4496 JAVA_BIN_PATH=
4497 MOZ_ARG_WITH_STRING(java-bin-path,
4498 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4499     JAVA_BIN_PATH=$withval)
4501 dnl ========================================================
4502 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4503 dnl their usage and use them in spidermonkey.
4504 dnl ========================================================
4505 MOZ_ARG_WITH_BOOL(arm-kuser,
4506 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4507     USE_ARM_KUSER=1,
4508     USE_ARM_KUSER=)
4509 if test -n "$USE_ARM_KUSER"; then
4510    AC_DEFINE(USE_ARM_KUSER)
4513 dnl ========================================================
4514 dnl =
4515 dnl = Application
4516 dnl =
4517 dnl ========================================================
4519 MOZ_ARG_HEADER(Application)
4521 BUILD_STATIC_LIBS=
4522 ENABLE_TESTS=1
4523 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4524 MOZ_BRANDING_DIRECTORY=
4525 MOZ_DBGRINFO_MODULES=
4526 MOZ_ENABLE_CANVAS=1
4527 MOZ_FEEDS=1
4528 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4529 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4530 MOZ_JAVAXPCOM=
4531 MOZ_JSDEBUGGER=1
4532 MOZ_JSLOADER=1
4533 MOZ_MATHML=1
4534 MOZ_MORK=1
4535 MOZ_MORKREADER=
4536 MOZ_AUTH_EXTENSION=1
4537 MOZ_NO_ACTIVEX_SUPPORT=1
4538 MOZ_NO_INSPECTOR_APIS=
4539 MOZ_NO_XPCOM_OBSOLETE=
4540 MOZ_NO_FAST_LOAD=
4541 MOZ_OGG=1
4542 MOZ_SYDNEYAUDIO=
4543 MOZ_WAVE=1
4544 MOZ_MEDIA=
4545 MOZ_PERMISSIONS=1
4546 MOZ_PLACES=
4547 MOZ_PLAINTEXT_EDITOR_ONLY=
4548 MOZ_PLUGINS=1
4549 MOZ_PREF_EXTENSIONS=1
4550 MOZ_PROFILELOCKING=1
4551 MOZ_PSM=1
4552 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4553 MOZ_PYTHON=
4554 MOZ_PYTHON_DEBUG_SUFFIX=
4555 MOZ_PYTHON_DLL_SUFFIX=
4556 MOZ_PYTHON_INCLUDES=
4557 MOZ_PYTHON_LIBS=
4558 MOZ_PYTHON_PREFIX=
4559 MOZ_PYTHON_VER=
4560 MOZ_PYTHON_VER_DOTTED=
4561 MOZ_RDF=1
4562 MOZ_REFLOW_PERF=
4563 MOZ_SAFE_BROWSING=
4564 MOZ_HELP_VIEWER=
4565 MOZ_SPELLCHECK=1
4566 MOZ_STATIC_MAIL_BUILD=
4567 MOZ_STORAGE=1
4568 MOZ_SVG=1
4569 MOZ_TIMELINE=
4570 MOZ_UI_LOCALE=en-US
4571 MOZ_UNIVERSALCHARDET=1
4572 MOZ_URL_CLASSIFIER=
4573 MOZ_USE_NATIVE_UCONV=
4574 MOZ_VIEW_SOURCE=1
4575 MOZ_XPFE_COMPONENTS=1
4576 MOZ_XPINSTALL=1
4577 MOZ_XSLT_STANDALONE=
4578 MOZ_XTF=1
4579 MOZ_XUL=1
4580 MOZ_ZIPWRITER=1
4581 NS_PRINTING=1
4582 NECKO_WIFI=1
4583 NECKO_COOKIES=1
4584 NECKO_DISK_CACHE=1
4585 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4586 NECKO_SMALL_BUFFERS=
4587 XPC_IDISPATCH_SUPPORT=
4590 case "$target_os" in
4591 darwin*)
4592     ACCESSIBILITY=
4593     ;;
4595     ACCESSIBILITY=1
4596     ;;
4597 esac
4599 case "$target_os" in
4600     msvc*|mks*|cygwin*|mingw*)
4601         if test -z "$GNU_CC"; then 
4602             XPC_IDISPATCH_SUPPORT=1
4603             MOZ_NO_ACTIVEX_SUPPORT=
4604             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4605         fi
4606         ;;
4607 esac
4609 MOZ_ARG_ENABLE_STRING(application,
4610 [  --enable-application=APP
4611                           Options include:
4612                             browser (Firefox)
4613                             xulrunner
4614                             content/xslt (Standalone Transformiix XSLT)
4615                             netwerk (Standalone Necko)
4616                             tools/update-packaging (AUS-related packaging tools)
4617                             standalone (use this for standalone
4618                               xpcom/xpconnect or to manually drive a build)],
4619 [ MOZ_BUILD_APP=$enableval ] )
4621 MOZ_EMBEDDING_PROFILE=default
4622 MOZ_ARG_WITH_STRING(embedding-profile,
4623 [  --with-embedding-profile=default|basic|minimal
4624                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4625 [ MOZ_EMBEDDING_PROFILE=$withval ])
4627 case "$MOZ_EMBEDDING_PROFILE" in
4628 default)
4629   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4630   MOZ_EMBEDDING_LEVEL_BASIC=1
4631   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4632   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4633   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4634   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4635   ;;
4637 basic)
4638   MOZ_EMBEDDING_LEVEL_DEFAULT=
4639   MOZ_EMBEDDING_LEVEL_BASIC=1
4640   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4641   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4642   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4643   ENABLE_TESTS=
4644   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4645   MOZ_ENABLE_CANVAS=
4646   MOZ_ENABLE_POSTSCRIPT=
4647   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4648   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4649   MOZ_IMG_ENCODERS_DEFAULT=
4650   MOZ_IMG_ENCODERS=
4651   MOZ_INSTALLER=
4652   MOZ_JSDEBUGGER=
4653   MOZ_MATHML=
4654   MOZ_AUTH_EXTENSION=
4655   MOZ_NO_ACTIVEX_SUPPORT=1
4656   MOZ_NO_INSPECTOR_APIS=1
4657   MOZ_NO_XPCOM_OBSOLETE=1
4658   MOZ_NO_FAST_LOAD=1
4659   MOZ_PLAINTEXT_EDITOR_ONLY=1
4660 #  MOZ_PLUGINS=
4661   MOZ_PREF_EXTENSIONS=
4662   MOZ_PROFILELOCKING=
4663   MOZ_SPELLCHECK=
4664   MOZ_SVG=
4665   MOZ_UNIVERSALCHARDET=
4666   MOZ_UPDATER=
4667   MOZ_USE_NATIVE_UCONV=
4668   MOZ_VIEW_SOURCE=
4669   MOZ_XPFE_COMPONENTS=
4670   MOZ_XPINSTALL=
4671   MOZ_XTF=
4672   MOZ_ZIPWRITER=
4673   NECKO_DISK_CACHE=
4674   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4675   NECKO_SMALL_BUFFERS=1
4676   NS_DISABLE_LOGGING=1
4677   NS_PRINTING=
4678   ;;
4680 minimal)
4681   MOZ_EMBEDDING_LEVEL_DEFAULT=
4682   MOZ_EMBEDDING_LEVEL_BASIC=
4683   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4684   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4685   ENABLE_TESTS=
4686   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4687   MOZ_ENABLE_CANVAS=
4688   MOZ_ENABLE_POSTSCRIPT=
4689   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4690   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4691   MOZ_IMG_ENCODERS_DEFAULT=
4692   MOZ_IMG_ENCODERS=
4693   MOZ_INSTALLER=
4694   MOZ_JSDEBUGGER=
4695   MOZ_MATHML=
4696   MOZ_AUTH_EXTENSION=
4697   MOZ_NO_ACTIVEX_SUPPORT=1
4698   MOZ_NO_INSPECTOR_APIS=1
4699   MOZ_NO_XPCOM_OBSOLETE=1
4700   MOZ_NO_FAST_LOAD=1
4701   MOZ_PLAINTEXT_EDITOR_ONLY=1
4702   MOZ_PLUGINS=
4703   MOZ_PREF_EXTENSIONS=
4704   MOZ_PROFILELOCKING=
4705   MOZ_SPELLCHECK=
4706   MOZ_STORAGE=1
4707   MOZ_PLACES=
4708   MOZ_SVG=
4709   MOZ_UNIVERSALCHARDET=
4710   MOZ_UPDATER=
4711   MOZ_USE_NATIVE_UCONV=1
4712   MOZ_VIEW_SOURCE=
4713   MOZ_XPFE_COMPONENTS=
4714   MOZ_XPINSTALL=
4715   MOZ_XTF=
4716   MOZ_XUL=
4717   MOZ_ZIPWRITER=
4718   MOZ_RDF=
4719   NECKO_DISK_CACHE=
4720   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4721   NECKO_SMALL_BUFFERS=1
4722   NS_DISABLE_LOGGING=1
4723   NS_PRINTING=
4724   ;;
4727   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4728   ;;
4729 esac
4731 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4732 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4733 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4735 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4736 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4737   XULRUNNER_STUB_NAME=$withval)
4739 if test -z "$XULRUNNER_STUB_NAME"; then
4740   case "$target_os" in
4741   darwin*)
4742     XULRUNNER_STUB_NAME=xulrunner
4743     ;;
4744   *)
4745     XULRUNNER_STUB_NAME=xulrunner-stub
4746   esac
4748 AC_SUBST(XULRUNNER_STUB_NAME)
4750 if test -z "$MOZ_BUILD_APP"; then
4751   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4752 else
4753   # We have a valid application only if it has a build.mk file in its top
4754   # directory.
4755   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4756     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4757   fi
4760 # Allow the application to influence configure with a confvars.sh script.
4762 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4763 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4764   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4765   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4766 else
4767   AC_MSG_RESULT([no])
4770 # Now is a good time to test for logic errors, define mismatches, etc.
4771 case "$MOZ_BUILD_APP" in
4772 xulrunner)
4773   if test "$LIBXUL_SDK"; then
4774     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4775   fi
4776   ;;
4777 esac
4779 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4780 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4781 # MOZ_BUILD_APP.
4782 case "$MOZ_BUILD_APP" in
4783 browser)
4784   AC_DEFINE(MOZ_PHOENIX)
4785   ;;
4787 xulrunner)
4788   AC_DEFINE(MOZ_XULRUNNER)
4789   ;;
4791 content/xslt)
4792   AC_DEFINE(TX_EXE)
4793   ;;
4795 standalone) 
4796   MOZ_APP_NAME=mozilla
4797   MOZ_APP_DISPLAYNAME=Mozilla
4798   MOZ_APP_VERSION=$MOZILLA_VERSION
4799   ;;
4801 esac
4803 AC_SUBST(MOZ_BUILD_APP)
4804 AC_SUBST(MOZ_PHOENIX)
4805 AC_SUBST(MOZ_XULRUNNER)
4807 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4809 dnl ========================================================
4810 dnl = 
4811 dnl = Toolkit Options
4812 dnl = 
4813 dnl ========================================================
4814 MOZ_ARG_HEADER(Toolkit Options)
4816     dnl ========================================================
4817     dnl = Select the default toolkit
4818     dnl ========================================================
4819         MOZ_ARG_ENABLE_STRING(default-toolkit,
4820         [  --enable-default-toolkit=TK
4821                           Select default toolkit
4822                           Platform specific defaults:
4823                             BeOS - cairo-beos
4824                             Mac OS X - cairo-cocoa
4825                             Neutrino/QNX - photon
4826                             OS/2 - cairo-os2
4827                             Win32 - cairo-windows
4828                             WinCE - windows
4829                             Gtk2 with DirectFB - cairo-gtk2-dfb
4830                             * - cairo-gtk2
4831                             * - cairo-qt],
4832     [ _DEFAULT_TOOLKIT=$enableval ],
4833     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4835     if test "$_DEFAULT_TOOLKIT" = "photon" \
4836         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4837         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4838         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4839         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4840         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4841         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4842         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4843         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4844     then
4845         dnl nglayout only supports building with one toolkit,
4846         dnl so ignore everything after the first comma (",").
4847         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4848     else
4849         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4850     fi
4852 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4854 dnl ========================================================
4855 dnl = Enable the toolkit as needed                         =
4856 dnl ========================================================
4858 case "$MOZ_WIDGET_TOOLKIT" in
4859 photon)
4860         MOZ_ENABLE_PHOTON=1
4861         AC_DEFINE(MOZ_WIDGET_PHOTON)
4862     ;;
4864 cairo-windows)
4865     MOZ_WIDGET_TOOLKIT=windows
4866     MOZ_GFX_TOOLKIT=cairo
4867     ;;
4869 cairo-gtk2|cairo-gtk2-x11)
4870     MOZ_WIDGET_TOOLKIT=gtk2
4871     MOZ_GFX_TOOLKIT=cairo
4872     MOZ_ENABLE_GTK2=1
4873     MOZ_ENABLE_XREMOTE=1
4875     AC_DEFINE(MOZ_X11)
4876     MOZ_X11=1
4878     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4879     TK_LIBS='$(MOZ_GTK2_LIBS)'
4880     AC_DEFINE(MOZ_WIDGET_GTK2)
4881     ;;
4883 cairo-gtk2-dfb)
4884     MOZ_WIDGET_TOOLKIT=gtk2
4885     MOZ_GFX_TOOLKIT=cairo
4886     MOZ_ENABLE_GTK2=1
4888     AC_DEFINE(MOZ_DFB)
4889     MOZ_DFB=1
4891     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4892     TK_LIBS='$(MOZ_GTK2_LIBS)'
4893     AC_DEFINE(MOZ_WIDGET_GTK2)
4894     if test "$no_x" != "yes"; then
4895         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4896         no_x=yes
4897     fi
4898     ;;
4900 cairo-qt)
4901     MOZ_WIDGET_TOOLKIT=qt
4902     MOZ_GFX_TOOLKIT=cairo
4903     MOZ_ENABLE_QT=1
4904     MOZ_ENABLE_XREMOTE=1
4905     USE_ELF_DYNSTR_GC=
4906     NS_PRINTING=
4908     AC_DEFINE(MOZ_X11)
4909     MOZ_X11=1
4911     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4912     TK_LIBS='$(MOZ_QT_LIBS)'
4913     AC_DEFINE(MOZ_WIDGET_QT)
4914     ;;
4916 cairo-beos)
4917     MOZ_WIDGET_TOOLKIT=beos
4918     MOZ_GFX_TOOLKIT=cairo
4919     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4920     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4921     ;;
4923 cairo-os2)
4924     MOZ_WIDGET_TOOLKIT=os2
4925     MOZ_GFX_TOOLKIT=cairo
4926     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4927     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4928     ;;
4930 cairo-cocoa)
4931     MOZ_WIDGET_TOOLKIT=cocoa
4932     AC_DEFINE(MOZ_WIDGET_COCOA)
4933     MOZ_ENABLE_COCOA=1
4934     MOZ_GFX_TOOLKIT=cairo
4935     MOZ_USER_DIR="Mozilla"
4936     AC_DEFINE(XP_MACOSX)
4937     AC_DEFINE(TARGET_CARBON)
4938     AC_DEFINE(TARGET_API_MAC_CARBON)
4939     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4940     TK_CFLAGS="-DNO_X11"
4941     LDFLAGS="$LDFLAGS -framework Cocoa"
4942     CFLAGS="$CFLAGS $TK_CFLAGS"
4943     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4944     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
4945     MOZ_FS_LAYOUT=bundle
4946     ;;
4947 esac
4949 if test "$MOZ_ENABLE_XREMOTE"; then
4950     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4953 if test "$COMPILE_ENVIRONMENT"; then
4954   if test "$MOZ_ENABLE_GTK2"; then
4955     if test "$MOZ_X11"; then
4956       GDK_PACKAGES=gdk-x11-2.0
4957     elif test "$MOZ_DFB"; then
4958       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4959       GDK_PACKAGES=directfb
4960     fi
4962     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4963   fi
4965 fi # COMPILE_ENVIRONMENT
4967 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4968 AC_SUBST(MOZ_FS_LAYOUT)
4970 dnl ========================================================
4971 dnl = startup-notification support module
4972 dnl ========================================================
4974 if test "$MOZ_ENABLE_GTK2"
4975 then
4976     MOZ_ENABLE_STARTUP_NOTIFICATION=
4978     MOZ_ARG_ENABLE_BOOL(startup-notification,
4979     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4980         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4981         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4982     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4983     then
4984         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4985                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4986         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4987             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4988             then
4989                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4990             fi
4991             MOZ_ENABLE_STARTUP_NOTIFICATION=
4992         ])
4993     fi
4995     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4996         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4997     fi
4999     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5001 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5002 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5003 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5005 dnl ========================================================
5006 dnl = QT support
5007 dnl ========================================================
5008 if test "$MOZ_ENABLE_QT"
5009 then
5010     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
5011     AC_SUBST(MOZ_QT_CFLAGS)
5012     AC_SUBST(MOZ_QT_LIBS)
5014     MOZ_ARG_WITH_STRING(qtdir,
5015     [  --with-qtdir=\$dir       Specify Qt directory ],
5016     [ QTDIR=$withval])
5018     if test -z "$QTDIR"; then
5019       QTDIR="/usr"
5020     fi
5021     QTINCDIR="/include/qt"
5022     if test ! -d "$QTDIR$QTINCDIR"; then
5023        QTINCDIR="/include/X11/qt"
5024     fi
5025     if test ! -d "$QTDIR$QTINCDIR"; then
5026        QTINCDIR="/include"
5027     fi
5029     if test -x "$QTDIR/bin/moc-qt4"; then
5030       HOST_MOC="$QTDIR/bin/moc-qt4"
5031     else
5032       if test -x "$QTDIR/bin/moc"; then
5033         HOST_MOC="$QTDIR/bin/moc"
5034       else
5035         AC_CHECK_PROGS(HOST_MOC, moc, "")
5036       fi
5037     fi
5038     if test -z "$HOST_MOC"; then
5039       AC_MSG_ERROR([no acceptable moc preprocessor found])
5040     fi
5041     MOC=$HOST_MOC
5044 AC_SUBST(GTK_CONFIG)
5045 AC_SUBST(TK_CFLAGS)
5046 AC_SUBST(TK_LIBS)
5048 AC_SUBST(MOZ_ENABLE_GTK2)
5049 AC_SUBST(MOZ_ENABLE_PHOTON)
5050 AC_SUBST(MOZ_ENABLE_COCOA)
5051 AC_SUBST(MOZ_ENABLE_QT)
5052 AC_SUBST(MOZ_ENABLE_XREMOTE)
5053 AC_SUBST(MOZ_GTK2_CFLAGS)
5054 AC_SUBST(MOZ_GTK2_LIBS)
5055 AC_SUBST(MOZ_QT_CFLAGS)
5056 AC_SUBST(MOZ_QT_LIBS)
5058 AC_SUBST(MOC)
5060 AC_SUBST(MOZ_DFB)
5061 AC_SUBST(MOZ_X11)
5063 dnl ========================================================
5064 dnl =
5065 dnl = Components & Features
5066 dnl = 
5067 dnl ========================================================
5068 MOZ_ARG_HEADER(Components and Features)
5070 dnl ========================================================
5071 dnl = Localization
5072 dnl ========================================================
5073 MOZ_ARG_ENABLE_STRING(ui-locale,
5074 [  --enable-ui-locale=ab-CD
5075                           Select the user interface locale (default: en-US)],
5076     MOZ_UI_LOCALE=$enableval )
5077 AC_SUBST(MOZ_UI_LOCALE)
5079 dnl ========================================================
5080 dnl = Trademarked Branding 
5081 dnl ========================================================
5082 MOZ_ARG_ENABLE_BOOL(official-branding,
5083 [  --enable-official-branding Enable Official mozilla.org Branding
5084                           Do not distribute builds with
5085                           --enable-official-branding unless you have
5086                           permission to use trademarks per
5087                           http://www.mozilla.org/foundation/trademarks/ .],
5088 [case "$MOZ_BUILD_APP" in
5089 browser)
5090     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
5091     MOZ_APP_DISPLAYNAME=Firefox
5092     ;;
5095     AC_MSG_ERROR([Official branding is only available for Firefox.])
5096 esac
5099 MOZ_ARG_WITH_STRING(branding,
5100 [  --with-branding=dir    Use branding from the specified directory.],
5101     MOZ_BRANDING_DIRECTORY=$withval)
5103 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5104 if test -z "$REAL_BRANDING_DIRECTORY"; then
5105   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5108 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5109   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
5112 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5114 dnl ========================================================
5115 dnl = Distribution ID
5116 dnl ========================================================
5117 MOZ_ARG_WITH_STRING(distribution-id,
5118 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
5119 [ val=`echo $withval`
5120     MOZ_DISTRIBUTION_ID="$val"])
5122 if test -z "$MOZ_DISTRIBUTION_ID"; then
5123    MOZ_DISTRIBUTION_ID="org.mozilla"
5126 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5127 AC_SUBST(MOZ_DISTRIBUTION_ID)
5130 dnl ========================================================
5131 dnl complex text support off by default
5132 dnl ========================================================
5133 MOZ_PANGO=1
5134 MOZ_ARG_DISABLE_BOOL(pango,
5135 [  --disable-pango Disable usage of Pango ],
5136     MOZ_PANGO=,
5137     MOZ_PANGO=1)
5140 dnl ========================================================
5141 dnl = Pango
5142 dnl ========================================================
5143 if test "$MOZ_ENABLE_GTK2"
5144 then
5145     AC_SUBST(MOZ_PANGO)
5147     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5149     if test "$MOZ_PANGO"
5150     then
5151         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5152         AC_SUBST(MOZ_PANGO_CFLAGS)
5153         AC_SUBST(MOZ_PANGO_LIBS)
5154         AC_DEFINE(MOZ_PANGO)
5155     else
5156         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5157         AC_SUBST(MOZ_PANGO_CFLAGS)
5158         AC_SUBST(MOZ_PANGO_LIBS)
5160         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5161         AC_SUBST(FT2_CFLAGS)
5162         AC_SUBST(FT2_LIBS)
5163     fi
5166 dnl ========================================================
5167 dnl = PostScript print module
5168 dnl ========================================================
5169 MOZ_ARG_DISABLE_BOOL(postscript,
5170 [  --disable-postscript    Disable PostScript printing support ],
5171     MOZ_ENABLE_POSTSCRIPT=,
5172     MOZ_ENABLE_POSTSCRIPT=1 )
5174 dnl ========================================================
5175 dnl = GnomeVFS support module
5176 dnl ========================================================
5178 if test "$MOZ_X11"
5179 then
5180     dnl build the gnomevfs extension by default only when the
5181     dnl GTK2 toolkit is in use.
5182     if test "$MOZ_ENABLE_GTK2"
5183     then
5184         MOZ_ENABLE_GNOMEVFS=1
5185         MOZ_ENABLE_GCONF=1
5186     fi
5188     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5189     [  --disable-gnomevfs      Disable GnomeVFS support ],
5190         MOZ_ENABLE_GNOMEVFS=,
5191         MOZ_ENABLE_GNOMEVFS=force)
5193     if test "$MOZ_ENABLE_GNOMEVFS"
5194     then
5195         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5196             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5197             MOZ_ENABLE_GNOMEVFS=1
5198         ],[
5199             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5200             then
5201                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5202             fi
5203             MOZ_ENABLE_GNOMEVFS=
5204         ])
5205     fi
5207     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5208     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5209     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5211     if test "$MOZ_ENABLE_GCONF"
5212     then
5213         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5214             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5215             MOZ_ENABLE_GCONF=1
5216         ],[
5217             MOZ_ENABLE_GCONF=
5218         ])
5219     fi
5221     if test "$MOZ_ENABLE_GCONF"; then
5222         AC_DEFINE(MOZ_ENABLE_GCONF)
5223     fi
5225     AC_SUBST(MOZ_ENABLE_GCONF)
5226     AC_SUBST(MOZ_GCONF_CFLAGS)
5227     AC_SUBST(MOZ_GCONF_LIBS)
5229     # The GNOME component is built if gtk2, gconf and gnome-vfs
5230     # are all available.
5232     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5233             "$MOZ_ENABLE_GNOMEVFS"; then
5234       MOZ_ENABLE_GNOME_COMPONENT=1
5235     else
5236       MOZ_ENABLE_GNOME_COMPONENT=
5237     fi
5239     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5242 dnl ========================================================
5243 dnl = libgnomeui support module
5244 dnl ========================================================
5246 if test "$MOZ_ENABLE_GTK2"
5247 then
5248     MOZ_ENABLE_GNOMEUI=1
5250     MOZ_ARG_DISABLE_BOOL(gnomeui,
5251     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5252         MOZ_ENABLE_GNOMEUI=,
5253         MOZ_ENABLE_GNOMEUI=force)
5255     if test "$MOZ_ENABLE_GNOMEUI"
5256     then
5257         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5258         [
5259             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5260             MOZ_ENABLE_GNOMEUI=1
5261         ],[
5262             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5263             then
5264                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5265             fi
5266             MOZ_ENABLE_GNOMEUI=
5267         ])
5268     fi
5270     if test "$MOZ_ENABLE_GNOMEUI"; then
5271         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5272     fi
5274 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5275 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5276 AC_SUBST(MOZ_GNOMEUI_LIBS)
5278 dnl ========================================================
5279 dnl = dbus support
5280 dnl ========================================================
5282 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5283 then
5284     MOZ_ENABLE_DBUS=1
5286     MOZ_ARG_DISABLE_BOOL(dbus,
5287     [  --disable-dbus       Disable dbus support ],
5288         MOZ_ENABLE_DBUS=,
5289         MOZ_ENABLE_DBUS=1)
5291     if test "$MOZ_ENABLE_DBUS"
5292     then
5293         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5294         AC_DEFINE(MOZ_ENABLE_DBUS)
5295     fi
5297 AC_SUBST(MOZ_ENABLE_DBUS)
5298 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5299 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5301 dnl ========================================================
5302 dnl = libnotify support
5303 dnl ========================================================
5305 if test "$MOZ_ENABLE_GTK2"
5306 then
5307     MOZ_ENABLE_LIBNOTIFY=1
5309     MOZ_ARG_DISABLE_BOOL(libnotify,
5310     [  --disable-libnotify       Disable libnotify support ],
5311     MOZ_ENABLE_LIBNOTIFY=,
5312     MOZ_ENABLE_LIBNOTIFY=1)
5314     if test "$MOZ_ENABLE_LIBNOTIFY"
5315     then
5316         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5317     fi
5320 if test -z "$SKIP_LIBRARY_CHECKS"
5321 then
5322     if test "$MOZ_ENABLE_GTK2"
5323     then
5324         if test "$MOZ_ENABLE_LIBNOTIFY"
5325         then
5326             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5327         fi
5328     fi
5330 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5331 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5332 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5334 dnl ========================================================
5335 dnl = Build Personal Security Manager
5336 dnl ========================================================
5337 MOZ_ARG_DISABLE_BOOL(crypto,
5338 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5339     MOZ_PSM=,
5340     MOZ_PSM=1 )
5342 dnl ========================================================
5343 dnl = JS Debugger XPCOM component (js/jsd)
5344 dnl ========================================================
5345 MOZ_ARG_DISABLE_BOOL(jsd,
5346 [  --disable-jsd           Disable JavaScript debug library],
5347     MOZ_JSDEBUGGER=,
5348     MOZ_JSDEBUGGER=1)
5351 dnl ========================================================
5352 dnl = Disable plugin support
5353 dnl ========================================================
5354 MOZ_ARG_DISABLE_BOOL(plugins,
5355 [  --disable-plugins       Disable plugins support],
5356     MOZ_PLUGINS=,
5357     MOZ_PLUGINS=1)
5359 dnl ========================================================
5360 dnl = Disable building dbm
5361 dnl ========================================================
5362 MOZ_ARG_DISABLE_BOOL(dbm,
5363 [  --disable-dbm       Disable building dbm],
5364     NSS_DISABLE_DBM=1,
5365     NSS_DISABLE_DBM=)
5367 dnl bi-directional support always on
5368 IBMBIDI=1
5369 AC_DEFINE(IBMBIDI)
5371 dnl ========================================================
5372 dnl view source support on by default
5373 dnl ========================================================
5374 MOZ_ARG_DISABLE_BOOL(view-source,
5375 [  --disable-view-source     Disable view source support],
5376     MOZ_VIEW_SOURCE=,
5377     MOZ_VIEW_SOURCE=1 )
5378 if test "$MOZ_VIEW_SOURCE"; then
5379     AC_DEFINE(MOZ_VIEW_SOURCE)
5383 dnl ========================================================
5384 dnl accessibility support on by default on all platforms 
5385 dnl except OS X.
5386 dnl ========================================================
5387 MOZ_ARG_DISABLE_BOOL(accessibility,
5388 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5389     ACCESSIBILITY=,
5390     ACCESSIBILITY=1 )
5391 if test "$ACCESSIBILITY"; then
5392     AC_DEFINE(ACCESSIBILITY)
5395 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5396 case "$target" in
5397 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5398     if test "$ac_cv_header_atlbase_h" = "no"; then
5399         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.])
5400     fi
5401     if test "$ac_cv_header_oleacc_idl" = "no"; then
5402         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.])
5403     fi
5404     ;;
5405 esac
5408 dnl ========================================================
5409 dnl xpfe/components on by default
5410 dnl ========================================================
5411 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5412 [  --disable-xpfe-components
5413                           Disable xpfe components],
5414     MOZ_XPFE_COMPONENTS=,
5415     MOZ_XPFE_COMPONENTS=1 )
5417 dnl ========================================================
5418 dnl xpinstall support on by default
5419 dnl ========================================================
5420 MOZ_ARG_DISABLE_BOOL(xpinstall,
5421 [  --disable-xpinstall     Disable xpinstall support],
5422     MOZ_XPINSTALL=,
5423     MOZ_XPINSTALL=1 )
5424 if test "$MOZ_XPINSTALL"; then
5425     AC_DEFINE(MOZ_XPINSTALL)
5428 dnl ========================================================
5429 dnl xpcom js loader support on by default
5430 dnl ========================================================
5431 MOZ_ARG_DISABLE_BOOL(jsloader,
5432 [  --disable-jsloader      Disable xpcom js loader support],
5433     MOZ_JSLOADER=,
5434     MOZ_JSLOADER=1 )
5435 if test "$MOZ_JSLOADER"; then
5436     AC_DEFINE(MOZ_JSLOADER)
5439 dnl ========================================================
5440 dnl Disable printing
5441 dnl ========================================================
5442 MOZ_ARG_DISABLE_BOOL(printing,
5443 [  --disable-printing  Disable printing support],
5444     NS_PRINTING=,
5445     NS_PRINTING=1 )
5447 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5448     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5449     NS_PRINTING=
5452 if test "$NS_PRINTING"; then
5453     AC_DEFINE(NS_PRINTING)
5454     AC_DEFINE(NS_PRINT_PREVIEW)
5457 dnl ========================================================
5458 dnl use native unicode converters
5459 dnl ========================================================
5460 MOZ_ARG_ENABLE_BOOL(native-uconv,
5461 [  --enable-native-uconv   Enable iconv support],
5462     MOZ_USE_NATIVE_UCONV=1,
5463     MOZ_USE_NATIVE_UCONV= )
5464 if test "$MOZ_USE_NATIVE_UCONV"; then
5465     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5467 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5468     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5472 dnl ========================================================
5473 dnl Libeditor can be build as plaintext-only,
5474 dnl or as a full html and text editing component.
5475 dnl We build both by default.
5476 dnl ========================================================
5477 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5478 [  --enable-plaintext-editor-only
5479                           Allow only plaintext editing],
5480     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5481     MOZ_PLAINTEXT_EDITOR_ONLY= )
5482 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5483 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5485 dnl ========================================================
5486 dnl = Drop XPCOM Obsolete library
5487 dnl ========================================================
5488 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5489 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5490     MOZ_NO_XPCOM_OBSOLETE=1,
5491     MOZ_NO_XPCOM_OBSOLETE=)
5493 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5494     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5497 dnl ========================================================
5498 dnl = Disable Fast Load
5499 dnl ========================================================
5500 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5501 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5502     MOZ_NO_FAST_LOAD=1,
5503     MOZ_NO_FAST_LOAD=)
5505 AC_SUBST(MOZ_NO_FAST_LOAD)
5507 if test -n "$MOZ_NO_FAST_LOAD"; then
5508     AC_DEFINE(MOZ_NO_FAST_LOAD)
5511 dnl ========================================================
5512 dnl = Disable Ogg Codecs
5513 dnl ========================================================
5514 MOZ_ARG_DISABLE_BOOL(ogg,
5515 [  --disable-ogg           Disable Ogg Codec support],
5516     MOZ_OGG=,
5517     MOZ_OGG=1)
5519 AC_SUBST(MOZ_OGG)
5521 if test -n "$MOZ_OGG"; then
5522     AC_DEFINE(MOZ_OGG)
5523     MOZ_SYDNEYAUDIO=1
5524     MOZ_MEDIA=1
5526     dnl Checks for __attribute__(aligned()) directive
5527     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5528         [ac_cv_c_attribute_aligned],
5529         [ac_cv_c_attribute_aligned=0
5530          CFLAGS_save="${CFLAGS}"
5531          CFLAGS="${CFLAGS} -Werror"
5532          for ac_cv_c_attr_align_try in 64 32 16 8; do
5533            echo "trying $ac_cv_c_attr_align_try"
5534            AC_TRY_COMPILE([],
5535                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5536                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5537            if test "$ac_cv_c_attribute_aligned" != 0; then
5538              break;
5539            fi
5540          done
5541            CFLAGS="${CFLAGS_save}"])
5542     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5543       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5544                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5545     fi
5548 dnl ========================================================
5549 dnl = Disable Wave decoder support
5550 dnl ========================================================
5551 MOZ_ARG_DISABLE_BOOL(wave,
5552 [  --disable-wave          Disable Wave decoder support],
5553     MOZ_WAVE=,
5554     MOZ_WAVE=1)
5556 AC_SUBST(MOZ_WAVE)
5558 if test -n "$MOZ_WAVE"; then
5559     AC_DEFINE(MOZ_WAVE)
5560     MOZ_SYDNEYAUDIO=1
5561     MOZ_MEDIA=1
5564 dnl ========================================================
5565 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5566 dnl ========================================================
5568 AC_SUBST(MOZ_SYDNEYAUDIO)
5570 if test -n "$MOZ_SYDNEYAUDIO"; then
5571     AC_DEFINE(MOZ_SYDNEYAUDIO)
5574 AC_SUBST(MOZ_MEDIA)
5576 if test -n "$MOZ_MEDIA"; then
5577     AC_DEFINE(MOZ_MEDIA)
5580 dnl ========================================================
5581 dnl = Check alsa availability on Linux if using sydneyaudio
5582 dnl ========================================================
5584 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5585 if test "$COMPILE_ENVIRONMENT"; then
5586 if test -n "$MOZ_SYDNEYAUDIO"; then
5587    case "$target_os" in
5588 linux*)
5589       AC_CHECK_LIB(asound, snd_pcm_open,,AC_MSG_ERROR([Ogg support on Linux requires the alsa library]))
5590       ;;
5591    esac
5595 dnl ========================================================
5596 dnl Permissions System
5597 dnl ========================================================
5598 MOZ_ARG_DISABLE_BOOL(permissions,
5599 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5600     MOZ_PERMISSIONS=,
5601     MOZ_PERMISSIONS=1
5604 dnl ========================================================
5605 dnl NegotiateAuth
5606 dnl ========================================================
5607 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5608 [  --disable-negotiateauth Disable GSS-API negotiation ],
5609     MOZ_AUTH_EXTENSION=,
5610     MOZ_AUTH_EXTENSION=1 )
5612 dnl ========================================================
5613 dnl XTF
5614 dnl ========================================================
5615 MOZ_ARG_DISABLE_BOOL(xtf,
5616 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5617     MOZ_XTF=,
5618     MOZ_XTF=1 )
5619 if test "$MOZ_XTF"; then
5620   AC_DEFINE(MOZ_XTF)
5623 dnl ========================================================
5624 dnl Inspector APIs
5625 dnl ========================================================
5626 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5627 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5628     MOZ_NO_INSPECTOR_APIS=1,
5629     MOZ_NO_INSPECTOR_APIS= )
5631 dnl ========================================================
5632 dnl Pref extensions (autoconfig and system-pref)
5633 dnl ========================================================
5634 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5635 [  --disable-pref-extensions
5636                           Disable pref extensions such as autoconfig and
5637                           system-pref],
5638   MOZ_PREF_EXTENSIONS=,
5639   MOZ_PREF_EXTENSIONS=1 )
5641 dnl ========================================================
5642 dnl = Universalchardet
5643 dnl ========================================================
5644 MOZ_ARG_DISABLE_BOOL(universalchardet,
5645 [  --disable-universalchardet
5646                           Disable universal encoding detection],
5647   MOZ_UNIVERSALCHARDET=,
5648   MOZ_UNIVERSALCHARDET=1 )
5650 dnl ========================================================
5651 dnl JavaXPCOM
5652 dnl ========================================================
5653 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5654 [  --enable-javaxpcom
5655                           Enable Java-XPCOM bridge],
5656     MOZ_JAVAXPCOM=1,
5657     MOZ_JAVAXPCOM= )
5659 if test -n "${MOZ_JAVAXPCOM}"; then
5660   case "$host_os" in
5661     cygwin*|msvc*|mks*)
5662       if test -n "$JAVA_HOME"; then
5663         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5664       fi
5665       ;;
5666     *mingw*)
5667       if test -n "$JAVA_HOME"; then
5668         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5669       fi
5670       ;;
5671   esac
5673   if test -n "${JAVA_INCLUDE_PATH}"; then
5674     dnl Make sure jni.h exists in the given include path.
5675     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5676       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5677     fi
5678   else
5679     case "$target_os" in
5680       darwin*)
5681         dnl Default to java system location
5682         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5683         ;;
5684       *)
5685         dnl Try $JAVA_HOME
5686         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5687         ;;
5688     esac
5689     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5690       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.])
5691     fi
5692   fi
5694   if test -n "${JAVA_BIN_PATH}"; then
5695     dnl Look for javac and jar in the specified path.
5696     JAVA_PATH="$JAVA_BIN_PATH"
5697   else
5698     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5699     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5700   fi
5702   MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5703   MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5704   MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5705   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5706     AC_MSG_ERROR([The programs java, javac and jar were not found.  Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
5707   fi
5710 dnl ========================================================
5711 dnl = Breakpad crash reporting (on by default on supported platforms)
5712 dnl ========================================================
5714 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5715     || test "$OS_ARCH" = "Darwin" \
5716     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5717     || test "$OS_ARCH" = "SunOS") \
5718    && test -z "$HAVE_64BIT_OS"; then
5719    MOZ_CRASHREPORTER=1
5722 MOZ_ARG_DISABLE_BOOL(crashreporter,
5723 [  --disable-crashreporter          Disable breakpad crash reporting],
5724     MOZ_CRASHREPORTER=,
5725     MOZ_CRASHREPORTER=1)
5727 if test -n "$MOZ_CRASHREPORTER"; then
5728    AC_DEFINE(MOZ_CRASHREPORTER)
5730   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5731     test -z "$SKIP_LIBRARY_CHECKS"; then
5732     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5733     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5734     AC_SUBST(MOZ_GTHREAD_LIBS)
5736     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.])])
5737   fi
5740 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5741 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5742 [ val=`echo $withval | sed 's/[^0-9]//g'`
5743     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5745 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5746    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5748 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5750 dnl ========================================================
5751 dnl = Enable compilation of specific extension modules
5752 dnl ========================================================
5754 MOZ_ARG_ENABLE_STRING(extensions,
5755 [  --enable-extensions     Enable extensions],
5756 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5757     if test "$option" = "yes" || test "$option" = "all"; then
5758         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5759     elif test "$option" = "no" || test "$option" = "none"; then
5760         MOZ_EXTENSIONS=""
5761     elif test "$option" = "default"; then
5762         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5763     elif test `echo "$option" | grep -c \^-` != 0; then
5764         option=`echo $option | sed 's/^-//'`
5765         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5766     else
5767         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5768     fi
5769 done],
5770     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5772 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5773     # Suppress warning on non-X11 platforms
5774     if test -n "$MOZ_X11"; then
5775         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5776     fi
5777     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5780 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5781     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5782     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5785 dnl This might be temporary: build tridentprofile only on Windows
5786 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5787     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5788     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5791 dnl cookie must be built before tridentprofile. put it at list's end.
5792 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5793   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5794   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5797 dnl xforms requires xtf and schema-validation
5798 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5799     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5800     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5802 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5803     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5804     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5807 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5808     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5809     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5812 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5813     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5814     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5817 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5818     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5819     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5822 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5823     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5824     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5827 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5828     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5829     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5832 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5833     AC_MSG_WARN([spellcheck is no longer an extension.])
5834     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5837 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5838     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5839     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5842 dnl Remove dupes
5843 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5845 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5846 dnl when trying to build a non-existent extension.
5847 for extension in $MOZ_EXTENSIONS; do
5848     if test ! -d "${srcdir}/extensions/${extension}"; then
5849         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5850     fi
5851 done
5854 dnl ========================================================
5855 dnl Image decoders
5856 dnl ========================================================
5857 case "$MOZ_WIDGET_TOOLKIT" in
5858 beos|windows|os2|mac|cocoa)
5859     ;;
5861     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
5862        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
5863     fi
5864     ;;
5865 esac
5867 MOZ_ARG_ENABLE_STRING(image-decoders,
5868 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5869                           Enable specific image decoders],
5870 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5871     if test "$option" = "yes" || test "$option" = "all"; then
5872         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5873     elif test "$option" = "no" || test "$option" = "none"; then
5874         MOZ_IMG_DECODERS=""
5875     elif test "$option" = "default"; then
5876         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5877     elif test `echo "$option" | grep -c \^-` != 0; then
5878         option=`echo $option | sed 's/^-//'`
5879         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5880     else
5881         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5882     fi
5883 done],
5884     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5886 dnl Dupes are removed in the encoder section because it will also add decoders
5888 dnl ========================================================
5889 dnl Image encoders
5890 dnl ========================================================
5891 MOZ_ARG_ENABLE_STRING(image-encoders,
5892 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5893                           Enable specific image encoders],
5894 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5895     if test "$option" = "yes" || test "$option" = "all"; then
5896         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5897     elif test "$option" = "no" || test "$option" = "none"; then
5898         MOZ_IMG_ENCODERS=""
5899         addencoder=""
5900     elif test "$option" = "default"; then
5901         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5902     elif test `echo "$option" | grep -c \^-` != 0; then
5903         option=`echo $option | sed 's/^-//'`
5904         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5905     else
5906         addencoder="$option"
5907     fi
5908     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5909 done],
5910     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5912 dnl Remove dupes
5913 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5914 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5916 dnl ========================================================
5917 dnl MathML on by default
5918 dnl ========================================================
5919 MOZ_ARG_DISABLE_BOOL(mathml,
5920 [  --disable-mathml        Disable MathML support],
5921     MOZ_MATHML=,
5922     MOZ_MATHML=1 )
5923 if test "$MOZ_MATHML"; then
5924   AC_DEFINE(MOZ_MATHML)
5927 dnl ========================================================
5928 dnl Canvas
5929 dnl ========================================================
5930 MOZ_ARG_DISABLE_BOOL(canvas,
5931 [  --disable-canvas          Disable html:canvas feature],
5932     MOZ_ENABLE_CANVAS=,
5933     MOZ_ENABLE_CANVAS=1 )
5934 if test -n "$MOZ_ENABLE_CANVAS"; then
5935     AC_DEFINE(MOZ_ENABLE_CANVAS)
5937 AC_SUBST(MOZ_ENABLE_CANVAS)
5939 dnl ========================================================
5940 dnl SVG
5941 dnl ========================================================
5942 MOZ_ARG_DISABLE_BOOL(svg,
5943 [  --disable-svg            Disable SVG support],
5944     MOZ_SVG=,
5945     MOZ_SVG=1 )
5946 if test -n "$MOZ_SVG"; then
5947   AC_DEFINE(MOZ_SVG)
5950 dnl ========================================================
5951 dnl SMIL
5952 dnl ========================================================
5953 MOZ_SMIL=1
5954 MOZ_ARG_DISABLE_BOOL(smil,
5955 [  --disable-smil           Disable SMIL animation support],
5956     MOZ_SMIL=,
5957     MOZ_SMIL=1 )
5958 # Automatically disable SMIL if SVG is disabled
5959 if test -z "$MOZ_SVG"; then
5960   MOZ_SMIL=
5962 if test -n "$MOZ_SMIL"; then
5963   AC_DEFINE(MOZ_SMIL)
5966 dnl ========================================================
5967 dnl Build Freetype in the tree
5968 dnl ========================================================
5969 MOZ_ARG_ENABLE_BOOL(tree-freetype,
5970 [  --enable-tree-freetype         Enable Tree FreeType],
5971     MOZ_TREE_FREETYPE=1,
5972     MOZ_TREE_FREETYPE= )
5973 if test -n "$MOZ_TREE_FREETYPE"; then
5974    AC_DEFINE(MOZ_TREE_FREETYPE)
5975    AC_SUBST(MOZ_TREE_FREETYPE)
5976    MOZ_ENABLE_CAIRO_FT=1       
5977    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
5978    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5979    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5980    FT2_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
5981    CAIRO_FT_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
5982    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
5983    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
5984    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
5985    AC_SUBST(CAIRO_FT_CFLAGS)
5989 dnl ========================================================
5990 dnl Installer
5991 dnl ========================================================
5992 case "$target_os" in
5993     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5994         MOZ_INSTALLER=1
5995         ;;
5996 esac
5998 MOZ_ARG_DISABLE_BOOL(installer,
5999 [  --disable-installer     Disable building of installer],
6000     MOZ_INSTALLER=,
6001     MOZ_INSTALLER=1 )
6002 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6003     # Disable installer for Windows builds that use the new toolkit if NSIS
6004     # isn't in the path.
6005     MOZ_PATH_PROGS(MAKENSIS, makensis)
6006     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
6007         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
6008     fi
6009     # The Windows build for NSIS requires the iconv command line utility to
6010     # convert the charset of the locale files.
6011     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6012     if test -z "$HOST_ICONV"; then
6013         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6014     fi
6017 # Automatically disable installer if xpinstall isn't built
6018 if test -z "$MOZ_XPINSTALL"; then
6019     MOZ_INSTALLER=
6021 AC_SUBST(MOZ_INSTALLER)
6023 AC_MSG_CHECKING([for tar archiver])
6024 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6025 if test -z "$TAR"; then
6026     AC_MSG_ERROR([no tar archiver found in \$PATH])
6028 AC_MSG_RESULT([$TAR])
6029 AC_SUBST(TAR)
6031 AC_MSG_CHECKING([for wget])
6032 AC_CHECK_PROGS(WGET, wget, "")
6033 AC_MSG_RESULT([$WGET])
6034 AC_SUBST(WGET)
6036 dnl ========================================================
6037 dnl Updater
6038 dnl ========================================================
6040 MOZ_ARG_DISABLE_BOOL(updater,
6041 [  --disable-updater       Disable building of updater],
6042     MOZ_UPDATER=,
6043     MOZ_UPDATER=1 )
6044 AC_SUBST(MOZ_UPDATER)
6046 # app update channel is 'default' when not supplied.
6047 MOZ_ARG_ENABLE_STRING([update-channel],
6048 [  --enable-update-channel=CHANNEL
6049                            Select application update channel (default=default)],
6050     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6052 if test -z "$MOZ_UPDATE_CHANNEL"; then
6053     MOZ_UPDATE_CHANNEL=default
6055 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6057 # tools/update-packaging is not checked out by default.
6058 MOZ_ARG_ENABLE_BOOL(update-packaging,
6059 [  --enable-update-packaging
6060                            Enable tools/update-packaging],
6061     MOZ_UPDATE_PACKAGING=1,
6062     MOZ_UPDATE_PACKAGING= )
6063 AC_SUBST(MOZ_UPDATE_PACKAGING)
6065 dnl ========================================================
6066 dnl ActiveX
6067 dnl ========================================================
6069 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6070 [  --disable-xpconnect-idispatch
6071                           Disable building of xpconnect support for IDispatch
6072                           (win32 only)],
6073     XPC_IDISPATCH_SUPPORT=,
6074     XPC_IDISPATCH_SUPPORT=1)
6075 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6077 MOZ_ARG_DISABLE_BOOL(activex,
6078 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6079     MOZ_NO_ACTIVEX_SUPPORT=1,
6080     MOZ_NO_ACTIVEX_SUPPORT= )
6081 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6083 MOZ_ARG_DISABLE_BOOL(activex-scripting,
6084 [  --disable-activex-scripting
6085                           Disable building of ActiveX scripting support (win32)],
6086     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
6087     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
6088 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6090 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6091 then
6092     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6095 if test "$COMPILE_ENVIRONMENT" = "1"; then
6096 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6097 case "$target" in
6098 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6099     if test "$ac_cv_header_atlbase_h" = "no"; then
6100         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.])
6101     fi
6102     ;;
6103 esac
6107 dnl ========================================================
6108 dnl leaky
6109 dnl ========================================================
6110 MOZ_ARG_ENABLE_BOOL(leaky,
6111 [  --enable-leaky          Build leaky memory tool],
6112     MOZ_LEAKY=1,
6113     MOZ_LEAKY=)
6116 dnl ========================================================
6117 dnl xpctools
6118 dnl ========================================================
6119 MOZ_ARG_ENABLE_BOOL(xpctools,
6120 [  --enable-xpctools       Build JS profiling tool],
6121     MOZ_XPCTOOLS=1,
6122     MOZ_XPCTOOLS= )
6125 dnl ========================================================
6126 dnl build the tests by default
6127 dnl ========================================================
6128 MOZ_ARG_DISABLE_BOOL(tests,
6129 [  --disable-tests         Do not build test libraries & programs],
6130     ENABLE_TESTS=,
6131     ENABLE_TESTS=1 )
6133 dnl ========================================================
6134 dnl parental controls (for Windows Vista)
6135 dnl ========================================================
6136 MOZ_ARG_DISABLE_BOOL(parental-controls,
6137 [  --disable-parental-controls
6138                            Do not build parental controls],
6139    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6140    MOZ_DISABLE_PARENTAL_CONTROLS=)
6141 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6142     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6145 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6147 dnl ========================================================
6148 dnl =
6149 dnl = Module specific options
6150 dnl =
6151 dnl ========================================================
6152 MOZ_ARG_HEADER(Individual module options)
6154 dnl ========================================================
6155 dnl = Enable Lea malloc in xpcom. OFF by default.
6156 dnl ========================================================
6157 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
6158 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
6159     XPCOM_USE_LEA=1,
6160     XPCOM_USE_LEA= )
6161 if test -n "$XPCOM_USE_LEA"; then
6162     AC_DEFINE(XPCOM_USE_LEA)
6165 dnl ========================================================
6166 dnl = Enable places (new history/bookmarks)
6167 dnl ========================================================
6168 MOZ_ARG_ENABLE_BOOL(places,
6169 [  --enable-places        Enable 'places' bookmark/history implementation],
6170     MOZ_PLACES=1,
6171     MOZ_PLACES= )
6172 if test -n "$MOZ_PLACES"; then
6173     AC_DEFINE(MOZ_PLACES)
6174     if test -z "$MOZ_MAIL_NEWS"; then
6175       MOZ_MORK=
6176     fi
6177     MOZ_MORKREADER=1
6178 else
6179   if test "$MOZ_BUILD_APP" = "browser"; then
6180     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
6181   fi
6184 dnl ========================================================
6185 dnl = Disable feed handling components
6186 dnl ========================================================
6187 MOZ_ARG_DISABLE_BOOL(feeds,
6188 [  --disable-feeds        Disable feed handling and processing components],
6189     MOZ_FEEDS=,
6190     MOZ_FEEDS=1 )
6191 if test -n "$MOZ_FEEDS"; then
6192     AC_DEFINE(MOZ_FEEDS)
6193 else
6194     if test "$MOZ_BUILD_APP" = "browser"; then
6195         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6196     fi
6199 dnl ========================================================
6200 dnl = Enable mozStorage
6201 dnl ========================================================
6202 dnl Implicitly enabled by default if building calendar or places
6203 MOZ_ARG_ENABLE_BOOL(storage,
6204 [  --enable-storage        Enable mozStorage module and related components],
6205     MOZ_STORAGE=1,
6206     MOZ_STORAGE= )
6207 if test -n "$MOZ_STORAGE"; then
6208     AC_DEFINE(MOZ_STORAGE)
6211 dnl ========================================================
6212 dnl Check for sqlite
6213 dnl ========================================================
6215 MOZ_NATIVE_SQLITE=
6216 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6217 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6218 MOZ_NATIVE_SQLITE=1,
6219 MOZ_NATIVE_SQLITE= )
6221 if test -z "$MOZ_NATIVE_SQLITE"
6222 then
6223     SQLITE_CFLAGS=
6224     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6225 else
6226     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6229 AC_SUBST(MOZ_NATIVE_SQLITE)
6231 dnl ========================================================
6232 dnl = Enable help viewer (off by default)
6233 dnl ========================================================
6234 MOZ_ARG_ENABLE_BOOL(help-viewer,
6235 [  --enable-help-viewer        Enable help viewer],
6236     MOZ_HELP_VIEWER=1,
6237     MOZ_HELP_VIEWER= )
6238 if test -n "$MOZ_HELP_VIEWER"; then
6239      AC_DEFINE(MOZ_HELP_VIEWER)
6241 AC_SUBST(MOZ_HELP_VIEWER)
6242 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6243     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6246 dnl ========================================================
6247 dnl = Enable safe browsing (anti-phishing)
6248 dnl ========================================================
6249 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6250 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6251     MOZ_SAFE_BROWSING=1,
6252     MOZ_SAFE_BROWSING= )
6253 if test -n "$MOZ_SAFE_BROWSING"; then
6254     AC_DEFINE(MOZ_SAFE_BROWSING)
6256 AC_SUBST(MOZ_SAFE_BROWSING)
6258 dnl ========================================================
6259 dnl = Enable url-classifier
6260 dnl ========================================================
6261 dnl Implicitly enabled by default if building with safe-browsing
6262 if test -n "$MOZ_SAFE_BROWSING"; then
6263     MOZ_URL_CLASSIFIER=1
6265 MOZ_ARG_ENABLE_BOOL(url-classifier,
6266 [  --enable-url-classifier        Enable url classifier module],
6267     MOZ_URL_CLASSIFIER=1,
6268     MOZ_URL_CLASSIFIER= )
6269 if test -n "$MOZ_URL_CLASSIFIER"; then
6270     AC_DEFINE(MOZ_URL_CLASSIFIER)
6272 AC_SUBST(MOZ_URL_CLASSIFIER)
6274 dnl ========================================================
6275 dnl = Disable zipwriter
6276 dnl ========================================================
6277 MOZ_ARG_DISABLE_BOOL(zipwriter,
6278 [  --disable-zipwriter             Disable zipwriter component],
6279     MOZ_ZIPWRITER=,
6280     MOZ_ZIPWRITER=1 )
6281 AC_SUBST(MOZ_ZIPWRITER)
6283 dnl ========================================================
6284 dnl = Enable Ultrasparc specific optimizations for JS
6285 dnl ========================================================
6286 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6287 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6288     JS_ULTRASPARC_OPTS=1,
6289     JS_ULTRASPARC_OPTS= )
6291 dnl only enable option for ultrasparcs
6292 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6293     "$OS_TEST" != "sun4u"; then
6294     JS_ULTRASPARC_OPTS=
6296 AC_SUBST(JS_ULTRASPARC_OPTS)
6298 dnl ========================================================
6299 dnl = Hildon and OSSO checks
6300 dnl ========================================================
6301 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
6302                   MOZ_PLATFORM_HILDON=1,
6303                   MOZ_PLATFORM_HILDON=)
6304 if test $MOZ_PLATFORM_HILDON; then
6305    AC_DEFINE(MOZ_PLATFORM_HILDON)
6306    X11_COMPOSITED_PLUGINS="yes"
6308 AC_SUBST(LIBHILDONMIME_CFLAGS)
6309 AC_SUBST(LIBHILDONMIME_LIBS)
6311 if test "$X11_COMPOSITED_PLUGINS" = "yes"; then
6312     dnl if we have Xcomposite we should also have Xdamage and Xfixes
6313     AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6314                      [AC_MSG_ERROR([Couldn't find X11/extentsions/Xdamage.h which is required for composited plugins.])])
6315     AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6316                  [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6318 AC_SUBST(XCOMPOSITE_LIBS)
6320 PKG_CHECK_MODULES(LIBOSSO,libosso,
6321                   NS_OSSO=1,
6322                   NS_OSSO=)
6324 if test $NS_OSSO; then
6325     if test -z "$MOZ_ENABLE_DBUS"; then
6326         AC_MSG_ERROR([DBus is required when building for OSSO])
6327     fi
6328     AC_DEFINE(NS_OSSO)
6329     MOZ_GFX_OPTIMIZE_MOBILE=1
6331 AC_SUBST(LIBOSSO_CFLAGS)
6332 AC_SUBST(LIBOSSO_LIBS)
6334 PKG_CHECK_MODULES(MOZ_LOCATION, [liblocation gpsbt],
6335                   NS_MAEMO_LOCATION=1,
6336                   NS_MAEMO_LOCATION=)
6338 if test $NS_MAEMO_LOCATION; then
6339   AC_DEFINE(NS_MAEMO_LOCATION)
6342 AC_SUBST(MOZ_LOCATION_CFLAGS)
6343 AC_SUBST(MOZ_LOCATION_LIBS)
6345 dnl ========================================================
6346 dnl = faststripe theme
6347 dnl ========================================================
6348 MOZ_ARG_ENABLE_BOOL(faststripe,
6349 [  --enable-faststripe  Use faststripe theme],
6350     MOZ_THEME_FASTSTRIPE=1,
6351     MOZ_THEME_FASTSTRIPE= )
6352 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6354 dnl ========================================================
6355 dnl =
6356 dnl = Feature options that require extra sources to be pulled
6357 dnl =
6358 dnl ========================================================
6359 dnl MOZ_ARG_HEADER(Features that require extra sources)
6361 dnl ========================================================
6362 dnl =
6363 dnl = Debugging Options
6364 dnl = 
6365 dnl ========================================================
6366 MOZ_ARG_HEADER(Debugging and Optimizations)
6368 dnl ========================================================
6369 dnl = Disable building with debug info.
6370 dnl = Debugging is OFF by default
6371 dnl ========================================================
6372 if test -z "$MOZ_DEBUG_FLAGS"
6373 then
6374     case "$target" in
6375     *-irix*)
6376         if test "$GNU_CC"; then
6377             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6378             case "$GCC_VERSION" in
6379             2.95.*)
6380                 MOZ_DEBUG_FLAGS=""
6381                 ;;
6382             *)
6383                 MOZ_DEBUG_FLAGS="-g"
6384                 ;;
6385             esac
6386         else
6387             MOZ_DEBUG_FLAGS="-g"
6388         fi
6389         ;;
6390     *)
6391         MOZ_DEBUG_FLAGS="-g"
6392         ;;
6393     esac
6396 MOZ_ARG_ENABLE_STRING(debug,
6397 [  --enable-debug[=DBG]    Enable building with developer debug info
6398                           (Using compiler flags DBG)],
6399 [ if test "$enableval" != "no"; then
6400     MOZ_DEBUG=1
6401     if test -n "$enableval" && test "$enableval" != "yes"; then
6402         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6403     fi
6404   else
6405     MOZ_DEBUG=
6406   fi ],
6407   MOZ_DEBUG=)
6409 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6410  case "${target_os}" in
6411     beos*)
6412         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6413         ;;
6414     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6415         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6416         ;;
6417     *) 
6418         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6419         ;;
6420   esac
6421 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6423 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6425 if test -n "$MOZ_DEBUG"; then
6426     AC_MSG_CHECKING([for valid debug flags])
6427     _SAVE_CFLAGS=$CFLAGS
6428     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6429     AC_TRY_COMPILE([#include <stdio.h>], 
6430         [printf("Hello World\n");],
6431         _results=yes,
6432         _results=no)
6433     AC_MSG_RESULT([$_results])
6434     if test "$_results" = "no"; then
6435         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6436     fi
6437     CFLAGS=$_SAVE_CFLAGS
6440 dnl ========================================================
6441 dnl enable mobile optimizations
6442 dnl ========================================================
6443 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6444 [  --enable-mobile-optimize   Enable mobile optimizations],
6445     MOZ_GFX_OPTIMIZE_MOBILE=1)
6447 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6449 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6450     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6453 dnl ========================================================
6454 dnl = Enable code optimization. ON by default.
6455 dnl ========================================================
6456 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6457         MOZ_OPTIMIZE_FLAGS="-O"
6460 MOZ_ARG_ENABLE_STRING(optimize,
6461 [  --disable-optimize      Disable compiler optimization
6462   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6463 [ if test "$enableval" != "no"; then
6464     MOZ_OPTIMIZE=1
6465     if test -n "$enableval" && test "$enableval" != "yes"; then
6466         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6467         MOZ_OPTIMIZE=2
6468     fi
6469 else
6470     MOZ_OPTIMIZE=
6471 fi ], MOZ_OPTIMIZE=1)
6473 if test "$COMPILE_ENVIRONMENT"; then
6474 if test -n "$MOZ_OPTIMIZE"; then
6475     AC_MSG_CHECKING([for valid optimization flags])
6476     _SAVE_CFLAGS=$CFLAGS
6477     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6478     AC_TRY_COMPILE([#include <stdio.h>], 
6479         [printf("Hello World\n");],
6480         _results=yes,
6481         _results=no)
6482     AC_MSG_RESULT([$_results])
6483     if test "$_results" = "no"; then
6484         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6485     fi
6486     CFLAGS=$_SAVE_CFLAGS
6488 fi # COMPILE_ENVIRONMENT
6490 AC_SUBST(MOZ_OPTIMIZE)
6491 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6492 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6493 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6495 dnl ========================================================
6496 dnl = Enable/disable debug for specific modules only
6497 dnl =   module names beginning with ^ will be disabled 
6498 dnl ========================================================
6499 MOZ_ARG_ENABLE_STRING(debug-modules,
6500 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6501 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6503 dnl ========================================================
6504 dnl = Enable/disable generation of debugger info for specific modules only
6505 dnl =    the special module name ALL_MODULES can be used to denote all modules
6506 dnl =    module names beginning with ^ will be disabled
6507 dnl ========================================================
6508 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6509 [  --enable-debugger-info-modules
6510                           Enable/disable debugger info for specific modules],
6511 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6512       dnl note that the list of module names is reversed as it is copied
6513       dnl this is important, as it will allow config.mk to interpret stuff like
6514       dnl "^ALL_MODULES xpcom" properly
6515       if test "$i" = "no"; then
6516         i="^ALL_MODULES"
6517       fi
6518       if test "$i" = "yes"; then
6519         i="ALL_MODULES"
6520       fi
6521       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6522     done ])
6524 dnl ========================================================
6525 dnl Enable garbage collector
6526 dnl ========================================================
6527 MOZ_ARG_ENABLE_BOOL(boehm,
6528 [  --enable-boehm          Enable the Boehm Garbage Collector],
6529     GC_LEAK_DETECTOR=1,
6530     GC_LEAK_DETECTOR= )
6531 if test -n "$GC_LEAK_DETECTOR"; then
6532     AC_DEFINE(GC_LEAK_DETECTOR)
6535 dnl ========================================================
6536 dnl Disable runtime logging checks
6537 dnl ========================================================
6538 MOZ_ARG_DISABLE_BOOL(logging,
6539 [  --disable-logging       Disable logging facilities],
6540     NS_DISABLE_LOGGING=1,
6541     NS_DISABLE_LOGGING= )
6542 if test "$NS_DISABLE_LOGGING"; then
6543     AC_DEFINE(NS_DISABLE_LOGGING)
6544 else
6545     AC_DEFINE(MOZ_LOGGING)
6548 dnl ========================================================
6549 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6550 dnl ========================================================
6551 _ENABLE_LOGREFCNT=42
6552 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6553 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6554     _ENABLE_LOGREFCNT=1,
6555     _ENABLE_LOGREFCNT= )
6556 if test "$_ENABLE_LOGREFCNT" = "1"; then
6557     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6558 elif test -z "$_ENABLE_LOGREFCNT"; then
6559     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6562 dnl ========================================================
6563 dnl = Enable trace malloc
6564 dnl ========================================================
6565 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6566 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6567 [  --enable-trace-malloc   Enable malloc tracing],
6568     NS_TRACE_MALLOC=1,
6569     NS_TRACE_MALLOC= )
6570 if test "$NS_TRACE_MALLOC"; then
6571   # Please, Mr. Linker Man, don't take away our symbol names
6572   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6573   USE_ELF_DYNSTR_GC=
6574   AC_DEFINE(NS_TRACE_MALLOC)
6576 AC_SUBST(NS_TRACE_MALLOC)
6578 dnl ========================================================
6579 dnl = Enable jemalloc
6580 dnl ========================================================
6581 MOZ_ARG_ENABLE_BOOL(jemalloc,
6582 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6583     MOZ_MEMORY=1,
6584     MOZ_MEMORY=)
6586 if test "$NS_TRACE_MALLOC"; then
6587     MOZ_MEMORY=
6590 if test "$MOZ_MEMORY"; then
6592   dnl Don't try to run compiler tests on Windows  
6593   if test "$OS_ARCH" = "WINNT"; then
6594     if test -z "$HAVE_64BIT_OS"; then
6595       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6596     else
6597       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6598     fi
6599   else
6600     AC_CHECK_SIZEOF([int *], [4])
6601     case "${ac_cv_sizeof_int_p}" in
6602     4)
6603       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6604       ;;
6605     8)
6606       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6607       ;;
6608     *)
6609       AC_MSG_ERROR([Unexpected pointer size])
6610       ;;
6611     esac
6612   fi
6614   AC_DEFINE(MOZ_MEMORY)
6615   if test "x$MOZ_DEBUG" = "x1"; then
6616     AC_DEFINE(MOZ_MEMORY_DEBUG)
6617   fi
6618   dnl The generic feature tests that determine how to compute ncpus are long and
6619   dnl complicated.  Therefore, simply define special cpp variables for the
6620   dnl platforms we have special knowledge of.
6621   case "${target_os}" in
6622   darwin*)
6623     AC_DEFINE(MOZ_MEMORY_DARWIN)
6624     ;;
6625   *freebsd*)
6626     AC_DEFINE(MOZ_MEMORY_BSD)
6627     ;;
6628   *linux*)
6629     AC_DEFINE(MOZ_MEMORY_LINUX)
6630     ;;
6631   netbsd*)
6632     AC_DEFINE(MOZ_MEMORY_BSD)
6633     ;;
6634   solaris*)
6635     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6636     ;;
6637   msvc*|mks*|cygwin*|mingw*)
6638     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6639     dnl This is sort of awful. Will revisit if we add support for more versions
6640     if test "$CC_VERSION" != "14.00.50727.762"; then
6641         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 currently.])
6642     fi
6643     if test -z "$WIN32_CRT_SRC_DIR"; then
6644       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6645         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).])
6646       else
6647         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6648       fi
6649     fi
6651     if test ! -d "$WIN32_CRT_SRC_DIR"; then
6652       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
6653     fi
6654     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
6655     _objdir_win=`pwd -W`
6656     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/intel"
6657     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6658     AC_DEFINE(_STATIC_CPPLIB)
6659     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -DEFAULTLIB:mozcrt19"
6660     dnl Also pass this to NSPR/NSS
6661     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
6662     export DLLFLAGS
6663     ;;
6664   *wince)
6665     AC_DEFINE(MOZ_MEMORY_WINCE)
6666     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6667     if test -z "$WINCE_WINDOWS_MOBILE"; then
6668       AC_DEFINE(MOZ_MEMORY_WINCE6)
6669     fi
6670     ;;
6671   *)
6672     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6673     ;;
6674   esac
6676 AC_SUBST(MOZ_MEMORY)
6677 AC_SUBST(MOZ_MEMORY_LDFLAGS)
6678 AC_SUBST(WIN32_CRT_SRC_DIR)
6679 dnl Need to set this for make because NSS doesn't have configure
6680 AC_SUBST(DLLFLAGS)
6682 dnl ========================================================
6683 dnl = Use malloc wrapper lib
6684 dnl ========================================================
6685 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6686 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6687     _WRAP_MALLOC=1,
6688     _WRAP_MALLOC= )
6690 if test -n "$_WRAP_MALLOC"; then
6691     if test "$GNU_CC"; then
6692     WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -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"
6693     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6694     fi
6697 dnl ========================================================
6698 dnl = Location of malloc wrapper lib
6699 dnl ========================================================
6700 MOZ_ARG_WITH_STRING(wrap-malloc,
6701 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6702     WRAP_MALLOC_LIB=$withval)
6704 dnl ========================================================
6705 dnl = Use Valgrind
6706 dnl ========================================================
6707 MOZ_ARG_ENABLE_BOOL(valgrind,
6708 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
6709     MOZ_VALGRIND=1,
6710     MOZ_VALGRIND= )
6711 if test -n "$MOZ_VALGRIND"; then
6712     AC_CHECK_HEADER([valgrind/valgrind.h], [],
6713         AC_MSG_ERROR(
6714             [--enable-valgrind specified but Valgrind is not installed]))
6715     AC_DEFINE(MOZ_VALGRIND)
6718 dnl ========================================================
6719 dnl = Use Electric Fence
6720 dnl ========================================================
6721 MOZ_ARG_ENABLE_BOOL(efence,
6722 [  --enable-efence         Link with Electric Fence],
6723     _ENABLE_EFENCE=1,
6724     _ENABLE_EFENCE= )
6725 if test -n "$_ENABLE_EFENCE"; then
6726     AC_CHECK_LIB(efence,malloc)
6729 dnl ========================================================
6730 dnl jprof
6731 dnl ========================================================
6732 MOZ_ARG_ENABLE_BOOL(jprof,
6733 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6734     MOZ_JPROF=1,
6735     MOZ_JPROF= )
6736 if test -n "$MOZ_JPROF"; then
6737     AC_DEFINE(MOZ_JPROF)
6740 dnl ========================================================
6741 dnl shark
6742 dnl ========================================================
6743 MOZ_ARG_ENABLE_BOOL(shark,
6744 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6745     MOZ_SHARK=1,
6746     MOZ_SHARK= )
6747 if test -n "$MOZ_SHARK"; then
6748     AC_DEFINE(MOZ_SHARK)
6751 dnl ========================================================
6752 dnl callgrind
6753 dnl ========================================================
6754 MOZ_ARG_ENABLE_BOOL(callgrind,
6755 [  --enable-callgrind      Enable callgrind profiling],
6756     MOZ_CALLGRIND=1,
6757     MOZ_CALLGRIND= )
6758 if test -n "$MOZ_CALLGRIND"; then
6759     AC_DEFINE(MOZ_CALLGRIND)
6762 dnl ========================================================
6763 dnl vtune
6764 dnl ========================================================
6765 MOZ_ARG_ENABLE_BOOL(vtune,
6766 [  --enable-vtune          Enable vtune profiling],
6767     MOZ_VTUNE=1,
6768     MOZ_VTUNE= )
6769 if test -n "$MOZ_VTUNE"; then
6770     AC_DEFINE(MOZ_VTUNE)
6773 dnl ========================================================
6774 dnl Zealous JavaScript GC
6775 dnl ========================================================
6776 MOZ_ARG_ENABLE_BOOL(gczeal,
6777 [  --enable-gczeal          Enable zealous JavaScript GCing],
6778     JS_GC_ZEAL=1,
6779     JS_GC_ZEAL= )
6780 if test -n "$JS_GC_ZEAL"; then
6781     AC_DEFINE(JS_GC_ZEAL)
6784 dnl ========================================================
6785 dnl = Enable static checking using gcc-dehydra
6786 dnl ========================================================
6788 MOZ_ARG_WITH_STRING(static-checking,
6789 [  --with-static-checking=path/to/gcc_dehydra.so
6790                             Enable static checking of code using GCC-dehydra],
6791     DEHYDRA_PATH=$withval,
6792     DEHYDRA_PATH= )
6794 if test -n "$DEHYDRA_PATH"; then
6795     if test ! -f "$DEHYDRA_PATH"; then
6796         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6797     fi
6798     AC_DEFINE(NS_STATIC_CHECKING)
6800 AC_SUBST(DEHYDRA_PATH)
6802 dnl ========================================================
6803 dnl = Enable stripping of libs & executables
6804 dnl ========================================================
6805 MOZ_ARG_ENABLE_BOOL(strip,
6806 [  --enable-strip          Enable stripping of libs & executables ],
6807     ENABLE_STRIP=1,
6808     ENABLE_STRIP= )
6810 dnl ========================================================
6811 dnl = Enable stripping of libs & executables when packaging
6812 dnl ========================================================
6813 MOZ_ARG_ENABLE_BOOL(install-strip,
6814 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6815     PKG_SKIP_STRIP= ,
6816     PKG_SKIP_STRIP=1)
6818 dnl ========================================================
6819 dnl = --enable-elf-dynstr-gc
6820 dnl ========================================================
6821 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6822 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6823     USE_ELF_DYNSTR_GC=1,
6824     USE_ELF_DYNSTR_GC= )
6826 dnl ========================================================
6827 dnl = --enable-old-abi-compat-wrappers
6828 dnl ========================================================
6829 dnl on x86 linux, the current builds of some popular plugins (notably
6830 dnl flashplayer and real) expect a few builtin symbols from libgcc
6831 dnl which were available in some older versions of gcc.  However,
6832 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6833 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6834 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6835 dnl to true on x86 linux, and false everywhere else.
6838 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6839 [  --enable-old-abi-compat-wrappers
6840                           Support old GCC ABI symbols to ease the pain 
6841                           of the linux compiler change],
6842     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6843     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6844 if test "$COMPILE_ENVIRONMENT"; then
6845 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6846     AC_LANG_SAVE
6847     AC_LANG_CPLUSPLUS
6848     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6849     AC_LANG_RESTORE
6850     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6852 fi # COMPILE_ENVIRONMENT
6854 dnl ========================================================
6855 dnl = 
6856 dnl = Profiling and Instrumenting
6857 dnl = 
6858 dnl ========================================================
6859 MOZ_ARG_HEADER(Profiling and Instrumenting)
6861 dnl ========================================================
6862 dnl = Enable timeline service, which provides lightweight
6863 dnl = instrumentation of mozilla for performance measurement.
6864 dnl = Timeline is off by default.
6865 dnl ========================================================
6866 MOZ_ARG_ENABLE_BOOL(timeline,
6867 [  --enable-timeline       Enable timeline services ],
6868     MOZ_TIMELINE=1,
6869     MOZ_TIMELINE= )
6870 if test -n "$MOZ_TIMELINE"; then
6871     AC_DEFINE(MOZ_TIMELINE)
6874 dnl ========================================================
6875 dnl Turn on reflow counting
6876 dnl ========================================================
6877 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6878 [  --enable-reflow-perf    Enable reflow performance tracing],
6879     MOZ_REFLOW_PERF=1,
6880     MOZ_REFLOW_PERF= )
6881 if test -n "$MOZ_REFLOW_PERF"; then
6882     AC_DEFINE(MOZ_REFLOW_PERF)
6885 dnl ========================================================
6886 dnl Enable performance metrics.
6887 dnl ========================================================
6888 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6889 [  --enable-perf-metrics   Enable performance metrics],
6890     MOZ_PERF_METRICS=1,
6891     MOZ_PERF_METRICS= )
6892 if test -n "$MOZ_PERF_METRICS"; then
6893     AC_DEFINE(MOZ_PERF_METRICS)
6896 dnl ========================================================
6897 dnl Enable code size metrics.
6898 dnl ========================================================
6899 MOZ_ARG_ENABLE_BOOL(codesighs,
6900 [  --enable-codesighs      Enable code size analysis tools],
6901     _ENABLE_CODESIGHS=1,
6902     _ENABLE_CODESIGHS= )
6903 if test -n "$_ENABLE_CODESIGHS"; then
6904     if test -d $srcdir/tools/codesighs; then 
6905         MOZ_MAPINFO=1
6906     else
6907         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6908     fi
6911 dnl ========================================================
6912 dnl = Add support for Eazel profiler
6913 dnl ========================================================
6914 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6915 [  --enable-eazel-profiler-support
6916                           Enable Corel/Eazel profiler support],
6917     ENABLE_EAZEL_PROFILER=1,
6918     ENABLE_EAZEL_PROFILER= )
6919 if test -n "$ENABLE_EAZEL_PROFILER"; then
6920     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6921     USE_ELF_DYNSTR_GC=
6922     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6923     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6924     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6927 MOZ_ARG_ENABLE_STRING(profile-modules,
6928 [  --enable-profile-modules
6929                           Enable/disable profiling for specific modules],
6930 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6932 MOZ_ARG_ENABLE_BOOL(insure,
6933 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6934     _ENABLE_INSURE=1,
6935     _ENABLE_INSURE= )
6936 if test -n "$_ENABLE_INSURE"; then
6937     MOZ_INSURE="insure"
6938     MOZ_INSURIFYING=1
6939     MOZ_INSURE_DIRS="."
6940     MOZ_INSURE_EXCLUDE_DIRS="config"
6943 MOZ_ARG_WITH_STRING(insure-dirs,
6944 [  --with-insure-dirs=DIRS
6945                           Dirs to instrument with insure ],
6946     MOZ_INSURE_DIRS=$withval )
6948 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6949 [  --with-insure-exclude-dirs=DIRS
6950                           Dirs to not instrument with insure ],
6951     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6953 dnl ========================================================
6954 dnl = Support for Quantify (Windows)
6955 dnl ========================================================
6956 MOZ_ARG_ENABLE_BOOL(quantify,
6957 [  --enable-quantify      Enable Quantify support (Windows only) ],
6958     MOZ_QUANTIFY=1,
6959     MOZ_QUANTIFY= )
6961 dnl ========================================================
6962 dnl = Support for demangling undefined symbols
6963 dnl ========================================================
6964 if test -z "$SKIP_LIBRARY_CHECKS"; then
6965     AC_LANG_SAVE
6966     AC_LANG_CPLUSPLUS
6967     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6968     AC_LANG_RESTORE
6971 # Demangle only for debug or trace-malloc builds
6972 MOZ_DEMANGLE_SYMBOLS=
6973 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6974     MOZ_DEMANGLE_SYMBOLS=1
6975     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6977 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6979 dnl ========================================================
6980 dnl = Support for gcc stack unwinding (from gcc 3.3)
6981 dnl ========================================================
6982 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6983     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6986 dnl ========================================================
6987 dnl =
6988 dnl = Misc. Options
6989 dnl = 
6990 dnl ========================================================
6991 MOZ_ARG_HEADER(Misc. Options)
6993 dnl ========================================================
6994 dnl update xterm title
6995 dnl ========================================================
6996 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6997 [  --enable-xterm-updates  Update XTERM titles with current command.],
6998     MOZ_UPDATE_XTERM=1,
6999     MOZ_UPDATE_XTERM= )
7001 dnl =========================================================
7002 dnl = Chrome format
7003 dnl =========================================================
7004 MOZ_ARG_ENABLE_STRING([chrome-format],
7005 [  --enable-chrome-format=jar|flat|both|symlink
7006                           Select FORMAT of chrome files (default=jar)],
7007     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7009 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7010     MOZ_CHROME_FILE_FORMAT=jar
7013 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7014     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7015     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7016     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
7017     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
7020 dnl ========================================================
7021 dnl = Define default location for MOZILLA_FIVE_HOME
7022 dnl ========================================================
7023 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7024 [  --with-default-mozilla-five-home
7025                           Set the default value for MOZILLA_FIVE_HOME],
7026 [ val=`echo $withval`
7027   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7029 dnl ========================================================
7030 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7031 dnl ========================================================
7032 MOZ_ARG_WITH_STRING(user-appdir,
7033 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7034 [ val=`echo $withval`
7035 if echo "$val" | grep "\/" >/dev/null; then
7036     AC_MSG_ERROR("Homedir must be single relative path.")
7037 else 
7038     MOZ_USER_DIR="$val"
7039 fi])
7041 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7043 dnl ========================================================
7044 dnl = Doxygen configuration
7045 dnl ========================================================
7046 dnl Use commas to specify multiple dirs to this arg
7047 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7048 MOZ_ARG_WITH_STRING(doc-input-dirs,
7049 [  --with-doc-input-dirs=DIRS
7050                           Header/idl dirs to create docs from],
7051 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7052 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7054 dnl Use commas to specify multiple dirs to this arg
7055 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7056 MOZ_ARG_WITH_STRING(doc-include-dirs,
7057 [  --with-doc-include-dirs=DIRS  
7058                           Include dirs to preprocess doc headers],
7059 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7060 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7062 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7063 MOZ_ARG_WITH_STRING(doc-output-dir,
7064 [  --with-doc-output-dir=DIR
7065                           Dir to generate docs into],
7066 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7067 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7069 if test -z "$SKIP_COMPILER_CHECKS"; then
7070 dnl ========================================================
7071 dnl =
7072 dnl = Compiler Options
7073 dnl = 
7074 dnl ========================================================
7075 MOZ_ARG_HEADER(Compiler Options)
7077 dnl ========================================================
7078 dnl Check for gcc -pipe support
7079 dnl ========================================================
7080 AC_MSG_CHECKING([for gcc -pipe support])
7081 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7082     echo '#include <stdio.h>' > dummy-hello.c
7083     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7084     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7085     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7086     if test $? = 0; then
7087         _res_as_stdin="yes"
7088     else
7089         _res_as_stdin="no"
7090     fi
7091     if test "$_res_as_stdin" = "yes"; then
7092         _SAVE_CFLAGS=$CFLAGS
7093         CFLAGS="$CFLAGS -pipe"
7094         AC_TRY_COMPILE( [ #include <stdio.h> ],
7095             [printf("Hello World\n");],
7096             [_res_gcc_pipe="yes"],
7097             [_res_gcc_pipe="no"] )
7098         CFLAGS=$_SAVE_CFLAGS
7099     fi
7100     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7101         _res="yes";
7102         CFLAGS="$CFLAGS -pipe"
7103         CXXFLAGS="$CXXFLAGS -pipe"
7104     else
7105         _res="no"
7106     fi
7107     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7108     AC_MSG_RESULT([$_res])
7109 else
7110     AC_MSG_RESULT([no])
7113 dnl pass -Wno-long-long to the compiler
7114 MOZ_ARG_ENABLE_BOOL(long-long-warning,
7115 [  --enable-long-long-warning 
7116                           Warn about use of non-ANSI long long type],
7117     _IGNORE_LONG_LONG_WARNINGS=,
7118     _IGNORE_LONG_LONG_WARNINGS=1)
7120 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
7121      _SAVE_CFLAGS="$CFLAGS"
7122      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
7123      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
7124      AC_TRY_COMPILE([], [return(0);], 
7125         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7126           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7127           result="yes" ], result="no")
7128      AC_MSG_RESULT([$result])
7129      CFLAGS="$_SAVE_CFLAGS"
7132 dnl ========================================================
7133 dnl Profile guided optimization
7134 dnl ========================================================
7135 dnl Test for profiling options
7136 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7137 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7139 dnl Provide a switch to disable PGO even when called via profiledbuild.
7140 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7141 [  --disable-profile-guided-optimization
7142                            Don't build with PGO even if called via make profiledbuild],
7143 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7144 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7146 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7148 _SAVE_CFLAGS="$CFLAGS"
7149 CFLAGS="$CFLAGS -fprofile-generate"
7151 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7152 AC_TRY_COMPILE([], [return 0;],
7153                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7154                  result="yes" ], result="no")
7155 AC_MSG_RESULT([$result])
7157 if test $result = "yes"; then
7158   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7159   PROFILE_USE_CFLAGS="-fprofile-use"
7160   PROFILE_USE_LDFLAGS="-fprofile-use"
7161 else
7162   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7163   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7164   AC_TRY_COMPILE([], [return 0;],
7165                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7166                    result="yes" ], result="no")
7167   AC_MSG_RESULT([$result])
7168   if test $result = "yes"; then
7169     PROFILE_USE_CFLAGS="-fbranch-probabilities"
7170   fi
7171   # don't really care, this is an old GCC
7172   PROFILE_GEN_LDFLAGS=
7173   PROFILE_USE_LDFLAGS=
7176 CFLAGS="$_SAVE_CFLAGS"
7178 if test -n "$INTEL_CC"; then
7179   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7180   PROFILE_GEN_LDFLAGS=
7181   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7182   PROFILE_USE_LDFLAGS=
7185 dnl Sun Studio on Solaris
7186 if test "$SOLARIS_SUNPRO_CC"; then
7187   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7188   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7189   if test "$CPU_ARCH" != "sparc"; then
7190     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7191     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7192   else
7193     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7194     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7195   fi
7198 AC_SUBST(PROFILE_GEN_CFLAGS)
7199 AC_SUBST(PROFILE_GEN_LDFLAGS)
7200 AC_SUBST(PROFILE_USE_CFLAGS)
7201 AC_SUBST(PROFILE_USE_LDFLAGS)
7203 AC_LANG_CPLUSPLUS
7205 dnl ========================================================
7206 dnl Test for -pedantic bustage
7207 dnl ========================================================
7208 MOZ_ARG_DISABLE_BOOL(pedantic,
7209 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7210 _PEDANTIC= )
7211 if test "$_PEDANTIC"; then
7212     _SAVE_CXXFLAGS=$CXXFLAGS
7213     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7214     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7215     AC_TRY_COMPILE([$configure_static_assert_macros],
7216                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7217                    result="no", result="yes" )
7218     AC_MSG_RESULT([$result])
7219     CXXFLAGS="$_SAVE_CXXFLAGS"
7221     case "$result" in
7222     no)
7223         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7224         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7225         ;;
7226     yes)
7227         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7228         ;;
7229     esac
7232 dnl ========================================================
7233 dnl Test for correct temporary object destruction order
7234 dnl ========================================================
7235 dnl We want to make sure the compiler follows the C++ spec here as 
7236 dnl xpcom and the string classes depend on it (bug 235381).
7237 AC_MSG_CHECKING([for correct temporary object destruction order])
7238 AC_TRY_RUN([ class A {
7239              public:  A(int& x) : mValue(x) {}
7240                       ~A() { mValue--; }
7241                       operator char**() { return 0; }
7242              private:  int& mValue;
7243              };
7244              void func(char **arg) {}
7245              int m=2;
7246              void test() {
7247                   func(A(m));
7248                   if (m==1) m = 0;
7249              }
7250              int main() {
7251                  test();
7252                  return(m);
7253              }
7254              ],
7255      result="yes", result="no", result="maybe")
7256 AC_MSG_RESULT([$result])
7258 if test "$result" = "no"; then
7259     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7262 dnl ========================================================
7263 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7264 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7265 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7266 dnl ========================================================
7267 _SAVE_CXXFLAGS=$CXXFLAGS
7268 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7269 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7270     ac_nscap_nonconst_opeq_bug,
7271     [AC_TRY_COMPILE([
7272                       template <class T>
7273                       class Pointer
7274                         {
7275                         public:
7276                           T* myPtr;
7277                         };
7278                       
7279                       template <class T, class U>
7280                       int operator==(const Pointer<T>& rhs, U* lhs)
7281                         {
7282                           return rhs.myPtr == lhs;
7283                         }
7284                       
7285                       template <class T, class U>
7286                       int operator==(const Pointer<T>& rhs, const U* lhs)
7287                         {
7288                           return rhs.myPtr == lhs;
7289                         }
7290                     ],
7291                     [
7292                       Pointer<int> foo;
7293                       const int* bar;
7294                       return foo == bar;
7295                     ],
7296                     ac_nscap_nonconst_opeq_bug="no",
7297                     ac_nscap_nonconst_opeq_bug="yes")])
7298 CXXFLAGS="$_SAVE_CXXFLAGS"
7300 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7301     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7303 fi # SKIP_COMPILER_CHECKS
7305 dnl ========================================================
7306 dnl C++ rtti
7307 dnl Should be smarter and check that the compiler does indeed have rtti
7308 dnl ========================================================
7309 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7310 [  --enable-cpp-rtti       Enable C++ RTTI ],
7311 [ _MOZ_USE_RTTI=1 ],
7312 [ _MOZ_USE_RTTI= ])
7314 if test "$_MOZ_USE_RTTI"; then
7315    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7316 else
7317    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7320 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7322 dnl ========================================================
7323 dnl C++ exceptions (g++/egcs only - for now)
7324 dnl Should be smarter and check that the compiler does indeed have exceptions
7325 dnl ========================================================
7326 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7327 [  --enable-cpp-exceptions Enable C++ exceptions ],
7328 [ _MOZ_CPP_EXCEPTIONS=1 ],
7329 [ _MOZ_CPP_EXCEPTIONS= ])
7331 if test "$_MOZ_CPP_EXCEPTIONS"; then
7332     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7333 else
7334     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7337 # Irix & OSF native compilers do not like exception declarations 
7338 # when exceptions are disabled
7339 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7340     AC_DEFINE(CPP_THROW_NEW, [])
7341 else
7342     AC_DEFINE(CPP_THROW_NEW, [throw()])
7344 AC_LANG_C
7346 dnl ========================================================
7347 dnl =
7348 dnl = Build depencency options
7349 dnl =
7350 dnl ========================================================
7351 MOZ_ARG_HEADER(Build dependencies)
7353 dnl ========================================================
7354 dnl = Do not auto generate dependency info
7355 dnl ========================================================
7356 MOZ_AUTO_DEPS=1
7357 MOZ_ARG_DISABLE_BOOL(auto-deps,
7358 [  --disable-auto-deps     Do not automatically generate dependency info],
7359     MOZ_AUTO_DEPS=,
7360     MOZ_AUTO_DEPS=1)
7362 if test -n "$MOZ_AUTO_DEPS"; then
7363 dnl ========================================================
7364 dnl = Use mkdepend instead of $CC -MD for dependency generation
7365 dnl ========================================================
7366 _cpp_md_flag=
7367 MOZ_ARG_DISABLE_BOOL(md,
7368 [  --disable-md            Do not use compiler-based dependencies ],
7369   [_cpp_md_flag=],
7370   [_cpp_md_flag=1],
7371   [dnl Default is to turn on -MD if using GNU-compatible compilers
7372    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7373      _cpp_md_flag=1
7374    fi
7375   dnl Default is to use -xM if using Sun Studio on Solaris
7376    if test "$SOLARIS_SUNPRO_CC"; then
7377      _cpp_md_flag=1
7378    fi])
7379 if test "$_cpp_md_flag"; then
7380   COMPILER_DEPEND=1
7381   if test "$OS_ARCH" = "OpenVMS"; then
7382     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7383   else
7384     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7385   fi
7386   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7387   if test "$SOLARIS_SUNPRO_CC"; then
7388     _DEPEND_CFLAGS=
7389   fi
7390 else
7391   COMPILER_DEPEND=
7392   _USE_CPP_INCLUDE_FLAG=
7393   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7394   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7396 fi # MOZ_AUTO_DEPS
7397 MDDEPDIR='.deps'
7398 AC_SUBST(MOZ_AUTO_DEPS)
7399 AC_SUBST(COMPILER_DEPEND)
7400 AC_SUBST(MDDEPDIR)
7403 dnl ========================================================
7404 dnl =
7405 dnl = Static Build Options
7406 dnl =
7407 dnl ========================================================
7408 MOZ_ARG_HEADER(Static build options)
7410 MOZ_ARG_ENABLE_BOOL(static,
7411 [  --enable-static         Enable building of internal static libs],
7412     BUILD_STATIC_LIBS=1,
7413     BUILD_STATIC_LIBS=)
7415 dnl Disable libxul in debug builds, but not for xulrunner.
7416 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7417    MOZ_ENABLE_LIBXUL=
7420 MOZ_ARG_ENABLE_BOOL(libxul,
7421 [  --enable-libxul         Enable building of libxul],
7422     MOZ_ENABLE_LIBXUL=1,
7423     MOZ_ENABLE_LIBXUL=)
7425 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7426         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7429 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7430         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7433 AC_SUBST(LIBXUL_LIBS)
7435 if test -n "$MOZ_ENABLE_LIBXUL"; then
7436     XPCOM_LIBS="$LIBXUL_LIBS"
7437     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7438 else
7439     if test -n "$BUILD_STATIC_LIBS"; then
7440         AC_DEFINE(MOZ_STATIC_BUILD)
7441     fi
7442     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7445 dnl ========================================================
7446 dnl =
7447 dnl = Standalone module options
7448 dnl = 
7449 dnl ========================================================
7450 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7452 dnl Check for GLib and libIDL.
7453 dnl ========================================================
7454 case "$target_os" in
7455 msvc*|mks*|cygwin*|mingw*|wince*)
7456     SKIP_IDL_CHECK="yes"
7457     ;;
7459     SKIP_IDL_CHECK="no"
7460     ;;
7461 esac
7463 if test -z "$COMPILE_ENVIRONMENT"; then
7464     SKIP_IDL_CHECK="yes"
7467 dnl = Allow users to disable libIDL checking for standalone modules
7468 MOZ_ARG_WITHOUT_BOOL(libIDL,
7469 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7470         SKIP_IDL_CHECK="yes")
7472 if test "$SKIP_IDL_CHECK" = "no"
7473 then
7474     _LIBIDL_FOUND=
7475     if test "$MACOS_SDK_DIR"; then 
7476       dnl xpidl, and therefore libIDL, is only needed on the build host.
7477       dnl Don't build it against the SDK, as that causes problems.
7478       _MACSAVE_CFLAGS="$CFLAGS"
7479       _MACSAVE_LIBS="$LIBS"
7480       _MACSAVE_LDFLAGS="$LDFLAGS"
7481       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7482       changequote(,)
7483       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"`
7484       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7485       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7486       changequote([,])
7487       unset NEXT_ROOT
7488     fi
7490     if test "$MOZ_ENABLE_GTK2"; then
7491         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7492     fi
7493     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7494     dnl to either libIDL1 or libIDL2.
7495     if test -z "$_LIBIDL_FOUND"; then
7496         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7497         if test -z "$_LIBIDL_FOUND"; then
7498             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7499         fi
7500     fi
7501     dnl
7502     dnl If we don't have a libIDL config program & not cross-compiling, 
7503     dnl     look for orbit-config instead.
7504     dnl
7505     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7506         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7507         if test -n "$ORBIT_CONFIG"; then
7508             AC_MSG_CHECKING([for ORBit libIDL usability])
7509                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7510             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7511             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7512             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7513             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7514             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7515             LIBIDL_CONFIG=
7516             _SAVE_CFLAGS="$CFLAGS"
7517             _SAVE_LIBS="$LIBS"
7518             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7519             LIBS="$LIBIDL_LIBS $LIBS"
7520             AC_TRY_RUN([
7521 #include <stdlib.h>
7522 #include <libIDL/IDL.h>
7523 int main() {
7524   char *s;
7525   s=strdup(IDL_get_libver_string());
7526   if(s==NULL) {
7527     exit(1);
7528   }
7529   exit(0);
7531             ], [_LIBIDL_FOUND=1
7532                 result="yes"],
7533                [LIBIDL_CFLAGS=
7534                 LIBIDL_LIBS=
7535                 result="no"],
7536                [_LIBIDL_FOUND=1
7537                 result="maybe"] )
7538             AC_MSG_RESULT($result)
7539             CFLAGS="$_SAVE_CFLAGS"
7540             LIBS="$_SAVE_LIBS"
7541         fi
7542     fi
7543     if test -z "$_LIBIDL_FOUND"; then
7544         AC_MSG_ERROR([libIDL not found.
7545         libIDL $LIBIDL_VERSION or higher is required.])
7546     fi
7547     if test "$MACOS_SDK_DIR"; then
7548       CFLAGS="$_MACSAVE_CFLAGS"
7549       LIBS="$_MACSAVE_LIBS"
7550       LDFLAGS="$_MACSAVE_LDFLAGS"
7551       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7552         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7553       fi
7554     fi
7557 if test -n "$CROSS_COMPILE"; then
7558      if test -z "$HOST_LIBIDL_CONFIG"; then
7559         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7560     fi
7561     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7562         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7563         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7564     else
7565         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7566         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7567     fi
7570 if test -z "$SKIP_PATH_CHECKS"; then
7571 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7572     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7573         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7574     else
7575         AM_PATH_GLIB(${GLIB_VERSION})
7576     fi
7580 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7581     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7584 AC_SUBST(LIBIDL_CFLAGS)
7585 AC_SUBST(LIBIDL_LIBS)
7586 AC_SUBST(STATIC_LIBIDL)
7587 AC_SUBST(GLIB_CFLAGS)
7588 AC_SUBST(GLIB_LIBS)
7589 AC_SUBST(GLIB_GMODULE_LIBS)
7590 AC_SUBST(HOST_LIBIDL_CONFIG)
7591 AC_SUBST(HOST_LIBIDL_CFLAGS)
7592 AC_SUBST(HOST_LIBIDL_LIBS)
7594 dnl ========================================================
7595 dnl Check for cairo
7596 dnl ========================================================
7597 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7599 MOZ_TREE_CAIRO=1
7600 MOZ_ARG_ENABLE_BOOL(system-cairo,
7601 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7602 MOZ_TREE_CAIRO=,
7603 MOZ_TREE_CAIRO=1 )
7605 # Check for headers defining standard int types.
7606 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7608 if test "$MOZ_TREE_CAIRO"; then
7609     AC_DEFINE(MOZ_TREE_CAIRO)
7611     # For now we assume that we will have a uint64_t available through
7612     # one of the above headers or mozstdint.h.
7613     AC_DEFINE(HAVE_UINT64_T)
7615     # Define macros for cairo-features.h
7616     if test "$MOZ_X11"; then
7617         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7618         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7619         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7620         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7621         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7622         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7623         MOZ_ENABLE_CAIRO_FT=1
7624         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7625     fi
7626     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7627         QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7628     fi
7629     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7630         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7631         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7632         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7633     fi
7634     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7635         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7636         if test -z "$WINCE"; then
7637            WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7638            DDRAW_SURFACE_FEATURE=
7639         else
7640            WIN32_FONT_FEATURE=
7642            AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
7643            if test -z "$HAS_DDRAW"; then
7644                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.])
7645              DDRAW_SURFACE_FEATURE=
7646            else
7647              DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
7648            fi
7649         fi  
7650         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7651     fi
7652     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7653         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7654         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7655         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7656         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7657         MOZ_ENABLE_CAIRO_FT=1
7658         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7659         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7660     fi
7661     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7662         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7663         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7664         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7665         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7666         MOZ_ENABLE_CAIRO_FT=1
7667     fi
7668     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7669     AC_SUBST(CAIRO_FT_CFLAGS)
7671     if test "$MOZ_DEBUG"; then
7672       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7673     else
7674       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7675     fi
7677     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7679     AC_SUBST(PS_SURFACE_FEATURE)
7680     AC_SUBST(PDF_SURFACE_FEATURE)
7681     AC_SUBST(SVG_SURFACE_FEATURE)
7682     AC_SUBST(XLIB_SURFACE_FEATURE)
7683     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7684     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7685     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7686     AC_SUBST(XCB_SURFACE_FEATURE)
7687     AC_SUBST(WIN32_SURFACE_FEATURE)
7688     AC_SUBST(DDRAW_SURFACE_FEATURE)
7689     AC_SUBST(OS2_SURFACE_FEATURE)
7690     AC_SUBST(BEOS_SURFACE_FEATURE)
7691     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7692     AC_SUBST(FT_FONT_FEATURE)
7693     AC_SUBST(FC_FONT_FEATURE)
7694     AC_SUBST(WIN32_FONT_FEATURE)
7695     AC_SUBST(QUARTZ_FONT_FEATURE)
7696     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7697     AC_SUBST(QPAINTER_SURFACE_FEATURE)
7699     if test "$_WIN32_MSVC"; then
7700         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7701     else
7702         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
7704         if test "$MOZ_X11"; then
7705             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7706         fi
7707     fi
7709     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7710     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7712 else
7713    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7714    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7715    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7716    if test "$MOZ_X11"; then
7717         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7718         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7719         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7720    fi
7723 AC_SUBST(MOZ_TREE_CAIRO)
7724 AC_SUBST(MOZ_CAIRO_CFLAGS)
7725 AC_SUBST(MOZ_CAIRO_LIBS)
7727 dnl qcms
7728 dnl ========================================================
7730 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7731 AC_SUBST(QCMS_LIBS)
7733 dnl ========================================================
7734 dnl disable xul
7735 dnl ========================================================
7736 MOZ_ARG_DISABLE_BOOL(xul,
7737 [  --disable-xul           Disable XUL],
7738     MOZ_XUL= )
7739 if test "$MOZ_XUL"; then
7740   AC_DEFINE(MOZ_XUL)
7741 else
7742   dnl remove extensions that require XUL
7743   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7746 AC_SUBST(MOZ_XUL)
7748 dnl ========================================================
7749 dnl Two ways to enable Python support:
7750 dnl   --enable-extensions=python # select all available.
7751 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7752 dnl or:
7753 dnl   --enable-extensions=python/xpcom,... # select individual ones
7755 dnl If either is used, we locate the Python to use.
7756 dnl ========================================================
7758 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7759 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7760     dnl Allow PYTHON to point to the Python interpreter to use
7761     dnl (note that it must be the python executable - which we
7762     dnl run to locate the relevant paths etc)
7763     dnl If not set, we use whatever Python we can find.
7764     MOZ_PYTHON=$PYTHON
7765     dnl Ask Python what its version number is
7766     changequote(,)
7767     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7768     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7769     changequote([,])
7770     dnl Ask for the Python "prefix" (ie, home/source dir)
7771     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7772     dnl Setup the include and library directories.
7773     if test "$OS_ARCH" = "WINNT"; then
7774         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7775         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7776         dnl Binary trees have "include" for .h, and "libs" for .lib
7777         dnl We add 'em both - along with quotes, to handle spaces.
7778         MOZ_PYTHON_DLL_SUFFIX=.pyd
7779         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7780         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7781     else
7782         dnl Non-Windows include and libs
7783         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7784         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7785         dnl Check for dynamic Python lib
7786         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7787         dnl - core, xpcom loader, pydom etc) all need to share Python.
7788         dnl - Python 2.3's std --enable-shared configure option will
7789         dnl   create a libpython2.3.so.1.0. We should first try this
7790         dnl   dotted versioned .so file because this is the one that
7791         dnl   the PyXPCOM build mechanics tries to link to.
7792         dnl   XXX Should find a better way than hardcoding "1.0".
7793         dnl - Python developement tree dir layouts are NOT allowed here
7794         dnl   because the PyXPCOM build just dies on it later anyway.
7795         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7796         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7797             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7798         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7799             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7800         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7801             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7802         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7803             dnl Don't Python development tree directory layout.
7804             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7805             AC_MSG_ERROR([The Python at $MOZ_PYTHON_PREFIX looks like a dev tree. The PyXPCOM build cannot handle this yet. You must 'make install' Python and use the installed tree.])
7806         elif test "$OS_ARCH" = "Darwin"; then
7807             dnl We do Darwin last, so if a custom non-framework build of
7808             dnl python is used on OSX, then it will be picked up first by
7809             dnl the logic above.
7810             MOZ_PYTHON_LIBS="-framework Python"
7811         else
7812             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7813         fi
7814         if test "$OS_ARCH" = "Linux"; then
7815             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7816         fi
7817     fi
7818     dnl Handle "_d" on Windows
7819     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7820         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7821     else
7822         MOZ_PYTHON_DEBUG_SUFFIX=
7823     fi
7824     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7827 dnl If the user asks for the 'python' extension, then we add
7828 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7829 dnl Note the careful regex - it must match 'python' followed by anything
7830 dnl other than a '/', including the end-of-string.
7831 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7832     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7833         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7834     done
7836 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7837 dnl command-line, but not yet
7838 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7839 AC_SUBST(MOZ_PYTHON)
7840 AC_SUBST(MOZ_PYTHON_PREFIX)
7841 AC_SUBST(MOZ_PYTHON_INCLUDES)
7842 AC_SUBST(MOZ_PYTHON_LIBS)
7843 AC_SUBST(MOZ_PYTHON_VER)
7844 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7845 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7846 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7848 dnl ========================================================
7849 dnl disable profile locking
7850 dnl   do no use this in applications that can have more than
7851 dnl   one process accessing the profile directory.
7852 dnl ========================================================
7853 MOZ_ARG_DISABLE_BOOL(profilelocking,
7854 [  --disable-profilelocking           Disable profile locking],
7855     MOZ_PROFILELOCKING=,
7856     MOZ_PROFILELOCKING=1 )
7857 if test "$MOZ_PROFILELOCKING"; then
7858   AC_DEFINE(MOZ_PROFILELOCKING)
7861 dnl ========================================================
7862 dnl disable rdf services
7863 dnl ========================================================
7864 MOZ_ARG_DISABLE_BOOL(rdf,
7865 [  --disable-rdf           Disable RDF],
7866     MOZ_RDF= )
7867 if test "$MOZ_RDF"; then
7868   AC_DEFINE(MOZ_RDF)
7871 AC_SUBST(MOZ_RDF)
7873 dnl ========================================================
7874 dnl necko configuration options
7875 dnl ========================================================
7878 dnl option to disable various necko protocols
7880 MOZ_ARG_ENABLE_STRING(necko-protocols,
7881 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7882                           Enable/disable specific protocol handlers],
7883 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7884     if test "$option" = "yes" || test "$option" = "all"; then
7885         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7886     elif test "$option" = "no" || test "$option" = "none"; then
7887         NECKO_PROTOCOLS=""
7888     elif test "$option" = "default"; then
7889         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7890     elif test `echo "$option" | grep -c \^-` != 0; then
7891         option=`echo $option | sed 's/^-//'`
7892         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7893     else
7894         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7895     fi
7896 done],
7897     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7898 dnl Remove dupes
7899 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7900 AC_SUBST(NECKO_PROTOCOLS)
7901 for p in $NECKO_PROTOCOLS; do
7902     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7903 done
7906 dnl option to disable necko's disk cache
7908 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7909 [  --disable-necko-disk-cache
7910                           Disable necko disk cache],
7911     NECKO_DISK_CACHE=,
7912     NECKO_DISK_CACHE=1)
7913 AC_SUBST(NECKO_DISK_CACHE)
7914 if test "$NECKO_DISK_CACHE"; then
7915     AC_DEFINE(NECKO_DISK_CACHE)
7919 dnl option to disable necko's wifi scanner
7921 MOZ_ARG_DISABLE_BOOL(necko-wifi,
7922 [  --disable-necko-wifi   Disable necko wifi scanner],
7923     NECKO_WIFI=,
7924     NECKO_WIFI=1
7926 if test "$NECKO_WIFI"; then
7927   NECKO_WIFI=
7928   if test "$OS_ARCH" = "Linux"; then
7929     AC_CHECK_HEADER([iwlib.h])
7930     if test "$ac_cv_header_iwlib_h" = "yes"; then
7931       NECKO_WIFI=1
7932     fi
7933   elif test "$OS_ARCH" = "Darwin"; then
7934     NECKO_WIFI=1
7935   elif test "$OS_ARCH" = "WINNT"; then
7936     NECKO_WIFI=1
7937   elif test "$OS_ARCH" = "WINCE"; then
7938     NECKO_WIFI=1    
7939   else
7940     AC_MSG_WARN([Necko WiFi scanning not supported on your platform.])
7941   fi
7942   AC_SUBST(NECKO_WIFI)
7943   
7944   if test "$NECKO_WIFI"; then
7945     AC_DEFINE(NECKO_WIFI)
7946   fi
7949 AC_SUBST(NECKO_WIFI)
7953 dnl option to minimize size of necko's i/o buffers
7955 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7956 [  --enable-necko-small-buffers
7957                           Minimize size of necko's i/o buffers],
7958     NECKO_SMALL_BUFFERS=1,
7959     NECKO_SMALL_BUFFERS=)
7960 AC_SUBST(NECKO_SMALL_BUFFERS)
7961 if test "$NECKO_SMALL_BUFFERS"; then
7962     AC_DEFINE(NECKO_SMALL_BUFFERS)
7963 fi 
7966 dnl option to disable cookies
7968 MOZ_ARG_DISABLE_BOOL(cookies,
7969 [  --disable-cookies       Disable cookie support],
7970     NECKO_COOKIES=,
7971     NECKO_COOKIES=1)
7972 AC_SUBST(NECKO_COOKIES)
7973 if test "$NECKO_COOKIES"; then
7974     AC_DEFINE(NECKO_COOKIES)
7977 dnl NECKO_ configuration options are not global
7978 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7980 dnl Only build Mork if it's required
7981 AC_SUBST(MOZ_MORK)
7982 if test "$MOZ_MORK"; then
7983   AC_DEFINE(MOZ_MORK)
7986 dnl Build the lightweight Mork reader if required
7987 AC_SUBST(MOZ_MORKREADER)
7988 if test "$MOZ_MORKREADER"; then
7989   AC_DEFINE(MOZ_MORKREADER)
7992 dnl ========================================================
7993 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7994     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7997 dnl ========================================================
7998 dnl =
7999 dnl = Maintainer debug option (no --enable equivalent)
8000 dnl =
8001 dnl ========================================================
8003 AC_SUBST(AR)
8004 AC_SUBST(AR_FLAGS)
8005 AC_SUBST(AR_LIST)
8006 AC_SUBST(AR_EXTRACT)
8007 AC_SUBST(AR_DELETE)
8008 AC_SUBST(AS)
8009 AC_SUBST(ASFLAGS)
8010 AC_SUBST(AS_DASH_C_FLAG)
8011 AC_SUBST(LD)
8012 AC_SUBST(RC)
8013 AC_SUBST(RCFLAGS)
8014 AC_SUBST(WINDRES)
8015 AC_SUBST(USE_SHORT_LIBNAME)
8016 AC_SUBST(IMPLIB)
8017 AC_SUBST(FILTER)
8018 AC_SUBST(BIN_FLAGS)
8019 AC_SUBST(NS_USE_NATIVE)
8020 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8021 AC_SUBST(MOZ_GFX_TOOLKIT)
8022 AC_SUBST(MOZ_UPDATE_XTERM)
8023 AC_SUBST(MINIMO)
8024 AC_SUBST(MOZ_PLATFORM_HILDON)
8025 AC_SUBST(NS_OSSO)
8026 AC_SUBST(NS_MAEMO_LOCATION)
8027 AC_SUBST(MOZ_AUTH_EXTENSION)
8028 AC_SUBST(MOZ_MATHML)
8029 AC_SUBST(MOZ_PERMISSIONS)
8030 AC_SUBST(MOZ_XTF)
8031 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8032 AC_SUBST(MOZ_PREF_EXTENSIONS)
8033 AC_SUBST(MOZ_SVG)
8034 AC_SUBST(MOZ_SMIL)
8035 AC_SUBST(MOZ_XSLT_STANDALONE)
8036 AC_SUBST(MOZ_JS_LIBS)
8037 AC_SUBST(MOZ_PSM)
8038 AC_SUBST(MOZ_DEBUG)
8039 AC_SUBST(MOZ_DEBUG_MODULES)
8040 AC_SUBST(MOZ_PROFILE_MODULES)
8041 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8042 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8043 AC_SUBST(MOZ_DEBUG_FLAGS)
8044 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8045 AC_SUBST(WARNINGS_AS_ERRORS)
8046 AC_SUBST(MOZ_DBGRINFO_MODULES)
8047 AC_SUBST(MOZ_EXTENSIONS)
8048 AC_SUBST(MOZ_IMG_DECODERS)
8049 AC_SUBST(MOZ_IMG_ENCODERS)
8050 AC_SUBST(MOZ_JSDEBUGGER)
8051 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
8052 AC_SUBST(MOZ_PLUGINS)
8053 AC_SUBST(ENABLE_EAZEL_PROFILER)
8054 AC_SUBST(EAZEL_PROFILER_CFLAGS)
8055 AC_SUBST(EAZEL_PROFILER_LIBS)
8056 AC_SUBST(MOZ_PERF_METRICS)
8057 AC_SUBST(GC_LEAK_DETECTOR)
8058 AC_SUBST(MOZ_LOG_REFCNT)
8059 AC_SUBST(MOZ_LEAKY)
8060 AC_SUBST(MOZ_JPROF)
8061 AC_SUBST(MOZ_SHARK)
8062 AC_SUBST(MOZ_CALLGRIND)
8063 AC_SUBST(MOZ_VTUNE)
8064 AC_SUBST(MOZ_XPCTOOLS)
8065 AC_SUBST(MOZ_JSLOADER)
8066 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8067 AC_SUBST(MOZ_INSURE)
8068 AC_SUBST(MOZ_INSURE_DIRS)
8069 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
8070 AC_SUBST(MOZ_QUANTIFY)
8071 AC_SUBST(MOZ_INSURIFYING)
8072 AC_SUBST(LIBICONV)
8073 AC_SUBST(MOZ_PLACES)
8074 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8075 AC_SUBST(MOZ_STORAGE)
8076 AC_SUBST(MOZ_FEEDS)
8077 AC_SUBST(NS_PRINTING)
8079 AC_SUBST(MOZ_JAVAXPCOM)
8080 AC_SUBST(JAVA_INCLUDE_PATH)
8081 AC_SUBST(JAVA)
8082 AC_SUBST(JAVAC)
8083 AC_SUBST(JAR)
8085 AC_SUBST(MOZ_PROFILELOCKING)
8087 AC_SUBST(HAVE_XIE)
8088 AC_SUBST(MOZ_XIE_LIBS)
8089 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8091 AC_SUBST(XPCOM_USE_LEA)
8092 AC_SUBST(BUILD_STATIC_LIBS)
8093 AC_SUBST(MOZ_ENABLE_LIBXUL)
8094 AC_SUBST(ENABLE_TESTS)
8095 AC_SUBST(IBMBIDI)
8096 AC_SUBST(MOZ_UNIVERSALCHARDET)
8097 AC_SUBST(ACCESSIBILITY)
8098 AC_SUBST(MOZ_XPINSTALL)
8099 AC_SUBST(MOZ_VIEW_SOURCE)
8100 AC_SUBST(MOZ_SPELLCHECK)
8101 AC_SUBST(MOZ_XPFE_COMPONENTS)
8102 AC_SUBST(MOZ_USER_DIR)
8103 AC_SUBST(MOZ_CRASHREPORTER)
8105 AC_SUBST(ENABLE_STRIP)
8106 AC_SUBST(PKG_SKIP_STRIP)
8107 AC_SUBST(USE_ELF_DYNSTR_GC)
8108 AC_SUBST(INCREMENTAL_LINKER)
8109 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8110 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8111 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
8113 AC_SUBST(MOZ_FIX_LINK_PATHS)
8114 AC_SUBST(XPCOM_LIBS)
8115 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8116 AC_SUBST(XPCOM_GLUE_LDOPTS)
8117 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8119 AC_SUBST(USE_DEPENDENT_LIBS)
8121 AC_SUBST(MOZ_BUILD_ROOT)
8122 AC_SUBST(MOZ_OS2_TOOLS)
8123 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8125 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8126 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8127 AC_SUBST(MOZ_TIMELINE)
8128 AC_SUBST(WINCE)
8129 AC_SUBST(WINCE_SDK_DIR)
8131 AC_SUBST(MOZ_APP_NAME)
8132 AC_SUBST(MOZ_APP_DISPLAYNAME)
8133 AC_SUBST(MOZ_APP_VERSION)
8134 AC_SUBST(FIREFOX_VERSION)
8136 AC_SUBST(MOZ_PKG_SPECIAL)
8138 AC_SUBST(MOZILLA_OFFICIAL)
8139 AC_SUBST(BUILD_OFFICIAL)
8140 AC_SUBST(MOZ_MILESTONE_RELEASE)
8142 dnl win32 options
8143 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8144 AC_SUBST(MOZ_MAPINFO)
8145 AC_SUBST(MOZ_BROWSE_INFO)
8146 AC_SUBST(MOZ_TOOLS_DIR)
8147 AC_SUBST(CYGWIN_WRAPPER)
8148 AC_SUBST(AS_PERL)
8149 AC_SUBST(WIN32_REDIST_DIR)
8150 AC_SUBST(PYTHON)
8152 AC_SUBST(WINCE)
8153 AC_SUBST(WINCE_WINDOWS_MOBILE)
8155 dnl Echo the CFLAGS to remove extra whitespace.
8156 CFLAGS=`echo \
8157         $_WARNINGS_CFLAGS \
8158         $CFLAGS`
8160 CXXFLAGS=`echo \
8161         $_MOZ_RTTI_FLAGS \
8162         $_MOZ_EXCEPTIONS_FLAGS \
8163         $_WARNINGS_CXXFLAGS \
8164         $CXXFLAGS`
8166 COMPILE_CFLAGS=`echo \
8167     $_DEFINES_CFLAGS \
8168         $_DEPEND_CFLAGS \
8169     $COMPILE_CFLAGS`
8171 COMPILE_CXXFLAGS=`echo \
8172     $_DEFINES_CXXFLAGS \
8173         $_DEPEND_CFLAGS \
8174     $COMPILE_CXXFLAGS`
8176 AC_SUBST(SYSTEM_MAKEDEPEND)
8177 AC_SUBST(SYSTEM_LIBXUL)
8178 AC_SUBST(SYSTEM_JPEG)
8179 AC_SUBST(SYSTEM_PNG)
8180 AC_SUBST(SYSTEM_ZLIB)
8181 AC_SUBST(SYSTEM_BZ2)
8183 AC_SUBST(JPEG_CFLAGS)
8184 AC_SUBST(JPEG_LIBS)
8185 AC_SUBST(ZLIB_CFLAGS)
8186 AC_SUBST(ZLIB_LIBS)
8187 AC_SUBST(BZ2_CFLAGS)
8188 AC_SUBST(BZ2_LIBS)
8189 AC_SUBST(PNG_CFLAGS)
8190 AC_SUBST(PNG_LIBS)
8192 AC_SUBST(MOZ_JPEG_CFLAGS)
8193 AC_SUBST(MOZ_JPEG_LIBS)
8194 AC_SUBST(MOZ_ZLIB_CFLAGS)
8195 AC_SUBST(MOZ_ZLIB_LIBS)
8196 AC_SUBST(MOZ_BZ2_CFLAGS)
8197 AC_SUBST(MOZ_BZ2_LIBS)
8198 AC_SUBST(MOZ_PNG_CFLAGS)
8199 AC_SUBST(MOZ_PNG_LIBS)
8201 AC_SUBST(NSPR_CFLAGS)
8202 AC_SUBST(NSPR_LIBS)
8203 AC_SUBST(MOZ_NATIVE_NSPR)
8205 AC_SUBST(NSS_CFLAGS)
8206 AC_SUBST(NSS_LIBS)
8207 AC_SUBST(NSS_DEP_LIBS)
8208 AC_SUBST(MOZ_NATIVE_NSS)
8209 AC_SUBST(NSS_DISABLE_DBM)
8211 AC_SUBST(CFLAGS)
8212 AC_SUBST(CXXFLAGS)
8213 AC_SUBST(CPPFLAGS)
8214 AC_SUBST(COMPILE_CFLAGS)
8215 AC_SUBST(COMPILE_CXXFLAGS)
8216 AC_SUBST(LDFLAGS)
8217 AC_SUBST(LIBS)
8218 AC_SUBST(CROSS_COMPILE)
8219 AC_SUBST(WCHAR_CFLAGS)
8221 AC_SUBST(HOST_CC)
8222 AC_SUBST(HOST_CXX)
8223 AC_SUBST(HOST_CFLAGS)
8224 AC_SUBST(HOST_CXXFLAGS)
8225 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8226 AC_SUBST(HOST_AR)
8227 AC_SUBST(HOST_AR_FLAGS)
8228 AC_SUBST(HOST_LD)
8229 AC_SUBST(HOST_RANLIB)
8230 AC_SUBST(HOST_NSPR_MDCPUCFG)
8231 AC_SUBST(HOST_BIN_SUFFIX)
8232 AC_SUBST(HOST_OS_ARCH)
8234 AC_SUBST(TARGET_CPU)
8235 AC_SUBST(TARGET_VENDOR)
8236 AC_SUBST(TARGET_OS)
8237 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8238 AC_SUBST(TARGET_MD_ARCH)
8239 AC_SUBST(TARGET_XPCOM_ABI)
8240 AC_SUBST(OS_TARGET)
8241 AC_SUBST(OS_ARCH)
8242 AC_SUBST(OS_RELEASE)
8243 AC_SUBST(OS_TEST)
8245 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8246 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8248 AC_SUBST(WRAP_MALLOC_CFLAGS)
8249 AC_SUBST(WRAP_MALLOC_LIB)
8250 AC_SUBST(MKSHLIB)
8251 AC_SUBST(MKCSHLIB)
8252 AC_SUBST(MKSHLIB_FORCE_ALL)
8253 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8254 AC_SUBST(DSO_CFLAGS)
8255 AC_SUBST(DSO_PIC_CFLAGS)
8256 AC_SUBST(DSO_LDOPTS)
8257 AC_SUBST(LIB_PREFIX)
8258 AC_SUBST(DLL_PREFIX)
8259 AC_SUBST(DLL_SUFFIX)
8260 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8261 AC_SUBST(LIB_SUFFIX)
8262 AC_SUBST(OBJ_SUFFIX)
8263 AC_SUBST(BIN_SUFFIX)
8264 AC_SUBST(ASM_SUFFIX)
8265 AC_SUBST(IMPORT_LIB_SUFFIX)
8266 AC_SUBST(USE_N32)
8267 AC_SUBST(CC_VERSION)
8268 AC_SUBST(CXX_VERSION)
8269 AC_SUBST(MSMANIFEST_TOOL)
8271 if test "$USING_HCC"; then
8272    CC='${topsrcdir}/build/hcc'
8273    CC="$CC '$_OLDCC'"
8274    CXX='${topsrcdir}/build/hcpp'
8275    CXX="$CXX '$_OLDCXX'"
8276    AC_SUBST(CC)
8277    AC_SUBST(CXX)
8280 dnl Check for missing components
8281 if test "$COMPILE_ENVIRONMENT"; then
8282 if test "$MOZ_X11"; then
8283     dnl ====================================================
8284     dnl = Check if X headers exist
8285     dnl ====================================================
8286     _SAVE_CFLAGS=$CFLAGS
8287     CFLAGS="$CFLAGS $XCFLAGS"
8288     AC_TRY_COMPILE([
8289         #include <stdio.h>
8290         #include <stdlib.h>
8291         #include <X11/Xlib.h>
8292         #include <X11/Intrinsic.h>
8293     ],
8294     [
8295         Display *dpy = 0;
8296         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8297             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8298             exit(1);
8299         }
8300     ], [], 
8301     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8302     CFLAGS="$_SAVE_CFLAGS"
8304     if test ! -z "$MISSING_X"; then
8305         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8306     fi
8308 fi # MOZ_X11
8309 fi # COMPILE_ENVIRONMENT
8311 dnl Set various defines and substitutions
8312 dnl ========================================================
8314 if test "$OS_ARCH" = "BeOS"; then
8315   AC_DEFINE(XP_BEOS)
8316   MOZ_MOVEMAIL=1
8317 elif test "$OS_ARCH" = "Darwin"; then
8318   AC_DEFINE(XP_UNIX)
8319   AC_DEFINE(UNIX_ASYNC_DNS)
8320   MOZ_MOVEMAIL=1
8321 elif test "$OS_ARCH" = "OpenVMS"; then
8322   AC_DEFINE(XP_UNIX)
8323 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8324   AC_DEFINE(XP_UNIX)
8325   AC_DEFINE(UNIX_ASYNC_DNS)
8326   MOZ_MOVEMAIL=1
8328 AC_SUBST(MOZ_MOVEMAIL)
8330 if test "$MOZ_DEBUG"; then
8331     AC_DEFINE(MOZ_REFLOW_PERF)
8332     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8335 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8336     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8337     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8338     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8339     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8340     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8341     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8342     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8343     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8346 # Used for LD_LIBRARY_PATH of run_viewer target
8347 LIBS_PATH=
8348 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8349   case $lib_arg in
8350     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8351       * ) ;;
8352   esac
8353 done
8354 AC_SUBST(LIBS_PATH)
8356 dnl ========================================================
8357 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8358 dnl ========================================================
8359 case "$host_os" in
8360 mingw*)
8361     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8362     ;;
8363 cygwin*|msvc*|mks*)
8364     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8365     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8366     CC="\$(CYGWIN_WRAPPER) $CC"
8367     CXX="\$(CYGWIN_WRAPPER) $CXX"
8368     CPP="\$(CYGWIN_WRAPPER) $CPP"
8369     LD="\$(CYGWIN_WRAPPER) $LD"
8370     AS="\$(CYGWIN_WRAPPER) $AS"
8371     RC="\$(CYGWIN_WRAPPER) $RC"
8372     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8373     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8374     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8375     ;;
8376 esac
8378 AC_SUBST(CYGDRIVE_MOUNT)
8379 AC_SUBST(WIN_TOP_SRC)
8381 AC_SUBST(MOZILLA_VERSION)
8383 AC_SUBST(ac_configure_args)
8385 dnl Spit out some output
8386 dnl ========================================================
8388 dnl The following defines are used by xpcom
8389 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8390 CPP_THROW_NEW
8391 HAVE_CPP_2BYTE_WCHAR_T
8392 HAVE_CPP_ACCESS_CHANGING_USING
8393 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8394 HAVE_CPP_BOOL
8395 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8396 HAVE_CPP_EXPLICIT
8397 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8398 HAVE_CPP_NAMESPACE_STD
8399 HAVE_CPP_NEW_CASTS
8400 HAVE_CPP_PARTIAL_SPECIALIZATION
8401 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8402 HAVE_CPP_TYPENAME
8403 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8404 HAVE_STATVFS
8405 NEED_CPP_UNUSED_IMPLEMENTATIONS
8406 NEW_H
8407 HAVE_GETPAGESIZE
8408 HAVE_ICONV
8409 HAVE_ICONV_WITH_CONST_INPUT
8410 HAVE_MBRTOWC
8411 HAVE_SYS_MOUNT_H
8412 HAVE_SYS_VFS_H
8413 HAVE_WCRTOMB
8416 AC_CONFIG_HEADER(
8417 netwerk/necko-config.h
8418 xpcom/xpcom-config.h
8419 xpcom/xpcom-private.h
8422 # Save the defines header file before autoconf removes it.
8423 # (Do not add AC_DEFINE calls after this line.)
8424   _CONFIG_TMP=confdefs-tmp.h
8425   _CONFIG_DEFS_H=mozilla-config.h
8427   cat > $_CONFIG_TMP <<\EOF
8428 /* List of defines generated by configure. Included with preprocessor flag,
8429  * -include, to avoid long list of -D defines on the compile command-line.
8430  * Do not edit.
8431  */
8433 #ifndef _MOZILLA_CONFIG_H_
8434 #define _MOZILLA_CONFIG_H_
8437 _EGREP_PATTERN='^#define ('
8438 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8439     for f in $_NON_GLOBAL_ACDEFINES; do
8440         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8441     done
8443 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8445   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8447   cat >> $_CONFIG_TMP <<\EOF
8449 #endif /* _MOZILLA_CONFIG_H_ */
8453   # Only write mozilla-config.h when something changes (or it doesn't exist)
8454   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8455     rm $_CONFIG_TMP
8456   else
8457     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8458     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8460     echo ==== $_CONFIG_DEFS_H =================================
8461     cat $_CONFIG_DEFS_H
8462   fi
8464 dnl Probably shouldn't call this manually but we always want the output of DEFS
8465 rm -f confdefs.h.save
8466 mv confdefs.h confdefs.h.save
8467 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8468 AC_OUTPUT_MAKE_DEFS()
8469 MOZ_DEFINES=$DEFS
8470 AC_SUBST(MOZ_DEFINES)
8471 rm -f confdefs.h
8472 mv confdefs.h.save confdefs.h
8474 dnl Load the list of Makefiles to generate.
8475 dnl   To add new Makefiles, edit allmakefiles.sh.
8476 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8477 . ${srcdir}/allmakefiles.sh
8478 dnl 
8479 dnl Run a perl script to quickly create the makefiles.
8480 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8481 dnl   for the files it cannot handle correctly. This way, config.status
8482 dnl   will handle these files.
8483 dnl If it fails, nothing is set and config.status will run as usual.
8485 dnl This does not change the $MAKEFILES variable.
8487 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8489 if test -z "${AS_PERL}"; then
8490 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8491 else
8492 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8494 . ./conftest.sh
8495 rm conftest.sh
8497 echo $MAKEFILES > unallmakefiles
8499 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8501 AC_OUTPUT($MAKEFILES)
8503 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8504 if test "$CAIRO_FEATURES_H"; then
8505   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8506     echo "$CAIRO_FEATURES_H is unchanged"
8507     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8508   else
8509     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8510   fi
8513 dnl ========================================================
8514 dnl = Setup a nice relatively clean build environment for
8515 dnl = sub-configures.
8516 dnl ========================================================
8517 CC="$_SUBDIR_CC" 
8518 CXX="$_SUBDIR_CXX" 
8519 CFLAGS="$_SUBDIR_CFLAGS" 
8520 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8521 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8522 LDFLAGS="$_SUBDIR_LDFLAGS"
8523 HOST_CC="$_SUBDIR_HOST_CC" 
8524 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8525 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8528 unset MAKEFILES
8529 unset CONFIG_FILES
8531 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8532 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8534 if test -z "$MOZ_NATIVE_NSPR"; then
8535     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8536     if test -z "$MOZ_DEBUG"; then
8537         ac_configure_args="$ac_configure_args --disable-debug"
8538     fi
8539     if test "$MOZ_OPTIMIZE" = "1"; then
8540         ac_configure_args="$ac_configure_args --enable-optimize"
8541     fi
8542     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8543        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8544     fi
8545     if test -n "$HAVE_64BIT_OS"; then
8546         ac_configure_args="$ac_configure_args --enable-64bit"
8547     fi
8548     if test -n "$USE_ARM_KUSER"; then
8549         ac_configure_args="$ac_configure_args --with-arm-kuser"
8550     fi
8551     AC_OUTPUT_SUBDIRS(nsprpub)
8552     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8555 if test -z "$MOZ_NATIVE_NSPR"; then
8556     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8557     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8558     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8559        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8560        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8561        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8562        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8563     fi
8564     rm -f config/autoconf.mk.bak
8567 # Run the SpiderMonkey 'configure' script.
8568 dist=$MOZ_BUILD_ROOT/dist
8569 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8570 ac_configure_args="$ac_configure_args --enable-threadsafe"
8571 if test -z "$MOZ_NATIVE_NSPR"; then
8572     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8573     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8575 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8576 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8577 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8578 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8579 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8580 if test "$MOZ_MEMORY"; then
8581    ac_configure_args="$ac_configure_args --enable-jemalloc"
8582    if test -n "$MOZ_MEMORY_LDFLAGS"; then
8583      export MOZ_MEMORY_LDFLAGS
8584    fi
8586 AC_OUTPUT_SUBDIRS(js/src)
8587 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8589 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8591 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8592 dnl Needs to be at the end to respect possible changes from NSPR configure
8593 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8594   echo "config/autoconf.mk is unchanged"
8595   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8596 else
8597   rm -f config/autoconf.mk.orig 2> /dev/null