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