Bug 509449 - Minimized browser window restores during page loads. r=jimm.
[mozilla-central.git] / configure.in
blob31d5a4ef34a8e80d8531b207a09c6f4b627d9352
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.5.sdk $CFLAGS"
358         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.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.5)
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         export MACOSX_DEPLOYMENT_TARGET=10.5
921     fi
922     ;;
923 esac
925 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
927 dnl ========================================================
928 dnl = Mac OS X SDK support
929 dnl ========================================================
930 MACOS_SDK_DIR=
931 NEXT_ROOT=
932 MOZ_ARG_WITH_STRING(macos-sdk,
933 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
934     MACOS_SDK_DIR=$withval)
936 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
937 dnl NEXT_ROOT will be set and exported only if it's needed.
938 AC_SUBST(MACOS_SDK_DIR)
939 AC_SUBST(NEXT_ROOT)
941 if test "$MACOS_SDK_DIR"; then
942   dnl Sync this section with the ones in NSPR and NSS.
943   dnl Changes to the cross environment here need to be accounted for in
944   dnl the libIDL checks (below) and xpidl build.
946   if test ! -d "$MACOS_SDK_DIR"; then
947     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
948 specify a valid SDK.  SDKs are installed when the optional cross-development
949 tools are selected during the Xcode/Developer Tools installation.])
950   fi
952   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
953   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
954     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
955   else
956     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
957     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
959     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
960     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
961     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
963     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
964       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
965       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
966       dnl be ignored and cause warnings when -syslibroot is specified.
967       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
968       dnl the -isysroot it receives, so this is only needed with 4.0.0.
969       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
970     fi
971   fi
973   AC_LANG_SAVE
974   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
975   AC_LANG_CPLUSPLUS
976   AC_TRY_COMPILE([#include <new>
977                  int main() { return 0; }],
978    result=yes,
979    result=no)
980   AC_LANG_RESTORE
981   AC_MSG_RESULT($result)
983   if test "$result" = "no" ; then
984     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
985   fi
988 fi # COMPILE_ENVIRONMENT
990 dnl Be sure the make we use is GNU make.
991 dnl on win32, gmake.exe is the generally the wrong version
992 if test -n "$MAKE"; then
993   if test `echo $MAKE | grep -c make.py` != 1; then
994      NOT_PYMAKE=$MAKE
995   fi
998 case "$host_os" in
999 cygwin*|mingw*|mks*|msvc*)
1000     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1001     ;;
1003     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1004     ;;
1005 esac
1006 if test "$GMAKE" = ":"; then
1007    AC_MSG_ERROR([GNU make not found])
1009 AC_SUBST(GMAKE)
1011 if test "$COMPILE_ENVIRONMENT"; then
1013 AC_PATH_XTRA
1015 XCFLAGS="$X_CFLAGS"
1017 fi # COMPILE_ENVIRONMENT
1019 dnl ========================================================
1020 dnl set the defaults first
1021 dnl ========================================================
1022 AS_BIN=$AS
1023 AR_FLAGS='cr $@'
1024 AR_LIST='$(AR) t'
1025 AR_EXTRACT='$(AR) x'
1026 AR_DELETE='$(AR) d'
1027 AS='$(CC)'
1028 AS_DASH_C_FLAG='-c'
1029 DLL_PREFIX=lib
1030 LIB_PREFIX=lib
1031 DLL_SUFFIX=.so
1032 OBJ_SUFFIX=o
1033 LIB_SUFFIX=a
1034 ASM_SUFFIX=s
1035 IMPORT_LIB_SUFFIX=
1036 TARGET_MD_ARCH=unix
1037 DIRENT_INO=d_ino
1038 CYGWIN_WRAPPER=
1039 WIN_TOP_SRC=
1040 MOZ_USER_DIR=".mozilla"
1041 HOST_AR='$(AR)'
1042 HOST_AR_FLAGS='$(AR_FLAGS)'
1044 MOZ_JPEG_CFLAGS=
1045 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1046 MOZ_ZLIB_CFLAGS=
1047 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1048 MOZ_BZ2_CFLAGS=
1049 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1050 MOZ_PNG_CFLAGS=
1051 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1053 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1054 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
1055 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1056 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
1057 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1058 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1059 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1061 MOZ_FS_LAYOUT=unix
1063 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1065 USE_DEPENDENT_LIBS=1
1067 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1069 MOZ_ENABLE_POSTSCRIPT=1 
1071 if test -n "$CROSS_COMPILE"; then
1072     OS_TARGET="${target_os}"
1073     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1074     OS_RELEASE=
1075     case "${target_os}" in
1076         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1077         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1078         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1079         mingw*)       OS_ARCH=WINNT ;;
1080         wince*)       OS_ARCH=WINCE ;;
1081         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1082     esac
1083 else
1084     OS_TARGET=`uname -s`
1085     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1086     OS_RELEASE=`uname -r`
1089 # Before this used `uname -m` when not cross compiling
1090 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1091 OS_TEST="${target_cpu}"
1093 _COMPILER_PREFIX=
1095 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1097 #######################################################################
1098 # Master "Core Components" macros for getting the OS target           #
1099 #######################################################################
1102 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1103 # cross-compilation.
1107 # Define and override various archtecture-specific variables, including
1108 # HOST_OS_ARCH
1109 # OS_ARCH
1110 # OS_TEST
1111 # OS_TARGET
1112 # OS_RELEASE
1113 # OS_MINOR_RELEASE
1116 case "$HOST_OS_ARCH" in
1117 cygwin*|mingw*|mks*|msvc*)
1118     HOST_OS_ARCH=WINNT
1119     ;;
1120 linux*)
1121     HOST_OS_ARCH=Linux
1122     ;;
1123 solaris*)
1124     HOST_OS_ARCH=SunOS
1125     SOLARIS_SUNPRO_CC=
1126     SOLARIS_SUNPRO_CXX=
1127     if test -z "$GNU_CC"; then
1128         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1129             SOLARIS_SUNPRO_CC=1
1130        fi
1131     fi
1133     if test -z "$GNU_CXX"; then
1134        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1135            SOLARIS_SUNPRO_CXX=1
1136        fi
1137     fi
1138     AC_SUBST(SOLARIS_SUNPRO_CC)
1139     AC_SUBST(SOLARIS_SUNPRO_CXX)
1140     ;;
1141 BSD_386)
1142     HOST_OS_ARCH=BSD
1143     ;;
1144 dgux)
1145     HOST_OS_ARCH=DGUX
1146     ;;
1147 IRIX64)
1148     HOST_OS_ARCH=IRIX
1149     ;;
1150 UNIX_SV)
1151     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1152         HOST_OS_ARCH=NCR
1153     else
1154         HOST_OS_ARCH=UNIXWARE
1155     fi
1156     ;;
1157 ncr)
1158     HOST_OS_ARCH=NCR
1159     ;;
1160 UNIX_SYSTEM_V)
1161     HOST_OS_ARCH=NEC
1162     ;;
1163 OSF1)
1164     ;;
1165 *OpenVMS*)
1166     HOST_OS_ARCH=OpenVMS
1167     ;;
1168 OS_2)
1169     HOST_OS_ARCH=OS2
1170     ;;
1171 QNX)
1172     ;;
1173 SCO_SV)
1174     HOST_OS_ARCH=SCOOS
1175     ;;
1176 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1177     HOST_OS_ARCH=SINIX
1178     ;;
1179 UnixWare)
1180     HOST_OS_ARCH=UNIXWARE
1181     ;;
1182 esac
1184 case "$OS_ARCH" in
1185 WINNT)
1186     OS_TEST=`uname -p`
1187     ;;
1188 Windows_NT)
1190 # If uname -s returns "Windows_NT", we assume that we are using
1191 # the uname.exe in MKS toolkit.
1193 # The -r option of MKS uname only returns the major version number.
1194 # So we need to use its -v option to get the minor version number.
1195 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1197     OS_ARCH=WINNT
1198     OS_TARGET=WINNT
1199     OS_MINOR_RELEASE=`uname -v`
1200     if test "$OS_MINOR_RELEASE" = "00"; then
1201         OS_MINOR_RELEASE=0
1202     fi
1203     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1204     ;;
1205 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1207 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1208 # the uname.exe in the Cygwin tools.
1209 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1210 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1211 # the uname.exe in the GNU-Win32 tools.
1212 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1213 # the uname.exe in the MSYS tools.
1215     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1216     OS_ARCH=WINNT
1217     OS_TARGET=WINNT
1218     ;;
1219 AIX)
1220     OS_RELEASE=`uname -v`.`uname -r`
1221     OS_TEST=${target_cpu}
1222     ;;
1223 BSD_386)
1224     OS_ARCH=BSD
1225     ;;
1226 dgux)
1227     OS_ARCH=DGUX
1228     ;;
1229 IRIX64)
1230     OS_ARCH=IRIX
1231     ;;
1232 UNIX_SV)
1233     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1234         OS_ARCH=NCR
1235     else
1236         OS_ARCH=UNIXWARE
1237         OS_RELEASE=`uname -v`
1238     fi
1239     ;;
1240 ncr)
1241     OS_ARCH=NCR
1242     ;;
1243 UNIX_SYSTEM_V)
1244     OS_ARCH=NEC
1245     ;;
1246 OSF1)
1247     case `uname -v` in
1248     148)
1249         OS_RELEASE=V3.2C
1250         ;;
1251     564)
1252         OS_RELEASE=V4.0B
1253         ;;
1254     878)
1255         OS_RELEASE=V4.0D
1256         ;;
1257     esac
1258     ;;
1259 *OpenVMS*)
1260     OS_ARCH=OpenVMS
1261     OS_RELEASE=`uname -v`
1262     OS_TEST=`uname -p`
1263     ;;
1264 OS_2)
1265     OS_ARCH=OS2
1266     OS_TARGET=OS2
1267     OS_RELEASE=`uname -v`
1268     ;;
1269 QNX)
1270     if test "$OS_TARGET" != "NTO"; then
1271         changequote(,)
1272         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1273         changequote([,])
1274     fi
1275     OS_TEST=x86
1276     ;;
1277 SCO_SV)
1278     OS_ARCH=SCOOS
1279     OS_RELEASE=5.0
1280     ;;
1281 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1282     OS_ARCH=SINIX
1283     OS_TEST=`uname -p`
1284     ;;
1285 UnixWare)
1286     OS_ARCH=UNIXWARE
1287     OS_RELEASE=`uname -v`
1288     ;;
1289 WINCE)
1290     OS_ARCH=WINCE
1291     OS_TARGET=WINCE
1292     ;;
1293 Darwin)
1294     case "${target_cpu}" in
1295     powerpc*)
1296         OS_TEST=ppc
1297         ;;
1298     i*86*)
1299         OS_TEST=i386 
1300         ;;
1301     x86_64)
1302         OS_TEST=x86_64
1303         ;;
1304     *)
1305         if test -z "$CROSS_COMPILE" ; then
1306             OS_TEST=`uname -p`
1307         fi
1308         ;;
1309     esac
1310     ;;
1311 esac
1313 if test "$OS_ARCH" = "NCR"; then
1314     changequote(,)
1315     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1316     changequote([,])
1319 # Only set CPU_ARCH if we recognize the value of OS_TEST
1321 case "$OS_TEST" in
1322 *86 | i86pc)
1323     CPU_ARCH=x86
1324     ;;
1326 powerpc* | ppc | rs6000)
1327     CPU_ARCH=ppc
1328     ;;
1330 Alpha | alpha | ALPHA)
1331     CPU_ARCH=Alpha
1332     ;;
1334 hppa* | parisc)
1335     CPU_ARCH=hppa
1336     ;;
1338 sun4u | sparc*)
1339     CPU_ARCH=sparc
1340     ;;
1342 x86_64 | ia64)
1343     CPU_ARCH="$OS_TEST"
1344     ;;
1346 arm)
1347     if test "$OS_TARGET" = "WINCE"; then
1348         CPU_ARCH="$OS_TEST"
1349     fi
1350     ;;
1351 esac
1353 if test -z "$OS_TARGET"; then
1354     OS_TARGET=$OS_ARCH
1356 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1358 dnl ========================================================
1359 dnl GNU specific defaults
1360 dnl ========================================================
1361 if test "$GNU_CC"; then
1362     # FIXME: Let us build with strict aliasing. bug 414641.
1363     CFLAGS="$CFLAGS -fno-strict-aliasing"
1364     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1365     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1366     DSO_LDOPTS='-shared'
1367     if test "$GCC_USE_GNU_LD"; then
1368         # Don't allow undefined symbols in libraries
1369         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1370     fi
1371     WARNINGS_AS_ERRORS='-Werror'
1372     DSO_CFLAGS=''
1373     DSO_PIC_CFLAGS='-fPIC'
1374     ASFLAGS="$ASFLAGS -fPIC"
1375     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1376     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1377     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1378     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1380     # Turn on GNU specific features
1381     # -Wall - turn on all warnings
1382     # -pedantic - make compiler warn about non-ANSI stuff, and
1383     #             be a little bit stricter
1384     # Warnings slamm took out for now (these were giving more noise than help):
1385     # -Wbad-function-cast - warns when casting a function to a new return type
1386     # -Wshadow - removed because it generates more noise than help --pete
1387     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1388     if test -z "$INTEL_CC"; then
1389        # Don't use -Wcast-align with ICC
1390        case "$CPU_ARCH" in
1391            # And don't use it on hppa, ia64, sparc, since it's noisy there
1392            hppa | ia64 | sparc)
1393            ;;
1394            *)
1395         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1396            ;;
1397        esac
1398     fi
1400     dnl Turn pedantic on but disable the warnings for long long
1401     _PEDANTIC=1
1403     if test -z "$INTEL_CC"; then
1404       _IGNORE_LONG_LONG_WARNINGS=1
1405       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1406     else
1407       _IGNORE_LONG_LONG_WARNINGS=
1408     fi
1411     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1412     _USE_CPP_INCLUDE_FLAG=1
1413 elif test "$SOLARIS_SUNPRO_CC"; then
1414     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1415     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1417     DSO_LDOPTS='-shared'
1418     if test "$GNU_LD"; then
1419         # Don't allow undefined symbols in libraries
1420         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1421     fi
1423     DSO_CFLAGS=''
1424     if test "$CPU_ARCH" = "sparc"; then
1425         # for Sun Studio on Solaris/SPARC
1426         DSO_PIC_CFLAGS='-xcode=pic32'
1427     else
1428         DSO_PIC_CFLAGS='-KPIC'
1429     fi
1430     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1431 else
1432     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1433     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1435     DSO_LDOPTS='-shared'
1436     if test "$GNU_LD"; then
1437         # Don't allow undefined symbols in libraries
1438         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1439     fi
1441     DSO_CFLAGS=''
1442     DSO_PIC_CFLAGS='-KPIC'
1443     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1446 if test "$GNU_CXX"; then
1447     # FIXME: Let us build with strict aliasing. bug 414641.
1448     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1449     # Turn on GNU specific features
1450     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1451     if test -z "$INTEL_CC"; then
1452        # Don't use -Wcast-align with ICC
1453        case "$CPU_ARCH" in
1454            # And don't use it on hppa, ia64, sparc, since it's noisy there
1455            hppa | ia64 | sparc)
1456            ;;
1457            *)
1458         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1459            ;;
1460        esac
1461     fi
1463     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1464     _USE_CPP_INCLUDE_FLAG=1
1466     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1467                    ac_has_wno_invalid_offsetof,
1468         [
1469             AC_LANG_SAVE
1470             AC_LANG_CPLUSPLUS
1471             _SAVE_CXXFLAGS="$CXXFLAGS"
1472             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1473             AC_TRY_COMPILE([],
1474                            [return(0);],
1475                            ac_has_wno_invalid_offsetof="yes",
1476                            ac_has_wno_invalid_offsetof="no")
1477             CXXFLAGS="$_SAVE_CXXFLAGS"
1478             AC_LANG_RESTORE
1479         ])
1480     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1481         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1482     fi
1483 else
1484     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1487 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1488 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1489 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1490 dnl normal behavior.
1491 dnl ========================================================
1492 MKSHLIB_FORCE_ALL=
1493 MKSHLIB_UNFORCE_ALL=
1495 if test "$COMPILE_ENVIRONMENT"; then
1496 if test "$GNU_CC"; then
1497   AC_MSG_CHECKING(whether ld has archive extraction flags)
1498   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1499    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1500     ac_cv_mkshlib_force_and_unforce="no"
1501     exec 3<&0 <<LOOP_INPUT
1502         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1503         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1504         force="-Wl,-all";              unforce="-Wl,-none"
1505 LOOP_INPUT
1506     while read line
1507     do
1508       eval $line
1509       LDFLAGS=$force
1510       LIBS=$unforce
1511       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1512     done
1513     exec 0<&3 3<&-
1514     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1515    ])
1516   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1517     AC_MSG_RESULT(no)
1518   else
1519     AC_MSG_RESULT(yes)
1520     eval $ac_cv_mkshlib_force_and_unforce
1521     MKSHLIB_FORCE_ALL=$force
1522     MKSHLIB_UNFORCE_ALL=$unforce
1523   fi
1524 fi # GNU_CC
1525 fi # COMPILE_ENVIRONMENT
1527 dnl =================================================================
1528 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1529 dnl which is bad when cross compiling.
1530 dnl =================================================================
1531 if test "$COMPILE_ENVIRONMENT"; then
1532 configure_static_assert_macros='
1533 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1534 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1535 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1538 dnl test that the macros actually work:
1539 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1540 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1541  [AC_LANG_SAVE
1542   AC_LANG_C
1543   ac_cv_static_assertion_macros_work="yes"
1544   AC_TRY_COMPILE([$configure_static_assert_macros],
1545                  [CONFIGURE_STATIC_ASSERT(1)],
1546                  ,
1547                  ac_cv_static_assertion_macros_work="no")
1548   AC_TRY_COMPILE([$configure_static_assert_macros],
1549                  [CONFIGURE_STATIC_ASSERT(0)],
1550                  ac_cv_static_assertion_macros_work="no",
1551                  )
1552   AC_LANG_CPLUSPLUS
1553   AC_TRY_COMPILE([$configure_static_assert_macros],
1554                  [CONFIGURE_STATIC_ASSERT(1)],
1555                  ,
1556                  ac_cv_static_assertion_macros_work="no")
1557   AC_TRY_COMPILE([$configure_static_assert_macros],
1558                  [CONFIGURE_STATIC_ASSERT(0)],
1559                  ac_cv_static_assertion_macros_work="no",
1560                  )
1561   AC_LANG_RESTORE
1562  ])
1563 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1564 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1565     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1567 fi # COMPILE_ENVIRONMENT
1569 dnl ========================================================
1570 dnl Checking for 64-bit OS
1571 dnl ========================================================
1572 if test "$COMPILE_ENVIRONMENT"; then
1573 AC_LANG_SAVE
1574 AC_LANG_C
1575 AC_MSG_CHECKING(for 64-bit OS)
1576 AC_TRY_COMPILE([$configure_static_assert_macros],
1577                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1578                result="yes", result="no")
1579 AC_MSG_RESULT("$result")
1580 if test "$result" = "yes"; then
1581     AC_DEFINE(HAVE_64BIT_OS)
1582     HAVE_64BIT_OS=1
1584 AC_SUBST(HAVE_64BIT_OS)
1585 AC_LANG_RESTORE
1586 fi # COMPILE_ENVIRONMENT
1588 dnl ========================================================
1589 dnl Enable high-memory support on OS/2 by default.
1590 dnl ========================================================
1591 MOZ_OS2_HIGH_MEMORY=1
1592 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1593 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1594     MOZ_OS2_HIGH_MEMORY=,
1595     MOZ_OS2_HIGH_MEMORY=1 )
1596 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1598 dnl ========================================================
1599 dnl System overrides of the defaults for host
1600 dnl ========================================================
1601 case "$host" in
1602 *-beos*)
1603     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1604     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1605     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1606     ;;
1608 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1609     # we need Python 2.5 on Windows
1610     PYTHON_VERSION=2.5
1611     if test -n "$_WIN32_MSVC"; then
1612         HOST_AR=lib
1613         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1614         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1615         HOST_RANLIB='echo ranlib'
1616     else
1617         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1618     fi
1619     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1620     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1621     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1622     HOST_BIN_SUFFIX=.exe
1623     case "$host" in
1624     *mingw*)
1625     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1626         PERL="/bin/sh ${srcdir}/build/msys-perl-wrapper"
1627         ;;
1628     *)
1629         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1630         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1631             _pwd=`pwd`
1632             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1633         fi
1634         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1635             AS_PERL=1
1636             PERL="${CYGWIN_WRAPPER} $PERL"
1637         fi
1639         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1640             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1641         fi
1642         ;;
1643     esac
1644     ;;
1646 *-darwin*)
1647     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1648     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1649     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1650     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1651     ;;
1653 *-linux*|*-kfreebsd*-gnu)
1654     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1655     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1656     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1657     ;;
1659 *os2*)
1660     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1661     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1662     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1663     HOST_BIN_SUFFIX=.exe
1664     MOZ_FIX_LINK_PATHS=
1665     ;;
1667 *-osf*)
1668     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1669     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1670     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1671     ;;
1674     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1675     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1676     ;;
1677 esac
1679 dnl We require version 2.4 or newer of Python to build,
1680 dnl and 2.5 or newer on Windows.
1681 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1682 changequote(,)
1683 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1684 _python_res=$?
1685 changequote([,])
1686 if test "$_python_res" != 0; then
1687     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1689 AC_MSG_RESULT([yes])
1691 dnl Get mozilla version from central milestone file
1692 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1694 dnl Get version of various core apps from the version files.
1695 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1697 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1698 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1700 dnl ========================================================
1701 dnl System overrides of the defaults for target
1702 dnl ========================================================
1704 case "$target" in
1705 *-aix*)
1706     AC_DEFINE(AIX)
1707     if test ! "$GNU_CC"; then
1708         if test ! "$HAVE_64BIT_OS"; then
1709             # Compiling with Visual Age C++ object model compat is the
1710             # default. To compile with object model ibm, add 
1711             # AIX_OBJMODEL=ibm to .mozconfig.
1712             if test "$AIX_OBJMODEL" = "ibm"; then
1713                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1714             else
1715                 AIX_OBJMODEL=compat
1716             fi
1717         else
1718             AIX_OBJMODEL=compat
1719         fi
1720         AC_SUBST(AIX_OBJMODEL)
1721         DSO_LDOPTS='-qmkshrobj=1'
1722         DSO_CFLAGS='-qflag=w:w'
1723         DSO_PIC_CFLAGS=
1724         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1725         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1726         MOZ_FIX_LINK_PATHS=
1727         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1728         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1729         if test "$COMPILE_ENVIRONMENT"; then
1730             AC_LANG_SAVE
1731             AC_LANG_CPLUSPLUS
1732             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1733             AC_TRY_COMPILE([],
1734                 [#if (__IBMCPP__ < 600)
1735                  #error "Bad compiler"
1736                  #endif],
1737                 _BAD_COMPILER=,_BAD_COMPILER=1)
1738             if test -n "$_BAD_COMPILER"; then
1739                 AC_MSG_RESULT([no])    
1740                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1741             else
1742                 AC_MSG_RESULT([yes])    
1743             fi
1744             AC_LANG_RESTORE
1745             TARGET_COMPILER_ABI="ibmc"
1746             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1747             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1748         fi
1749     fi
1750     case "${target_os}" in
1751     aix4.1*)
1752         DLL_SUFFIX='_shr.a'
1753         ;;
1754     esac
1755     if test "$COMPILE_ENVIRONMENT"; then
1756         AC_CHECK_HEADERS(sys/inttypes.h)
1757     fi
1758     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1759     ;;
1761 *-beos*)
1762     no_x=yes
1763     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1764     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1765     DSO_LDOPTS='-nostart'
1766     TK_LIBS='-lbe -lroot'
1767     LIBS="$LIBS -lbe"
1768     if test "$COMPILE_ENVIRONMENT"; then
1769         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1770         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1771     fi
1772     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1773     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1774     _MOZ_USE_RTTI=1
1775     USE_DEPENDENT_LIBS=
1776     MOZ_USER_DIR="Mozilla"
1777     ;;
1779 *-bsdi*)
1780     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1781     _PEDANTIC=
1782     _IGNORE_LONG_LONG_WARNINGS=
1783     case $OS_RELEASE in
1784         4.*|5.*)
1785             STRIP="$STRIP -d"
1786             ;;
1787         *)
1788             DSO_CFLAGS=''
1789             DSO_LDOPTS='-r'
1790             _WARNINGS_CFLAGS="-Wall"
1791             _WARNINGS_CXXFLAGS="-Wall"
1792             # The test above doesn't work properly, at least on 3.1.
1793             MKSHLIB_FORCE_ALL=''
1794             MKSHLIB_UNFORCE_ALL=''
1795         ;;
1796     esac
1797     ;;
1799 *-darwin*) 
1800     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1801     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1802     MOZ_OPTIMIZE_FLAGS="-O3"
1803     _PEDANTIC=
1804     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1805     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1806     DLL_SUFFIX=".dylib"
1807     DSO_LDOPTS=''
1808     STRIP="$STRIP -x -S"
1809     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1810     MOZ_ENABLE_POSTSCRIPT=
1811     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1812     # The ExceptionHandling framework is needed for Objective-C exception
1813     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1814     # builds.
1815     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1817     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1818     dnl ===================================================================
1819     if test "x$enable_dtrace" = "xyes"; then
1820         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1821     else
1822         dnl check for the presence of the -dead_strip linker flag
1823         AC_MSG_CHECKING([for -dead_strip option to ld])
1824         _SAVE_LDFLAGS=$LDFLAGS
1825         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1826         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1827         if test -n "$_HAVE_DEAD_STRIP" ; then
1828             AC_MSG_RESULT([yes])
1829             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1830         else
1831             AC_MSG_RESULT([no])
1832         fi
1833         
1834         LDFLAGS=$_SAVE_LDFLAGS
1835     fi
1836     ;;
1838 *-freebsd*)
1839     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1840         DLL_SUFFIX=".so.1.0"
1841         DSO_LDOPTS="-shared"
1842     fi
1843     if test ! "$GNU_CC"; then
1844         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1845     fi
1846 # Can't have force w/o an unforce.
1847 #    # Hack for FreeBSD 2.2
1848 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1849 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1850 #       MKSHLIB_UNFORCE_ALL=''
1851 #    fi
1852     ;; 
1854 *-hpux*)
1855     DLL_SUFFIX=".sl"
1856     if test ! "$GNU_CC"; then
1857         DSO_LDOPTS='-b -Wl,+s'
1858         DSO_CFLAGS=""
1859         DSO_PIC_CFLAGS="+Z"
1860         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1861         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1862         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1863     else
1864         DSO_LDOPTS='-b -E +s'
1865         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1866         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1867     fi
1868     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1869     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1870     ;;
1872 *-irix5*)
1873     AC_DEFINE(IRIX)
1874     DSO_LDOPTS='-elf -shared'
1876     if test "$GNU_CC"; then
1877        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1878        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1879        MKSHLIB_FORCE_ALL='-Wl,-all'
1880        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1881        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1882     else
1883        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1884        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1885        MKSHLIB_FORCE_ALL='-all'
1886        MKSHLIB_UNFORCE_ALL='-none'
1887     fi
1888     ;;
1890 *-irix6*)
1891     AC_DEFINE(IRIX)
1892     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1893     dnl compile and link using -n32
1894     USE_N32=1
1895     TARGET_COMPILER_ABI=n32
1896     DSO_LDOPTS='-elf -shared'
1897     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1898     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1899     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1900     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1901     if test "$GNU_CC"; then
1902        MKSHLIB_FORCE_ALL='-Wl,-all'
1903        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1904        _WARNINGS_CFLAGS="-Wall"
1905        _WARNINGS_CXXFLAGS="-Wall"
1906        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1907     else
1908        MKSHLIB_FORCE_ALL='-all'
1909        MKSHLIB_UNFORCE_ALL='-none'
1910            AR_LIST="$AR t"
1911            AR_EXTRACT="$AR x"
1912            AR_DELETE="$AR d"
1913            AR='$(CXX) -ar'
1914            AR_FLAGS='-o $@'
1915        CFLAGS="$CFLAGS -woff 3262 -G 4"
1916        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1917        if test -n "$USE_N32"; then
1918            ASFLAGS="$ASFLAGS -n32"
1919            CFLAGS="$CFLAGS -n32"
1920            CXXFLAGS="$CXXFLAGS -n32"
1921            LDFLAGS="$LDFLAGS -n32"
1922        fi
1923        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1924        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1925        MOZ_FIX_LINK_PATHS=
1926     fi
1927     if test -z "$GNU_CXX"; then
1928       MIPSPRO_CXX=1
1929     fi
1930     ;;
1932 *-*linux*)
1933     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1934     # Similarly for GNU_CXX and INTEL_CXX.
1935     if test "$INTEL_CC" || test "$INTEL_CXX"; then
1936         # -Os has been broken on Intel's C/C++ compilers for quite a
1937         # while; Intel recommends against using it.
1938         MOZ_OPTIMIZE_FLAGS="-O2"
1939         MOZ_DEBUG_FLAGS="-g -fno-inline"
1940     elif test "$GNU_CC" || test "$GNU_CXX"; then
1941         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1942         case $GCC_VERSION in
1943         4.1.*|4.2.*)
1944             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1945             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1946         esac
1947         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1948         MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1949                                           # and that combo is not yet good at
1950                                           # debugging inlined functions (even
1951                                           # when using DWARF2 as the debugging
1952                                           # format)
1953     fi
1955     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1957     MOZ_MEMORY=1
1959     case "${target_cpu}" in
1960     alpha*)
1961         CFLAGS="$CFLAGS -mieee"
1962         CXXFLAGS="$CXXFLAGS -mieee"
1963     ;;
1964     i*86)
1965         USE_ELF_DYNSTR_GC=1
1966     ;;
1967     mips*)
1968         MOZ_DEBUG_FLAGS="-g" # We want inlining
1969     ;;
1970     esac
1971     ;;
1973 *-wince*)
1974     TARGET_COMPILER_ABI=msvc
1975     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1976     AR_LIST="$AR -list"
1977     AR_EXTRACT="$AR -extract"
1978     AR_DELETE="$AR d"
1979     AR_FLAGS='-OUT:"$@"'
1981     if test "$AS_BIN"; then
1982         AS="$AS_BIN"
1983     fi
1984     DSO_CFLAGS=
1985     DSO_PIC_CFLAGS=
1986     DLL_SUFFIX=.dll
1987     BIN_SUFFIX='.exe'
1988     if test -z "$RC"; then 
1989         RC=rc.exe  
1990     fi
1991     # certain versions of cygwin's makedepend barf on the 
1992     # #include <string> vs -I./dist/include/string issue so don't use it
1993     SYSTEM_MAKEDEPEND=
1995     HOST_CC=cl
1996     HOST_CXX=cl
1997     HOST_LD=link
1998     HOST_AR='lib -OUT:$@'
1999     HOST_RANLIB='echo ranlib'
2000     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2001         
2002         
2003     WARNINGS_AS_ERRORS='-WX'
2004     MOZ_OPTIMIZE_FLAGS='-Ox'
2005     AR_FLAGS='-NOLOGO -OUT:"$@"'
2006     ASM_SUFFIX=asm
2007     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2008     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2009     DLL_PREFIX=
2010     DOXYGEN=:
2011     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2012     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2013     GARBAGE=
2014     IMPORT_LIB_SUFFIX=lib
2015     LIBS="$LIBS"
2016     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2017     LIB_PREFIX=
2018     LIB_SUFFIX=lib 
2019     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2020     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2021     MKSHLIB_FORCE_ALL=
2022     MKSHLIB_UNFORCE_ALL=
2023     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2024     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2025     MOZ_DEBUG_FLAGS='-Zi'
2026     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2027     MOZ_FIX_LINK_PATHS=
2028     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2029     OBJ_SUFFIX=obj
2030     RANLIB='echo not_ranlib'
2031     STRIP='echo not_strip'
2032     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2033     UNZIP=unzip
2034     XARGS=xargs
2035     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2036     ZIP=zip
2037     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2038     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2039     STATIC_LIBIDL=1
2040     MOZ_TREE_FREETYPE=1
2042     AC_DEFINE(HAVE_SNPRINTF)
2043     AC_DEFINE(_WINDOWS)
2044     AC_DEFINE(WIN32)
2045     AC_DEFINE(XP_WIN)
2046     AC_DEFINE(XP_WIN32)
2047     AC_DEFINE(HW_THREADS)
2048     AC_DEFINE(STDC_HEADERS)
2049     AC_DEFINE(NEW_H, <new>)
2050     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2051     AC_DEFINE(HAVE_LOCALTIME_R)
2053     TARGET_MD_ARCH=win32
2054     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2055     BIN_SUFFIX='.exe'
2056     MOZ_ENABLE_POSTSCRIPT=
2057     MOZ_USER_DIR="Mozilla"
2059     MOZ_GFX_OPTIMIZE_MOBILE=1
2061     # Sanity check for WINCE_WINDOWS_MOBILE
2062     # XXX disabled until we can fix the mobile tinderbox
2063     ##if test "$WINCE_WINDOWS_MOBILE"; then
2064     ##   AC_CHECK_HEADER(tpcshell.h, [],
2065     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2066     ##fi
2070 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2071     DSO_CFLAGS=
2072     DSO_PIC_CFLAGS=
2073     DLL_SUFFIX=.dll
2074     RC=rc.exe
2075     # certain versions of cygwin's makedepend barf on the 
2076     # #include <string> vs -I./dist/include/string issue so don't use it
2077     SYSTEM_MAKEDEPEND=
2078     if test -n "$GNU_CC"; then
2079         CC="$CC -mno-cygwin"
2080         CXX="$CXX -mno-cygwin"
2081         CPP="$CPP -mno-cygwin"
2082         CFLAGS="$CFLAGS -mms-bitfields"
2083         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2084         DSO_LDOPTS='-shared'
2085         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2086         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2087         RC='$(WINDRES)'
2088         # Use temp file for windres (bug 213281)
2089         RCFLAGS='-O coff --use-temp-file'
2090         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2091         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
2092         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
2093         MOZ_FIX_LINK_PATHS=
2094         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
2095         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
2096         DLL_PREFIX=
2097         IMPORT_LIB_SUFFIX=dll.a
2098     else
2099         TARGET_COMPILER_ABI=msvc
2100         HOST_CC='$(CC)'
2101         HOST_CXX='$(CXX)'
2102         HOST_LD='$(LD)'
2103         AR='lib -NOLOGO -OUT:"$@"'
2104         AR_FLAGS=
2105         RANLIB='echo not_ranlib'
2106         STRIP='echo not_strip'
2107         XARGS=xargs
2108         ZIP=zip
2109         UNZIP=unzip
2110         DOXYGEN=:
2111         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2112         OBJ_SUFFIX=obj
2113         LIB_SUFFIX=lib
2114         DLL_PREFIX=
2115         LIB_PREFIX=
2116         IMPORT_LIB_SUFFIX=lib
2117         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2118         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2119         MKSHLIB_FORCE_ALL=
2120         MKSHLIB_UNFORCE_ALL=
2121         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2122         _USE_CPP_INCLUDE_FLAG=1
2123         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2124         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2125         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2126         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2127         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2128         MOZ_DEBUG_FLAGS='-Zi'
2129         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2130         WARNINGS_AS_ERRORS='-WX'
2131         MOZ_OPTIMIZE_FLAGS='-O1'
2132         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2133         MOZ_FIX_LINK_PATHS=
2134         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2135         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2136         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2137         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2138         if test $_MSC_VER -ge 1400; then
2139             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2140             dnl For profile-guided optimization
2141             PROFILE_GEN_CFLAGS="-GL"
2142             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2143             dnl XXX: PGO builds can fail with warnings treated as errors,
2144             dnl specifically "no profile data available" appears to be
2145             dnl treated as an error sometimes. This might be a consequence
2146             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2147             dnl with the linker doing most of the work in the whole-program
2148             dnl optimization/PGO case. I think it's probably a compiler bug,
2149             dnl but we work around it here.
2150             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2151             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2152             dnl Probably also a compiler bug, but what can you do?
2153             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2154             if test -n "$_USE_DYNAMICBASE"; then
2155                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2156             fi
2157         fi
2158     fi
2159     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2160     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2161     AC_DEFINE(HAVE_SNPRINTF)
2162     AC_DEFINE(_WINDOWS)
2163     AC_DEFINE(WIN32)
2164     AC_DEFINE(XP_WIN)
2165     AC_DEFINE(XP_WIN32)
2166     AC_DEFINE(HW_THREADS)
2167     AC_DEFINE(STDC_HEADERS)
2168     AC_DEFINE(NEW_H, <new>)
2169     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2170     TARGET_MD_ARCH=win32
2171     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2172     BIN_SUFFIX='.exe'
2173     MOZ_ENABLE_POSTSCRIPT=
2174     MOZ_USER_DIR="Mozilla"
2176     dnl Hardcode to win95 for now - cls
2177     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2179     dnl set NO_X11 defines here as the general check is skipped on win32
2180     no_x=yes
2181     AC_DEFINE(NO_X11)
2183     dnl MinGW/MSYS doesn't provide or need cygpath
2184     case "$host" in
2185     *-mingw*)
2186         CYGPATH_W=echo
2187         CYGPATH_S=cat
2188         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2189         ;;
2190     *-cygwin*|*-msvc*|*-mks*)
2191         CYGPATH_W="cygpath -a -w"
2192         CYGPATH_S="sed -e s|\\\\|/|g"
2193         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2194         ;;
2195     esac
2196     case "$host" in
2197     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2199     if test -z "$MOZ_TOOLS"; then
2200         AC_MSG_ERROR([MOZ_TOOLS is not set])
2201     fi
2203     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2204     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2205         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2206     fi
2207     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2208     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2209         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2210     fi
2211     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2213     if test -n "$GLIB_PREFIX"; then
2214         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2215         if test "$?" = "0"; then
2216             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2217                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2218             fi
2219             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2220         else
2221             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2222         fi
2223     else
2224         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2225     fi
2226     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2227         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2228     fi
2229     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2230     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2231         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2232     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2233         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2234     else
2235         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2236     fi
2238     if test -n "$LIBIDL_PREFIX"; then
2239         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2240         if test "$?" = "0"; then
2241             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2242                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2243             fi
2244             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2245         else
2246             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2247         fi
2248     else
2249         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2250     fi        
2251     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2252         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2253     fi
2254     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2255     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2256         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2257         STATIC_LIBIDL=1
2258     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2259         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2260     else
2261         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2262     fi
2263     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2264     ;;
2266     *) # else cross-compiling
2267         if test -n "$GLIB_PREFIX"; then
2268             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2269             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2270                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2271             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2272                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2273             else
2274                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2275             fi
2276         fi
2277         if test -n "$LIBIDL_PREFIX"; then
2278             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2279             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2280                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2281                 STATIC_LIBIDL=1
2282             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2283                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2284             else
2285                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2286             fi
2287         fi
2288         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2289         ;;
2290     esac 
2293     case "$host_os" in
2294     cygwin*|msvc*|mks*)
2295         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])
2296         ;;
2298     *)
2299         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2301         AC_LANG_SAVE
2302         AC_LANG_CPLUSPLUS
2303         AC_CHECK_HEADERS(atlbase.h)
2304         AC_LANG_RESTORE
2305         ;;
2306     esac
2308     case "$target" in
2309     i*86-*)
2310         AC_DEFINE(_X86_)
2311         ;;
2312     alpha-*)
2313         AC_DEFINE(_ALPHA_)
2314         ;;
2315     mips-*)
2316         AC_DEFINE(_MIPS_)
2317         ;;
2318     *)
2319         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2320         ;;
2321     esac
2322     ;;
2324 *-netbsd*)
2325     DSO_CFLAGS=''
2326     CFLAGS="$CFLAGS -Dunix"
2327     CXXFLAGS="$CXXFLAGS -Dunix"
2328     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2329         DLL_SUFFIX=".so"
2330         DSO_PIC_CFLAGS='-fPIC -DPIC'
2331         DSO_LDOPTS='-shared'
2332         BIN_FLAGS='-Wl,--export-dynamic'
2333     else
2334         DSO_PIC_CFLAGS='-fPIC -DPIC'
2335         DLL_SUFFIX=".so.1.0"
2336         DSO_LDOPTS='-shared'
2337     fi
2338     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2339     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2340     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2341     if test "$LIBRUNPATH"; then
2342         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2343     fi
2344     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2345     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2346     ;;
2348 *-nto*) 
2349         AC_DEFINE(NTO)  
2350         AC_DEFINE(_QNX_SOURCE)
2351         AC_DEFINE(_i386)
2352         OS_TARGET=NTO
2353         WARNINGS_AS_ERRORS=''
2354         MOZ_OPTIMIZE_FLAGS="-O"
2355         MOZ_DEBUG_FLAGS="-gstabs"
2356         USE_PTHREADS=1
2357         _PEDANTIC=
2358         LIBS="$LIBS -lsocket -lstdc++"
2359         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2360         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2361         if test "$with_x" != "yes"
2362         then
2363                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2364             TK_CFLAGS='-I/usr/include/photon'
2365                 TK_LIBS='-lph'
2366         fi
2367         case "${target_cpu}" in
2368         ppc*)
2369         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2370         ;;
2371         esac
2372         case "${host_cpu}" in
2373         i*86)
2374         USE_ELF_DYNSTR_GC=1
2375         ;;
2376         esac
2377         ;;
2379 *-openbsd*)
2380     DLL_SUFFIX=".so.1.0"
2381     DSO_CFLAGS=''
2382     DSO_PIC_CFLAGS='-fPIC'
2383     DSO_LDOPTS='-shared -fPIC'
2384     if test "$LIBRUNPATH"; then
2385         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2386     fi
2387     ;;
2389 *-openvms*) 
2390     AC_DEFINE(NO_PW_GECOS)
2391     AC_DEFINE(NO_UDSOCK)
2392     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2393     USE_PTHREADS=1
2394     MKSHLIB_FORCE_ALL='-all'
2395     MKSHLIB_UNFORCE_ALL='-none'
2396     AS='as'
2397     AS_DASH_C_FLAG='-Wc/names=as_is'
2398     AR_FLAGS='c $@'
2399     DSO_LDOPTS='-shared -auto_symvec'
2400     DSO_PIC_CFLAGS=
2401     MOZ_DEBUG_LDFLAGS='-g'
2402     COMPAQ_CXX=1
2403     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2404     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2405     ;;
2408 *-os2*)
2409     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2410     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2411     AC_DEFINE(OS2)
2412     AC_DEFINE(XP_OS2)
2413     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2414     AC_DEFINE(TCPV40HDRS)
2415     DLL_PREFIX=
2416     LIB_PREFIX=
2417     LIB_SUFFIX=lib
2418     BIN_SUFFIX=".exe"
2419     DLL_SUFFIX=".dll"
2420     IMPORT_LIB_SUFFIX=lib
2421     DSO_PIC_CFLAGS=
2422     AR=emxomfar
2423     AR_FLAGS='r $@'
2424     CFLAGS="$CFLAGS -Zomf"
2425     CXXFLAGS="$CXXFLAGS -Zomf"
2426     DSO_LDOPTS='-Zdll'
2427     BIN_FLAGS='-Zlinker /ST:0x100000'
2428     IMPLIB='emximp -o'
2429     FILTER='emxexp -o'
2430     LDFLAGS='-Zmap'
2431     WARNINGS_AS_ERRORS='-Werror'
2432     MOZ_DEBUG_FLAGS="-g -fno-inline"
2433     MOZ_OPTIMIZE_FLAGS="-O2"
2434     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2435     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2436     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2437     TARGET_MD_ARCH=os2
2438     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2439     MOZ_ENABLE_POSTSCRIPT=
2440     RC=rc.exe
2441     RCFLAGS='-n'
2442     MOZ_USER_DIR="Mozilla"
2444     if test "$MOZTOOLS"; then
2445         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2446     else
2447         AC_MSG_ERROR([MOZTOOLS is not set])
2448     fi
2449     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2450         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2451         LDFLAGS="$LDFLAGS -Zhigh-mem"
2452         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2453         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2454     fi
2456     # GCC for OS/2 currently predefines these, but we don't want them
2457     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2458     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2460     AC_CACHE_CHECK(for __declspec(dllexport),
2461         ac_os2_declspec,
2462         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2463                         [return 0;],
2464                         ac_os2_declspec="yes",
2465                         ac_os2_declspec="no")])
2466     if test "$ac_os2_declspec" = "yes"; then
2467         FILTER='true'
2468         MOZ_OS2_USE_DECLSPEC='1'
2469     fi
2470     ;;
2472 alpha*-*-osf*)
2473     if test "$GNU_CC"; then
2474       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2475       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2477     else
2478         MOZ_DEBUG_FLAGS='-g'
2479         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2480         CFLAGS="$CFLAGS -ieee"
2481         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2482         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2483         DSO_CFLAGS=
2484         DSO_PIC_CFLAGS=
2485         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2486         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2487         MKSHLIB_FORCE_ALL='-all'
2488         MKSHLIB_UNFORCE_ALL='-none'
2489         dnl Might fix the libxpcom.so breakage on this platform as well....
2490         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2491         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2492     fi
2493     if test -z "$GNU_CXX"; then
2494       COMPAQ_CXX=1
2495     fi
2496     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2497     ;;
2499 *-qnx*) 
2500     DIRENT_INO=d_stat.st_ino
2501     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2502     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2503     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2504     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2505     AC_DEFINE(STDC_HEADERS)
2506     if test "$no_x" = "yes"; then
2507             _PLATFORM_DEFAULT_TOOLKIT='photon'
2508             TK_CFLAGS='-I/usr/nto/include/photon'
2509             TK_LIBS='-lphoton -lphrender'
2510     fi
2511     ;;
2513 *-sco*) 
2514     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2515     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2516     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2517     if test ! "$GNU_CC"; then
2518        DSO_LDOPTS='-G'
2519     fi
2520     ;;
2522 dnl the qsort routine under solaris is faulty
2523 *-solaris*) 
2524     AC_DEFINE(SOLARIS)
2525     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2526     SYSTEM_MAKEDEPEND=
2527     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2528     # libraries one level up (e.g. libnspr4.so)
2529     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2530     MOZ_MEMORY=1
2531     if test "$SOLARIS_SUNPRO_CC"; then
2532        LIBS="-lCrun -lCstd $LIBS"
2533        NS_USE_NATIVE=1
2534        MOZ_FIX_LINK_PATHS=
2535        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2536        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2537        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2538        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2539        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2540            _SAVE_LDFLAGS=$LDFLAGS
2541            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2542            AC_TRY_LINK([#include <stdio.h>],
2543                        [printf("Hello World\n");],
2544                        ,
2545                        [LDFLAGS=$_SAVE_LDFLAGS])
2546        fi
2547        WARNINGS_AS_ERRORS='-Werror'
2548        MOZ_OPTIMIZE_FLAGS="-xO4"
2549        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2550        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2551        MKSHLIB_FORCE_ALL='-z allextract'
2552        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2553        DSO_LDOPTS='-G -z muldefs'
2554        AR_LIST="$AR t"
2555        AR_EXTRACT="$AR x"
2556        AR_DELETE="$AR d"
2557        AR='$(CXX) -xar'
2558        AR_FLAGS='-o $@'
2559        AS='/usr/ccs/bin/as'
2560        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2561        AS_DASH_C_FLAG=''
2562        TARGET_COMPILER_ABI="sunc"
2563        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2564        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2565        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2566        AC_LANG_SAVE
2567        AC_LANG_CPLUSPLUS
2568        AC_TRY_COMPILE([],
2569            [#if (__SUNPRO_CC < 0x590)
2570            #error "Denied"
2571            #endif],
2572            _BAD_COMPILER=,_BAD_COMPILER=1)
2573         if test -n "$_BAD_COMPILER"; then
2574             _res="no"
2575             AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2576         else
2577             _res="yes"
2578         fi
2579         AC_MSG_RESULT([$_res])
2580         AC_LANG_RESTORE
2581     else
2582        ASFLAGS="$ASFLAGS -fPIC"
2583        DSO_LDOPTS='-G'
2584        _WARNINGS_CFLAGS=''
2585        _WARNINGS_CXXFLAGS=''
2586        if test "$OS_RELEASE" = "5.3"; then
2587           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2588        fi
2589     fi
2590     if test "$OS_RELEASE" = "5.5.1"; then
2591        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2592     fi
2593     ;;
2595 *-sunos*) 
2596     DSO_LDOPTS='-Bdynamic'
2597     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2598     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2599     AC_DEFINE(SUNOS4)
2600     AC_DEFINE(SPRINTF_RETURNS_STRING)
2601     case "$(target_os)" in
2602     sunos4.1*)
2603         DLL_SUFFIX='.so.1.0'
2604         ;;
2605     esac
2606     ;;
2608 *-sysv4.2uw7*) 
2609         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2610     ;;
2612 *-os2*)
2613     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2614     ;;
2616 esac
2618 dnl Only one oddball right now (QNX), but this gives us flexibility
2619 dnl if any other platforms need to override this in the future.
2620 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2622 dnl ========================================================
2623 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2624 dnl by now will not have any way to link most binaries (tests
2625 dnl as well as viewer, apprunner, etc.), because some symbols
2626 dnl will be left out of the "composite" .so's by ld as unneeded.
2627 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2628 dnl they can link in the static libs that provide the missing
2629 dnl symbols.
2630 dnl ========================================================
2631 NO_LD_ARCHIVE_FLAGS=
2632 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2633     NO_LD_ARCHIVE_FLAGS=1
2635 case "$target" in
2636 *-os2*)
2637     NO_LD_ARCHIVE_FLAGS=
2638     ;;
2639 *-aix4.3*|*-aix5*)
2640     NO_LD_ARCHIVE_FLAGS=
2641     ;;
2642 *-openvms*)
2643     NO_LD_ARCHIVE_FLAGS=
2644     ;;
2645 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2646     if test -z "$GNU_CC"; then
2647         NO_LD_ARCHIVE_FLAGS=
2648     fi
2649     ;;
2650 esac
2651 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2653 dnl ========================================================
2654 dnl = Flags to strip unused symbols from .so components
2655 dnl ========================================================
2656 case "$target" in
2657     *-linux*|*-kfreebsd*-gnu)
2658         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2659         ;;
2660     *-solaris*)
2661         if test -z "$GNU_CC"; then
2662          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2663         else
2664          if test -z "$GCC_USE_GNU_LD"; then
2665           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2666          else
2667           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2668          fi
2669         fi
2670         ;;
2671     *-nto*) 
2672         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2673         ;;
2674     *-darwin*)
2675         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2676         ;;
2677     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2678         if test -n "$GNU_CC"; then
2679            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2680         fi
2681         ;;
2682 esac
2684 if test -z "$COMPILE_ENVIRONMENT"; then
2685     SKIP_COMPILER_CHECKS=1
2686     SKIP_LIBRARY_CHECKS=1
2689 if test -z "$SKIP_COMPILER_CHECKS"; then
2690 dnl Checks for typedefs, structures, and compiler characteristics.
2691 dnl ========================================================
2692 AC_LANG_C
2693 AC_HEADER_STDC
2694 AC_C_CONST
2695 AC_TYPE_MODE_T
2696 AC_TYPE_OFF_T
2697 AC_TYPE_PID_T
2698 AC_TYPE_SIZE_T
2699 AC_STRUCT_ST_BLKSIZE
2700 AC_MSG_CHECKING(for siginfo_t)
2701 AC_CACHE_VAL(ac_cv_siginfo_t,
2702  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2703                   #include <signal.h>],
2704                  [siginfo_t* info;],
2705                  [ac_cv_siginfo_t=true],
2706                  [ac_cv_siginfo_t=false])])
2707 if test "$ac_cv_siginfo_t" = true ; then
2708   AC_DEFINE(HAVE_SIGINFO_T)
2709   AC_MSG_RESULT(yes)
2710 else
2711   AC_MSG_RESULT(no)
2714 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2715 dnl ========================================================
2716 AC_MSG_CHECKING(for int16_t)
2717 AC_CACHE_VAL(ac_cv_int16_t,
2718  [AC_TRY_COMPILE([#include <stdio.h>
2719                   #include <sys/types.h>],
2720                  [int16_t foo = 0;],
2721                  [ac_cv_int16_t=true],
2722                  [ac_cv_int16_t=false])])
2723 if test "$ac_cv_int16_t" = true ; then
2724   AC_DEFINE(HAVE_INT16_T)
2725   AC_MSG_RESULT(yes)
2726 else
2727   AC_MSG_RESULT(no)
2729 AC_MSG_CHECKING(for int32_t)
2730 AC_CACHE_VAL(ac_cv_int32_t,
2731  [AC_TRY_COMPILE([#include <stdio.h>
2732                   #include <sys/types.h>],
2733                  [int32_t foo = 0;],
2734                  [ac_cv_int32_t=true],
2735                  [ac_cv_int32_t=false])])
2736 if test "$ac_cv_int32_t" = true ; then
2737   AC_DEFINE(HAVE_INT32_T)
2738   AC_MSG_RESULT(yes)
2739 else
2740   AC_MSG_RESULT(no)
2742 AC_MSG_CHECKING(for int64_t)
2743 AC_CACHE_VAL(ac_cv_int64_t,
2744  [AC_TRY_COMPILE([#include <stdio.h>
2745                   #include <sys/types.h>],
2746                  [int64_t foo = 0;],
2747                  [ac_cv_int64_t=true],
2748                  [ac_cv_int64_t=false])])
2749 if test "$ac_cv_int64_t" = true ; then
2750   AC_DEFINE(HAVE_INT64_T)
2751   AC_MSG_RESULT(yes)
2752 else
2753   AC_MSG_RESULT(no)
2755 AC_MSG_CHECKING(for int64)
2756 AC_CACHE_VAL(ac_cv_int64,
2757  [AC_TRY_COMPILE([#include <stdio.h>
2758                   #include <sys/types.h>],
2759                  [int64 foo = 0;],
2760                  [ac_cv_int64=true],
2761                  [ac_cv_int64=false])])
2762 if test "$ac_cv_int64" = true ; then
2763   AC_DEFINE(HAVE_INT64)
2764   AC_MSG_RESULT(yes)
2765 else
2766   AC_MSG_RESULT(no)
2768 AC_MSG_CHECKING(for uint)
2769 AC_CACHE_VAL(ac_cv_uint,
2770  [AC_TRY_COMPILE([#include <stdio.h>
2771                   #include <sys/types.h>],
2772                  [uint foo = 0;],
2773                  [ac_cv_uint=true],
2774                  [ac_cv_uint=false])])
2775 if test "$ac_cv_uint" = true ; then
2776   AC_DEFINE(HAVE_UINT)
2777   AC_MSG_RESULT(yes)
2778 else
2779   AC_MSG_RESULT(no)
2781 AC_MSG_CHECKING(for uint_t)
2782 AC_CACHE_VAL(ac_cv_uint_t,
2783  [AC_TRY_COMPILE([#include <stdio.h>
2784                   #include <sys/types.h>],
2785                  [uint_t foo = 0;],
2786                  [ac_cv_uint_t=true],
2787                  [ac_cv_uint_t=false])])
2788 if test "$ac_cv_uint_t" = true ; then
2789   AC_DEFINE(HAVE_UINT_T)
2790   AC_MSG_RESULT(yes)
2791 else
2792   AC_MSG_RESULT(no)
2794 AC_MSG_CHECKING(for uint16_t)
2795 AC_CACHE_VAL(ac_cv_uint16_t,
2796  [AC_TRY_COMPILE([#include <stdio.h>
2797                   #include <sys/types.h>],
2798                  [uint16_t foo = 0;],
2799                  [ac_cv_uint16_t=true],
2800                  [ac_cv_uint16_t=false])])
2801 if test "$ac_cv_uint16_t" = true ; then
2802   AC_DEFINE(HAVE_UINT16_T)
2803   AC_MSG_RESULT(yes)
2804 else
2805   AC_MSG_RESULT(no)
2808 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2809 dnl are defined when compiling C++ but not C.  Since the result of this
2810 dnl test is used only in C++, do it in C++.
2811 AC_LANG_CPLUSPLUS
2813 AC_MSG_CHECKING(for uname.domainname)
2814 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2815     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2816         [ struct utsname *res; char *domain; 
2817             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2818         [ac_cv_have_uname_domainname_field=true],
2819         [ac_cv_have_uname_domainname_field=false])])
2821 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2822     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2823     AC_MSG_RESULT(yes)
2824 else
2825     AC_MSG_RESULT(no)
2828 AC_MSG_CHECKING(for uname.__domainname)
2829 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2830     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2831         [ struct utsname *res; char *domain; 
2832             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2833         [ac_cv_have_uname_us_domainname_field=true],
2834         [ac_cv_have_uname_us_domainname_field=false])])
2836 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2837     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2838     AC_MSG_RESULT(yes)
2839 else
2840     AC_MSG_RESULT(no)
2843 AC_LANG_CPLUSPLUS
2845 dnl Check for usable char16_t (2 bytes, unsigned)
2846 dnl (we might not need the unsignedness check anymore)
2847 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2848     ac_cv_have_usable_char16_t,
2849     [AC_TRY_COMPILE([$configure_static_assert_macros],
2850                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2851                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2852                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2853                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2854                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2855                     ac_cv_have_usable_char16_t="yes",
2856                     ac_cv_have_usable_char16_t="no")])
2857 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2858     AC_DEFINE(HAVE_CPP_CHAR16_T)
2859     HAVE_CPP_CHAR16_T=1
2862 dnl Check for usable wchar_t (2 bytes, unsigned)
2863 dnl (we really don't need the unsignedness check anymore)
2864 dnl ========================================================
2866 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2867     ac_cv_have_usable_wchar_v2,
2868     [AC_TRY_COMPILE([#include <stddef.h>
2869                      $configure_static_assert_macros],
2870                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2871                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2872                     ac_cv_have_usable_wchar_v2="yes",
2873                     ac_cv_have_usable_wchar_v2="no")])
2874 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2875     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2876     HAVE_CPP_2BYTE_WCHAR_T=1
2877 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2878 dnl This is really gcc-only
2879 dnl Do this test using CXX only since some versions of gcc
2880 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2881 dnl only have short-wchar support for c++.
2882 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2884     _SAVE_CXXFLAGS=$CXXFLAGS
2885     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2887     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2888         ac_cv_have_usable_wchar_option_v2,
2889         [AC_TRY_LINK([#include <stddef.h>
2890                       $configure_static_assert_macros],
2891                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2892                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2893                      ac_cv_have_usable_wchar_option_v2="yes",
2894                      ac_cv_have_usable_wchar_option_v2="no")])
2896     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2897         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2898         HAVE_CPP_2BYTE_WCHAR_T=1
2899         WCHAR_CFLAGS="-fshort-wchar"
2900     else    
2901         CXXFLAGS=$_SAVE_CXXFLAGS
2902     fi
2905 AC_LANG_C
2907 dnl Check for .hidden assembler directive and visibility attribute.
2908 dnl Borrowed from glibc configure.in
2909 dnl ===============================================================
2910 if test "$GNU_CC"; then
2911   AC_CACHE_CHECK(for visibility(hidden) attribute,
2912                  ac_cv_visibility_hidden,
2913                  [cat > conftest.c <<EOF
2914                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2916                   ac_cv_visibility_hidden=no
2917                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2918                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2919                       ac_cv_visibility_hidden=yes
2920                     fi
2921                   fi
2922                   rm -f conftest.[cs]
2923                  ])
2924   if test "$ac_cv_visibility_hidden" = "yes"; then
2925     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2927     AC_CACHE_CHECK(for visibility(default) attribute,
2928                    ac_cv_visibility_default,
2929                    [cat > conftest.c <<EOF
2930                     int foo __attribute__ ((visibility ("default"))) = 1;
2932                     ac_cv_visibility_default=no
2933                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2934                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2935                         ac_cv_visibility_default=yes
2936                       fi
2937                     fi
2938                     rm -f conftest.[cs]
2939                    ])
2940     if test "$ac_cv_visibility_default" = "yes"; then
2941       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2943       AC_CACHE_CHECK(for visibility pragma support,
2944                      ac_cv_visibility_pragma,
2945                      [cat > conftest.c <<EOF
2946 #pragma GCC visibility push(hidden)
2947                       int foo_hidden = 1;
2948 #pragma GCC visibility push(default)
2949                       int foo_default = 1;
2951                       ac_cv_visibility_pragma=no
2952                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2953                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2954                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2955                             ac_cv_visibility_pragma=yes
2956                           fi
2957                         fi
2958                       fi
2959                       rm -f conftest.[cs]
2960                     ])
2961       if test "$ac_cv_visibility_pragma" = "yes"; then
2962         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2963                        ac_cv_have_visibility_class_bug,
2964                        [cat > conftest.c <<EOF
2965 #pragma GCC visibility push(hidden)
2966 struct __attribute__ ((visibility ("default"))) TestStruct {
2967   static void Init();
2969 __attribute__ ((visibility ("default"))) void TestFunc() {
2970   TestStruct::Init();
2973                        ac_cv_have_visibility_class_bug=no
2974                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2975                          ac_cv_have_visibility_class_bug=yes
2976                        else
2977                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2978                            ac_cv_have_visibility_class_bug=yes
2979                          fi
2980                        fi
2981                        rm -rf conftest.{c,S}
2982                        ])
2984         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2985                        ac_cv_have_visibility_builtin_bug,
2986                        [cat > conftest.c <<EOF
2987 #pragma GCC visibility push(hidden)
2988 #pragma GCC visibility push(default)
2989 #include <string.h>
2990 #pragma GCC visibility pop
2992 __attribute__ ((visibility ("default"))) void Func() {
2993   char c[[100]];
2994   memset(c, 0, sizeof(c));
2997                        ac_cv_have_visibility_builtin_bug=no
2998                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2999                          ac_cv_have_visibility_builtin_bug=yes
3000                        else
3001                          if test `grep -c "@PLT" conftest.S` = 0; then
3002                            ac_cv_visibility_builtin_bug=yes
3003                          fi
3004                        fi
3005                        rm -f conftest.{c,S}
3006                        ])
3007         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3008                 "$ac_cv_have_visibility_class_bug" = "no"; then
3009           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3010           WRAP_SYSTEM_INCLUDES=1
3011         else
3012           VISIBILITY_FLAGS='-fvisibility=hidden'
3013         fi # have visibility pragma bug
3014       fi   # have visibility pragma
3015     fi     # have visibility(default) attribute
3016   fi       # have visibility(hidden) attribute
3017 fi         # GNU_CC
3019 # visibility hidden flag for Sun Studio on Solaris
3020 if test "$SOLARIS_SUNPRO_CC"; then
3021 VISIBILITY_FLAGS='-xldscope=hidden'
3022 fi         # Sun Studio on Solaris
3024 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3025 AC_SUBST(VISIBILITY_FLAGS)
3027 dnl Checks for header files.
3028 dnl ========================================================
3029 AC_HEADER_DIRENT
3030 case "$target_os" in
3031 freebsd*)
3032 # for stuff like -lXshm
3033     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3034     ;;
3035 esac
3036 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3037 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3038 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3039 AC_CHECK_HEADERS(malloc.h)
3040 AC_CHECK_HEADERS(X11/XKBlib.h)
3041 AC_CHECK_HEADERS(io.h)
3043 dnl These are all the places some variant of statfs can be hiding.
3044 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3046 dnl Try for MMX support
3047 dnl NB - later gcc versions require -mmmx for this header to be successfully
3048 dnl included (or another option which implies it, such as -march=pentium-mmx)
3049 AC_CHECK_HEADERS(mmintrin.h)
3051 dnl Check whether the compiler supports the new-style C++ standard
3052 dnl library headers (i.e. <new>) or needs the old "new.h"
3053 AC_LANG_CPLUSPLUS
3054 NEW_H=new.h
3055 AC_CHECK_HEADER(new, [NEW_H=new])
3056 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3057 AC_LANG_C
3059 AC_ARG_ENABLE(dtrace,
3060               [  --enable-dtrace         build with dtrace support if available (default=no)],
3061               [enable_dtrace="yes"],)
3062 if test "x$enable_dtrace" = "xyes"; then
3063   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3064   if test -n "$HAVE_DTRACE"; then
3065       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3066   else
3067       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3068   fi
3070 AC_SUBST(HAVE_DTRACE)
3072 case $target in
3073 *-aix4.3*|*-aix5*)
3074         ;;
3076         AC_CHECK_HEADERS(sys/cdefs.h)
3077         ;;
3078 esac
3080 dnl Checks for libraries.
3081 dnl ========================================================
3082 case $target in
3083 *-hpux11.*)
3084         ;;
3086         AC_CHECK_LIB(c_r, gethostbyname_r)
3087         ;;
3088 esac
3090 dnl We don't want to link with libdl even if it's present on OS X, since
3091 dnl it's not used and not part of the default installation.
3092 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3093 dnl We don't want to link against libm or libpthread on Darwin since
3094 dnl they both are just symlinks to libSystem and explicitly linking
3095 dnl against libSystem causes issues when debugging (see bug 299601).
3096 case $target in
3097 *-darwin*)
3098     ;;
3099 *-beos*)
3100     ;;
3101 *-os2*)
3102     ;;
3104     AC_CHECK_LIB(m, atan)
3105     AC_CHECK_LIB(dl, dlopen,
3106     AC_CHECK_HEADER(dlfcn.h, 
3107         LIBS="-ldl $LIBS"
3108         AC_DEFINE(HAVE_LIBDL)))
3109     ;;
3110 esac
3112 _SAVE_CFLAGS="$CFLAGS"
3113 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3114 AC_CHECK_FUNCS(dladdr)
3115 CFLAGS="$_SAVE_CFLAGS"
3117 if test ! "$GNU_CXX"; then
3119     case $target in
3120     *-aix*)
3121         AC_CHECK_LIB(C_r, demangle)
3122         ;;
3123      *)
3124         AC_CHECK_LIB(C, demangle)
3125         ;;
3126      esac
3129 dnl OS/2 has socket in libc.
3130 case $target in
3131 *-os2*)
3132     ;;
3134     AC_CHECK_LIB(socket, socket)
3135 esac
3137 dnl ========================================================
3138 dnl Check whether we can compile code for Core Text
3139 dnl (Mac OS X 10.5 or later)
3140 dnl ========================================================
3141 case "$target" in
3142 *-darwin*)
3143   AC_MSG_CHECKING([for Core Text])
3144   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3145                  [CTLineRef lineRef;],
3146                   ac_cv_have_core_text="yes",
3147                   ac_cv_have_core_text="no")
3148   AC_MSG_RESULT([$ac_cv_have_core_text])
3150   case "${target_cpu}" in
3151   x86_64)
3152     MOZ_CORETEXT=1
3153     ;;
3154   esac
3156   MOZ_ARG_ENABLE_BOOL(coretext,
3157 [  --enable-coretext      Use CoreText instead of ATSUI for text rendering],
3158     MOZ_CORETEXT=1,
3159     MOZ_CORETEXT=)
3161   if test -n "$MOZ_CORETEXT"; then
3162     if test "$ac_cv_have_core_text" = "no"; then
3163       AC_MSG_ERROR([--enable-coretext requires MacOS SDK 10.5 or newer])
3164      fi
3165      AC_DEFINE(MOZ_CORETEXT)
3166   fi
3167   ;;
3168 esac
3170 AC_SUBST(MOZ_CORETEXT)
3172 XLDFLAGS="$X_LIBS"
3173 XLIBS="$X_EXTRA_LIBS"
3175 dnl ========================================================
3176 dnl Checks for X libraries.
3177 dnl Ordering is important.
3178 dnl Xt is dependent upon SM as of X11R6
3179 dnl ========================================================
3180 if test "$no_x" = "yes"; then
3181     AC_DEFINE(NO_X11)
3182 else
3183     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3184         XLIBS="-lX11 $XLIBS"
3185         _SAVE_LDFLAGS="$LDFLAGS"
3186         LDFLAGS="$XLDFLAGS $LDFLAGS"
3187         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3188                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3189         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3190                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3191      
3192         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3193         unset ac_cv_lib_Xt_XtFree
3194             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3195             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3196         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3197                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3198         ])
3200     # AIX needs the motif library linked before libXt to prevent
3201     # crashes in plugins linked against Motif - Bug #98892
3202     case "${target_os}" in
3203     aix*)
3204         XT_LIBS="-lXm $XT_LIBS"
3205         ;;
3206     esac
3208     dnl ========================================================
3209     dnl = Check for XShm
3210     dnl ========================================================
3211     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3212         $XLIBS $XEXT_LIBS)
3213     AC_CHECK_HEADER(X11/extensions/XShm.h)
3214     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3215         test -n "$_HAVE_XSHM_XEXT"; then
3216         AC_DEFINE(HAVE_XSHM)
3217     fi
3219     dnl ========================================================
3220     dnl = Check for XIE
3221     dnl ========================================================
3222     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3223         $XLIBS $XEXT_LIBS)
3224     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3226     if test "$MOZ_XIE_LIBS"; then
3227         dnl ====================================================
3228         dnl = If XIE is present and is desired, turn it on
3229         dnl ====================================================
3230         case $target in
3231             *-hpux*)
3232                 ;;
3233             *)
3234                 HAVE_XIE=1
3235                 ;;
3236         esac
3237     fi
3239         LDFLAGS="$_SAVE_LDFLAGS"
3241     dnl ========================================================
3242     dnl = Check for freetype2 and its functionality
3243     dnl ========================================================
3244     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3246     if test "$_HAVE_FREETYPE2"; then
3247         _SAVE_LIBS="$LIBS"
3248         _SAVE_CFLAGS="$CFLAGS"
3249         LIBS="$LIBS $FT2_LIBS"
3250         CFLAGS="$CFLAGS $FT2_CFLAGS"
3252         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3253             ac_cv_member_FT_Bitmap_Size_y_ppem,
3254             [AC_TRY_COMPILE([#include <ft2build.h>
3255                              #include FT_FREETYPE_H],
3256                             [FT_Bitmap_Size s;
3257                              if (sizeof s.y_ppem) return 0;
3258                              return 1],
3259                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3260                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3261         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3262             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3263         else
3264             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3265         fi
3266         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3267                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3268                            [FT_Bitmap_Size structure includes y_ppem field])
3270         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3272         LIBS="$_SAVE_LIBS"
3273         CFLAGS="$_SAVE_CFLAGS"
3274     fi
3276 fi # $no_x
3278 AC_SUBST(XCFLAGS)
3279 AC_SUBST(XLDFLAGS)
3280 AC_SUBST(XLIBS)
3281 AC_SUBST(XEXT_LIBS)
3282 AC_SUBST(XT_LIBS)
3284 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3285 AC_TRY_COMPILE([],
3286                [asm("uqadd8 r1, r1, r2");],
3287                result="yes", result="no")
3288 AC_MSG_RESULT("$result")
3289 if test "$result" = "yes"; then
3290     AC_DEFINE(HAVE_ARM_SIMD)
3291     HAVE_ARM_SIMD=1
3293 AC_SUBST(HAVE_ARM_SIMD)
3295 AC_MSG_CHECKING(for ARM NEON support in compiler)
3296 _SAVE_CFLAGS="$CFLAGS"
3297 if test "$GNU_CC"; then
3298   # gcc needs -mfpu=neon to recognize NEON instructions
3299   CFLAGS="$CFLAGS -mfpu=neon"
3301 AC_TRY_COMPILE([],
3302                [asm("vadd.i8 d0, d0, d0");],
3303                result="yes", result="no")
3304 AC_MSG_RESULT("$result")
3305 if test "$result" = "yes"; then
3306     AC_DEFINE(HAVE_ARM_NEON)
3307     HAVE_ARM_NEON=1
3309 CFLAGS="$_SAVE_CFLAGS"
3310 AC_SUBST(HAVE_ARM_NEON)
3312 dnl ========================================================
3313 dnl = pthread support
3314 dnl = Start by checking whether the system support pthreads
3315 dnl ========================================================
3316 case "$target_os" in
3317 darwin*)
3318     USE_PTHREADS=1
3319     ;;
3321     MOZ_CHECK_PTHREADS(pthreads,
3322         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3323         MOZ_CHECK_PTHREADS(pthread,
3324             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3325             MOZ_CHECK_PTHREADS(c_r,
3326                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3327                 MOZ_CHECK_PTHREADS(c,
3328                     USE_PTHREADS=1
3329                 )
3330             )
3331         )
3332     )
3333     ;;
3334 esac
3336 dnl ========================================================
3337 dnl Check the command line for --with-pthreads 
3338 dnl ========================================================
3339 MOZ_ARG_WITH_BOOL(pthreads,
3340 [  --with-pthreads         Force use of system pthread library with NSPR ],
3341 [ if test "$USE_PTHREADS"x = x; then
3342     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3343 fi],
3344     USE_PTHREADS=
3345     _PTHREAD_LDFLAGS=
3348 dnl ========================================================
3349 dnl Do the platform specific pthread hackery
3350 dnl ========================================================
3351 if test "$USE_PTHREADS"x != x
3352 then
3353         dnl
3354         dnl See if -pthread is supported.
3355         dnl
3356         rm -f conftest*
3357         ac_cv_have_dash_pthread=no
3358         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3359         echo 'int main() { return 0; }' | cat > conftest.c
3360         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3361         if test $? -eq 0; then
3362                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3363                         ac_cv_have_dash_pthread=yes
3364                 case "$target_os" in
3365                 freebsd*)
3366 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3367                 ;;
3368                 *)
3369                             CFLAGS="$CFLAGS -pthread"
3370                             CXXFLAGS="$CXXFLAGS -pthread"
3371                 ;;
3372                 esac
3373                 fi
3374         fi
3375         rm -f conftest*
3376     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3378         dnl
3379         dnl See if -pthreads is supported.
3380         dnl
3381     ac_cv_have_dash_pthreads=no
3382     if test "$ac_cv_have_dash_pthread" = "no"; then
3383             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3384         echo 'int main() { return 0; }' | cat > conftest.c
3385             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3386         if test $? -eq 0; then
3387                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3388                             ac_cv_have_dash_pthreads=yes
3389                             CFLAGS="$CFLAGS -pthreads"
3390                             CXXFLAGS="$CXXFLAGS -pthreads"
3391                     fi
3392             fi
3393             rm -f conftest*
3394         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3395     fi
3397         case "$target" in
3398             *-*-freebsd*)
3399                         AC_DEFINE(_REENTRANT)
3400                         AC_DEFINE(_THREAD_SAFE)
3401                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3402                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3403                                 _PTHREAD_LDFLAGS="-pthread"
3404                         else
3405                                 _PTHREAD_LDFLAGS="-lc_r"
3406                         fi
3407                         ;;
3409             *-*-openbsd*|*-*-bsdi*)
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                         fi
3416                         ;;
3418             *-*-linux*|*-*-kfreebsd*-gnu)
3419                         AC_DEFINE(_REENTRANT) 
3420                         ;;
3422             *-*-nto*) 
3423                         AC_DEFINE(_REENTRANT) 
3424                         ;;
3426             *-aix4.3*|*-aix5*)
3427                         AC_DEFINE(_REENTRANT) 
3428                         ;;
3430             *-hpux11.*)
3431                         AC_DEFINE(_REENTRANT) 
3432                         ;;
3434             alpha*-*-osf*)
3435                         AC_DEFINE(_REENTRANT)
3436                         ;;
3438             *-*-solaris*) 
3439                         AC_DEFINE(_REENTRANT)
3440                         if test "$SOLARIS_SUNPRO_CC"; then
3441                                 CFLAGS="$CFLAGS -mt" 
3442                                 CXXFLAGS="$CXXFLAGS -mt" 
3443                         fi
3444                         ;;
3445         esac
3446     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3449 dnl ========================================================
3450 dnl See if mmap sees writes
3451 dnl For cross compiling, just define it as no, which is a safe default
3452 dnl ========================================================
3453 AC_MSG_CHECKING(whether mmap() sees write()s)
3455 changequote(,)
3456 mmap_test_prog='
3457     #include <stdlib.h>
3458     #include <unistd.h>
3459     #include <sys/mman.h>
3460     #include <sys/types.h>
3461     #include <sys/stat.h>
3462     #include <fcntl.h>
3464     char fname[] = "conftest.file";
3465     char zbuff[1024]; /* Fractional page is probably worst case */
3467     int main() {
3468         char *map;
3469         int fd;
3470         int i;
3471         unlink(fname);
3472         fd = open(fname, O_RDWR | O_CREAT, 0660);
3473         if(fd<0) return 1;
3474         unlink(fname);
3475         write(fd, zbuff, sizeof(zbuff));
3476         lseek(fd, 0, SEEK_SET);
3477         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3478         if(map==(char*)-1) return 2;
3479         for(i=0; fname[i]; i++) {
3480             int rc = write(fd, &fname[i], 1);
3481             if(map[i]!=fname[i]) return 4;
3482         }
3483         return 0;
3484     }
3486 changequote([,])
3488 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3490 AC_MSG_RESULT("$result")
3492 if test "$result" = "no"; then
3493     AC_DEFINE(MMAP_MISSES_WRITES)
3497 dnl Checks for library functions.
3498 dnl ========================================================
3499 AC_PROG_GCC_TRADITIONAL
3500 AC_FUNC_MEMCMP
3501 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3502 AC_CHECK_FUNCS(flockfile getpagesize)
3503 AC_CHECK_FUNCS(localtime_r strtok_r)
3505 dnl check for wcrtomb/mbrtowc
3506 dnl =======================================================================
3507 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3508 AC_LANG_SAVE
3509 AC_LANG_CPLUSPLUS
3510 AC_CACHE_CHECK(for wcrtomb,
3511     ac_cv_have_wcrtomb,
3512     [AC_TRY_LINK([#include <wchar.h>],
3513                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3514                  ac_cv_have_wcrtomb="yes",
3515                  ac_cv_have_wcrtomb="no")])
3516 if test "$ac_cv_have_wcrtomb" = "yes"; then
3517     AC_DEFINE(HAVE_WCRTOMB)
3519 AC_CACHE_CHECK(for mbrtowc,
3520     ac_cv_have_mbrtowc,
3521     [AC_TRY_LINK([#include <wchar.h>],
3522                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3523                  ac_cv_have_mbrtowc="yes",
3524                  ac_cv_have_mbrtowc="no")])
3525 if test "$ac_cv_have_mbrtowc" = "yes"; then
3526     AC_DEFINE(HAVE_MBRTOWC)
3528 AC_LANG_RESTORE
3531 AC_CACHE_CHECK(
3532     [for res_ninit()],
3533     ac_cv_func_res_ninit,
3534     [AC_TRY_LINK([
3535         #ifdef linux
3536         #define _BSD_SOURCE 1
3537         #endif
3538         #include <resolv.h>
3539         ],
3540         [int foo = res_ninit(&_res);],
3541         [ac_cv_func_res_ninit=yes],
3542         [ac_cv_func_res_ninit=no])
3543     ])
3545 if test "$ac_cv_func_res_ninit" = "yes"; then
3546     AC_DEFINE(HAVE_RES_NINIT)
3547 dnl must add the link line we do something as foolish as this... dougt
3548 dnl else
3549 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3550 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3553 AC_LANG_CPLUSPLUS
3554 AC_CACHE_CHECK(
3555     [for gnu_get_libc_version()],
3556     ac_cv_func_gnu_get_libc_version,
3557     [AC_TRY_LINK([
3558         #ifdef HAVE_GNU_LIBC_VERSION_H
3559         #include <gnu/libc-version.h>
3560         #endif
3561         ],
3562         [const char *glibc_version = gnu_get_libc_version();],
3563         [ac_cv_func_gnu_get_libc_version=yes],
3564         [ac_cv_func_gnu_get_libc_version=no] 
3565         )]
3566     )
3568 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3569     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3572 case $target_os in
3573     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3574         ;;
3575     *)
3576     
3577 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3578     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3579         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3580 _SAVE_LIBS=$LIBS
3581 LIBS="$LIBS $_ICONV_LIBS"
3582 AC_CACHE_CHECK(
3583     [for iconv()],
3584     ac_cv_func_iconv,
3585     [AC_TRY_LINK([
3586         #include <stdlib.h>
3587         #include <iconv.h>
3588         ],
3589         [
3590             iconv_t h = iconv_open("", "");
3591             iconv(h, NULL, NULL, NULL, NULL);
3592             iconv_close(h);
3593         ],
3594         [ac_cv_func_iconv=yes],
3595         [ac_cv_func_iconv=no] 
3596         )]
3597     )
3598 if test "$ac_cv_func_iconv" = "yes"; then
3599     AC_DEFINE(HAVE_ICONV)
3600     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3601     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3602     LIBICONV="$_ICONV_LIBS"
3603     AC_CACHE_CHECK(
3604         [for iconv() with const input],
3605         ac_cv_func_const_iconv,
3606         [AC_TRY_COMPILE([
3607             #include <stdlib.h>
3608             #include <iconv.h>
3609             ],
3610             [
3611                 const char *input = "testing";
3612                 iconv_t h = iconv_open("", "");
3613                 iconv(h, &input, NULL, NULL, NULL);
3614                 iconv_close(h);
3615             ],
3616             [ac_cv_func_const_iconv=yes],
3617             [ac_cv_func_const_iconv=no] 
3618             )]
3619         )
3620     if test "$ac_cv_func_const_iconv" = "yes"; then
3621         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3622     fi
3624 LIBS=$_SAVE_LIBS
3626     ;;
3627 esac
3629 AM_LANGINFO_CODESET
3631 AC_LANG_C
3633 dnl **********************
3634 dnl *** va_copy checks ***
3635 dnl **********************
3636 dnl we currently check for all three va_copy possibilities, so we get
3637 dnl all results in config.log for bug reports.
3638 AC_MSG_CHECKING(for an implementation of va_copy())
3639 AC_CACHE_VAL(ac_cv_va_copy,[
3640     AC_TRY_RUN([
3641         #include <stdarg.h>
3642         void f (int i, ...) {
3643             va_list args1, args2;
3644             va_start (args1, i);
3645             va_copy (args2, args1);
3646             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3647                 exit (1);
3648             va_end (args1); va_end (args2);
3649         }
3650         int main() { f (0, 42); return 0; }],
3651         ac_cv_va_copy=yes,
3652         ac_cv_va_copy=no,
3653         ac_cv_va_copy=no
3654     )
3656 AC_MSG_RESULT($ac_cv_va_copy)
3657 AC_MSG_CHECKING(for an implementation of __va_copy())
3658 AC_CACHE_VAL(ac_cv___va_copy,[
3659     AC_TRY_RUN([
3660         #include <stdarg.h>
3661         void f (int i, ...) {
3662             va_list args1, args2;
3663             va_start (args1, i);
3664             __va_copy (args2, args1);
3665             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3666                 exit (1);
3667             va_end (args1); va_end (args2);
3668         }
3669         int main() { f (0, 42); return 0; }],
3670         ac_cv___va_copy=yes,
3671         ac_cv___va_copy=no,
3672         ac_cv___va_copy=no
3673     )
3675 AC_MSG_RESULT($ac_cv___va_copy)
3676 AC_MSG_CHECKING(whether va_lists can be copied by value)
3677 AC_CACHE_VAL(ac_cv_va_val_copy,[
3678     AC_TRY_RUN([
3679         #include <stdarg.h>
3680         void f (int i, ...) {
3681             va_list args1, args2;
3682             va_start (args1, i);
3683             args2 = args1;
3684             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3685                 exit (1);
3686             va_end (args1); va_end (args2);
3687         }
3688         int main() { f (0, 42); return 0; }],
3689         ac_cv_va_val_copy=yes,
3690         ac_cv_va_val_copy=no,
3691         ac_cv_va_val_copy=yes
3692     )
3694 if test "x$ac_cv_va_copy" = "xyes"; then
3695     AC_DEFINE(VA_COPY, va_copy)
3696     AC_DEFINE(HAVE_VA_COPY)
3697 elif test "x$ac_cv___va_copy" = "xyes"; then
3698     AC_DEFINE(VA_COPY, __va_copy)
3699     AC_DEFINE(HAVE_VA_COPY)
3702 if test "x$ac_cv_va_val_copy" = "xno"; then
3703    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3705 AC_MSG_RESULT($ac_cv_va_val_copy)
3707 dnl Check for dll-challenged libc's.
3708 dnl This check is apparently only needed for Linux.
3709 case "$target" in
3710         *-linux*)
3711             dnl ===================================================================
3712             _curdir=`pwd`
3713             export _curdir
3714             rm -rf conftest* _conftest
3715             mkdir _conftest
3716             cat >> conftest.C <<\EOF
3717 #include <stdio.h>
3718 #include <link.h>
3719 #include <dlfcn.h>
3720 #ifdef _dl_loaded
3721 void __dump_link_map(void) {
3722   struct link_map *map = _dl_loaded;
3723   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3725 int main() {
3726   dlopen("./conftest1.so",RTLD_LAZY);
3727   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3728   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3729   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3730   __dump_link_map();
3732 #else
3733 /* _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).*/
3734 int main() { printf("./conftest1.so\n"); }
3735 #endif
3738             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3740             cat >> conftest1.C <<\EOF
3741 #include <stdio.h>
3742 void foo(void) {printf("foo in dll called\n");}
3744             ${CXX-g++} -fPIC -c -g conftest1.C
3745             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3746             ${CXX-g++} -g conftest.C -o conftest -ldl
3747             cp -f conftest1.so conftest _conftest
3748             cd _conftest
3749             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3750             then
3751                 echo
3752                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3753                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3754                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3755                 echo "*** will be excessive memory usage at runtime."
3756                 echo
3757             fi
3758             cd ${_curdir}
3759             rm -rf conftest* _conftest
3760             dnl ===================================================================
3761             ;;
3762 esac
3764 dnl ===================================================================
3765 dnl ========================================================
3766 dnl By default, turn rtti and exceptions off on g++/egcs
3767 dnl ========================================================
3768 if test "$GNU_CXX"; then
3770   AC_MSG_CHECKING(for C++ exceptions flag)
3772   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3773   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3774   [echo "int main() { return 0; }" | cat > conftest.C
3776   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3778   if egrep "warning.*renamed" conftest.out >/dev/null; then
3779     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3780   else
3781     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3782   fi
3784   rm -f conftest*])
3786   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3787   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3788   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3791 dnl ========================================================
3792 dnl Put your C++ language/feature checks below
3793 dnl ========================================================
3794 AC_LANG_CPLUSPLUS
3796 HAVE_GCC3_ABI=
3797 if test "$GNU_CC"; then
3798   AC_CACHE_CHECK(for gcc 3.0 ABI,
3799       ac_cv_gcc_three_abi,
3800       [AC_TRY_COMPILE([],
3801                       [
3802 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3803   return 0;
3804 #else
3805 #error Not gcc3.
3806 #endif
3807                       ],
3808                       ac_cv_gcc_three_abi="yes",
3809                       ac_cv_gcc_three_abi="no")])
3810   if test "$ac_cv_gcc_three_abi" = "yes"; then
3811       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3812       HAVE_GCC3_ABI=1
3813   else
3814       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3815   fi
3817 AC_SUBST(HAVE_GCC3_ABI)
3820 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3821                ac_cv_cpp_explicit,
3822                [AC_TRY_COMPILE(class X {
3823                                public: explicit X(int i) : i_(i) {}
3824                                private: int i_;
3825                                };,
3826                                X x(3);,
3827                                ac_cv_cpp_explicit=yes,
3828                                ac_cv_cpp_explicit=no)])
3829 if test "$ac_cv_cpp_explicit" = yes ; then
3830    AC_DEFINE(HAVE_CPP_EXPLICIT)
3833 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3834                ac_cv_cpp_typename,
3835                [AC_TRY_COMPILE(class param {
3836                                public:
3837                                    typedef unsigned long num_type;
3838                                };
3840                                template <class T> class tplt {
3841                                public:
3842                                    typedef typename T::num_type t_num_type;
3843                                    t_num_type foo(typename T::num_type num) {
3844                                        return num;
3845                                    }
3846                                };,
3847                                tplt<param> A;
3848                                A.foo(0);,
3849                                ac_cv_cpp_typename=yes,
3850                                ac_cv_cpp_typename=no)])
3851 if test "$ac_cv_cpp_typename" = yes ; then
3852    AC_DEFINE(HAVE_CPP_TYPENAME)
3855 dnl Check for support of modern template specialization syntax
3856 dnl Test code and requirement from scc@netscape.com.
3857 dnl Autoconf cut-and-paste job by waterson@netscape.com
3858 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3859                ac_cv_cpp_modern_specialize_template_syntax,
3860                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3861                                class Y {};
3862                                template <> struct X<Y> { double a; };,
3863                                X<int> int_x;
3864                                X<Y> y_x;,
3865                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3866                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3867 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3868   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3872 dnl Some compilers support only full specialization, and some don't.
3873 AC_CACHE_CHECK(whether partial template specialization works,
3874                ac_cv_cpp_partial_specialization,
3875                [AC_TRY_COMPILE(template <class T> class Foo {};
3876                                template <class T> class Foo<T*> {};,
3877                                return 0;,
3878                                ac_cv_cpp_partial_specialization=yes,
3879                                ac_cv_cpp_partial_specialization=no)])
3880 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3881   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3884 dnl Some compilers have limited support for operators with templates;
3885 dnl specifically, it is necessary to define derived operators when a base
3886 dnl class's operator declaration should suffice.
3887 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3888                ac_cv_need_derived_template_operators,
3889                [AC_TRY_COMPILE([template <class T> class Base { };
3890                                 template <class T>
3891                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3892                                 template <class T> class Derived : public Base<T> { };],
3893                                [Derived<char> a, b;
3894                                 Base<char> c = a + b;
3895                                 return 0;],
3896                                ac_cv_need_derived_template_operators=no,
3897                                ac_cv_need_derived_template_operators=yes)])
3898 if test "$ac_cv_need_derived_template_operators" = yes ; then
3899   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3903 dnl Some compilers have trouble detecting that a template class
3904 dnl that derives from another template is actually an instance
3905 dnl of the base class. This test checks for that.
3906 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3907                ac_cv_need_cpp_template_cast_to_base,
3908                [AC_TRY_COMPILE([template <class T> class Base { };
3909                                 template <class T> class Derived : public Base<T> { };
3910                                 template <class T> int foo(const Base<T>&) { return 0; }],
3911                                [Derived<char> bar; return foo(bar);],
3912                                ac_cv_need_cpp_template_cast_to_base=no,
3913                                ac_cv_need_cpp_template_cast_to_base=yes)])
3914 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3915   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3918 dnl Some compilers have trouble resolving the ambiguity between two
3919 dnl functions whose arguments differ only by cv-qualifications.
3920 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3921                ac_cv_can_resolve_const_ambiguity,
3922                [AC_TRY_COMPILE([
3923                                 template <class T> class ptrClass {
3924                                   public: T* ptr;
3925                                 };
3927                                 template <class T> T* a(ptrClass<T> *arg) {
3928                                   return arg->ptr;
3929                                 }
3931                                 template <class T>
3932                                 const T* a(const ptrClass<T> *arg) {
3933                                   return arg->ptr;
3934                                 }
3935                                ],
3936                                [ ptrClass<int> i;
3937                                  a(&i); ],
3938                                ac_cv_can_resolve_const_ambiguity=yes,
3939                                ac_cv_can_resolve_const_ambiguity=no)])
3940 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3941   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3945 dnl We don't do exceptions on unix.  The only reason this used to be here
3946 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3947 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3948 dnl So im commenting this out until someone writes some artificial 
3949 dnl intelligence to detect not only if the compiler has exceptions, but if 
3950 dnl they are enabled as well.
3951 dnl 
3952 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3953 dnl                ac_cv_cpp_exceptions,
3954 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3955 dnl                                static void F() { throw X(); },
3956 dnl                                try { F(); } catch(X & e) { },
3957 dnl                                ac_cv_cpp_exceptions=yes,
3958 dnl                                ac_cv_cpp_exceptions=no)])
3959 dnl if test $ac_cv_cpp_exceptions = yes ; then
3960 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3961 dnl fi
3963 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3964 dnl supports it well enough to allow us to use it to change access, but not
3965 dnl to resolve ambiguity. The next two tests determine how well the |using|
3966 dnl keyword is supported.
3968 dnl Check to see if we can change access with |using|.  Test both a
3969 dnl legal and an illegal example.
3970 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3971                ac_cv_cpp_access_changing_using2,
3972                [AC_TRY_COMPILE(
3973                    class A { protected: int foo() { return 0; } };
3974                    class B : public A { public: using A::foo; };,
3975                    B b; return b.foo();,
3976                    [AC_TRY_COMPILE(
3977                        class A { public: int foo() { return 1; } };
3978                        class B : public A { private: using A::foo; };,
3979                        B b; return b.foo();,
3980                        ac_cv_cpp_access_changing_using2=no,
3981                        ac_cv_cpp_access_changing_using2=yes)],
3982                    ac_cv_cpp_access_changing_using2=no)])
3983 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3984    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3987 dnl Check to see if we can resolve ambiguity with |using|.
3988 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3989                ac_cv_cpp_ambiguity_resolving_using,
3990                [AC_TRY_COMPILE(class X { 
3991                                  public: int go(const X&) {return 3;}
3992                                          int jo(const X&) {return 3;}
3993                                };
3994                                class Y : public X {
3995                                  public:  int go(int) {return 2;}
3996                                           int jo(int) {return 2;}
3997                                           using X::jo;
3998                                  private: using X::go;
3999                                };,
4000                                X x; Y y; y.jo(x);,
4001                                ac_cv_cpp_ambiguity_resolving_using=yes,
4002                                ac_cv_cpp_ambiguity_resolving_using=no)])
4003 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4004    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4007 dnl Check to see if the |std| namespace is supported. If so, we'll want
4008 dnl to qualify any standard library calls with "std::" to ensure that
4009 dnl those functions can be resolved.
4010 AC_CACHE_CHECK(for \"std::\" namespace,
4011                ac_cv_cpp_namespace_std,
4012                [AC_TRY_COMPILE([#include <algorithm>],
4013                                [return std::min(0, 1);],
4014                                ac_cv_cpp_namespace_std=yes,
4015                                ac_cv_cpp_namespace_std=no)])
4016 if test "$ac_cv_cpp_namespace_std" = yes ; then
4017    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4020 dnl Older compilers are overly ambitious with respect to using the standard
4021 dnl template library's |operator!=()| when |operator==()| is defined. In
4022 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4023 dnl ambiguity at compile-time. This test checks for that case.
4024 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4025                ac_cv_cpp_unambiguous_std_notequal,
4026                [AC_TRY_COMPILE([#include <algorithm>
4027                                 struct T1 {};
4028                                 int operator==(const T1&, const T1&) { return 0; }
4029                                 int operator!=(const T1&, const T1&) { return 0; }],
4030                                [T1 a,b; return a != b;],
4031                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4032                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4033 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4034   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4038 AC_CACHE_CHECK(for C++ reinterpret_cast,
4039                ac_cv_cpp_reinterpret_cast,
4040                [AC_TRY_COMPILE(struct X { int i; };
4041                                struct Y { int i; };,
4042                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4043                                ac_cv_cpp_reinterpret_cast=yes,
4044                                ac_cv_cpp_reinterpret_cast=no)])
4045 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4046    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4049 dnl See if a dynamic_cast to void* gives the most derived object.
4050 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4051                ac_cv_cpp_dynamic_cast_void_ptr,
4052                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4053                             class Y { int j; public: virtual ~Y() { } };
4054                             class Z : public X, public Y { int k; };
4056                             int main() {
4057                                  Z mdo;
4058                                  X *subx = (X*)&mdo;
4059                                  Y *suby = (Y*)&mdo;
4060                                  return !((((void*)&mdo != (void*)subx) &&
4061                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4062                                           (((void*)&mdo != (void*)suby) &&
4063                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4064                             }],
4065                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4066                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4067                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4068 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4069    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4073 dnl note that this one is reversed - if the test fails, then
4074 dnl we require implementations of unused virtual methods. Which
4075 dnl really blows because it means we'll have useless vtable
4076 dnl bloat.
4077 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4078                ac_cv_cpp_unused_required,
4079                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4080                                X x;,
4081                                ac_cv_cpp_unused_required=no,
4082                                ac_cv_cpp_unused_required=yes)])
4083 if test "$ac_cv_cpp_unused_required" = yes ; then
4084    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4088 dnl Some compilers have trouble comparing a constant reference to a templatized
4089 dnl class to zero, and require an explicit operator==() to be defined that takes
4090 dnl an int. This test separates the strong from the weak.
4092 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4093                ac_cv_trouble_comparing_to_zero,
4094                [AC_TRY_COMPILE([#include <algorithm>
4095                                 template <class T> class Foo {};
4096                                 class T2;
4097                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4098                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4099                                [Foo<int> f; return (0 != f);],
4100                                ac_cv_trouble_comparing_to_zero=no,
4101                                ac_cv_trouble_comparing_to_zero=yes)])
4102 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4103   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4108 dnl End of C++ language/feature checks
4109 AC_LANG_C
4111 dnl ========================================================
4112 dnl =  Internationalization checks
4113 dnl ========================================================
4115 dnl Internationalization and Locale support is different
4116 dnl on various UNIX platforms.  Checks for specific i18n
4117 dnl features go here.
4119 dnl check for LC_MESSAGES
4120 AC_CACHE_CHECK(for LC_MESSAGES,
4121                 ac_cv_i18n_lc_messages,
4122                 [AC_TRY_COMPILE([#include <locale.h>],
4123                                 [int category = LC_MESSAGES;],
4124                                 ac_cv_i18n_lc_messages=yes,
4125                                 ac_cv_i18n_lc_messages=no)])
4126 if test "$ac_cv_i18n_lc_messages" = yes; then
4127    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4128 fi      
4130 fi # SKIP_COMPILER_CHECKS
4132 TARGET_XPCOM_ABI=
4133 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4134     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4137 dnl Mozilla specific options
4138 dnl ========================================================
4139 dnl The macros used for command line options
4140 dnl are defined in build/autoconf/altoptions.m4.
4143 dnl ========================================================
4144 dnl =
4145 dnl = Check for external package dependencies
4146 dnl =
4147 dnl ========================================================
4148 MOZ_ARG_HEADER(External Packages)
4150 MOZ_ENABLE_LIBXUL=
4152 MOZ_ARG_WITH_STRING(libxul-sdk,
4153 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4154   LIBXUL_SDK_DIR=$withval)
4156 if test "$LIBXUL_SDK_DIR" = "yes"; then
4157     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4158 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4159     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4161     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4162         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4163     fi
4165     MOZ_ENABLE_LIBXUL=1
4167 AC_SUBST(LIBXUL_SDK)
4169 if test -n "$LIBXUL_SDK"; then
4170     LIBXUL_DIST="$LIBXUL_SDK"
4171 else
4172     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4174 AC_SUBST(LIBXUL_DIST)
4176 SYSTEM_LIBXUL=
4178 MOZ_ARG_WITH_BOOL(system-libxul,
4179 [  --with-system-libxul   Use system installed libxul SDK],
4180     SYSTEM_LIBXUL=1)
4182 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4183     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4186 dnl ========================================================
4187 dnl = If NSPR was not detected in the system, 
4188 dnl = use the one in the source tree (mozilla/nsprpub)
4189 dnl ========================================================
4190 MOZ_ARG_WITH_BOOL(system-nspr,
4191 [  --with-system-nspr      Use system installed NSPR],
4192     _USE_SYSTEM_NSPR=1 )
4194 if test -n "$_USE_SYSTEM_NSPR"; then
4195     AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4198 if test -n "$MOZ_NATIVE_NSPR"; then
4199     _SAVE_CFLAGS=$CFLAGS
4200     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4201     AC_TRY_COMPILE([#include "prlog.h"],
4202                 [#ifndef PR_STATIC_ASSERT
4203                  #error PR_STATIC_ASSERT not defined
4204                  #endif],
4205                 [MOZ_NATIVE_NSPR=1],
4206                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4207     CFLAGS=$_SAVE_CFLAGS
4208 else
4209     if test "$OS_ARCH" = "WINCE"; then
4210         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4211         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4212     elif test "$OS_ARCH" = "WINNT"; then
4213         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4214         if test -n "$GNU_CC"; then
4215             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4216         else
4217             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4218         fi
4219     else
4220         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4221         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4222     fi
4225 dnl ========================================================
4226 dnl = If NSS was not detected in the system, 
4227 dnl = use the one in the source tree (mozilla/security/nss)
4228 dnl ========================================================
4230 MOZ_ARG_WITH_BOOL(system-nss,
4231 [  --with-system-nss      Use system installed NSS],
4232     _USE_SYSTEM_NSS=1 )
4234 if test -n "$_USE_SYSTEM_NSS"; then
4235     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4238 if test -n "$MOZ_NATIVE_NSS"; then
4239    NSS_LIBS="$NSS_LIBS -lcrmf"
4240 else
4241    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4242    NSS_DEP_LIBS="\
4243         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4244         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4245         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4246         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4247         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4249    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4250        NSS_LIBS="\
4251         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4252         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4253         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4254         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4255         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4256    else
4257        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4258    fi
4261 if test -z "$SKIP_LIBRARY_CHECKS"; then
4262 dnl system JPEG support
4263 dnl ========================================================
4264 MOZ_ARG_WITH_STRING(system-jpeg,
4265 [  --with-system-jpeg[=PFX]
4266                           Use system libjpeg [installed at prefix PFX]],
4267     JPEG_DIR=$withval)
4269 _SAVE_CFLAGS=$CFLAGS
4270 _SAVE_LDFLAGS=$LDFLAGS
4271 _SAVE_LIBS=$LIBS
4272 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4273     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4274     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4276 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4277     SYSTEM_JPEG=
4278 else
4279     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4282 if test "$SYSTEM_JPEG" = 1; then
4283     LIBS="$JPEG_LIBS $LIBS"
4284     AC_TRY_COMPILE([ #include <stdio.h>
4285                      #include <sys/types.h>
4286                      #include <jpeglib.h> ],
4287                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4288                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4289                      #endif ],
4290                    SYSTEM_JPEG=1,
4291                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4292 fi 
4293 CFLAGS=$_SAVE_CFLAGS
4294 LDFLAGS=$_SAVE_LDFLAGS
4295 LIBS=$_SAVE_LIBS
4297 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4298     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4299     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4302 dnl system ZLIB support
4303 dnl ========================================================
4304 MOZ_ARG_WITH_STRING(system-zlib,
4305 [  --with-system-zlib[=PFX]
4306                           Use system libz [installed at prefix PFX]],
4307     ZLIB_DIR=$withval)
4309 _SAVE_CFLAGS=$CFLAGS
4310 _SAVE_LDFLAGS=$LDFLAGS
4311 _SAVE_LIBS=$LIBS
4312 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4313     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4314     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4316 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4317     SYSTEM_ZLIB=
4318 else
4319     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4320         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4322 if test "$SYSTEM_ZLIB" = 1; then
4323     LIBS="$ZLIB_LIBS $LIBS"
4324     AC_TRY_COMPILE([ #include <stdio.h>
4325                      #include <string.h>
4326                      #include <zlib.h> ],
4327                    [ #if ZLIB_VERNUM < $MOZZLIB 
4328                      #error "Insufficient zlib version ($MOZZLIB required)."
4329                      #endif ],
4330                    SYSTEM_ZLIB=1,
4331                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4333 CFLAGS=$_SAVE_CFLAGS
4334 LDFLAGS=$_SAVE_LDFLAGS
4335 LIBS=$_SAVE_LIBS
4337 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4338     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4339     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4342 dnl system BZIP2 Support
4343 dnl ========================================================
4344 MOZ_ARG_WITH_STRING(system-bz2,
4345 [  --with-system-bz2[=PFX]
4346                           Use system libbz2 [installed at prefix PFX]],
4347     BZ2_DIR=$withval)
4349 _SAVE_CFLAGS=$CFLAGS
4350 _SAVE_LDFLAGS=$LDFLAGS
4351 _SAVE_LIBS=$LIBS
4352 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4353     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4354     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4356 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4357     SYSTEM_BZ2=
4358 else
4359     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4360         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4362 CFLAGS=$_SAVE_CFLAGS
4363 LDFLAGS=$_SAVE_LDFLAGS
4364 LIBS=$_SAVE_LIBS
4366 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4367     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4368     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4371 dnl system PNG Support
4372 dnl ========================================================
4373 MOZ_ARG_WITH_STRING(system-png, 
4374 [  --with-system-png[=PFX]
4375                           Use system libpng [installed at prefix PFX]],
4376     PNG_DIR=$withval)
4378 _SAVE_CFLAGS=$CFLAGS
4379 _SAVE_LDFLAGS=$LDFLAGS
4380 _SAVE_LIBS=$LIBS
4381 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4382 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4383 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4384     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4385     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4387 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4388     SYSTEM_PNG=
4389 else
4390     _SAVE_PNG_LIBS=$PNG_LIBS
4391     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4392                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4393                  $PNG_LIBS)
4394     AC_CHECK_LIB(png, png_get_acTL, ,
4395                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4396                  $_SAVE_PNG_LIBS)
4398 if test "$SYSTEM_PNG" = 1; then
4399     LIBS="$PNG_LIBS $LIBS"
4400     AC_TRY_COMPILE([ #include <stdio.h>
4401                      #include <sys/types.h>
4402                      #include <png.h> ],
4403                    [ #if PNG_LIBPNG_VER < $MOZPNG
4404                      #error "Insufficient libpng version ($MOZPNG required)."
4405                      #endif
4406                      #ifndef PNG_UINT_31_MAX
4407                      #error "Insufficient libpng version."
4408                      #endif ],
4409                    SYSTEM_PNG=1,
4410                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4412 CFLAGS=$_SAVE_CFLAGS
4413 LDFLAGS=$_SAVE_LDFLAGS
4414 LIBS=$_SAVE_LIBS
4416 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4417     PNG_CFLAGS="-I${PNG_DIR}/include"
4418     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4421 fi # SKIP_LIBRARY_CHECKS
4423 dnl system HunSpell Support
4424 dnl ========================================================
4425 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4426 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4427     SYSTEM_HUNSPELL=1 )
4429 if test -n "$SYSTEM_HUNSPELL"; then
4430     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4433 AC_SUBST(SYSTEM_HUNSPELL)
4435 dnl ========================================================
4436 dnl Java SDK support
4437 dnl ========================================================
4438 JAVA_INCLUDE_PATH=
4439 MOZ_ARG_WITH_STRING(java-include-path,
4440 [  --with-java-include-path=dir   Location of Java SDK headers],
4441     JAVA_INCLUDE_PATH=$withval)
4443 JAVA_BIN_PATH=
4444 MOZ_ARG_WITH_STRING(java-bin-path,
4445 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4446     JAVA_BIN_PATH=$withval)
4448 dnl ========================================================
4449 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4450 dnl their usage and use them in spidermonkey.
4451 dnl ========================================================
4452 MOZ_ARG_WITH_BOOL(arm-kuser,
4453 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4454     USE_ARM_KUSER=1,
4455     USE_ARM_KUSER=)
4456 if test -n "$USE_ARM_KUSER"; then
4457    AC_DEFINE(USE_ARM_KUSER)
4460 dnl ========================================================
4461 dnl =
4462 dnl = Application
4463 dnl =
4464 dnl ========================================================
4466 MOZ_ARG_HEADER(Application)
4468 BUILD_STATIC_LIBS=
4469 ENABLE_TESTS=1
4470 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4471 MOZ_BRANDING_DIRECTORY=
4472 MOZ_OFFICIAL_BRANDING=
4473 MOZ_DBGRINFO_MODULES=
4474 MOZ_FEEDS=1
4475 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4476 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4477 MOZ_JAVAXPCOM=
4478 MOZ_JSDEBUGGER=1
4479 MOZ_JSLOADER=1
4480 MOZ_MATHML=1
4481 MOZ_MORK=1
4482 MOZ_MORKREADER=
4483 MOZ_AUTH_EXTENSION=1
4484 MOZ_NO_ACTIVEX_SUPPORT=1
4485 MOZ_NO_INSPECTOR_APIS=
4486 MOZ_NO_FAST_LOAD=
4487 MOZ_OGG=1
4488 MOZ_SYDNEYAUDIO=
4489 MOZ_WAVE=1
4490 MOZ_MEDIA=
4491 MOZ_PERMISSIONS=1
4492 MOZ_PLACES=
4493 MOZ_PLAINTEXT_EDITOR_ONLY=
4494 MOZ_PLUGINS=1
4495 MOZ_PREF_EXTENSIONS=1
4496 MOZ_PROFILELOCKING=1
4497 MOZ_PSM=1
4498 MOZ_RDF=1
4499 MOZ_REFLOW_PERF=
4500 MOZ_SAFE_BROWSING=
4501 MOZ_FASTSTART=
4502 MOZ_HELP_VIEWER=
4503 MOZ_SPELLCHECK=1
4504 MOZ_SPLASHSCREEN=
4505 MOZ_STATIC_MAIL_BUILD=
4506 MOZ_STORAGE=1
4507 MOZ_SVG=1
4508 MOZ_TIMELINE=
4509 MOZ_UI_LOCALE=en-US
4510 MOZ_UNIVERSALCHARDET=1
4511 MOZ_URL_CLASSIFIER=
4512 MOZ_USE_NATIVE_UCONV=
4513 MOZ_VIEW_SOURCE=1
4514 MOZ_XPFE_COMPONENTS=1
4515 MOZ_XPINSTALL=1
4516 MOZ_XSLT_STANDALONE=
4517 MOZ_XTF=1
4518 MOZ_XUL=1
4519 MOZ_ZIPWRITER=1
4520 NS_PRINTING=1
4521 NECKO_WIFI=1
4522 NECKO_COOKIES=1
4523 NECKO_DISK_CACHE=1
4524 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4525 NECKO_SMALL_BUFFERS=
4526 XPC_IDISPATCH_SUPPORT=
4529 case "$target_os" in
4530 darwin*)
4531     ACCESSIBILITY=
4532     ;;
4534     ACCESSIBILITY=1
4535     ;;
4536 esac
4538 case "$target_os" in
4539     msvc*|mks*|cygwin*|mingw*)
4540         NS_ENABLE_TSF=1
4541         if test -z "$GNU_CC"; then 
4542             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4543                 NS_ENABLE_TSF=
4544             fi
4545             XPC_IDISPATCH_SUPPORT=1
4546             MOZ_NO_ACTIVEX_SUPPORT=
4547         fi
4548         if test -n "$NS_ENABLE_TSF"; then
4549             AC_DEFINE(NS_ENABLE_TSF)
4550         fi
4551         ;;
4552 esac
4554 MOZ_ARG_ENABLE_STRING(application,
4555 [  --enable-application=APP
4556                           Options include:
4557                             browser (Firefox)
4558                             xulrunner
4559                             content/xslt (Standalone Transformiix XSLT)
4560                             netwerk (Standalone Necko)
4561                             tools/update-packaging (AUS-related packaging tools)
4562                             standalone (use this for standalone
4563                               xpcom/xpconnect or to manually drive a build)],
4564 [ MOZ_BUILD_APP=$enableval ] )
4566 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4567 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4568   XULRUNNER_STUB_NAME=$withval)
4570 if test -z "$XULRUNNER_STUB_NAME"; then
4571   case "$target_os" in
4572   darwin*)
4573     XULRUNNER_STUB_NAME=xulrunner
4574     ;;
4575   *)
4576     XULRUNNER_STUB_NAME=xulrunner-stub
4577   esac
4579 AC_SUBST(XULRUNNER_STUB_NAME)
4581 if test -z "$MOZ_BUILD_APP"; then
4582   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4583 else
4584   # We have a valid application only if it has a build.mk file in its top
4585   # directory.
4586   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4587     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4588   fi
4591 # Allow the application to influence configure with a confvars.sh script.
4593 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4594 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4595   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4596   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4597 else
4598   AC_MSG_RESULT([no])
4601 # Now is a good time to test for logic errors, define mismatches, etc.
4602 case "$MOZ_BUILD_APP" in
4603 xulrunner)
4604   if test "$LIBXUL_SDK"; then
4605     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4606   fi
4607   ;;
4608 esac
4610 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4611 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4612 # MOZ_BUILD_APP.
4613 case "$MOZ_BUILD_APP" in
4614 browser)
4615   AC_DEFINE(MOZ_PHOENIX)
4616   ;;
4618 xulrunner)
4619   AC_DEFINE(MOZ_XULRUNNER)
4620   ;;
4622 content/xslt)
4623   AC_DEFINE(TX_EXE)
4624   ;;
4626 standalone) 
4627   MOZ_APP_NAME=mozilla
4628   MOZ_APP_DISPLAYNAME=Mozilla
4629   MOZ_APP_VERSION=$MOZILLA_VERSION
4630   ;;
4632 esac
4634 AC_SUBST(MOZ_BUILD_APP)
4635 AC_SUBST(MOZ_PHOENIX)
4636 AC_SUBST(MOZ_XULRUNNER)
4638 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4640 dnl ========================================================
4641 dnl = 
4642 dnl = Toolkit Options
4643 dnl = 
4644 dnl ========================================================
4645 MOZ_ARG_HEADER(Toolkit Options)
4647     dnl ========================================================
4648     dnl = Select the default toolkit
4649     dnl ========================================================
4650         MOZ_ARG_ENABLE_STRING(default-toolkit,
4651         [  --enable-default-toolkit=TK
4652                           Select default toolkit
4653                           Platform specific defaults:
4654                             BeOS - cairo-beos
4655                             Mac OS X - cairo-cocoa
4656                             Neutrino/QNX - photon
4657                             OS/2 - cairo-os2
4658                             Win32/WinCE - cairo-windows
4659                             Gtk2 with DirectFB - cairo-gtk2-dfb
4660                             * - cairo-gtk2
4661                             * - cairo-qt],
4662     [ _DEFAULT_TOOLKIT=$enableval ],
4663     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4665     if test "$_DEFAULT_TOOLKIT" = "photon" \
4666         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4667         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4668         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4669         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4670         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4671         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4672         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4673         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4674     then
4675         dnl nglayout only supports building with one toolkit,
4676         dnl so ignore everything after the first comma (",").
4677         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4678     else
4679         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4680     fi
4682 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4684 dnl ========================================================
4685 dnl = Enable the toolkit as needed                         =
4686 dnl ========================================================
4688 case "$MOZ_WIDGET_TOOLKIT" in
4689 photon)
4690         MOZ_ENABLE_PHOTON=1
4691         AC_DEFINE(MOZ_WIDGET_PHOTON)
4692     ;;
4694 cairo-windows)
4695     MOZ_WIDGET_TOOLKIT=windows
4696     ;;
4698 cairo-gtk2|cairo-gtk2-x11)
4699     MOZ_WIDGET_TOOLKIT=gtk2
4700     MOZ_ENABLE_GTK2=1
4701     MOZ_ENABLE_XREMOTE=1
4703     AC_DEFINE(MOZ_X11)
4704     MOZ_X11=1
4706     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4707     TK_LIBS='$(MOZ_GTK2_LIBS)'
4708     AC_DEFINE(MOZ_WIDGET_GTK2)
4709     ;;
4711 cairo-gtk2-dfb)
4712     MOZ_WIDGET_TOOLKIT=gtk2
4713     MOZ_ENABLE_GTK2=1
4715     AC_DEFINE(MOZ_DFB)
4716     MOZ_DFB=1
4718     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4719     TK_LIBS='$(MOZ_GTK2_LIBS)'
4720     AC_DEFINE(MOZ_WIDGET_GTK2)
4721     if test "$no_x" != "yes"; then
4722         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4723         no_x=yes
4724     fi
4725     ;;
4727 cairo-qt)
4728     MOZ_WIDGET_TOOLKIT=qt
4729     MOZ_ENABLE_QT=1
4730     MOZ_ENABLE_XREMOTE=1
4731     USE_ELF_DYNSTR_GC=
4732     NS_PRINTING=
4734     AC_DEFINE(MOZ_X11)
4735     MOZ_X11=1
4737     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4738     TK_LIBS='$(MOZ_QT_LIBS)'
4739     AC_DEFINE(MOZ_WIDGET_QT)
4740     ;;
4742 cairo-beos)
4743     MOZ_WIDGET_TOOLKIT=beos
4744     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4745     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4746     ;;
4748 cairo-os2)
4749     MOZ_WIDGET_TOOLKIT=os2
4750     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4751     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4752     ;;
4754 cairo-cocoa)
4755     MOZ_WIDGET_TOOLKIT=cocoa
4756     AC_DEFINE(MOZ_WIDGET_COCOA)
4757     MOZ_USER_DIR="Mozilla"
4758     AC_DEFINE(XP_MACOSX)
4759     AC_DEFINE(TARGET_CARBON)
4760     AC_DEFINE(TARGET_API_MAC_CARBON)
4761     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4762     TK_CFLAGS="-DNO_X11"
4763     LDFLAGS="$LDFLAGS -framework Cocoa"
4764     CFLAGS="$CFLAGS $TK_CFLAGS"
4765     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4766     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
4767     MOZ_FS_LAYOUT=bundle
4768     ;;
4769 esac
4771 if test "$MOZ_ENABLE_XREMOTE"; then
4772     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4775 if test "$COMPILE_ENVIRONMENT"; then
4776   if test "$MOZ_ENABLE_GTK2"; then
4777     if test "$MOZ_X11"; then
4778       GDK_PACKAGES=gdk-x11-2.0
4779     elif test "$MOZ_DFB"; then
4780       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4781       GDK_PACKAGES=directfb
4782     fi
4784     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4785   fi
4787 fi # COMPILE_ENVIRONMENT
4789 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4790 AC_SUBST(MOZ_FS_LAYOUT)
4792 dnl ========================================================
4793 dnl = startup-notification support module
4794 dnl ========================================================
4796 if test "$MOZ_ENABLE_GTK2"
4797 then
4798     MOZ_ENABLE_STARTUP_NOTIFICATION=
4800     MOZ_ARG_ENABLE_BOOL(startup-notification,
4801     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4802         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4803         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4804     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4805     then
4806         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4807                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4808         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4809             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4810             then
4811                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4812             fi
4813             MOZ_ENABLE_STARTUP_NOTIFICATION=
4814         ])
4815     fi
4817     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4818         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4819     fi
4821     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4823 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4824 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4825 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4827 dnl ========================================================
4828 dnl = QT support
4829 dnl ========================================================
4830 if test "$MOZ_ENABLE_QT"
4831 then
4832     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4833     AC_SUBST(MOZ_QT_CFLAGS)
4834     AC_SUBST(MOZ_QT_LIBS)
4836     MOZ_ARG_WITH_STRING(qtdir,
4837     [  --with-qtdir=\$dir       Specify Qt directory ],
4838     [ QTDIR=$withval])
4840     if test -z "$QTDIR"; then
4841       QTDIR="/usr"
4842     fi
4843     QTINCDIR="/include/qt"
4844     if test ! -d "$QTDIR$QTINCDIR"; then
4845        QTINCDIR="/include/X11/qt"
4846     fi
4847     if test ! -d "$QTDIR$QTINCDIR"; then
4848        QTINCDIR="/include"
4849     fi
4851     if test -x "$QTDIR/bin/moc-qt4"; then
4852       HOST_MOC="$QTDIR/bin/moc-qt4"
4853     else
4854       if test -x "$QTDIR/bin/moc"; then
4855         HOST_MOC="$QTDIR/bin/moc"
4856       else
4857         AC_CHECK_PROGS(HOST_MOC, moc, "")
4858       fi
4859     fi
4860     if test -z "$HOST_MOC"; then
4861       AC_MSG_ERROR([no acceptable moc preprocessor found])
4862     fi
4863     MOC=$HOST_MOC
4866 AC_SUBST(GTK_CONFIG)
4867 AC_SUBST(TK_CFLAGS)
4868 AC_SUBST(TK_LIBS)
4870 AC_SUBST(MOZ_ENABLE_GTK2)
4871 AC_SUBST(MOZ_ENABLE_PHOTON)
4872 AC_SUBST(MOZ_ENABLE_QT)
4873 AC_SUBST(MOZ_ENABLE_XREMOTE)
4874 AC_SUBST(MOZ_GTK2_CFLAGS)
4875 AC_SUBST(MOZ_GTK2_LIBS)
4876 AC_SUBST(MOZ_QT_CFLAGS)
4877 AC_SUBST(MOZ_QT_LIBS)
4879 AC_SUBST(MOC)
4881 AC_SUBST(MOZ_DFB)
4882 AC_SUBST(MOZ_X11)
4884 dnl ========================================================
4885 dnl =
4886 dnl = Components & Features
4887 dnl = 
4888 dnl ========================================================
4889 MOZ_ARG_HEADER(Components and Features)
4891 dnl ========================================================
4892 dnl = Localization
4893 dnl ========================================================
4894 MOZ_ARG_ENABLE_STRING(ui-locale,
4895 [  --enable-ui-locale=ab-CD
4896                           Select the user interface locale (default: en-US)],
4897     MOZ_UI_LOCALE=$enableval )
4898 AC_SUBST(MOZ_UI_LOCALE)
4900 dnl ========================================================
4901 dnl = Trademarked Branding 
4902 dnl ========================================================
4903 MOZ_ARG_ENABLE_BOOL(official-branding,
4904 [  --enable-official-branding Enable Official mozilla.org Branding
4905                           Do not distribute builds with
4906                           --enable-official-branding unless you have
4907                           permission to use trademarks per
4908                           http://www.mozilla.org/foundation/trademarks/ .],
4910   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4911     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4912   else
4913     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4914     MOZ_OFFICIAL_BRANDING=1
4915   fi
4916 ], MOZ_OFFICIAL_BRANDING=)
4918 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4919 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4920   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4923 MOZ_ARG_WITH_STRING(branding,
4924 [  --with-branding=dir    Use branding from the specified directory.],
4925     MOZ_BRANDING_DIRECTORY=$withval)
4927 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4928 if test -z "$REAL_BRANDING_DIRECTORY"; then
4929   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4932 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4933   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4936 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4938 dnl ========================================================
4939 dnl = Distribution ID
4940 dnl ========================================================
4941 MOZ_ARG_WITH_STRING(distribution-id,
4942 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4943 [ val=`echo $withval`
4944     MOZ_DISTRIBUTION_ID="$val"])
4946 if test -z "$MOZ_DISTRIBUTION_ID"; then
4947    MOZ_DISTRIBUTION_ID="org.mozilla"
4950 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4951 AC_SUBST(MOZ_DISTRIBUTION_ID)
4954 dnl ========================================================
4955 dnl complex text support off by default
4956 dnl ========================================================
4957 MOZ_PANGO=1
4958 MOZ_ARG_DISABLE_BOOL(pango,
4959 [  --disable-pango Disable usage of Pango ],
4960     MOZ_PANGO=,
4961     MOZ_PANGO=1)
4964 dnl ========================================================
4965 dnl = Pango
4966 dnl ========================================================
4967 if test "$MOZ_ENABLE_GTK2"
4968 then
4969     AC_SUBST(MOZ_PANGO)
4971     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4973     if test "$MOZ_PANGO"
4974     then
4975         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4976         AC_SUBST(MOZ_PANGO_CFLAGS)
4977         AC_SUBST(MOZ_PANGO_LIBS)
4978         AC_DEFINE(MOZ_PANGO)
4979     else
4980         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4981         AC_SUBST(MOZ_PANGO_CFLAGS)
4982         AC_SUBST(MOZ_PANGO_LIBS)
4984         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
4985         AC_SUBST(FT2_CFLAGS)
4986         AC_SUBST(FT2_LIBS)
4987     fi
4990 dnl ========================================================
4991 dnl = GnomeVFS support module
4992 dnl ========================================================
4994 if test "$MOZ_X11"
4995 then
4996     dnl build the gnomevfs extension by default only when the
4997     dnl GTK2 toolkit is in use.
4998     if test "$MOZ_ENABLE_GTK2"
4999     then
5000         MOZ_ENABLE_GNOMEVFS=1
5001         MOZ_ENABLE_GCONF=1
5002     fi
5004     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5005     [  --disable-gnomevfs      Disable GnomeVFS support ],
5006         MOZ_ENABLE_GNOMEVFS=,
5007         MOZ_ENABLE_GNOMEVFS=force)
5009     if test "$MOZ_ENABLE_GNOMEVFS"
5010     then
5011         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5012             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5013             MOZ_ENABLE_GNOMEVFS=1
5014             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5015         ],[
5016             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5017             then
5018                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5019             fi
5020             MOZ_ENABLE_GNOMEVFS=
5021         ])
5022     fi
5024     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5025     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5026     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5028     if test "$MOZ_ENABLE_GCONF"
5029     then
5030         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5031             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5032             MOZ_ENABLE_GCONF=1
5033         ],[
5034             MOZ_ENABLE_GCONF=
5035         ])
5036     fi
5038     if test "$MOZ_ENABLE_GCONF"; then
5039         AC_DEFINE(MOZ_ENABLE_GCONF)
5040     fi
5042     AC_SUBST(MOZ_ENABLE_GCONF)
5043     AC_SUBST(MOZ_GCONF_CFLAGS)
5044     AC_SUBST(MOZ_GCONF_LIBS)
5046     dnl ========================================================
5047     dnl = GIO support module
5048     dnl ========================================================
5049     MOZ_ARG_ENABLE_BOOL(gio,
5050     [  --enable-gio            Enable GIO support (default: disabled)],
5051         MOZ_ENABLE_GIO=force,
5052         MOZ_ENABLE_GIO=)
5054     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5055     then
5056         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5057             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5058             MOZ_ENABLE_GIO=1
5059             AC_DEFINE(MOZ_ENABLE_GIO)
5060         ],[
5061             if test "$MOZ_ENABLE_GIO" = "force"
5062             then
5063                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5064             fi
5065             MOZ_ENABLE_GIO=
5066         ])
5067     fi
5069     AC_SUBST(MOZ_ENABLE_GIO)
5070     AC_SUBST(MOZ_GIO_CFLAGS)
5071     AC_SUBST(MOZ_GIO_LIBS)
5074 dnl ========================================================
5075 dnl = libgnomeui support module
5076 dnl ========================================================
5078 if test "$MOZ_ENABLE_GTK2"
5079 then
5080     MOZ_ENABLE_GNOMEUI=1
5082     MOZ_ARG_DISABLE_BOOL(gnomeui,
5083     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5084         MOZ_ENABLE_GNOMEUI=,
5085         MOZ_ENABLE_GNOMEUI=force)
5087     if test "$MOZ_ENABLE_GNOMEUI"
5088     then
5089         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5090         [
5091             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5092             MOZ_ENABLE_GNOMEUI=1
5093         ],[
5094             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5095             then
5096                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5097             fi
5098             MOZ_ENABLE_GNOMEUI=
5099         ])
5100     fi
5102     if test "$MOZ_ENABLE_GNOMEUI"; then
5103         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5104     fi
5106     # The GNOME component is built if gtk2, gconf and gnome-vfs
5107     # are all available.
5109     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" && \
5110             (test "$MOZ_ENABLE_GNOMEVFS" || test "$MOZ_ENABLE_GIO"); then
5111       MOZ_ENABLE_GNOME_COMPONENT=1
5112     else
5113       MOZ_ENABLE_GNOME_COMPONENT=
5114     fi
5116     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5118 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5119 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5120 AC_SUBST(MOZ_GNOMEUI_LIBS)
5122 dnl ========================================================
5123 dnl = dbus support
5124 dnl ========================================================
5126 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5127 then
5128     MOZ_ENABLE_DBUS=1
5130     MOZ_ARG_DISABLE_BOOL(dbus,
5131     [  --disable-dbus       Disable dbus support ],
5132         MOZ_ENABLE_DBUS=,
5133         MOZ_ENABLE_DBUS=1)
5135     if test "$MOZ_ENABLE_DBUS"
5136     then
5137         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5138         AC_DEFINE(MOZ_ENABLE_DBUS)
5139     fi
5141 AC_SUBST(MOZ_ENABLE_DBUS)
5142 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5143 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5145 dnl ========================================================
5146 dnl = libnotify support
5147 dnl ========================================================
5149 if test "$MOZ_ENABLE_GTK2"
5150 then
5151     MOZ_ENABLE_LIBNOTIFY=1
5153     MOZ_ARG_DISABLE_BOOL(libnotify,
5154     [  --disable-libnotify       Disable libnotify support ],
5155     MOZ_ENABLE_LIBNOTIFY=,
5156     MOZ_ENABLE_LIBNOTIFY=1)
5158     if test "$MOZ_ENABLE_LIBNOTIFY"
5159     then
5160         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5161     fi
5164 if test -z "$SKIP_LIBRARY_CHECKS"
5165 then
5166     if test "$MOZ_ENABLE_GTK2"
5167     then
5168         if test "$MOZ_ENABLE_LIBNOTIFY"
5169         then
5170             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5171         fi
5172     fi
5174 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5175 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5176 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5178 dnl ========================================================
5179 dnl = Build Personal Security Manager
5180 dnl ========================================================
5181 MOZ_ARG_DISABLE_BOOL(crypto,
5182 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5183     MOZ_PSM=,
5184     MOZ_PSM=1 )
5186 dnl ========================================================
5187 dnl = JS Debugger XPCOM component (js/jsd)
5188 dnl ========================================================
5189 MOZ_ARG_DISABLE_BOOL(jsd,
5190 [  --disable-jsd           Disable JavaScript debug library],
5191     MOZ_JSDEBUGGER=,
5192     MOZ_JSDEBUGGER=1)
5195 dnl ========================================================
5196 dnl = Disable plugin support
5197 dnl ========================================================
5198 MOZ_ARG_DISABLE_BOOL(plugins,
5199 [  --disable-plugins       Disable plugins support],
5200     MOZ_PLUGINS=,
5201     MOZ_PLUGINS=1)
5203 dnl ========================================================
5204 dnl = Disable building dbm
5205 dnl ========================================================
5206 MOZ_ARG_DISABLE_BOOL(dbm,
5207 [  --disable-dbm       Disable building dbm],
5208     NSS_DISABLE_DBM=1,
5209     NSS_DISABLE_DBM=)
5211 dnl bi-directional support always on
5212 IBMBIDI=1
5213 AC_DEFINE(IBMBIDI)
5215 dnl ========================================================
5216 dnl view source support on by default
5217 dnl ========================================================
5218 if test "$MOZ_VIEW_SOURCE"; then
5219     AC_DEFINE(MOZ_VIEW_SOURCE)
5222 dnl ========================================================
5223 dnl accessibility support on by default on all platforms 
5224 dnl except OS X.
5225 dnl ========================================================
5226 MOZ_ARG_DISABLE_BOOL(accessibility,
5227 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5228     ACCESSIBILITY=,
5229     ACCESSIBILITY=1 )
5230 if test "$ACCESSIBILITY"; then
5231     AC_DEFINE(ACCESSIBILITY)
5234 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5235 case "$target" in
5236 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5237     if test "$ac_cv_header_atlbase_h" = "no"; then
5238         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.])
5239     fi
5240     if test "$ac_cv_header_oleacc_idl" = "no"; then
5241         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.])
5242     fi
5243     ;;
5244 esac
5247 dnl ========================================================
5248 dnl xpfe/components on by default
5249 dnl ========================================================
5250 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5251 [  --disable-xpfe-components
5252                           Disable xpfe components],
5253     MOZ_XPFE_COMPONENTS=,
5254     MOZ_XPFE_COMPONENTS=1 )
5256 dnl ========================================================
5257 dnl xpinstall support on by default
5258 dnl ========================================================
5259 MOZ_ARG_DISABLE_BOOL(xpinstall,
5260 [  --disable-xpinstall     Disable xpinstall support],
5261     MOZ_XPINSTALL=,
5262     MOZ_XPINSTALL=1 )
5263 if test "$MOZ_XPINSTALL"; then
5264     AC_DEFINE(MOZ_XPINSTALL)
5267 dnl ========================================================
5268 dnl xpcom js loader support on by default
5269 dnl ========================================================
5270 if test "$MOZ_JSLOADER"; then
5271     AC_DEFINE(MOZ_JSLOADER)
5274 dnl ========================================================
5275 dnl Disable printing
5276 dnl ========================================================
5277 MOZ_ARG_DISABLE_BOOL(printing,
5278 [  --disable-printing  Disable printing support],
5279     NS_PRINTING=,
5280     NS_PRINTING=1 )
5282 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5283     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5284     NS_PRINTING=
5287 if test "$NS_PRINTING"; then
5288     AC_DEFINE(NS_PRINTING)
5289     AC_DEFINE(NS_PRINT_PREVIEW)
5292 dnl ========================================================
5293 dnl use native unicode converters
5294 dnl ========================================================
5295 MOZ_ARG_ENABLE_BOOL(native-uconv,
5296 [  --enable-native-uconv   Enable iconv support],
5297     MOZ_USE_NATIVE_UCONV=1,
5298     MOZ_USE_NATIVE_UCONV= )
5299 if test "$MOZ_USE_NATIVE_UCONV"; then
5300     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5302 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5303     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5307 dnl ========================================================
5308 dnl Libeditor can be build as plaintext-only,
5309 dnl or as a full html and text editing component.
5310 dnl We build both by default.
5311 dnl ========================================================
5312 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5313 [  --enable-plaintext-editor-only
5314                           Allow only plaintext editing],
5315     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5316     MOZ_PLAINTEXT_EDITOR_ONLY= )
5317 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5318 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5320 dnl ========================================================
5321 dnl = Disable Fast Load
5322 dnl ========================================================
5323 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5324 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5325     MOZ_NO_FAST_LOAD=1,
5326     MOZ_NO_FAST_LOAD=)
5328 AC_SUBST(MOZ_NO_FAST_LOAD)
5330 if test -n "$MOZ_NO_FAST_LOAD"; then
5331     AC_DEFINE(MOZ_NO_FAST_LOAD)
5334 dnl ========================================================
5335 dnl = Disable Ogg Codecs
5336 dnl ========================================================
5337 MOZ_ARG_DISABLE_BOOL(ogg,
5338 [  --disable-ogg           Disable Ogg Codec support],
5339     MOZ_OGG=,
5340     MOZ_OGG=1)
5342 AC_SUBST(MOZ_OGG)
5344 if test -n "$MOZ_OGG"; then
5345     AC_DEFINE(MOZ_OGG)
5346     MOZ_SYDNEYAUDIO=1
5347     MOZ_MEDIA=1
5349     dnl Checks for __attribute__(aligned()) directive
5350     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5351         [ac_cv_c_attribute_aligned],
5352         [ac_cv_c_attribute_aligned=0
5353          CFLAGS_save="${CFLAGS}"
5354          CFLAGS="${CFLAGS} -Werror"
5355          for ac_cv_c_attr_align_try in 64 32 16 8; do
5356            echo "trying $ac_cv_c_attr_align_try"
5357            AC_TRY_COMPILE([],
5358                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5359                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5360            if test "$ac_cv_c_attribute_aligned" != 0; then
5361              break;
5362            fi
5363          done
5364            CFLAGS="${CFLAGS_save}"])
5365     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5366       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5367                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5368     fi
5371 dnl ========================================================
5372 dnl = Disable Wave decoder support
5373 dnl ========================================================
5374 MOZ_ARG_DISABLE_BOOL(wave,
5375 [  --disable-wave          Disable Wave decoder support],
5376     MOZ_WAVE=,
5377     MOZ_WAVE=1)
5379 AC_SUBST(MOZ_WAVE)
5381 if test -n "$MOZ_WAVE"; then
5382     AC_DEFINE(MOZ_WAVE)
5383     MOZ_SYDNEYAUDIO=1
5384     MOZ_MEDIA=1
5387 dnl ========================================================
5388 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5389 dnl ========================================================
5391 AC_SUBST(MOZ_SYDNEYAUDIO)
5393 if test -n "$MOZ_SYDNEYAUDIO"; then
5394     AC_DEFINE(MOZ_SYDNEYAUDIO)
5397 AC_SUBST(MOZ_MEDIA)
5399 if test -n "$MOZ_MEDIA"; then
5400     AC_DEFINE(MOZ_MEDIA)
5403 dnl ========================================================
5404 dnl = Check alsa availability on Linux if using sydneyaudio
5405 dnl ========================================================
5407 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5408 if test -n "$MOZ_SYDNEYAUDIO"; then
5409    case "$target_os" in
5410 linux*)
5411       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5412          [echo "$MOZ_ALSA_PKG_ERRORS"
5413           AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux.  Disable with --disable-ogg --disable-wave.])])
5414       ;;
5415    esac
5417 AC_SUBST(MOZ_ALSA_LIBS)
5419 dnl ========================================================
5420 dnl Splashscreen
5421 dnl ========================================================
5422 AC_ARG_ENABLE(splashscreen,
5423               [  --enable-splashscreen   display splashscreen while loading (default=no)],
5424               [enable_splash="yes"],[enable_splash=""])
5425 if test "x$enable_splash" = "xyes"; then
5426   MOZ_SPLASHSCREEN=1
5427   AC_DEFINE(MOZ_SPLASHSCREEN)
5429 AC_SUBST(MOZ_SPLASHSCREEN)
5431 dnl ========================================================
5432 dnl Permissions System
5433 dnl ========================================================
5434 MOZ_ARG_DISABLE_BOOL(permissions,
5435 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5436     MOZ_PERMISSIONS=,
5437     MOZ_PERMISSIONS=1
5440 dnl ========================================================
5441 dnl NegotiateAuth
5442 dnl ========================================================
5443 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5444 [  --disable-negotiateauth Disable GSS-API negotiation ],
5445     MOZ_AUTH_EXTENSION=,
5446     MOZ_AUTH_EXTENSION=1 )
5448 dnl ========================================================
5449 dnl XTF
5450 dnl ========================================================
5451 MOZ_ARG_DISABLE_BOOL(xtf,
5452 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5453     MOZ_XTF=,
5454     MOZ_XTF=1 )
5455 if test "$MOZ_XTF"; then
5456   AC_DEFINE(MOZ_XTF)
5459 dnl ========================================================
5460 dnl Pref extensions (autoconfig and system-pref)
5461 dnl ========================================================
5462 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5463 [  --disable-pref-extensions
5464                           Disable pref extensions such as autoconfig and
5465                           system-pref],
5466   MOZ_PREF_EXTENSIONS=,
5467   MOZ_PREF_EXTENSIONS=1 )
5469 dnl ========================================================
5470 dnl = Universalchardet
5471 dnl ========================================================
5472 MOZ_ARG_DISABLE_BOOL(universalchardet,
5473 [  --disable-universalchardet
5474                           Disable universal encoding detection],
5475   MOZ_UNIVERSALCHARDET=,
5476   MOZ_UNIVERSALCHARDET=1 )
5478 dnl ========================================================
5479 dnl JavaXPCOM
5480 dnl ========================================================
5481 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5482 [  --enable-javaxpcom
5483                           Enable Java-XPCOM bridge],
5484     MOZ_JAVAXPCOM=1,
5485     MOZ_JAVAXPCOM= )
5487 if test -n "${MOZ_JAVAXPCOM}"; then
5488   case "$host_os" in
5489     cygwin*|msvc*|mks*)
5490       if test -n "$JAVA_HOME"; then
5491         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5492       fi
5493       ;;
5494     *mingw*)
5495       if test -n "$JAVA_HOME"; then
5496         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5497       fi
5498       ;;
5499   esac
5501   if test -n "${JAVA_INCLUDE_PATH}"; then
5502     dnl Make sure jni.h exists in the given include path.
5503     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5504       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5505     fi
5506   else
5507     case "$target_os" in
5508       darwin*)
5509         dnl Default to java system location
5510         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5511         ;;
5512       *)
5513         dnl Try $JAVA_HOME
5514         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5515         ;;
5516     esac
5517     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5518       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.])
5519     fi
5520   fi
5522   if test -n "${JAVA_BIN_PATH}"; then
5523     dnl Look for javac and jar in the specified path.
5524     JAVA_PATH="$JAVA_BIN_PATH"
5525   else
5526     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5527     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5528   fi
5530   MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5531   MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5532   MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5533   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5534     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.])
5535   fi
5538 dnl ========================================================
5539 dnl = Breakpad crash reporting (on by default on supported platforms)
5540 dnl ========================================================
5542 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5543     || test "$OS_ARCH" = "Darwin" \
5544     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5545     || test "$OS_ARCH" = "SunOS") \
5546    && test -z "$HAVE_64BIT_OS"; then
5547    MOZ_CRASHREPORTER=1
5550 MOZ_ARG_DISABLE_BOOL(crashreporter,
5551 [  --disable-crashreporter          Disable breakpad crash reporting],
5552     MOZ_CRASHREPORTER=,
5553     MOZ_CRASHREPORTER=1)
5555 if test -n "$MOZ_CRASHREPORTER"; then
5556    AC_DEFINE(MOZ_CRASHREPORTER)
5558   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5559     test -z "$SKIP_LIBRARY_CHECKS"; then
5560     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5561     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5562     AC_SUBST(MOZ_GTHREAD_LIBS)
5564     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.])])
5565   fi
5568 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5569 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5570 [ val=`echo $withval | sed 's/[^0-9]//g'`
5571     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5573 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5574    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5576 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5578 dnl ========================================================
5579 dnl = Enable compilation of specific extension modules
5580 dnl ========================================================
5582 MOZ_ARG_ENABLE_STRING(extensions,
5583 [  --enable-extensions     Enable extensions],
5584 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5585     if test "$option" = "yes" || test "$option" = "all"; then
5586         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5587     elif test "$option" = "no" || test "$option" = "none"; then
5588         MOZ_EXTENSIONS=""
5589     elif test "$option" = "default"; then
5590         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5591     elif test `echo "$option" | grep -c \^-` != 0; then
5592         option=`echo $option | sed 's/^-//'`
5593         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5594     else
5595         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5596     fi
5597 done],
5598     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5600 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5601     # Suppress warning on non-X11 platforms
5602     if test -n "$MOZ_X11"; then
5603         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5604     fi
5605     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5608 dnl Do not build gnomevfs with libxul based apps
5609 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5610     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5613 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5614     # Suppress warning on non-X11 platforms
5615     if test -n "$MOZ_X11"; then
5616         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5617     fi
5618     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5621 dnl Do not build gio with libxul based apps
5622 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5623     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5626 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5627     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5628     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5631 dnl This might be temporary: build tridentprofile only on Windows
5632 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5633     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5634     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5637 dnl cookie must be built before tridentprofile. put it at list's end.
5638 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5639   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5640   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5643 dnl xforms requires xtf and schema-validation
5644 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5645     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5646     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5648 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5649     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5650     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5653 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5654     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5655     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5658 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5659     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5660     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5663 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5664     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5665     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5668 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5669     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5670     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5673 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5674     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5675     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5678 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5679     AC_MSG_WARN([spellcheck is no longer an extension.])
5680     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5683 dnl Remove dupes
5684 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5686 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5687 dnl when trying to build a non-existent extension.
5688 for extension in $MOZ_EXTENSIONS; do
5689     if test ! -d "${srcdir}/extensions/${extension}"; then
5690         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5691     fi
5692 done
5695 dnl ========================================================
5696 dnl Image decoders
5697 dnl ========================================================
5698 case "$MOZ_WIDGET_TOOLKIT" in
5699 beos|windows|os2|mac|cocoa)
5700     ;;
5702     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
5703        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
5704     fi
5705     ;;
5706 esac
5708 MOZ_ARG_ENABLE_STRING(image-decoders,
5709 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5710                           Enable specific image decoders],
5711 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5712     if test "$option" = "yes" || test "$option" = "all"; then
5713         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5714     elif test "$option" = "no" || test "$option" = "none"; then
5715         MOZ_IMG_DECODERS=""
5716     elif test "$option" = "default"; then
5717         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5718     elif test `echo "$option" | grep -c \^-` != 0; then
5719         option=`echo $option | sed 's/^-//'`
5720         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5721     else
5722         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5723     fi
5724 done],
5725     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5727 dnl Dupes are removed in the encoder section because it will also add decoders
5729 dnl ========================================================
5730 dnl Image encoders
5731 dnl ========================================================
5732 MOZ_ARG_ENABLE_STRING(image-encoders,
5733 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5734                           Enable specific image encoders],
5735 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5736     if test "$option" = "yes" || test "$option" = "all"; then
5737         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5738     elif test "$option" = "no" || test "$option" = "none"; then
5739         MOZ_IMG_ENCODERS=""
5740         addencoder=""
5741     elif test "$option" = "default"; then
5742         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5743     elif test `echo "$option" | grep -c \^-` != 0; then
5744         option=`echo $option | sed 's/^-//'`
5745         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5746     else
5747         addencoder="$option"
5748     fi
5749     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5750 done],
5751     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5753 dnl Remove dupes
5754 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5755 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5757 dnl ========================================================
5758 dnl MathML on by default
5759 dnl ========================================================
5760 MOZ_ARG_DISABLE_BOOL(mathml,
5761 [  --disable-mathml        Disable MathML support],
5762     MOZ_MATHML=,
5763     MOZ_MATHML=1 )
5764 if test "$MOZ_MATHML"; then
5765   AC_DEFINE(MOZ_MATHML)
5768 dnl ========================================================
5769 dnl SVG
5770 dnl ========================================================
5771 MOZ_ARG_DISABLE_BOOL(svg,
5772 [  --disable-svg            Disable SVG support],
5773     MOZ_SVG=,
5774     MOZ_SVG=1 )
5775 if test -n "$MOZ_SVG"; then
5776   AC_DEFINE(MOZ_SVG)
5779 dnl ========================================================
5780 dnl SMIL
5781 dnl ========================================================
5782 MOZ_SMIL=1
5783 MOZ_ARG_DISABLE_BOOL(smil,
5784 [  --disable-smil           Disable SMIL animation support],
5785     MOZ_SMIL=,
5786     MOZ_SMIL=1 )
5787 # Automatically disable SMIL if SVG is disabled
5788 if test -z "$MOZ_SVG"; then
5789   MOZ_SMIL=
5791 if test -n "$MOZ_SMIL"; then
5792   AC_DEFINE(MOZ_SMIL)
5795 dnl ========================================================
5796 dnl Build Freetype in the tree
5797 dnl ========================================================
5798 MOZ_ARG_ENABLE_BOOL(tree-freetype,
5799 [  --enable-tree-freetype         Enable Tree FreeType],
5800     MOZ_TREE_FREETYPE=1,
5801     MOZ_TREE_FREETYPE= )
5802 if test -n "$MOZ_TREE_FREETYPE"; then
5803    AC_DEFINE(MOZ_TREE_FREETYPE)
5804    AC_SUBST(MOZ_TREE_FREETYPE)
5805    MOZ_ENABLE_CAIRO_FT=1       
5806    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
5807    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5808    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5809    FT2_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
5810    CAIRO_FT_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
5811    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
5812    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
5813    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
5814    AC_SUBST(CAIRO_FT_CFLAGS)
5818 dnl ========================================================
5819 dnl Installer
5820 dnl ========================================================
5821 case "$target_os" in
5822     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5823         MOZ_INSTALLER=1
5824         ;;
5825 esac
5827 MOZ_ARG_DISABLE_BOOL(installer,
5828 [  --disable-installer     Disable building of installer],
5829     MOZ_INSTALLER=,
5830     MOZ_INSTALLER=1 )
5831 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
5832     # Disable installer for Windows builds that use the new toolkit if NSIS
5833     # isn't in the path.
5834     MOZ_PATH_PROGS(MAKENSIS, makensis)
5835     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5836         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5837     fi
5838     # The Windows build for NSIS requires the iconv command line utility to
5839     # convert the charset of the locale files.
5840     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5841     if test -z "$HOST_ICONV"; then
5842         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5843     fi
5846 # Automatically disable installer if xpinstall isn't built
5847 if test -z "$MOZ_XPINSTALL"; then
5848     MOZ_INSTALLER=
5850 AC_SUBST(MOZ_INSTALLER)
5852 AC_MSG_CHECKING([for tar archiver])
5853 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5854 if test -z "$TAR"; then
5855     AC_MSG_ERROR([no tar archiver found in \$PATH])
5857 AC_MSG_RESULT([$TAR])
5858 AC_SUBST(TAR)
5860 AC_MSG_CHECKING([for wget])
5861 AC_CHECK_PROGS(WGET, wget, "")
5862 AC_MSG_RESULT([$WGET])
5863 AC_SUBST(WGET)
5865 dnl ========================================================
5866 dnl Updater
5867 dnl ========================================================
5869 MOZ_ARG_DISABLE_BOOL(updater,
5870 [  --disable-updater       Disable building of updater],
5871     MOZ_UPDATER=,
5872     MOZ_UPDATER=1 )
5873 AC_SUBST(MOZ_UPDATER)
5875 # app update channel is 'default' when not supplied.
5876 MOZ_ARG_ENABLE_STRING([update-channel],
5877 [  --enable-update-channel=CHANNEL
5878                            Select application update channel (default=default)],
5879     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5881 if test -z "$MOZ_UPDATE_CHANNEL"; then
5882     MOZ_UPDATE_CHANNEL=default
5884 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5886 # tools/update-packaging is not checked out by default.
5887 MOZ_ARG_ENABLE_BOOL(update-packaging,
5888 [  --enable-update-packaging
5889                            Enable tools/update-packaging],
5890     MOZ_UPDATE_PACKAGING=1,
5891     MOZ_UPDATE_PACKAGING= )
5892 AC_SUBST(MOZ_UPDATE_PACKAGING)
5894 dnl ========================================================
5895 dnl ActiveX
5896 dnl ========================================================
5898 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5899 [  --disable-xpconnect-idispatch
5900                           Disable building of xpconnect support for IDispatch
5901                           (win32 only)],
5902     XPC_IDISPATCH_SUPPORT=,
5903     XPC_IDISPATCH_SUPPORT=1)
5904 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5906 MOZ_ARG_DISABLE_BOOL(activex,
5907 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5908     MOZ_NO_ACTIVEX_SUPPORT=1,
5909     MOZ_NO_ACTIVEX_SUPPORT= )
5910 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5912 MOZ_ARG_ENABLE_BOOL(activex-scripting,
5913 [  --enable-activex-scripting
5914                           Enable building of ActiveX scripting support (win32)],
5915     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
5916     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
5917 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5919 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5920 then
5921     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5924 if test "$COMPILE_ENVIRONMENT" = "1"; then
5925 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5926 case "$target" in
5927 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5928     if test "$ac_cv_header_atlbase_h" = "no"; then
5929         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.])
5930     fi
5931     ;;
5932 esac
5936 dnl ========================================================
5937 dnl leaky
5938 dnl ========================================================
5939 MOZ_ARG_ENABLE_BOOL(leaky,
5940 [  --enable-leaky          Build leaky memory tool],
5941     MOZ_LEAKY=1,
5942     MOZ_LEAKY=)
5945 dnl ========================================================
5946 dnl xpctools
5947 dnl ========================================================
5948 MOZ_ARG_ENABLE_BOOL(xpctools,
5949 [  --enable-xpctools       Build JS profiling tool],
5950     MOZ_XPCTOOLS=1,
5951     MOZ_XPCTOOLS= )
5954 dnl ========================================================
5955 dnl build the tests by default
5956 dnl ========================================================
5957 MOZ_ARG_DISABLE_BOOL(tests,
5958 [  --disable-tests         Do not build test libraries & programs],
5959     ENABLE_TESTS=,
5960     ENABLE_TESTS=1 )
5962 dnl ========================================================
5963 dnl parental controls (for Windows Vista)
5964 dnl ========================================================
5965 MOZ_ARG_DISABLE_BOOL(parental-controls,
5966 [  --disable-parental-controls
5967                            Do not build parental controls],
5968    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5969    MOZ_DISABLE_PARENTAL_CONTROLS=)
5970 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5971     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5974 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5976 dnl ========================================================
5977 dnl =
5978 dnl = Module specific options
5979 dnl =
5980 dnl ========================================================
5981 MOZ_ARG_HEADER(Individual module options)
5983 dnl ========================================================
5984 dnl = Enable places (new history/bookmarks)
5985 dnl ========================================================
5986 MOZ_ARG_ENABLE_BOOL(places,
5987 [  --enable-places        Enable 'places' bookmark/history implementation],
5988     MOZ_PLACES=1,
5989     MOZ_PLACES= )
5990 if test -n "$MOZ_PLACES"; then
5991     AC_DEFINE(MOZ_PLACES)
5992     if test -z "$MOZ_MAIL_NEWS"; then
5993       MOZ_MORK=
5994     fi
5995     MOZ_MORKREADER=1
5996 else
5997   if test "$MOZ_BUILD_APP" = "browser"; then
5998     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5999   fi
6002 dnl ========================================================
6003 dnl = Disable feed handling components
6004 dnl ========================================================
6005 MOZ_ARG_DISABLE_BOOL(feeds,
6006 [  --disable-feeds        Disable feed handling and processing components],
6007     MOZ_FEEDS=,
6008     MOZ_FEEDS=1 )
6009 if test -n "$MOZ_FEEDS"; then
6010     AC_DEFINE(MOZ_FEEDS)
6011 else
6012     if test "$MOZ_BUILD_APP" = "browser"; then
6013         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6014     fi
6017 dnl ========================================================
6018 dnl = Enable mozStorage
6019 dnl ========================================================
6020 dnl Implicitly enabled by default if building calendar or places
6021 MOZ_ARG_ENABLE_BOOL(storage,
6022 [  --enable-storage        Enable mozStorage module and related components],
6023     MOZ_STORAGE=1,
6024     MOZ_STORAGE= )
6025 if test -n "$MOZ_STORAGE"; then
6026     AC_DEFINE(MOZ_STORAGE)
6029 dnl ========================================================
6030 dnl Check for sqlite
6031 dnl ========================================================
6033 MOZ_NATIVE_SQLITE=
6034 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6035 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6036 MOZ_NATIVE_SQLITE=1,
6037 MOZ_NATIVE_SQLITE= )
6039 if test -z "$MOZ_NATIVE_SQLITE"
6040 then
6041     SQLITE_CFLAGS=
6042     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6043 else
6044     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6047 AC_SUBST(MOZ_NATIVE_SQLITE)
6049 dnl ========================================================
6050 dnl = Enable help viewer (off by default)
6051 dnl ========================================================
6052 MOZ_ARG_ENABLE_BOOL(help-viewer,
6053 [  --enable-help-viewer        Enable help viewer],
6054     MOZ_HELP_VIEWER=1,
6055     MOZ_HELP_VIEWER= )
6056 if test -n "$MOZ_HELP_VIEWER"; then
6057      AC_DEFINE(MOZ_HELP_VIEWER)
6059 AC_SUBST(MOZ_HELP_VIEWER)
6060 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6061     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6064 dnl ========================================================
6065 dnl = Enable safe browsing (anti-phishing)
6066 dnl ========================================================
6067 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6068 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6069     MOZ_SAFE_BROWSING=1,
6070     MOZ_SAFE_BROWSING= )
6071 if test -n "$MOZ_SAFE_BROWSING"; then
6072     AC_DEFINE(MOZ_SAFE_BROWSING)
6074 AC_SUBST(MOZ_SAFE_BROWSING)
6076 dnl ========================================================
6077 dnl = Enable faststart component
6078 dnl ========================================================
6079 MOZ_ARG_ENABLE_BOOL(faststart,
6080 [  --enable-faststart            Enable the faststart component],
6081     MOZ_FASTSTART=1,
6082     MOZ_FASTSTART= )
6083 if test -n "$MOZ_FASTSTART"; then
6084     AC_DEFINE(MOZ_FASTSTART)
6086 AC_SUBST(MOZ_FASTSTART)
6088 dnl ========================================================
6089 dnl = Enable url-classifier
6090 dnl ========================================================
6091 dnl Implicitly enabled by default if building with safe-browsing
6092 if test -n "$MOZ_SAFE_BROWSING"; then
6093     MOZ_URL_CLASSIFIER=1
6095 MOZ_ARG_ENABLE_BOOL(url-classifier,
6096 [  --enable-url-classifier        Enable url classifier module],
6097     MOZ_URL_CLASSIFIER=1,
6098     MOZ_URL_CLASSIFIER= )
6099 if test -n "$MOZ_URL_CLASSIFIER"; then
6100     AC_DEFINE(MOZ_URL_CLASSIFIER)
6102 AC_SUBST(MOZ_URL_CLASSIFIER)
6104 dnl ========================================================
6105 dnl = Disable zipwriter
6106 dnl ========================================================
6107 MOZ_ARG_DISABLE_BOOL(zipwriter,
6108 [  --disable-zipwriter             Disable zipwriter component],
6109     MOZ_ZIPWRITER=,
6110     MOZ_ZIPWRITER=1 )
6111 AC_SUBST(MOZ_ZIPWRITER)
6113 dnl ========================================================
6114 dnl = Hildon and OSSO checks
6115 dnl ========================================================
6116 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
6117                   MOZ_PLATFORM_HILDON=1,
6118                   MOZ_PLATFORM_HILDON=)
6119 if test $MOZ_PLATFORM_HILDON; then
6120    AC_DEFINE(MOZ_PLATFORM_HILDON)
6121    X11_COMPOSITED_PLUGINS="yes"
6123 AC_SUBST(LIBHILDONMIME_CFLAGS)
6124 AC_SUBST(LIBHILDONMIME_LIBS)
6126 if test "$X11_COMPOSITED_PLUGINS" = "yes"; then
6127     dnl if we have Xcomposite we should also have Xdamage and Xfixes
6128     AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6129                      [AC_MSG_ERROR([Couldn't find X11/extentsions/Xdamage.h which is required for composited plugins.])])
6130     AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6131                  [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6133 AC_SUBST(XCOMPOSITE_LIBS)
6135 PKG_CHECK_MODULES(LIBOSSO,libosso,
6136                   NS_OSSO=1,
6137                   NS_OSSO=)
6139 if test $NS_OSSO; then
6140     if test -z "$MOZ_ENABLE_DBUS"; then
6141         AC_MSG_ERROR([DBus is required when building for OSSO])
6142     fi
6143     AC_DEFINE(NS_OSSO)
6144     MOZ_GFX_OPTIMIZE_MOBILE=1
6146 AC_SUBST(LIBOSSO_CFLAGS)
6147 AC_SUBST(LIBOSSO_LIBS)
6149 dnl ========================================================
6150 dnl = faststripe theme
6151 dnl ========================================================
6152 MOZ_ARG_ENABLE_BOOL(faststripe,
6153 [  --enable-faststripe  Use faststripe theme],
6154     MOZ_THEME_FASTSTRIPE=1,
6155     MOZ_THEME_FASTSTRIPE= )
6156 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6158 dnl ========================================================
6159 dnl =
6160 dnl = Feature options that require extra sources to be pulled
6161 dnl =
6162 dnl ========================================================
6163 dnl MOZ_ARG_HEADER(Features that require extra sources)
6165 dnl ========================================================
6166 dnl =
6167 dnl = Debugging Options
6168 dnl = 
6169 dnl ========================================================
6170 MOZ_ARG_HEADER(Debugging and Optimizations)
6172 dnl ========================================================
6173 dnl = Disable building with debug info.
6174 dnl = Debugging is OFF by default
6175 dnl ========================================================
6176 if test -z "$MOZ_DEBUG_FLAGS"
6177 then
6178     case "$target" in
6179     *-irix*)
6180         if test "$GNU_CC"; then
6181             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6182             case "$GCC_VERSION" in
6183             2.95.*)
6184                 MOZ_DEBUG_FLAGS=""
6185                 ;;
6186             *)
6187                 MOZ_DEBUG_FLAGS="-g"
6188                 ;;
6189             esac
6190         else
6191             MOZ_DEBUG_FLAGS="-g"
6192         fi
6193         ;;
6194     *)
6195         MOZ_DEBUG_FLAGS="-g"
6196         ;;
6197     esac
6200 MOZ_ARG_ENABLE_STRING(debug,
6201 [  --enable-debug[=DBG]    Enable building with developer debug info
6202                           (Using compiler flags DBG)],
6203 [ if test "$enableval" != "no"; then
6204     MOZ_DEBUG=1
6205     if test -n "$enableval" && test "$enableval" != "yes"; then
6206         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6207     fi
6208   else
6209     MOZ_DEBUG=
6210   fi ],
6211   MOZ_DEBUG=)
6213 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6214  case "${target_os}" in
6215     beos*)
6216         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6217         ;;
6218     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6219         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6220         ;;
6221     *) 
6222         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6223         ;;
6224   esac
6225 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6227 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6229 if test -n "$MOZ_DEBUG"; then
6230     AC_MSG_CHECKING([for valid debug flags])
6231     _SAVE_CFLAGS=$CFLAGS
6232     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6233     AC_TRY_COMPILE([#include <stdio.h>], 
6234         [printf("Hello World\n");],
6235         _results=yes,
6236         _results=no)
6237     AC_MSG_RESULT([$_results])
6238     if test "$_results" = "no"; then
6239         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6240     fi
6241     CFLAGS=$_SAVE_CFLAGS
6244 dnl ========================================================
6245 dnl enable mobile optimizations
6246 dnl ========================================================
6247 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6248 [  --enable-mobile-optimize   Enable mobile optimizations],
6249     MOZ_GFX_OPTIMIZE_MOBILE=1)
6251 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6253 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6254     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6257 dnl ========================================================
6258 dnl = Enable code optimization. ON by default.
6259 dnl ========================================================
6260 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6261         MOZ_OPTIMIZE_FLAGS="-O"
6264 MOZ_ARG_ENABLE_STRING(optimize,
6265 [  --disable-optimize      Disable compiler optimization
6266   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6267 [ if test "$enableval" != "no"; then
6268     MOZ_OPTIMIZE=1
6269     if test -n "$enableval" && test "$enableval" != "yes"; then
6270         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6271         MOZ_OPTIMIZE=2
6272     fi
6273 else
6274     MOZ_OPTIMIZE=
6275 fi ], MOZ_OPTIMIZE=1)
6277 if test "$COMPILE_ENVIRONMENT"; then
6278 if test -n "$MOZ_OPTIMIZE"; then
6279     AC_MSG_CHECKING([for valid optimization flags])
6280     _SAVE_CFLAGS=$CFLAGS
6281     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6282     AC_TRY_COMPILE([#include <stdio.h>], 
6283         [printf("Hello World\n");],
6284         _results=yes,
6285         _results=no)
6286     AC_MSG_RESULT([$_results])
6287     if test "$_results" = "no"; then
6288         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6289     fi
6290     CFLAGS=$_SAVE_CFLAGS
6292 fi # COMPILE_ENVIRONMENT
6294 AC_SUBST(MOZ_OPTIMIZE)
6295 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6296 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6297 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6299 dnl ========================================================
6300 dnl = Enable/disable debug for specific modules only
6301 dnl =   module names beginning with ^ will be disabled 
6302 dnl ========================================================
6303 MOZ_ARG_ENABLE_STRING(debug-modules,
6304 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6305 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6307 dnl ========================================================
6308 dnl = Enable/disable generation of debugger info for specific modules only
6309 dnl =    the special module name ALL_MODULES can be used to denote all modules
6310 dnl =    module names beginning with ^ will be disabled
6311 dnl ========================================================
6312 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6313 [  --enable-debugger-info-modules
6314                           Enable/disable debugger info for specific modules],
6315 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6316       dnl note that the list of module names is reversed as it is copied
6317       dnl this is important, as it will allow config.mk to interpret stuff like
6318       dnl "^ALL_MODULES xpcom" properly
6319       if test "$i" = "no"; then
6320         i="^ALL_MODULES"
6321       fi
6322       if test "$i" = "yes"; then
6323         i="ALL_MODULES"
6324       fi
6325       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6326     done ])
6328 dnl ========================================================
6329 dnl Disable runtime logging checks
6330 dnl ========================================================
6331 MOZ_ARG_DISABLE_BOOL(logging,
6332 [  --disable-logging       Disable logging facilities],
6333     NS_DISABLE_LOGGING=1,
6334     NS_DISABLE_LOGGING= )
6335 if test "$NS_DISABLE_LOGGING"; then
6336     AC_DEFINE(NS_DISABLE_LOGGING)
6337 else
6338     AC_DEFINE(MOZ_LOGGING)
6341 dnl ========================================================
6342 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6343 dnl ========================================================
6344 _ENABLE_LOGREFCNT=42
6345 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6346 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6347     _ENABLE_LOGREFCNT=1,
6348     _ENABLE_LOGREFCNT= )
6349 if test "$_ENABLE_LOGREFCNT" = "1"; then
6350     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6351 elif test -z "$_ENABLE_LOGREFCNT"; then
6352     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6355 dnl ========================================================
6356 dnl = Enable trace malloc
6357 dnl ========================================================
6358 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6359 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6360 [  --enable-trace-malloc   Enable malloc tracing],
6361     NS_TRACE_MALLOC=1,
6362     NS_TRACE_MALLOC= )
6363 if test "$NS_TRACE_MALLOC"; then
6364   # Please, Mr. Linker Man, don't take away our symbol names
6365   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6366   USE_ELF_DYNSTR_GC=
6367   AC_DEFINE(NS_TRACE_MALLOC)
6369 AC_SUBST(NS_TRACE_MALLOC)
6371 dnl ========================================================
6372 dnl = Enable jemalloc
6373 dnl ========================================================
6374 MOZ_ARG_ENABLE_BOOL(jemalloc,
6375 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6376     MOZ_MEMORY=1,
6377     MOZ_MEMORY=)
6379 if test "$NS_TRACE_MALLOC"; then
6380     MOZ_MEMORY=
6383 if test "$MOZ_MEMORY"; then
6385   dnl Don't try to run compiler tests on Windows  
6386   if test "$OS_ARCH" = "WINNT"; then
6387     if test -z "$HAVE_64BIT_OS"; then
6388       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6389     else
6390       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6391     fi
6392   else
6393     AC_CHECK_SIZEOF([int *], [4])
6394     case "${ac_cv_sizeof_int_p}" in
6395     4)
6396       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6397       ;;
6398     8)
6399       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6400       ;;
6401     *)
6402       AC_MSG_ERROR([Unexpected pointer size])
6403       ;;
6404     esac
6405   fi
6407   AC_DEFINE(MOZ_MEMORY)
6408   if test "x$MOZ_DEBUG" = "x1"; then
6409     AC_DEFINE(MOZ_MEMORY_DEBUG)
6410   fi
6411   dnl The generic feature tests that determine how to compute ncpus are long and
6412   dnl complicated.  Therefore, simply define special cpp variables for the
6413   dnl platforms we have special knowledge of.
6414   case "${target_os}" in
6415   darwin*)
6416     AC_DEFINE(MOZ_MEMORY_DARWIN)
6417     ;;
6418   *freebsd*)
6419     AC_DEFINE(MOZ_MEMORY_BSD)
6420     ;;
6421   *linux*)
6422     AC_DEFINE(MOZ_MEMORY_LINUX)
6423     ;;
6424   netbsd*)
6425     AC_DEFINE(MOZ_MEMORY_BSD)
6426     ;;
6427   solaris*)
6428     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6429     ;;
6430   msvc*|mks*|cygwin*|mingw*)
6431     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6432     dnl This is sort of awful. Will revisit if we add support for more versions
6433     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
6434         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
6435     fi
6436     if test -z "$WIN32_CRT_SRC_DIR"; then
6437       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6438         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).])
6439       else
6440         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6441       fi
6442     fi
6444     if test ! -d "$WIN32_CRT_SRC_DIR"; then
6445       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
6446     fi
6447     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
6448     _objdir_win=`pwd -W`
6449     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/intel"
6450     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
6451     dnl Also pass this to NSPR/NSS
6452     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
6453     export DLLFLAGS
6454     ;;
6455   *wince)
6456     AC_DEFINE(MOZ_MEMORY_WINCE)
6457     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6458     if test -z "$WINCE_WINDOWS_MOBILE"; then
6459       AC_DEFINE(MOZ_MEMORY_WINCE6)
6460     fi
6461     ;;
6462   *)
6463     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6464     ;;
6465   esac
6467 AC_SUBST(MOZ_MEMORY)
6468 AC_SUBST(MOZ_MEMORY_LDFLAGS)
6469 AC_SUBST(WIN32_CRT_SRC_DIR)
6470 dnl Need to set this for make because NSS doesn't have configure
6471 AC_SUBST(DLLFLAGS)
6473 dnl ========================================================
6474 dnl = Use malloc wrapper lib
6475 dnl ========================================================
6476 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6477 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6478     _WRAP_MALLOC=1,
6479     _WRAP_MALLOC= )
6481 if test -n "$_WRAP_MALLOC"; then
6482     if test "$GNU_CC"; then
6483     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"
6484     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6485     fi
6488 dnl ========================================================
6489 dnl = Location of malloc wrapper lib
6490 dnl ========================================================
6491 MOZ_ARG_WITH_STRING(wrap-malloc,
6492 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6493     WRAP_MALLOC_LIB=$withval)
6495 dnl ========================================================
6496 dnl = Use TraceVis
6497 dnl ========================================================
6498 MOZ_ARG_ENABLE_BOOL(tracevis,
6499 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
6500     MOZ_TRACEVIS=1,
6501     MOZ_TRACEVIS= )
6502 if test -n "$MOZ_TRACEVIS"; then
6503     AC_DEFINE(MOZ_TRACEVIS)
6506 dnl ========================================================
6507 dnl = Use Valgrind
6508 dnl ========================================================
6509 MOZ_ARG_ENABLE_BOOL(valgrind,
6510 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
6511     MOZ_VALGRIND=1,
6512     MOZ_VALGRIND= )
6513 if test -n "$MOZ_VALGRIND"; then
6514     AC_CHECK_HEADER([valgrind/valgrind.h], [],
6515         AC_MSG_ERROR(
6516             [--enable-valgrind specified but Valgrind is not installed]))
6517     AC_DEFINE(MOZ_VALGRIND)
6520 dnl ========================================================
6521 dnl jprof
6522 dnl ========================================================
6523 MOZ_ARG_ENABLE_BOOL(jprof,
6524 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6525     MOZ_JPROF=1,
6526     MOZ_JPROF= )
6527 if test -n "$MOZ_JPROF"; then
6528     AC_DEFINE(MOZ_JPROF)
6531 dnl ========================================================
6532 dnl shark
6533 dnl ========================================================
6534 MOZ_ARG_ENABLE_BOOL(shark,
6535 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6536     MOZ_SHARK=1,
6537     MOZ_SHARK= )
6538 if test -n "$MOZ_SHARK"; then
6539     AC_DEFINE(MOZ_SHARK)
6542 dnl ========================================================
6543 dnl callgrind
6544 dnl ========================================================
6545 MOZ_ARG_ENABLE_BOOL(callgrind,
6546 [  --enable-callgrind      Enable callgrind profiling],
6547     MOZ_CALLGRIND=1,
6548     MOZ_CALLGRIND= )
6549 if test -n "$MOZ_CALLGRIND"; then
6550     AC_DEFINE(MOZ_CALLGRIND)
6553 dnl ========================================================
6554 dnl vtune
6555 dnl ========================================================
6556 MOZ_ARG_ENABLE_BOOL(vtune,
6557 [  --enable-vtune          Enable vtune profiling],
6558     MOZ_VTUNE=1,
6559     MOZ_VTUNE= )
6560 if test -n "$MOZ_VTUNE"; then
6561     AC_DEFINE(MOZ_VTUNE)
6564 dnl ========================================================
6565 dnl Zealous JavaScript GC
6566 dnl ========================================================
6567 MOZ_ARG_ENABLE_BOOL(gczeal,
6568 [  --enable-gczeal          Enable zealous JavaScript GCing],
6569     JS_GC_ZEAL=1,
6570     JS_GC_ZEAL= )
6571 if test -n "$JS_GC_ZEAL"; then
6572     AC_DEFINE(JS_GC_ZEAL)
6575 dnl ========================================================
6576 dnl = Enable static checking using gcc-dehydra
6577 dnl ========================================================
6579 MOZ_ARG_WITH_STRING(static-checking,
6580 [  --with-static-checking=path/to/gcc_dehydra.so
6581                             Enable static checking of code using GCC-dehydra],
6582     DEHYDRA_PATH=$withval,
6583     DEHYDRA_PATH= )
6585 if test -n "$DEHYDRA_PATH"; then
6586     if test ! -f "$DEHYDRA_PATH"; then
6587         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6588     fi
6589     AC_DEFINE(NS_STATIC_CHECKING)
6591 AC_SUBST(DEHYDRA_PATH)
6593 dnl ========================================================
6594 dnl = Enable stripping of libs & executables
6595 dnl ========================================================
6596 MOZ_ARG_ENABLE_BOOL(strip,
6597 [  --enable-strip          Enable stripping of libs & executables ],
6598     ENABLE_STRIP=1,
6599     ENABLE_STRIP= )
6601 dnl ========================================================
6602 dnl = Enable stripping of libs & executables when packaging
6603 dnl ========================================================
6604 MOZ_ARG_ENABLE_BOOL(install-strip,
6605 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6606     PKG_SKIP_STRIP= ,
6607     PKG_SKIP_STRIP=1)
6609 dnl ========================================================
6610 dnl = --enable-elf-dynstr-gc
6611 dnl ========================================================
6612 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6613 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6614     USE_ELF_DYNSTR_GC=1,
6615     USE_ELF_DYNSTR_GC= )
6617 dnl ========================================================
6618 dnl = 
6619 dnl = Profiling and Instrumenting
6620 dnl = 
6621 dnl ========================================================
6622 MOZ_ARG_HEADER(Profiling and Instrumenting)
6624 dnl ========================================================
6625 dnl = Enable timeline service, which provides lightweight
6626 dnl = instrumentation of mozilla for performance measurement.
6627 dnl = Timeline is off by default.
6628 dnl ========================================================
6629 MOZ_ARG_ENABLE_BOOL(timeline,
6630 [  --enable-timeline       Enable timeline services ],
6631     MOZ_TIMELINE=1,
6632     MOZ_TIMELINE= )
6633 if test -n "$MOZ_TIMELINE"; then
6634     AC_DEFINE(MOZ_TIMELINE)
6637 dnl ========================================================
6638 dnl Turn on reflow counting
6639 dnl ========================================================
6640 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6641 [  --enable-reflow-perf    Enable reflow performance tracing],
6642     MOZ_REFLOW_PERF=1,
6643     MOZ_REFLOW_PERF= )
6644 if test -n "$MOZ_REFLOW_PERF"; then
6645     AC_DEFINE(MOZ_REFLOW_PERF)
6648 dnl ========================================================
6649 dnl Enable code size metrics.
6650 dnl ========================================================
6651 MOZ_ARG_ENABLE_BOOL(codesighs,
6652 [  --enable-codesighs      Enable code size analysis tools],
6653     _ENABLE_CODESIGHS=1,
6654     _ENABLE_CODESIGHS= )
6655 if test -n "$_ENABLE_CODESIGHS"; then
6656     if test -d $srcdir/tools/codesighs; then 
6657         MOZ_MAPINFO=1
6658     else
6659         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6660     fi
6663 MOZ_ARG_ENABLE_BOOL(insure,
6664 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6665     _ENABLE_INSURE=1,
6666     _ENABLE_INSURE= )
6667 if test -n "$_ENABLE_INSURE"; then
6668     MOZ_INSURE="insure"
6669     MOZ_INSURIFYING=1
6670     MOZ_INSURE_DIRS="."
6671     MOZ_INSURE_EXCLUDE_DIRS="config"
6674 MOZ_ARG_WITH_STRING(insure-dirs,
6675 [  --with-insure-dirs=DIRS
6676                           Dirs to instrument with insure ],
6677     MOZ_INSURE_DIRS=$withval )
6679 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6680 [  --with-insure-exclude-dirs=DIRS
6681                           Dirs to not instrument with insure ],
6682     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6684 dnl ========================================================
6685 dnl = Support for Quantify (Windows)
6686 dnl ========================================================
6687 MOZ_ARG_ENABLE_BOOL(quantify,
6688 [  --enable-quantify      Enable Quantify support (Windows only) ],
6689     MOZ_QUANTIFY=1,
6690     MOZ_QUANTIFY= )
6692 dnl ========================================================
6693 dnl = Support for demangling undefined symbols
6694 dnl ========================================================
6695 if test -z "$SKIP_LIBRARY_CHECKS"; then
6696     AC_LANG_SAVE
6697     AC_LANG_CPLUSPLUS
6698     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6699     AC_LANG_RESTORE
6702 # Demangle only for debug or trace-malloc builds
6703 MOZ_DEMANGLE_SYMBOLS=
6704 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6705     MOZ_DEMANGLE_SYMBOLS=1
6706     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6708 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6710 dnl ========================================================
6711 dnl = Support for gcc stack unwinding (from gcc 3.3)
6712 dnl ========================================================
6713 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6714     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6717 dnl ========================================================
6718 dnl =
6719 dnl = Misc. Options
6720 dnl = 
6721 dnl ========================================================
6722 MOZ_ARG_HEADER(Misc. Options)
6724 dnl ========================================================
6725 dnl update xterm title
6726 dnl ========================================================
6727 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6728 [  --enable-xterm-updates  Update XTERM titles with current command.],
6729     MOZ_UPDATE_XTERM=1,
6730     MOZ_UPDATE_XTERM= )
6732 dnl =========================================================
6733 dnl = Chrome format
6734 dnl =========================================================
6735 MOZ_ARG_ENABLE_STRING([chrome-format],
6736 [  --enable-chrome-format=jar|flat|both|symlink
6737                           Select FORMAT of chrome files (default=jar)],
6738     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6740 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6741     MOZ_CHROME_FILE_FORMAT=jar
6744 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6745     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6746     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6747     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6748     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6751 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
6752    AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
6754 dnl ========================================================
6755 dnl = Define default location for MOZILLA_FIVE_HOME
6756 dnl ========================================================
6757 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6758 [  --with-default-mozilla-five-home
6759                           Set the default value for MOZILLA_FIVE_HOME],
6760 [ val=`echo $withval`
6761   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6763 dnl ========================================================
6764 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6765 dnl ========================================================
6766 MOZ_ARG_WITH_STRING(user-appdir,
6767 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6768 [ val=`echo $withval`
6769 if echo "$val" | grep "\/" >/dev/null; then
6770     AC_MSG_ERROR("Homedir must be single relative path.")
6771 else 
6772     MOZ_USER_DIR="$val"
6773 fi])
6775 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6777 dnl ========================================================
6778 dnl = Doxygen configuration
6779 dnl ========================================================
6780 dnl Use commas to specify multiple dirs to this arg
6781 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6782 MOZ_ARG_WITH_STRING(doc-input-dirs,
6783 [  --with-doc-input-dirs=DIRS
6784                           Header/idl dirs to create docs from],
6785 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6786 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6788 dnl Use commas to specify multiple dirs to this arg
6789 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6790 MOZ_ARG_WITH_STRING(doc-include-dirs,
6791 [  --with-doc-include-dirs=DIRS  
6792                           Include dirs to preprocess doc headers],
6793 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6794 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6796 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6797 MOZ_ARG_WITH_STRING(doc-output-dir,
6798 [  --with-doc-output-dir=DIR
6799                           Dir to generate docs into],
6800 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6801 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6803 if test -z "$SKIP_COMPILER_CHECKS"; then
6804 dnl ========================================================
6805 dnl =
6806 dnl = Compiler Options
6807 dnl = 
6808 dnl ========================================================
6809 MOZ_ARG_HEADER(Compiler Options)
6811 dnl ========================================================
6812 dnl Check for gcc -pipe support
6813 dnl ========================================================
6814 AC_MSG_CHECKING([for gcc -pipe support])
6815 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6816     echo '#include <stdio.h>' > dummy-hello.c
6817     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6818     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6819     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
6820     if test $? = 0; then
6821         _res_as_stdin="yes"
6822     else
6823         _res_as_stdin="no"
6824     fi
6825     if test "$_res_as_stdin" = "yes"; then
6826         _SAVE_CFLAGS=$CFLAGS
6827         CFLAGS="$CFLAGS -pipe"
6828         AC_TRY_COMPILE( [ #include <stdio.h> ],
6829             [printf("Hello World\n");],
6830             [_res_gcc_pipe="yes"],
6831             [_res_gcc_pipe="no"] )
6832         CFLAGS=$_SAVE_CFLAGS
6833     fi
6834     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6835         _res="yes";
6836         CFLAGS="$CFLAGS -pipe"
6837         CXXFLAGS="$CXXFLAGS -pipe"
6838     else
6839         _res="no"
6840     fi
6841     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6842     AC_MSG_RESULT([$_res])
6843 else
6844     AC_MSG_RESULT([no])
6847 dnl pass -Wno-long-long to the compiler
6848 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6849 [  --enable-long-long-warning 
6850                           Warn about use of non-ANSI long long type],
6851     _IGNORE_LONG_LONG_WARNINGS=,
6852     _IGNORE_LONG_LONG_WARNINGS=1)
6854 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6855      _SAVE_CFLAGS="$CFLAGS"
6856      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6857      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6858      AC_TRY_COMPILE([], [return(0);], 
6859         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6860           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6861           result="yes" ], result="no")
6862      AC_MSG_RESULT([$result])
6863      CFLAGS="$_SAVE_CFLAGS"
6866 dnl ========================================================
6867 dnl Profile guided optimization
6868 dnl ========================================================
6869 dnl Test for profiling options
6870 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6871 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6873 dnl Provide a switch to disable PGO even when called via profiledbuild.
6874 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6875 [  --disable-profile-guided-optimization
6876                            Don't build with PGO even if called via make profiledbuild],
6877 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6878 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6880 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6882 _SAVE_CFLAGS="$CFLAGS"
6883 CFLAGS="$CFLAGS -fprofile-generate"
6885 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6886 AC_TRY_COMPILE([], [return 0;],
6887                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6888                  result="yes" ], result="no")
6889 AC_MSG_RESULT([$result])
6891 if test $result = "yes"; then
6892   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6893   PROFILE_USE_CFLAGS="-fprofile-use"
6894   PROFILE_USE_LDFLAGS="-fprofile-use"
6895 else
6896   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6897   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6898   AC_TRY_COMPILE([], [return 0;],
6899                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6900                    result="yes" ], result="no")
6901   AC_MSG_RESULT([$result])
6902   if test $result = "yes"; then
6903     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6904   fi
6905   # don't really care, this is an old GCC
6906   PROFILE_GEN_LDFLAGS=
6907   PROFILE_USE_LDFLAGS=
6910 CFLAGS="$_SAVE_CFLAGS"
6912 if test -n "$INTEL_CC"; then
6913   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6914   PROFILE_GEN_LDFLAGS=
6915   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6916   PROFILE_USE_LDFLAGS=
6919 dnl Sun Studio on Solaris
6920 if test "$SOLARIS_SUNPRO_CC"; then
6921   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6922   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6923   if test "$CPU_ARCH" != "sparc"; then
6924     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6925     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6926   else
6927     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6928     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6929   fi
6932 AC_SUBST(PROFILE_GEN_CFLAGS)
6933 AC_SUBST(PROFILE_GEN_LDFLAGS)
6934 AC_SUBST(PROFILE_USE_CFLAGS)
6935 AC_SUBST(PROFILE_USE_LDFLAGS)
6937 AC_LANG_CPLUSPLUS
6939 dnl ========================================================
6940 dnl Test for -pedantic bustage
6941 dnl ========================================================
6942 MOZ_ARG_DISABLE_BOOL(pedantic,
6943 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6944 _PEDANTIC= )
6945 if test "$_PEDANTIC"; then
6946     _SAVE_CXXFLAGS=$CXXFLAGS
6947     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6948     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6949     AC_TRY_COMPILE([$configure_static_assert_macros],
6950                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6951                    result="no", result="yes" )
6952     AC_MSG_RESULT([$result])
6953     CXXFLAGS="$_SAVE_CXXFLAGS"
6955     case "$result" in
6956     no)
6957         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6958         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6959         ;;
6960     yes)
6961         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
6962         ;;
6963     esac
6966 dnl ========================================================
6967 dnl Test for correct temporary object destruction order
6968 dnl ========================================================
6969 dnl We want to make sure the compiler follows the C++ spec here as 
6970 dnl xpcom and the string classes depend on it (bug 235381).
6971 AC_MSG_CHECKING([for correct temporary object destruction order])
6972 AC_TRY_RUN([ class A {
6973              public:  A(int& x) : mValue(x) {}
6974                       ~A() { mValue--; }
6975                       operator char**() { return 0; }
6976              private:  int& mValue;
6977              };
6978              void func(char **arg) {}
6979              int m=2;
6980              void test() {
6981                   func(A(m));
6982                   if (m==1) m = 0;
6983              }
6984              int main() {
6985                  test();
6986                  return(m);
6987              }
6988              ],
6989      result="yes", result="no", result="maybe")
6990 AC_MSG_RESULT([$result])
6992 if test "$result" = "no"; then
6993     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
6996 dnl ========================================================
6997 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
6998 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
6999 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7000 dnl ========================================================
7001 _SAVE_CXXFLAGS=$CXXFLAGS
7002 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7003 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7004     ac_nscap_nonconst_opeq_bug,
7005     [AC_TRY_COMPILE([
7006                       template <class T>
7007                       class Pointer
7008                         {
7009                         public:
7010                           T* myPtr;
7011                         };
7012                       
7013                       template <class T, class U>
7014                       int operator==(const Pointer<T>& rhs, U* lhs)
7015                         {
7016                           return rhs.myPtr == lhs;
7017                         }
7018                       
7019                       template <class T, class U>
7020                       int operator==(const Pointer<T>& rhs, const U* lhs)
7021                         {
7022                           return rhs.myPtr == lhs;
7023                         }
7024                     ],
7025                     [
7026                       Pointer<int> foo;
7027                       const int* bar;
7028                       return foo == bar;
7029                     ],
7030                     ac_nscap_nonconst_opeq_bug="no",
7031                     ac_nscap_nonconst_opeq_bug="yes")])
7032 CXXFLAGS="$_SAVE_CXXFLAGS"
7034 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7035     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7037 fi # SKIP_COMPILER_CHECKS
7039 dnl ========================================================
7040 dnl C++ rtti
7041 dnl Should be smarter and check that the compiler does indeed have rtti
7042 dnl ========================================================
7043 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7044 [  --enable-cpp-rtti       Enable C++ RTTI ],
7045 [ _MOZ_USE_RTTI=1 ],
7046 [ _MOZ_USE_RTTI= ])
7048 if test "$_MOZ_USE_RTTI"; then
7049    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7050 else
7051    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7054 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7056 dnl ========================================================
7057 dnl C++ exceptions (g++/egcs only - for now)
7058 dnl Should be smarter and check that the compiler does indeed have exceptions
7059 dnl ========================================================
7060 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7061 [  --enable-cpp-exceptions Enable C++ exceptions ],
7062 [ _MOZ_CPP_EXCEPTIONS=1 ],
7063 [ _MOZ_CPP_EXCEPTIONS= ])
7065 if test "$_MOZ_CPP_EXCEPTIONS"; then
7066     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7067 else
7068     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7071 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7073 # Irix & OSF native compilers do not like exception declarations 
7074 # when exceptions are disabled
7075 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7076     AC_DEFINE(CPP_THROW_NEW, [])
7077 else
7078     AC_DEFINE(CPP_THROW_NEW, [throw()])
7080 AC_LANG_C
7082 dnl ========================================================
7083 dnl =
7084 dnl = Build depencency options
7085 dnl =
7086 dnl ========================================================
7087 MOZ_ARG_HEADER(Build dependencies)
7089 dnl ========================================================
7090 dnl = Do not auto generate dependency info
7091 dnl ========================================================
7092 MOZ_AUTO_DEPS=1
7093 MOZ_ARG_DISABLE_BOOL(auto-deps,
7094 [  --disable-auto-deps     Do not automatically generate dependency info],
7095     MOZ_AUTO_DEPS=,
7096     MOZ_AUTO_DEPS=1)
7098 if test -n "$MOZ_AUTO_DEPS"; then
7099 dnl ========================================================
7100 dnl = Use mkdepend instead of $CC -MD for dependency generation
7101 dnl ========================================================
7102 _cpp_md_flag=
7103 MOZ_ARG_DISABLE_BOOL(md,
7104 [  --disable-md            Do not use compiler-based dependencies ],
7105   [_cpp_md_flag=],
7106   [_cpp_md_flag=1],
7107   [dnl Default is to turn on -MD if using GNU-compatible compilers
7108    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7109      _cpp_md_flag=1
7110    fi
7111   dnl Default is to use -xM if using Sun Studio on Solaris
7112    if test "$SOLARIS_SUNPRO_CC"; then
7113      _cpp_md_flag=1
7114    fi])
7115 if test "$_cpp_md_flag"; then
7116   COMPILER_DEPEND=1
7117   if test "$OS_ARCH" = "OpenVMS"; then
7118     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7119   else
7120     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7121   fi
7122   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7123   if test "$SOLARIS_SUNPRO_CC"; then
7124     _DEPEND_CFLAGS=
7125   fi
7126 else
7127   COMPILER_DEPEND=
7128   dnl Don't override this for MSVC
7129   if test -z "$_WIN32_MSVC"; then
7130     _USE_CPP_INCLUDE_FLAG=
7131     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7132     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7133   fi
7135 fi # MOZ_AUTO_DEPS
7136 MDDEPDIR='.deps'
7137 AC_SUBST(MOZ_AUTO_DEPS)
7138 AC_SUBST(COMPILER_DEPEND)
7139 AC_SUBST(MDDEPDIR)
7142 dnl ========================================================
7143 dnl =
7144 dnl = Static Build Options
7145 dnl =
7146 dnl ========================================================
7147 MOZ_ARG_HEADER(Static build options)
7149 MOZ_ARG_ENABLE_BOOL(static,
7150 [  --enable-static         Enable building of internal static libs],
7151     BUILD_STATIC_LIBS=1,
7152     BUILD_STATIC_LIBS=)
7154 dnl Disable libxul in debug builds, but not for xulrunner.
7155 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7156    MOZ_ENABLE_LIBXUL=
7159 MOZ_ARG_ENABLE_BOOL(libxul,
7160 [  --enable-libxul         Enable building of libxul],
7161     MOZ_ENABLE_LIBXUL=1,
7162     MOZ_ENABLE_LIBXUL=)
7164 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7165         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7168 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7169         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7172 AC_SUBST(LIBXUL_LIBS)
7174 if test -n "$MOZ_ENABLE_LIBXUL"; then
7175     XPCOM_LIBS="$LIBXUL_LIBS"
7176     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7177 else
7178     if test -n "$BUILD_STATIC_LIBS"; then
7179         AC_DEFINE(MOZ_STATIC_BUILD)
7180     fi
7181     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7184 dnl ========================================================
7185 dnl =
7186 dnl = Standalone module options
7187 dnl = 
7188 dnl ========================================================
7189 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7191 dnl Check for GLib and libIDL.
7192 dnl ========================================================
7193 case "$target_os" in
7194 msvc*|mks*|cygwin*|mingw*|wince*)
7195     SKIP_IDL_CHECK="yes"
7196     ;;
7198     SKIP_IDL_CHECK="no"
7199     ;;
7200 esac
7202 if test -z "$COMPILE_ENVIRONMENT"; then
7203     SKIP_IDL_CHECK="yes"
7206 dnl = Allow users to disable libIDL checking for standalone modules
7207 MOZ_ARG_WITHOUT_BOOL(libIDL,
7208 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7209         SKIP_IDL_CHECK="yes")
7211 if test "$SKIP_IDL_CHECK" = "no"
7212 then
7213     _LIBIDL_FOUND=
7214     if test "$MACOS_SDK_DIR"; then 
7215       dnl xpidl, and therefore libIDL, is only needed on the build host.
7216       dnl Don't build it against the SDK, as that causes problems.
7217       _MACSAVE_CFLAGS="$CFLAGS"
7218       _MACSAVE_LIBS="$LIBS"
7219       _MACSAVE_LDFLAGS="$LDFLAGS"
7220       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7221       changequote(,)
7222       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"`
7223       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7224       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7225       changequote([,])
7226       unset NEXT_ROOT
7227     fi
7229     if test "$MOZ_ENABLE_GTK2"; then
7230         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7231     fi
7232     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7233     dnl to either libIDL1 or libIDL2.
7234     if test -z "$_LIBIDL_FOUND"; then
7235         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7236         if test -z "$_LIBIDL_FOUND"; then
7237             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7238         fi
7239     fi
7240     dnl
7241     dnl If we don't have a libIDL config program & not cross-compiling, 
7242     dnl     look for orbit-config instead.
7243     dnl
7244     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7245         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7246         if test -n "$ORBIT_CONFIG"; then
7247             AC_MSG_CHECKING([for ORBit libIDL usability])
7248                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7249             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7250             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7251             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7252             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7253             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7254             LIBIDL_CONFIG=
7255             _SAVE_CFLAGS="$CFLAGS"
7256             _SAVE_LIBS="$LIBS"
7257             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7258             LIBS="$LIBIDL_LIBS $LIBS"
7259             AC_TRY_RUN([
7260 #include <stdlib.h>
7261 #include <libIDL/IDL.h>
7262 int main() {
7263   char *s;
7264   s=strdup(IDL_get_libver_string());
7265   if(s==NULL) {
7266     exit(1);
7267   }
7268   exit(0);
7270             ], [_LIBIDL_FOUND=1
7271                 result="yes"],
7272                [LIBIDL_CFLAGS=
7273                 LIBIDL_LIBS=
7274                 result="no"],
7275                [_LIBIDL_FOUND=1
7276                 result="maybe"] )
7277             AC_MSG_RESULT($result)
7278             CFLAGS="$_SAVE_CFLAGS"
7279             LIBS="$_SAVE_LIBS"
7280         fi
7281     fi
7282     if test -z "$_LIBIDL_FOUND"; then
7283         AC_MSG_ERROR([libIDL not found.
7284         libIDL $LIBIDL_VERSION or higher is required.])
7285     fi
7286     if test "$MACOS_SDK_DIR"; then
7287       CFLAGS="$_MACSAVE_CFLAGS"
7288       LIBS="$_MACSAVE_LIBS"
7289       LDFLAGS="$_MACSAVE_LDFLAGS"
7290       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7291         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7292       fi
7293     fi
7296 if test -n "$CROSS_COMPILE"; then
7297      if test -z "$HOST_LIBIDL_CONFIG"; then
7298         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7299     fi
7300     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7301         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7302         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7303     else
7304         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7305         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7306     fi
7309 if test -z "$SKIP_PATH_CHECKS"; then
7310 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7311     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7312         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7313     else
7314         AM_PATH_GLIB(${GLIB_VERSION})
7315     fi
7319 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7320     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7323 AC_SUBST(LIBIDL_CFLAGS)
7324 AC_SUBST(LIBIDL_LIBS)
7325 AC_SUBST(STATIC_LIBIDL)
7326 AC_SUBST(GLIB_CFLAGS)
7327 AC_SUBST(GLIB_LIBS)
7328 AC_SUBST(GLIB_GMODULE_LIBS)
7329 AC_SUBST(HOST_LIBIDL_CONFIG)
7330 AC_SUBST(HOST_LIBIDL_CFLAGS)
7331 AC_SUBST(HOST_LIBIDL_LIBS)
7333 dnl ========================================================
7334 dnl Check for cairo
7335 dnl ========================================================
7336 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7338 MOZ_TREE_CAIRO=1
7339 MOZ_ARG_ENABLE_BOOL(system-cairo,
7340 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7341 MOZ_TREE_CAIRO=,
7342 MOZ_TREE_CAIRO=1 )
7344 # Check for headers defining standard int types.
7345 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7347 if test "$MOZ_TREE_CAIRO"; then
7348     AC_DEFINE(MOZ_TREE_CAIRO)
7350     # For now we assume that we will have a uint64_t available through
7351     # one of the above headers or mozstdint.h.
7352     AC_DEFINE(HAVE_UINT64_T)
7354     # Define macros for cairo-features.h
7355     if test "$MOZ_X11"; then
7356         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7357         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7358         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7359         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7360         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7361         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7362         MOZ_ENABLE_CAIRO_FT=1
7363         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7364     fi
7365     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7366         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7367     fi
7368     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7369         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7370         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7371         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7372     fi
7373     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7374         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7375         if test -z "$WINCE"; then
7376             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7377         else
7378             WIN32_FONT_FEATURE=
7379         fi
7381         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
7382         if test -z "$HAS_DDRAW"; then
7383             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.])
7384             DDRAW_SURFACE_FEATURE=
7385         else
7386             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
7387         fi
7389         if test -z "$OGLES_SDK_DIR"; then
7390             OGLES_SURFACE_FEATURE=
7391         else
7392             AC_TRY_COMPILE([
7393               #include <EGL/egl.h>
7394               #include <EGL/eglext.h>
7395               #include <GLES2/gl2.h>
7396               #include <GLES2/gl2ext.h>
7397             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
7398             if test -z "$HAS_OGLES"; then
7399               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
7400               OGLES_SURFACE_FEATURE=
7401             else
7402               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
7403             fi
7404         fi
7406         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7407     fi
7408     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7409         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7410         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7411         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7412         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7413         MOZ_ENABLE_CAIRO_FT=1
7414         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7415         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7416     fi
7417     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7418         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7419         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7420         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7421         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7422         MOZ_ENABLE_CAIRO_FT=1
7423     fi
7424     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7425     AC_SUBST(CAIRO_FT_CFLAGS)
7426     AC_SUBST(HAS_OGLES)
7428     if test "$MOZ_DEBUG"; then
7429       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7430     else
7431       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7432     fi
7434     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7436     AC_SUBST(PS_SURFACE_FEATURE)
7437     AC_SUBST(PDF_SURFACE_FEATURE)
7438     AC_SUBST(SVG_SURFACE_FEATURE)
7439     AC_SUBST(XLIB_SURFACE_FEATURE)
7440     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7441     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7442     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7443     AC_SUBST(XCB_SURFACE_FEATURE)
7444     AC_SUBST(WIN32_SURFACE_FEATURE)
7445     AC_SUBST(DDRAW_SURFACE_FEATURE)
7446     AC_SUBST(OGLES_SURFACE_FEATURE)    
7447     AC_SUBST(OS2_SURFACE_FEATURE)
7448     AC_SUBST(BEOS_SURFACE_FEATURE)
7449     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7450     AC_SUBST(FT_FONT_FEATURE)
7451     AC_SUBST(FC_FONT_FEATURE)
7452     AC_SUBST(WIN32_FONT_FEATURE)
7453     AC_SUBST(QUARTZ_FONT_FEATURE)
7454     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7455     AC_SUBST(QT_SURFACE_FEATURE)
7457     if test "$_WIN32_MSVC"; then
7458         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7459     else
7460         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"
7462         if test "$MOZ_X11"; then
7463             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7464         fi
7465     fi
7467     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7468     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7470 else
7471    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7472    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7473    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7474    if test "$MOZ_X11"; then
7475         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7476         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7477         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7478    fi
7481 AC_SUBST(MOZ_TREE_CAIRO)
7482 AC_SUBST(MOZ_CAIRO_CFLAGS)
7483 AC_SUBST(MOZ_CAIRO_LIBS)
7485 dnl qcms
7486 dnl ========================================================
7488 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7489 AC_SUBST(QCMS_LIBS)
7491 dnl ========================================================
7492 dnl disable xul
7493 dnl ========================================================
7494 MOZ_ARG_DISABLE_BOOL(xul,
7495 [  --disable-xul           Disable XUL],
7496     MOZ_XUL= )
7497 if test "$MOZ_XUL"; then
7498   AC_DEFINE(MOZ_XUL)
7499 else
7500   dnl remove extensions that require XUL
7501   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7504 AC_SUBST(MOZ_XUL)
7506 dnl ========================================================
7507 dnl disable profile locking
7508 dnl   do no use this in applications that can have more than
7509 dnl   one process accessing the profile directory.
7510 dnl ========================================================
7511 MOZ_ARG_DISABLE_BOOL(profilelocking,
7512 [  --disable-profilelocking           Disable profile locking],
7513     MOZ_PROFILELOCKING=,
7514     MOZ_PROFILELOCKING=1 )
7515 if test "$MOZ_PROFILELOCKING"; then
7516   AC_DEFINE(MOZ_PROFILELOCKING)
7519 dnl ========================================================
7520 dnl disable rdf services
7521 dnl ========================================================
7522 MOZ_ARG_DISABLE_BOOL(rdf,
7523 [  --disable-rdf           Disable RDF],
7524     MOZ_RDF= )
7525 if test "$MOZ_RDF"; then
7526   AC_DEFINE(MOZ_RDF)
7529 AC_SUBST(MOZ_RDF)
7531 dnl ========================================================
7532 dnl necko configuration options
7533 dnl ========================================================
7536 dnl option to disable various necko protocols
7538 MOZ_ARG_ENABLE_STRING(necko-protocols,
7539 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7540                           Enable/disable specific protocol handlers],
7541 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7542     if test "$option" = "yes" || test "$option" = "all"; then
7543         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7544     elif test "$option" = "no" || test "$option" = "none"; then
7545         NECKO_PROTOCOLS=""
7546     elif test "$option" = "default"; then
7547         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7548     elif test `echo "$option" | grep -c \^-` != 0; then
7549         option=`echo $option | sed 's/^-//'`
7550         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7551     else
7552         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7553     fi
7554 done],
7555     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7556 dnl Remove dupes
7557 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7558 AC_SUBST(NECKO_PROTOCOLS)
7559 for p in $NECKO_PROTOCOLS; do
7560     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7561 done
7564 dnl option to disable necko's disk cache
7566 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7567 [  --disable-necko-disk-cache
7568                           Disable necko disk cache],
7569     NECKO_DISK_CACHE=,
7570     NECKO_DISK_CACHE=1)
7571 AC_SUBST(NECKO_DISK_CACHE)
7572 if test "$NECKO_DISK_CACHE"; then
7573     AC_DEFINE(NECKO_DISK_CACHE)
7577 dnl option to disable necko's wifi scanner
7579 MOZ_ARG_DISABLE_BOOL(necko-wifi,
7580 [  --disable-necko-wifi   Disable necko wifi scanner],
7581     NECKO_WIFI=,
7582     NECKO_WIFI=1
7585 if test "$OS_ARCH" = "OS2"; then
7586   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
7587   NECKO_WIFI=
7589 if test "$NECKO_WIFI" -a \
7590         "$OS_ARCH" != "Linux" -a \
7591         "$OS_ARCH" != "Darwin" -a \
7592         "$OS_ARCH" != "WINNT" -a \
7593         "$OS_ARCH" != "WINCE"; then
7594   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
7597 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
7598 then
7599   AC_CHECK_HEADER([iwlib.h])
7600   if test "$ac_cv_header_iwlib_h" != "yes"; then
7601     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])
7602   fi
7605 if test "$NECKO_WIFI"; then
7606   AC_DEFINE(NECKO_WIFI)
7608 AC_SUBST(NECKO_WIFI)
7611 dnl option to minimize size of necko's i/o buffers
7613 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7614 [  --enable-necko-small-buffers
7615                           Minimize size of necko's i/o buffers],
7616     NECKO_SMALL_BUFFERS=1,
7617     NECKO_SMALL_BUFFERS=)
7618 AC_SUBST(NECKO_SMALL_BUFFERS)
7619 if test "$NECKO_SMALL_BUFFERS"; then
7620     AC_DEFINE(NECKO_SMALL_BUFFERS)
7621 fi 
7624 dnl option to disable cookies
7626 MOZ_ARG_DISABLE_BOOL(cookies,
7627 [  --disable-cookies       Disable cookie support],
7628     NECKO_COOKIES=,
7629     NECKO_COOKIES=1)
7630 AC_SUBST(NECKO_COOKIES)
7631 if test "$NECKO_COOKIES"; then
7632     AC_DEFINE(NECKO_COOKIES)
7636 dnl Build jsctypes on the platforms we can.
7638 AC_SUBST(BUILD_CTYPES)
7639 if test "$OS_TEST" != "arm"; then
7640   BUILD_CTYPES=1
7641   AC_DEFINE(BUILD_CTYPES)
7644 dnl NECKO_ configuration options are not global
7645 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7647 dnl Only build Mork if it's required
7648 AC_SUBST(MOZ_MORK)
7649 if test "$MOZ_MORK"; then
7650   AC_DEFINE(MOZ_MORK)
7653 dnl Build the lightweight Mork reader if required
7654 AC_SUBST(MOZ_MORKREADER)
7655 if test "$MOZ_MORKREADER"; then
7656   AC_DEFINE(MOZ_MORKREADER)
7659 dnl ========================================================
7660 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7661     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7664 dnl ========================================================
7665 dnl =
7666 dnl = Maintainer debug option (no --enable equivalent)
7667 dnl =
7668 dnl ========================================================
7670 AC_SUBST(AR)
7671 AC_SUBST(AR_FLAGS)
7672 AC_SUBST(AR_LIST)
7673 AC_SUBST(AR_EXTRACT)
7674 AC_SUBST(AR_DELETE)
7675 AC_SUBST(AS)
7676 AC_SUBST(ASFLAGS)
7677 AC_SUBST(AS_DASH_C_FLAG)
7678 AC_SUBST(LD)
7679 AC_SUBST(RC)
7680 AC_SUBST(RCFLAGS)
7681 AC_SUBST(WINDRES)
7682 AC_SUBST(IMPLIB)
7683 AC_SUBST(FILTER)
7684 AC_SUBST(BIN_FLAGS)
7685 AC_SUBST(NS_USE_NATIVE)
7686 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7687 AC_SUBST(MOZ_UPDATE_XTERM)
7688 AC_SUBST(MINIMO)
7689 AC_SUBST(MOZ_PLATFORM_HILDON)
7690 AC_SUBST(NS_OSSO)
7691 AC_SUBST(NS_MAEMO_LOCATION)
7692 AC_SUBST(MOZ_AUTH_EXTENSION)
7693 AC_SUBST(MOZ_MATHML)
7694 AC_SUBST(MOZ_PERMISSIONS)
7695 AC_SUBST(MOZ_XTF)
7696 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7697 AC_SUBST(MOZ_PREF_EXTENSIONS)
7698 AC_SUBST(MOZ_SVG)
7699 AC_SUBST(MOZ_SMIL)
7700 AC_SUBST(MOZ_XSLT_STANDALONE)
7701 AC_SUBST(MOZ_JS_LIBS)
7702 AC_SUBST(MOZ_PSM)
7703 AC_SUBST(MOZ_DEBUG)
7704 AC_SUBST(MOZ_DEBUG_MODULES)
7705 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7706 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7707 AC_SUBST(MOZ_DEBUG_FLAGS)
7708 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7709 AC_SUBST(WARNINGS_AS_ERRORS)
7710 AC_SUBST(MOZ_DBGRINFO_MODULES)
7711 AC_SUBST(MOZ_EXTENSIONS)
7712 AC_SUBST(MOZ_IMG_DECODERS)
7713 AC_SUBST(MOZ_IMG_ENCODERS)
7714 AC_SUBST(MOZ_JSDEBUGGER)
7715 AC_SUBST(MOZ_PLUGINS)
7716 AC_SUBST(MOZ_LOG_REFCNT)
7717 AC_SUBST(MOZ_LEAKY)
7718 AC_SUBST(MOZ_JPROF)
7719 AC_SUBST(MOZ_SHARK)
7720 AC_SUBST(MOZ_CALLGRIND)
7721 AC_SUBST(MOZ_VTUNE)
7722 AC_SUBST(MOZ_XPCTOOLS)
7723 AC_SUBST(MOZ_JSLOADER)
7724 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7725 AC_SUBST(MOZ_INSURE)
7726 AC_SUBST(MOZ_INSURE_DIRS)
7727 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7728 AC_SUBST(MOZ_QUANTIFY)
7729 AC_SUBST(MOZ_INSURIFYING)
7730 AC_SUBST(LIBICONV)
7731 AC_SUBST(MOZ_PLACES)
7732 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7733 AC_SUBST(MOZ_STORAGE)
7734 AC_SUBST(MOZ_FEEDS)
7735 AC_SUBST(NS_PRINTING)
7737 AC_SUBST(MOZ_JAVAXPCOM)
7738 AC_SUBST(JAVA_INCLUDE_PATH)
7739 AC_SUBST(JAVA)
7740 AC_SUBST(JAVAC)
7741 AC_SUBST(JAR)
7743 AC_SUBST(MOZ_PROFILELOCKING)
7745 AC_SUBST(HAVE_XIE)
7746 AC_SUBST(MOZ_XIE_LIBS)
7747 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7749 AC_SUBST(BUILD_STATIC_LIBS)
7750 AC_SUBST(MOZ_ENABLE_LIBXUL)
7751 AC_SUBST(ENABLE_TESTS)
7752 AC_SUBST(IBMBIDI)
7753 AC_SUBST(MOZ_UNIVERSALCHARDET)
7754 AC_SUBST(ACCESSIBILITY)
7755 AC_SUBST(MOZ_XPINSTALL)
7756 AC_SUBST(MOZ_VIEW_SOURCE)
7757 AC_SUBST(MOZ_SPELLCHECK)
7758 AC_SUBST(MOZ_XPFE_COMPONENTS)
7759 AC_SUBST(MOZ_USER_DIR)
7760 AC_SUBST(MOZ_CRASHREPORTER)
7762 AC_SUBST(ENABLE_STRIP)
7763 AC_SUBST(PKG_SKIP_STRIP)
7764 AC_SUBST(USE_ELF_DYNSTR_GC)
7765 AC_SUBST(INCREMENTAL_LINKER)
7766 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7767 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7769 AC_SUBST(MOZ_FIX_LINK_PATHS)
7770 AC_SUBST(XPCOM_LIBS)
7771 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7772 AC_SUBST(XPCOM_GLUE_LDOPTS)
7773 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7775 AC_SUBST(USE_DEPENDENT_LIBS)
7777 AC_SUBST(MOZ_BUILD_ROOT)
7778 AC_SUBST(MOZ_OS2_TOOLS)
7779 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7781 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7782 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7783 AC_SUBST(MOZ_TIMELINE)
7784 AC_SUBST(OGLES_SDK_DIR)
7786 AC_SUBST(MOZ_APP_NAME)
7787 AC_SUBST(MOZ_APP_DISPLAYNAME)
7788 AC_SUBST(MOZ_APP_VERSION)
7789 AC_SUBST(FIREFOX_VERSION)
7791 AC_SUBST(MOZ_PKG_SPECIAL)
7793 AC_SUBST(MOZILLA_OFFICIAL)
7795 dnl win32 options
7796 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7797 AC_SUBST(MOZ_MAPINFO)
7798 AC_SUBST(MOZ_BROWSE_INFO)
7799 AC_SUBST(MOZ_TOOLS_DIR)
7800 AC_SUBST(CYGWIN_WRAPPER)
7801 AC_SUBST(AS_PERL)
7802 AC_SUBST(WIN32_REDIST_DIR)
7803 AC_SUBST(PYTHON)
7805 AC_SUBST(WINCE)
7806 AC_SUBST(WINCE_SDK_DIR)
7807 AC_SUBST(WINCE_WINDOWS_MOBILE)
7809 dnl Echo the CFLAGS to remove extra whitespace.
7810 CFLAGS=`echo \
7811         $_WARNINGS_CFLAGS \
7812         $CFLAGS`
7814 CXXFLAGS=`echo \
7815         $_MOZ_RTTI_FLAGS \
7816         $_MOZ_EXCEPTIONS_FLAGS \
7817         $_WARNINGS_CXXFLAGS \
7818         $CXXFLAGS`
7820 COMPILE_CFLAGS=`echo \
7821     $_DEFINES_CFLAGS \
7822         $_DEPEND_CFLAGS \
7823     $COMPILE_CFLAGS`
7825 COMPILE_CXXFLAGS=`echo \
7826     $_DEFINES_CXXFLAGS \
7827         $_DEPEND_CFLAGS \
7828     $COMPILE_CXXFLAGS`
7830 AC_SUBST(SYSTEM_MAKEDEPEND)
7831 AC_SUBST(SYSTEM_LIBXUL)
7832 AC_SUBST(SYSTEM_JPEG)
7833 AC_SUBST(SYSTEM_PNG)
7834 AC_SUBST(SYSTEM_ZLIB)
7835 AC_SUBST(SYSTEM_BZ2)
7837 AC_SUBST(JPEG_CFLAGS)
7838 AC_SUBST(JPEG_LIBS)
7839 AC_SUBST(ZLIB_CFLAGS)
7840 AC_SUBST(ZLIB_LIBS)
7841 AC_SUBST(BZ2_CFLAGS)
7842 AC_SUBST(BZ2_LIBS)
7843 AC_SUBST(PNG_CFLAGS)
7844 AC_SUBST(PNG_LIBS)
7846 AC_SUBST(MOZ_JPEG_CFLAGS)
7847 AC_SUBST(MOZ_JPEG_LIBS)
7848 AC_SUBST(MOZ_ZLIB_CFLAGS)
7849 AC_SUBST(MOZ_ZLIB_LIBS)
7850 AC_SUBST(MOZ_BZ2_CFLAGS)
7851 AC_SUBST(MOZ_BZ2_LIBS)
7852 AC_SUBST(MOZ_PNG_CFLAGS)
7853 AC_SUBST(MOZ_PNG_LIBS)
7855 AC_SUBST(NSPR_CFLAGS)
7856 AC_SUBST(NSPR_LIBS)
7857 AC_SUBST(MOZ_NATIVE_NSPR)
7859 AC_SUBST(NSS_CFLAGS)
7860 AC_SUBST(NSS_LIBS)
7861 AC_SUBST(NSS_DEP_LIBS)
7862 AC_SUBST(MOZ_NATIVE_NSS)
7863 AC_SUBST(NSS_DISABLE_DBM)
7865 AC_SUBST(CFLAGS)
7866 AC_SUBST(CXXFLAGS)
7867 AC_SUBST(CPPFLAGS)
7868 AC_SUBST(COMPILE_CFLAGS)
7869 AC_SUBST(COMPILE_CXXFLAGS)
7870 AC_SUBST(LDFLAGS)
7871 AC_SUBST(LIBS)
7872 AC_SUBST(CROSS_COMPILE)
7873 AC_SUBST(WCHAR_CFLAGS)
7875 AC_SUBST(HOST_CC)
7876 AC_SUBST(HOST_CXX)
7877 AC_SUBST(HOST_CFLAGS)
7878 AC_SUBST(HOST_CXXFLAGS)
7879 AC_SUBST(HOST_OPTIMIZE_FLAGS)
7880 AC_SUBST(HOST_AR)
7881 AC_SUBST(HOST_AR_FLAGS)
7882 AC_SUBST(HOST_LD)
7883 AC_SUBST(HOST_RANLIB)
7884 AC_SUBST(HOST_NSPR_MDCPUCFG)
7885 AC_SUBST(HOST_BIN_SUFFIX)
7886 AC_SUBST(HOST_OS_ARCH)
7888 AC_SUBST(TARGET_CPU)
7889 AC_SUBST(TARGET_VENDOR)
7890 AC_SUBST(TARGET_OS)
7891 AC_SUBST(TARGET_NSPR_MDCPUCFG)
7892 AC_SUBST(TARGET_MD_ARCH)
7893 AC_SUBST(TARGET_XPCOM_ABI)
7894 AC_SUBST(OS_TARGET)
7895 AC_SUBST(OS_ARCH)
7896 AC_SUBST(OS_RELEASE)
7897 AC_SUBST(OS_TEST)
7899 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
7900 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
7902 AC_SUBST(WRAP_MALLOC_CFLAGS)
7903 AC_SUBST(WRAP_MALLOC_LIB)
7904 AC_SUBST(MKSHLIB)
7905 AC_SUBST(MKCSHLIB)
7906 AC_SUBST(MKSHLIB_FORCE_ALL)
7907 AC_SUBST(MKSHLIB_UNFORCE_ALL)
7908 AC_SUBST(DSO_CFLAGS)
7909 AC_SUBST(DSO_PIC_CFLAGS)
7910 AC_SUBST(DSO_LDOPTS)
7911 AC_SUBST(LIB_PREFIX)
7912 AC_SUBST(DLL_PREFIX)
7913 AC_SUBST(DLL_SUFFIX)
7914 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
7915 AC_SUBST(LIB_SUFFIX)
7916 AC_SUBST(OBJ_SUFFIX)
7917 AC_SUBST(BIN_SUFFIX)
7918 AC_SUBST(ASM_SUFFIX)
7919 AC_SUBST(IMPORT_LIB_SUFFIX)
7920 AC_SUBST(USE_N32)
7921 AC_SUBST(CC_VERSION)
7922 AC_SUBST(CXX_VERSION)
7923 AC_SUBST(MSMANIFEST_TOOL)
7924 AC_SUBST(NS_ENABLE_TSF)
7925 AC_SUBST(MOZ_NSS_PATCH)
7927 if test "$USING_HCC"; then
7928    CC='${topsrcdir}/build/hcc'
7929    CC="$CC '$_OLDCC'"
7930    CXX='${topsrcdir}/build/hcpp'
7931    CXX="$CXX '$_OLDCXX'"
7932    AC_SUBST(CC)
7933    AC_SUBST(CXX)
7936 dnl Check for missing components
7937 if test "$COMPILE_ENVIRONMENT"; then
7938 if test "$MOZ_X11"; then
7939     dnl ====================================================
7940     dnl = Check if X headers exist
7941     dnl ====================================================
7942     _SAVE_CFLAGS=$CFLAGS
7943     CFLAGS="$CFLAGS $XCFLAGS"
7944     AC_TRY_COMPILE([
7945         #include <stdio.h>
7946         #include <stdlib.h>
7947         #include <X11/Xlib.h>
7948         #include <X11/Intrinsic.h>
7949     ],
7950     [
7951         Display *dpy = 0;
7952         if ((dpy = XOpenDisplay(NULL)) == NULL) {
7953             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
7954             exit(1);
7955         }
7956     ], [], 
7957     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
7958     CFLAGS="$_SAVE_CFLAGS"
7960     if test ! -z "$MISSING_X"; then
7961         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
7962     fi
7964 fi # MOZ_X11
7965 fi # COMPILE_ENVIRONMENT
7967 dnl Set various defines and substitutions
7968 dnl ========================================================
7970 if test "$OS_ARCH" = "BeOS"; then
7971   AC_DEFINE(XP_BEOS)
7972   MOZ_MOVEMAIL=1
7973 elif test "$OS_ARCH" = "Darwin"; then
7974   AC_DEFINE(XP_UNIX)
7975   AC_DEFINE(UNIX_ASYNC_DNS)
7976   MOZ_MOVEMAIL=1
7977 elif test "$OS_ARCH" = "OpenVMS"; then
7978   AC_DEFINE(XP_UNIX)
7979 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
7980   AC_DEFINE(XP_UNIX)
7981   AC_DEFINE(UNIX_ASYNC_DNS)
7982   MOZ_MOVEMAIL=1
7984 AC_SUBST(MOZ_MOVEMAIL)
7986 if test "$MOZ_DEBUG"; then
7987     AC_DEFINE(MOZ_REFLOW_PERF)
7988     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
7991 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
7992     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
7993     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
7994     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
7995     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
7996     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
7997     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
7998     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
7999     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8002 dnl ========================================================
8003 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8004 dnl ========================================================
8005 case "$host_os" in
8006 mingw*)
8007     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8008     ;;
8009 cygwin*|msvc*|mks*)
8010     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8011     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8012     CC="\$(CYGWIN_WRAPPER) $CC"
8013     CXX="\$(CYGWIN_WRAPPER) $CXX"
8014     CPP="\$(CYGWIN_WRAPPER) $CPP"
8015     LD="\$(CYGWIN_WRAPPER) $LD"
8016     AS="\$(CYGWIN_WRAPPER) $AS"
8017     RC="\$(CYGWIN_WRAPPER) $RC"
8018     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8019     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8020     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8021     ;;
8022 esac
8024 AC_SUBST(CYGDRIVE_MOUNT)
8025 AC_SUBST(WIN_TOP_SRC)
8027 AC_SUBST(MOZILLA_VERSION)
8029 AC_SUBST(ac_configure_args)
8031 dnl Spit out some output
8032 dnl ========================================================
8034 dnl The following defines are used by xpcom
8035 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8036 CPP_THROW_NEW
8037 HAVE_CPP_2BYTE_WCHAR_T
8038 HAVE_CPP_ACCESS_CHANGING_USING
8039 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8040 HAVE_CPP_BOOL
8041 HAVE_CPP_CHAR16_T
8042 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8043 HAVE_CPP_EXPLICIT
8044 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8045 HAVE_CPP_NAMESPACE_STD
8046 HAVE_CPP_NEW_CASTS
8047 HAVE_CPP_PARTIAL_SPECIALIZATION
8048 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8049 HAVE_CPP_TYPENAME
8050 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8051 HAVE_STATVFS
8052 NEED_CPP_UNUSED_IMPLEMENTATIONS
8053 NEW_H
8054 HAVE_GETPAGESIZE
8055 HAVE_ICONV
8056 HAVE_ICONV_WITH_CONST_INPUT
8057 HAVE_MBRTOWC
8058 HAVE_SYS_MOUNT_H
8059 HAVE_SYS_VFS_H
8060 HAVE_WCRTOMB
8063 AC_CONFIG_HEADER(
8064 netwerk/necko-config.h
8065 xpcom/xpcom-config.h
8066 xpcom/xpcom-private.h
8069 # Save the defines header file before autoconf removes it.
8070 # (Do not add AC_DEFINE calls after this line.)
8071   _CONFIG_TMP=confdefs-tmp.h
8072   _CONFIG_DEFS_H=mozilla-config.h
8074   cat > $_CONFIG_TMP <<\EOF
8075 /* List of defines generated by configure. Included with preprocessor flag,
8076  * -include, to avoid long list of -D defines on the compile command-line.
8077  * Do not edit.
8078  */
8080 #ifndef _MOZILLA_CONFIG_H_
8081 #define _MOZILLA_CONFIG_H_
8084 _EGREP_PATTERN='^#define ('
8085 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8086     for f in $_NON_GLOBAL_ACDEFINES; do
8087         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8088     done
8090 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8092   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8094   cat >> $_CONFIG_TMP <<\EOF
8096 #endif /* _MOZILLA_CONFIG_H_ */
8100   # Only write mozilla-config.h when something changes (or it doesn't exist)
8101   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8102     rm $_CONFIG_TMP
8103   else
8104     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8105     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8107     echo ==== $_CONFIG_DEFS_H =================================
8108     cat $_CONFIG_DEFS_H
8109   fi
8111 dnl Probably shouldn't call this manually but we always want the output of DEFS
8112 rm -f confdefs.h.save
8113 mv confdefs.h confdefs.h.save
8114 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8115 AC_OUTPUT_MAKE_DEFS()
8116 MOZ_DEFINES=$DEFS
8117 AC_SUBST(MOZ_DEFINES)
8118 rm -f confdefs.h
8119 mv confdefs.h.save confdefs.h
8121 dnl Load the list of Makefiles to generate.
8122 dnl   To add new Makefiles, edit allmakefiles.sh.
8123 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8124 . ${srcdir}/allmakefiles.sh
8125 dnl 
8126 dnl Run a perl script to quickly create the makefiles.
8127 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8128 dnl   for the files it cannot handle correctly. This way, config.status
8129 dnl   will handle these files.
8130 dnl If it fails, nothing is set and config.status will run as usual.
8132 dnl This does not change the $MAKEFILES variable.
8134 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8136 if test -z "${AS_PERL}"; then
8137 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8138 else
8139 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8141 . ./conftest.sh
8142 rm conftest.sh
8144 echo $MAKEFILES > unallmakefiles
8146 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8148 AC_OUTPUT($MAKEFILES)
8150 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8151 if test "$CAIRO_FEATURES_H"; then
8152   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8153     echo "$CAIRO_FEATURES_H is unchanged"
8154     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8155   else
8156     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8157   fi
8160 dnl ========================================================
8161 dnl = Setup a nice relatively clean build environment for
8162 dnl = sub-configures.
8163 dnl ========================================================
8164 CC="$_SUBDIR_CC" 
8165 CXX="$_SUBDIR_CXX" 
8166 CFLAGS="$_SUBDIR_CFLAGS" 
8167 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8168 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8169 LDFLAGS="$_SUBDIR_LDFLAGS"
8170 HOST_CC="$_SUBDIR_HOST_CC" 
8171 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8172 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8175 unset MAKEFILES
8176 unset CONFIG_FILES
8178 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8179 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8181 if test -z "$MOZ_NATIVE_NSPR"; then
8182     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8183     if test -z "$MOZ_DEBUG"; then
8184         ac_configure_args="$ac_configure_args --disable-debug"
8185     fi
8186     if test "$MOZ_OPTIMIZE" = "1"; then
8187         ac_configure_args="$ac_configure_args --enable-optimize"
8188     fi
8189     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8190        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8191     fi
8192     if test -n "$HAVE_64BIT_OS"; then
8193         ac_configure_args="$ac_configure_args --enable-64bit"
8194     fi
8195     if test -n "$USE_ARM_KUSER"; then
8196         ac_configure_args="$ac_configure_args --with-arm-kuser"
8197     fi
8198     AC_OUTPUT_SUBDIRS(nsprpub)
8199     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8202 if test -z "$MOZ_NATIVE_NSPR"; then
8203     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8204     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8205     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8206        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8207        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8208        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8209        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8210     fi
8211     rm -f config/autoconf.mk.bak
8214 # Run the SpiderMonkey 'configure' script.
8215 dist=$MOZ_BUILD_ROOT/dist
8216 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8217 ac_configure_args="$ac_configure_args --enable-threadsafe"
8218 if test -z "$MOZ_NATIVE_NSPR"; then
8219     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8220     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8222 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8223 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8224 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8225 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8226 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8227 if test "$MOZ_MEMORY"; then
8228    ac_configure_args="$ac_configure_args --enable-jemalloc"
8229    if test -n "$MOZ_MEMORY_LDFLAGS"; then
8230      export MOZ_MEMORY_LDFLAGS
8231    fi
8233 AC_OUTPUT_SUBDIRS(js/src)
8234 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8236 # Build jsctypes on the platforms we can.
8237 if test "$BUILD_CTYPES"; then
8238   # Run the libffi 'configure' script on platforms that it supports.
8239   if test -z "$_MSC_VER"; then
8240     ac_configure_args="--disable-shared --enable-static --disable-raw-api"
8241     if test "$MOZ_DEBUG"; then
8242       ac_configure_args="$ac_configure_args --enable-debug"
8243     fi
8244     if test -n "$DSO_PIC_CFLAGS"; then
8245       ac_configure_args="$ac_configure_args --with-pic"
8246     fi
8247     if test -n "$CROSS_COMPILE"; then
8248       ac_configure_args="$ac_configure_args --build=$build --host=$target"
8249     fi
8250     AC_OUTPUT_SUBDIRS(js/ctypes/libffi)
8251     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8252   fi
8255 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8257 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8258 dnl Needs to be at the end to respect possible changes from NSPR configure
8259 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8260   echo "config/autoconf.mk is unchanged"
8261   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8262 else
8263   rm -f config/autoconf.mk.orig 2> /dev/null