Bug 412743 nsScriptSecurityManager::Init shouldn't treat failure of InitPrefs as...
[mozilla-central.git] / configure.in
blob4d84f0b60cc8cd16ccc792a0420f47c71f736c7f
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 LIBART_VERSION=2.3.4
122 CAIRO_VERSION=1.6.0
123 PANGO_VERSION=1.14.0
124 GTK2_VERSION=2.10.0
125 MAKE_VERSION=3.78
126 WINDRES_VERSION=2.14.90
127 W32API_VERSION=3.8
128 GNOMEVFS_VERSION=2.0
129 GNOMEUI_VERSION=2.2.0
130 GCONF_VERSION=1.2.1
131 LIBGNOME_VERSION=2.0
132 STARTUP_NOTIFICATION_VERSION=0.8
133 DBUS_VERSION=0.60
134 LCMS_VERSION=1.17
135 SQLITE_VERSION=3.6.6.2
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     MAKE_VERSION=3.79
191     if test -z "$CC"; then CC=cl; fi
192     if test -z "$CXX"; then CXX=cl; fi
193     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
194     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
195     if test -z "$LD"; then LD=link; fi
196     if test -z "$AS"; then AS=ml; fi
197     if test -z "$MIDL"; then MIDL=midl; fi
198     ;;
199 esac
202 COMPILE_ENVIRONMENT=1
203 MOZ_ARG_ENABLE_BOOL(compile-environment,
204 [  --disable-compile-environment
205                            Disable compiler/library checks.],
206     COMPILE_ENVIRONMENT=1,
207     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 ========================================================
224 dnl Checks for compilers.
225 dnl ========================================================
226 dnl Set CROSS_COMPILE in the environment when running configure
227 dnl to use the cross-compile setup for now
228 dnl ========================================================
230 if test "$COMPILE_ENVIRONMENT"; then
232 dnl Do some special WinCE toolchain stuff
233 case "$target" in
234 *wince)
236     MOZ_ARG_WITH_STRING(wince-sdk,
237     [  --with-wince-sdk=WINCE_SDK
238                         The path to the windows mobile sdk],
239     WINCE_SDK=$withval)
241     export WINCE=1
242     mk_add_options WINCE=1
244     echo -----------------------------------------------------------------------------
245     echo Building Windows CE Shunt Library and Tool Chain
246     echo Using SDK in:
247     echo $WINCE_SDK
249     ac_exeext=.exe
251     
252     rm -f $srcdir/build/wince/shunt/include/windows.h
254     echo -n "#define TOPSRCDIR \"" > $srcdir/build/wince/tools/topsrcdir.h
255     echo `cd "$_topsrcdir" && pwd -W | tr '\n' '\"'` >> $srcdir/build/wince/tools/topsrcdir.h
256     make -C $srcdir/build/wince/tools
257     
258     echo "#include \"$WINCE_SDK/windows.h\"" > $srcdir/build/wince/shunt/include/windows.h
259     echo "#define GetProcAddress GetProcAddressA" >> $srcdir/build/wince/shunt/include/windows.h
260     echo -----------------------------------------------------------------------------
262     ;;
263 esac
265 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
266     echo "cross compiling from $host to $target"
267     cross_compiling=yes
269     _SAVE_CC="$CC"
270     _SAVE_CFLAGS="$CFLAGS"
271     _SAVE_LDFLAGS="$LDFLAGS"
273     AC_MSG_CHECKING([for host c compiler])
274     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
275     if test -z "$HOST_CC"; then
276         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
277     fi
278     AC_MSG_RESULT([$HOST_CC])
279     AC_MSG_CHECKING([for host c++ compiler])
280     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
281     if test -z "$HOST_CXX"; then
282         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
283     fi
284     AC_MSG_RESULT([$HOST_CXX])
286     if test -z "$HOST_CFLAGS"; then
287         HOST_CFLAGS="$CFLAGS"
288     fi
289     if test -z "$HOST_CXXFLAGS"; then
290         HOST_CXXFLAGS="$CXXFLAGS"
291     fi
292     if test -z "$HOST_LDFLAGS"; then
293         HOST_LDFLAGS="$LDFLAGS"
294     fi
295     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
296     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
297     CC="$HOST_CC"
298     CFLAGS="$HOST_CFLAGS"
299     LDFLAGS="$HOST_LDFLAGS"
301     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
302     AC_TRY_COMPILE([], [return(0);], 
303         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
304         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
306     CC="$HOST_CXX"
307     CFLAGS="$HOST_CXXFLAGS"
309     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
310     AC_TRY_COMPILE([], [return(0);], 
311         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
312         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
313     
314     CC=$_SAVE_CC
315     CFLAGS=$_SAVE_CFLAGS
316     LDFLAGS=$_SAVE_LDFLAGS
318     case "$build:$target" in
319       powerpc-apple-darwin8*:i?86-apple-darwin*)
320         dnl The Darwin cross compiler doesn't necessarily point itself at a
321         dnl root that has libraries for the proper architecture, it defaults
322         dnl to the system root.  The libraries in the system root on current
323         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
324         dnl checks will fail.  Fake a working SDK in that case.
325         _SAVE_CFLAGS=$CFLAGS
326         _SAVE_CXXFLAGS=$CXXLAGS
327         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
328         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
329         ;;
330     esac
332     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
333     unset ac_cv_prog_CC
334     AC_PROG_CC
335     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
336     unset ac_cv_prog_CXX
337     AC_PROG_CXX
339     case "$build:$target" in
340       powerpc-apple-darwin8*:i?86-apple-darwin*)
341         dnl Revert the changes made above.  From this point on, the target
342         dnl compiler will never be used without applying the SDK to CFLAGS
343         dnl (see --with-macos-sdk below).
344         CFLAGS=$_SAVE_CFLAGS
345         CXXFLAGS=$_SAVE_CXXFLAGS
346         ;;
347     esac
349     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
350     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
351     AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
352     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
353     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
354     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
355     AC_DEFINE(CROSS_COMPILE)
356 else
357     AC_PROG_CC
358     AC_PROG_CXX
359     AC_PROG_RANLIB
360     AC_PATH_PROGS(AS, $AS as, $CC)
361     AC_CHECK_PROGS(AR, ar, :)
362     AC_CHECK_PROGS(LD, ld, :)
363     AC_CHECK_PROGS(STRIP, strip, :)
364     AC_CHECK_PROGS(WINDRES, windres, :)
365     if test -z "$HOST_CC"; then
366         HOST_CC="$CC"
367     fi
368     if test -z "$HOST_CFLAGS"; then
369         HOST_CFLAGS="$CFLAGS"
370     fi
371     if test -z "$HOST_CXX"; then
372         HOST_CXX="$CXX"
373     fi
374     if test -z "$HOST_CXXFLAGS"; then
375         HOST_CXXFLAGS="$CXXFLAGS"
376     fi
377     if test -z "$HOST_LDFLAGS"; then
378         HOST_LDFLAGS="$LDFLAGS"
379     fi
380     if test -z "$HOST_RANLIB"; then
381         HOST_RANLIB="$RANLIB"
382     fi
383     if test -z "$HOST_AR"; then
384        HOST_AR="$AR"
385     fi
388 GNU_AS=
389 GNU_LD=
390 GNU_CC=
391 GNU_CXX=
392 CC_VERSION='N/A'
393 CXX_VERSION='N/A'
394 if test "$GCC" = "yes"; then
395     GNU_CC=1
396     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
398 if test "$GXX" = "yes"; then
399     GNU_CXX=1
400     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
402 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
403     GNU_AS=1
405 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
406     GNU_LD=1
408 if test "$GNU_CC"; then
409     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
410         GCC_USE_GNU_LD=1
411     fi
414 INTEL_CC=
415 INTEL_CXX=
416 if test "$GCC" = yes; then
417    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
418      INTEL_CC=1
419    fi
422 if test "$GXX" = yes; then
423    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
424      INTEL_CXX=1
425    fi
428 dnl Special win32 checks
429 dnl ========================================================
430 case "$target" in
431 *-wince)
432     WINVER=500
433     ;;
435     if test -n "$GNU_CC"; then  
436         WINVER=501
437     else    
438         WINVER=500
439     fi
440     ;;
441 esac
443 MOZ_ARG_WITH_STRING(windows-version,
444 [  --with-windows-version=WINVER
445                           Minimum Windows version (WINVER) to support
446                               400: Windows 95
447                               500: Windows 2000
448                               501: Windows XP],
449   WINVER=$withval)
451 case "$WINVER" in
452 400|500|501)
453     ;;
456     AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
457     ;;
459 esac
461 case "$target" in
462 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
463     if test "$GCC" != "yes"; then
464         # Check to see if we are really running in a msvc environemnt
465         _WIN32_MSVC=1
466         AC_CHECK_PROGS(MIDL, midl)
468         # Make sure compilers are valid
469         CFLAGS="$CFLAGS -TC -nologo"
470         CXXFLAGS="$CXXFLAGS -TP -nologo"
471         AC_LANG_SAVE
472         AC_LANG_C
473         AC_TRY_COMPILE([#include <stdio.h>],
474             [ printf("Hello World\n"); ],,
475             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
477         AC_LANG_CPLUSPLUS
478         AC_TRY_COMPILE([#include <new.h>],
479             [ unsigned *test = new unsigned(42); ],,
480             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
481         AC_LANG_RESTORE
482         
483         changequote(,)
484         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
485         changequote([,])
486         
487         # Determine compiler version
488         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
489         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
490         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
491         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
492         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
493         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
495         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
496         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
498         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
499             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
500         fi
501         if test "$_CC_MAJOR_VERSION" = "12"; then
502             _CC_SUITE=6
503         elif test "$_CC_MAJOR_VERSION" = "13"; then
504             _CC_SUITE=7
505         elif test "$_CC_MAJOR_VERSION" = "14"; then
506             _CC_SUITE=8
507             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
508             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
509             dnl so be very specific here!
510             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
511             if test $_CC_RELEASE -gt 50727; then
512                _USE_DYNAMICBASE=1
513             elif test $_CC_BUILD -ge 762; then
514                _USE_DYNAMICBASE=1
515             fi
516             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
517             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
518         elif test "$_CC_MAJOR_VERSION" = "15"; then
519             _CC_SUITE=9
520             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
521             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
522             _USE_DYNAMICBASE=1
523             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
524             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
525         else
526             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
527         fi
529         _MOZ_RTTI_FLAGS_ON='-GR'
530         _MOZ_RTTI_FLAGS_OFF='-GR-'
531         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
532         _MOZ_EXCEPTIONS_FLAGS_OFF=''
534         if test -n "$WIN32_REDIST_DIR"; then
535             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
536         fi
537         
538         # bug #249782
539         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
540         if test "$_CC_SUITE" -ge "8"; then
541                 changequote(,)
542                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
543                 changequote([,])
545                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
546                 if test -n "$MSMT_TOOL"; then
547                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
548                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
549                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
550                         fi
551                         MSMANIFEST_TOOL=1
552                         unset MSMT_TOOL
553                 else
554                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
555                 fi
556         fi
558         # Check linker version
559         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
560         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
561         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
562             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
563         fi
564         INCREMENTAL_LINKER=1
566         # Check midl version
567         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
568         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
569         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
570         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
571         # Add flags if necessary
572         AC_MSG_CHECKING([for midl flags])
573         if test -n "$_MIDL_MAJOR_VERSION"; then
574             if test \( "$_MIDL_MAJOR_VERSION" -gt "6" \) -o \( "$_MIDL_MAJOR_VERSION" = "6" -a "$_MIDL_MINOR_VERSION" -gt "0" \) -o \( "$_MIDL_MAJOR_VERSION" = "6" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" -gt "359" \); then
575                 # Starting with MIDL version 6.0.359, the MIDL compiler
576                 # generates /Oicf /robust stubs by default, which is not
577                 # compatible with versions of Windows older than Win2k.
578                 # This switches us back to the old behaviour. When we drop
579                 # support for Windows older than Win2k, we should remove
580                 # this.
581                 MIDL_FLAGS="${MIDL_FLAGS} -no_robust"
582                 AC_MSG_RESULT([need -no_robust])
583             else
584                 MIDL_FLAGS="${MIDL_FLAGS}"
585                 AC_MSG_RESULT([none needed])
586             fi
587         else
588             MIDL_FLAGS="${MIDL_FLAGS}"
589             AC_MSG_RESULT([none needed])
590         fi
591         
592         unset _MSVC_VER_FILTER
593         
594     else
595         # Check w32api version
596         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
597         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
598         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
599         AC_TRY_COMPILE([#include <w32api.h>],
600             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
601                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
602                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
603                 #error "test failed."
604             #endif
605             , [ res=yes ], [ res=no ])
606         AC_MSG_RESULT([$res])
607         if test "$res" != "yes"; then
608             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
609         fi
610         # Check windres version
611         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
612         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
613         AC_MSG_RESULT([$_WINDRES_VERSION])
614         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
615         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
616         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
617         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
618         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
619         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
620         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
621                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
622                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
623                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
624                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
625                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
626         then
627             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
628         fi
629     fi # !GNU_CC
631     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
632     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
633     # Require OS features provided by IE 5.0
634     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
635     ;;
636 esac
638 dnl Test breaks icc on OS/2 && MSVC
639 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
640     AC_PROG_CC_C_O
641     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
642         USING_HCC=1
643         _OLDCC=$CC
644         _OLDCXX=$CXX
645         CC="${srcdir}/build/hcc '$CC'"
646         CXX="${srcdir}/build/hcpp '$CXX'"
647     fi
650 AC_PROG_CPP
651 AC_PROG_CXXCPP
653 if test -n "$_WIN32_MSVC"; then
654     SKIP_PATH_CHECKS=1
655     SKIP_COMPILER_CHECKS=1
656     SKIP_LIBRARY_CHECKS=1
659 fi # COMPILE_ENVIRONMENT
661 AC_SUBST(MIDL_FLAGS)
662 AC_SUBST(_MSC_VER)
664 AC_SUBST(GNU_AS)
665 AC_SUBST(GNU_LD)
666 AC_SUBST(GNU_CC)
667 AC_SUBST(GNU_CXX)
668 AC_SUBST(INTEL_CC)
669 AC_SUBST(INTEL_CXX)
671 dnl ========================================================
672 dnl Checks for programs.
673 dnl ========================================================
674 AC_PROG_INSTALL
675 AC_PROG_LN_S
676 AC_PATH_PROGS(PERL, $PERL perl5 perl )
677 if test -z "$PERL" || test "$PERL" = ":"; then
678     AC_MSG_ERROR([perl not found in \$PATH])
681 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
682 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
683 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
684 _perl_res=$?
685 AC_MSG_RESULT([$_perl_version])
687 if test "$_perl_res" != 0; then
688     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
692 AC_MSG_CHECKING([for full perl installation])
693 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
694 _perl_res=$?
695 if test "$_perl_res" != 0; then
696     AC_MSG_RESULT([no])
697     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
698 else
699     AC_MSG_RESULT([yes])    
702 AC_PATH_PROGS(PYTHON, $PYTHON python)
703 if test -z "$PYTHON"; then
704     AC_MSG_ERROR([python was not found in \$PATH])
707 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
708 if test -z "$COMPILE_ENVIRONMENT"; then
709 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
710     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
713 AC_SUBST(NSINSTALL_BIN)
715 AC_PATH_PROG(DOXYGEN, doxygen, :)
716 AC_PATH_PROG(WHOAMI, whoami, :)
717 AC_PATH_PROG(AUTOCONF, autoconf, :)
718 AC_PATH_PROG(UNZIP, unzip, :)
719 AC_PATH_PROGS(ZIP, zip)
720 if test -z "$ZIP" || test "$ZIP" = ":"; then
721     AC_MSG_ERROR([zip not found in \$PATH])
723 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
724 AC_PATH_PROG(XARGS, xargs)
725 if test -z "$XARGS" || test "$XARGS" = ":"; then
726     AC_MSG_ERROR([xargs not found in \$PATH .])
729 if test "$COMPILE_ENVIRONMENT"; then
731 dnl ========================================================
732 dnl = Mac OS X toolchain support
733 dnl ========================================================
735 case "$target_os" in
736 darwin*)
737     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
738     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
739     dnl the environment and includedir purposes (when using an SDK, below),
740     dnl but remember the full version number for the libdir (SDK).
741     changequote(,)
742     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
743     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
744     changequote([,])
745     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
746         dnl Bug 280479, but this keeps popping up in bug 292530 too because
747         dnl 4.0.0/4061 is the default compiler in Tiger.
748         changequote(,)
749         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
750         changequote([,])
751         if test "$GCC_BUILD" = "4061" ; then
752             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
753 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
754 from building Mozilla. Upgrade to Xcode 2.1 or later.])
755         fi
756     fi
758     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
759     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
760     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
761     AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
763     case "$PBBUILD" in
764       *xcodebuild*)
765         changequote(,)
766         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
767         changequote([,])
768         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
769           HAS_XCODE_2_1=1;
770         fi
771       ;;
772     esac
774     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
775     dnl it has moved into /usr/bin.
776     AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
777     ;;
778 esac
780 AC_SUBST(GCC_VERSION)
781 AC_SUBST(XCODEBUILD_VERSION)
782 AC_SUBST(HAS_XCODE_2_1)
784 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
785 dnl that a universal binary is being produced.
786 AC_SUBST(UNIVERSAL_BINARY)
788 dnl ========================================================
789 dnl Check for MacOS deployment target version
790 dnl ========================================================
792 MOZ_ARG_ENABLE_STRING(macos-target,
793                       [  --enable-macos-target=VER (default=10.4)
794                           Set the minimum MacOS version needed at runtime],
795                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
797 case "$target" in
798 *-darwin*)
799     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
800         dnl Use the specified value
801         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
802         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
803     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
804         dnl No value specified on the command line or in the environment,
805         dnl use the lesser of the application's minimum or the architecture's
806         dnl minimum.
807         export MACOSX_DEPLOYMENT_TARGET=10.4
808     fi
809     ;;
810 esac
812 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
814 dnl ========================================================
815 dnl = Mac OS X SDK support
816 dnl ========================================================
817 MACOS_SDK_DIR=
818 NEXT_ROOT=
819 MOZ_ARG_WITH_STRING(macos-sdk,
820 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
821     MACOS_SDK_DIR=$withval)
823 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
824 dnl NEXT_ROOT will be set and exported only if it's needed.
825 AC_SUBST(MACOS_SDK_DIR)
826 AC_SUBST(NEXT_ROOT)
828 if test "$MACOS_SDK_DIR"; then
829   dnl Sync this section with the ones in NSPR and NSS.
830   dnl Changes to the cross environment here need to be accounted for in
831   dnl the libIDL checks (below) and xpidl build.
833   if test ! -d "$MACOS_SDK_DIR"; then
834     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
835 specify a valid SDK.  SDKs are installed when the optional cross-development
836 tools are selected during the Xcode/Developer Tools installation.])
837   fi
839   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
840   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
841     SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include -F${MACOS_SDK_DIR}/System/Library/Frameworks"
842     if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
843       SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
844     fi
845     SDK_CXX_INCLUDE="-I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++ -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/ppc-darwin -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/backward"
847     CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
848     CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
850     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
851     CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
852     CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
854     dnl ld support for -syslibroot is compiler-agnostic, but only available
855     dnl on Tiger.  Although it's possible to switch on the build host's
856     dnl OS release to use ld -syslibroot when available, ld -syslibroot will
857     dnl cause warnings as long as NEXT_ROOT is set.  NEXT_ROOT should be
858     dnl set because both the compiler and linker use it.
859     LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib $LIBS"
860     export NEXT_ROOT=$MACOS_SDK_DIR
862     if test -n "$CROSS_COMPILE" ; then
863       dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
864       dnl the build host.  HOST_CXX is presently unused.
865       HOST_CC="NEXT_ROOT= $HOST_CC"
866       HOST_CXX="NEXT_ROOT= $HOST_CXX"
867     fi
868   else
869     dnl gcc >= 4.0 uses different paths than above, but knows how to find
870     dnl them itself.
871     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
872     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
874     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
875     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
876     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
878     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
879       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
880       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
881       dnl be ignored and cause warnings when -syslibroot is specified.
882       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
883       dnl the -isysroot it receives, so this is only needed with 4.0.0.
884       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
885     fi
886   fi
888   AC_LANG_SAVE
889   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
890   AC_LANG_CPLUSPLUS
891   AC_TRY_COMPILE([#include <new>
892                  int main() { return 0; }],
893    result=yes,
894    result=no)
895   AC_LANG_RESTORE
896   AC_MSG_RESULT($result)
898   if test "$result" = "no" ; then
899     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
900   fi
903 fi # COMPILE_ENVIRONMENT
905 dnl Be sure the make we use is GNU make.
906 dnl on win32, gmake.exe is the generally the wrong version
907 case "$host_os" in
908 cygwin*|mingw*|mks*|msvc*)
909     AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
910     ;;
912     AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
913     ;;
914 esac
915 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
916 if test ! "$_make_try"
917 then
918         echo
919         echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
920         echo
921         exit 1
923 dnl Now exit if version if < MAKE_VERSION
924 rm -f dummy.mk
925 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
926 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
927 rm -f dummy.mk
928 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
929 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
930 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
931 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
932 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
933    test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
934         "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
935    AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
937 AC_SUBST(MAKE)
939 if test "$COMPILE_ENVIRONMENT"; then
941 AC_PATH_XTRA
943 dnl Check in X11 include directory too.
944 if test "$no_x" != "yes"; then
945     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
948 XCFLAGS="$X_CFLAGS"
950 fi # COMPILE_ENVIRONMENT
952 dnl ========================================================
953 dnl set the defaults first
954 dnl ========================================================
955 AS_BIN=$AS
956 AR_FLAGS='cr $@'
957 AR_LIST='$(AR) t'
958 AR_EXTRACT='$(AR) x'
959 AR_DELETE='$(AR) d'
960 AS='$(CC)'
961 AS_DASH_C_FLAG='-c'
962 DLL_PREFIX=lib
963 LIB_PREFIX=lib
964 DLL_SUFFIX=.so
965 OBJ_SUFFIX=o
966 LIB_SUFFIX=a
967 ASM_SUFFIX=s
968 IMPORT_LIB_SUFFIX=
969 TARGET_MD_ARCH=unix
970 DIRENT_INO=d_ino
971 CYGWIN_WRAPPER=
972 WIN_TOP_SRC=
973 MOZ_USER_DIR=".mozilla"
974 HOST_AR='$(AR)'
975 HOST_AR_FLAGS='$(AR_FLAGS)'
977 MOZ_JPEG_CFLAGS=
978 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
979 MOZ_ZLIB_CFLAGS=
980 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
981 MOZ_BZ2_CFLAGS=
982 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
983 MOZ_PNG_CFLAGS=
984 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
986 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
987 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
988 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
989 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
990 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
991 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
992 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
994 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
995 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
997 USE_DEPENDENT_LIBS=1
999 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1000 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
1002 MOZ_ENABLE_POSTSCRIPT=1 
1004 if test -n "$CROSS_COMPILE"; then
1005     OS_TARGET="${target_os}"
1006     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1007     OS_RELEASE=
1008     case "${target_os}" in
1009         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1010         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1011         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1012         mingw*)       OS_ARCH=WINNT ;;
1013         wince*)       OS_ARCH=WINCE ;;
1014         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1015     esac
1016 else
1017     OS_TARGET=`uname -s`
1018     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1019     OS_RELEASE=`uname -r`
1022 # Before this used `uname -m` when not cross compiling
1023 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1024 OS_TEST="${target_cpu}"
1026 _COMPILER_PREFIX=
1028 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1030 #######################################################################
1031 # Master "Core Components" macros for getting the OS target           #
1032 #######################################################################
1035 # Note: OS_TARGET should be specified on the command line for gmake.
1036 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
1037 # The difference between the Win95 target and the WinNT target is that
1038 # the WinNT target uses Windows NT specific features not available
1039 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
1040 # at lesser performance (the Win95 target uses threads; the WinNT target
1041 # uses fibers).
1043 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1044 # cross-compilation.
1048 # The following hack allows one to build on a WIN95 machine (as if
1049 # s/he were cross-compiling on a WINNT host for a WIN95 target).
1050 # It also accomodates for MKS's uname.exe.  If you never intend
1051 # to do development on a WIN95 machine, you don't need this hack.
1053 case "$OS_ARCH" in
1054 WIN95)
1055     OS_ARCH=WINNT
1056     OS_TARGET=WIN95
1057     ;;
1058 Windows_95)
1059     OS_ARCH=Windows_NT
1060     OS_TARGET=WIN95
1061     ;;
1062 Windows_98)
1063     OS_ARCH=Windows_NT
1064     OS_TARGET=WIN95
1065     ;;
1066 CYGWIN_9*|CYGWIN_ME*)
1067     OS_ARCH='CYGWIN_NT-4.0'
1068     OS_TARGET=WIN95
1069     ;;
1070 esac
1073 # Define and override various archtecture-specific variables, including
1074 # HOST_OS_ARCH
1075 # OS_ARCH
1076 # OS_TEST
1077 # OS_TARGET
1078 # OS_RELEASE
1079 # OS_MINOR_RELEASE
1082 case "$HOST_OS_ARCH" in
1083 cygwin*|mingw*|mks*|msvc*)
1084     HOST_OS_ARCH=WINNT
1085     ;;
1086 linux*)
1087     HOST_OS_ARCH=Linux
1088     ;;
1089 solaris*)
1090     HOST_OS_ARCH=SunOS
1091     ;;
1092 BSD_386)
1093     HOST_OS_ARCH=BSD
1094     ;;
1095 dgux)
1096     HOST_OS_ARCH=DGUX
1097     ;;
1098 IRIX64)
1099     HOST_OS_ARCH=IRIX
1100     ;;
1101 UNIX_SV)
1102     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1103         HOST_OS_ARCH=NCR
1104     else
1105         HOST_OS_ARCH=UNIXWARE
1106     fi
1107     ;;
1108 ncr)
1109     HOST_OS_ARCH=NCR
1110     ;;
1111 UNIX_SYSTEM_V)
1112     HOST_OS_ARCH=NEC
1113     ;;
1114 OSF1)
1115     ;;
1116 *OpenVMS*)
1117     HOST_OS_ARCH=OpenVMS
1118     ;;
1119 OS_2)
1120     HOST_OS_ARCH=OS2
1121     ;;
1122 QNX)
1123     ;;
1124 SCO_SV)
1125     HOST_OS_ARCH=SCOOS
1126     ;;
1127 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1128     HOST_OS_ARCH=SINIX
1129     ;;
1130 UnixWare)
1131     HOST_OS_ARCH=UNIXWARE
1132     ;;
1133 esac
1135 case "$OS_ARCH" in
1136 WINNT)
1137     OS_TEST=`uname -p`
1138     ;;
1139 Windows_NT)
1141 # If uname -s returns "Windows_NT", we assume that we are using
1142 # the uname.exe in MKS toolkit.
1144 # The -r option of MKS uname only returns the major version number.
1145 # So we need to use its -v option to get the minor version number.
1146 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1148     OS_ARCH=WINNT
1149     OS_TARGET=WINNT
1150     OS_MINOR_RELEASE=`uname -v`
1151     if test "$OS_MINOR_RELEASE" = "00"; then
1152         OS_MINOR_RELEASE=0
1153     fi
1154     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1155     ;;
1156 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1158 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1159 # the uname.exe in the Cygwin tools.
1160 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1161 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1162 # the uname.exe in the GNU-Win32 tools.
1163 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1164 # the uname.exe in the MSYS tools.
1166     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1167     OS_ARCH=WINNT
1168     OS_TARGET=WINNT
1169     ;;
1170 AIX)
1171     OS_RELEASE=`uname -v`.`uname -r`
1172     OS_TEST=${target_cpu}
1173     ;;
1174 BSD_386)
1175     OS_ARCH=BSD
1176     ;;
1177 dgux)
1178     OS_ARCH=DGUX
1179     ;;
1180 IRIX64)
1181     OS_ARCH=IRIX
1182     ;;
1183 UNIX_SV)
1184     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1185         OS_ARCH=NCR
1186     else
1187         OS_ARCH=UNIXWARE
1188         OS_RELEASE=`uname -v`
1189     fi
1190     ;;
1191 ncr)
1192     OS_ARCH=NCR
1193     ;;
1194 UNIX_SYSTEM_V)
1195     OS_ARCH=NEC
1196     ;;
1197 OSF1)
1198     case `uname -v` in
1199     148)
1200         OS_RELEASE=V3.2C
1201         ;;
1202     564)
1203         OS_RELEASE=V4.0B
1204         ;;
1205     878)
1206         OS_RELEASE=V4.0D
1207         ;;
1208     esac
1209     ;;
1210 *OpenVMS*)
1211     OS_ARCH=OpenVMS
1212     OS_RELEASE=`uname -v`
1213     OS_TEST=`uname -p`
1214     ;;
1215 OS_2)
1216     OS_ARCH=OS2
1217     OS_TARGET=OS2
1218     OS_RELEASE=`uname -v`
1219     ;;
1220 QNX)
1221     if test "$OS_TARGET" != "NTO"; then
1222         changequote(,)
1223         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1224         changequote([,])
1225     fi
1226     OS_TEST=x86
1227     ;;
1228 SCO_SV)
1229     OS_ARCH=SCOOS
1230     OS_RELEASE=5.0
1231     ;;
1232 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1233     OS_ARCH=SINIX
1234     OS_TEST=`uname -p`
1235     ;;
1236 UnixWare)
1237     OS_ARCH=UNIXWARE
1238     OS_RELEASE=`uname -v`
1239     ;;
1240 WINCE)
1241     OS_ARCH=WINCE
1242     OS_TARGET=WINCE
1243     ;;
1244 Darwin)
1245     case "${target_cpu}" in
1246     powerpc*)
1247         OS_TEST=ppc
1248         ;;
1249     i*86*)
1250         OS_TEST=i386 
1251         ;;
1252     x86_64)
1253         OS_TEST=x86_64
1254         ;;
1255     *)
1256         if test -z "$CROSS_COMPILE" ; then
1257             OS_TEST=`uname -p`
1258         fi
1259         ;;
1260     esac
1261     ;;
1262 esac
1264 if test "$OS_ARCH" = "NCR"; then
1265     changequote(,)
1266     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1267     changequote([,])
1270 # Only set CPU_ARCH if we recognize the value of OS_TEST
1272 case "$OS_TEST" in
1273 *86 | i86pc)
1274     CPU_ARCH=x86
1275     ;;
1277 powerpc* | ppc | rs6000)
1278     CPU_ARCH=ppc
1279     ;;
1281 Alpha | alpha | ALPHA)
1282     CPU_ARCH=Alpha
1283     ;;
1285 hppa* | parisc)
1286     CPU_ARCH=hppa
1287     ;;
1289 sun4u | sparc*)
1290     CPU_ARCH=sparc
1291     ;;
1293 x86_64 | ia64)
1294     CPU_ARCH="$OS_TEST"
1295     ;;
1296 esac
1298 if test -z "$OS_TARGET"; then
1299     OS_TARGET=$OS_ARCH
1301 if test "$OS_TARGET" = "WIN95"; then
1302     OS_RELEASE="4.0"
1304 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1306 dnl ========================================================
1307 dnl GNU specific defaults
1308 dnl ========================================================
1309 if test "$GNU_CC"; then
1310     # FIXME: Let us build with strict aliasing. bug 414641.
1311     CFLAGS="$CFLAGS -fno-strict-aliasing"
1312     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1313     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1314     DSO_LDOPTS='-shared'
1315     if test "$GCC_USE_GNU_LD"; then
1316         # Don't allow undefined symbols in libraries
1317         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1318     fi
1319     WARNINGS_AS_ERRORS='-Werror'
1320     DSO_CFLAGS=''
1321     DSO_PIC_CFLAGS='-fPIC'
1322     ASFLAGS="$ASFLAGS -fPIC"
1323     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1324     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1325     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1326     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1328     # Turn on GNU specific features
1329     # -Wall - turn on all warnings
1330     # -pedantic - make compiler warn about non-ANSI stuff, and
1331     #             be a little bit stricter
1332     # Warnings slamm took out for now (these were giving more noise than help):
1333     # -Wbad-function-cast - warns when casting a function to a new return type
1334     # -Wshadow - removed because it generates more noise than help --pete
1335     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1336     if test -z "$INTEL_CC"; then
1337        # Don't use -Wcast-align with ICC
1338        case "$CPU_ARCH" in
1339            # And don't use it on hppa, ia64, sparc, since it's noisy there
1340            hppa | ia64 | sparc)
1341            ;;
1342            *)
1343         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1344            ;;
1345        esac
1346     fi
1348     dnl Turn pedantic on but disable the warnings for long long
1349     _PEDANTIC=1
1351     if test -z "$INTEL_CC"; then
1352       _IGNORE_LONG_LONG_WARNINGS=1
1353       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1354     else
1355       _IGNORE_LONG_LONG_WARNINGS=
1356     fi
1359     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1360     _USE_CPP_INCLUDE_FLAG=1
1361 else
1362     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1363     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1365     DSO_LDOPTS='-shared'
1366     if test "$GNU_LD"; then
1367         # Don't allow undefined symbols in libraries
1368         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1369     fi
1371     DSO_CFLAGS=''
1372     DSO_PIC_CFLAGS='-KPIC'
1373     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1376 if test "$GNU_CXX"; then
1377     # FIXME: Let us build with strict aliasing. bug 414641.
1378     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1379     # Turn on GNU specific features
1380     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1381     if test -z "$INTEL_CC"; then
1382        # Don't use -Wcast-align with ICC
1383        case "$CPU_ARCH" in
1384            # And don't use it on hppa, ia64, sparc, since it's noisy there
1385            hppa | ia64 | sparc)
1386            ;;
1387            *)
1388         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1389            ;;
1390        esac
1391     fi
1393     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1394     _USE_CPP_INCLUDE_FLAG=1
1396     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1397                    ac_has_wno_invalid_offsetof,
1398         [
1399             AC_LANG_SAVE
1400             AC_LANG_CPLUSPLUS
1401             _SAVE_CXXFLAGS="$CXXFLAGS"
1402             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1403             AC_TRY_COMPILE([],
1404                            [return(0);],
1405                            ac_has_wno_invalid_offsetof="yes",
1406                            ac_has_wno_invalid_offsetof="no")
1407             CXXFLAGS="$_SAVE_CXXFLAGS"
1408             AC_LANG_RESTORE
1409         ])
1410     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1411         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1412     fi
1413 else
1414     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1417 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1418 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1419 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1420 dnl normal behavior.
1421 dnl ========================================================
1422 MKSHLIB_FORCE_ALL=
1423 MKSHLIB_UNFORCE_ALL=
1425 if test "$COMPILE_ENVIRONMENT"; then
1426 if test "$GNU_CC"; then
1427   AC_MSG_CHECKING(whether ld has archive extraction flags)
1428   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1429    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1430     ac_cv_mkshlib_force_and_unforce="no"
1431     exec 3<&0 <<LOOP_INPUT
1432         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1433         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1434         force="-Wl,-all";              unforce="-Wl,-none"
1435 LOOP_INPUT
1436     while read line
1437     do
1438       eval $line
1439       LDFLAGS=$force
1440       LIBS=$unforce
1441       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1442     done
1443     exec 0<&3 3<&-
1444     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1445    ])
1446   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1447     AC_MSG_RESULT(no)
1448   else
1449     AC_MSG_RESULT(yes)
1450     eval $ac_cv_mkshlib_force_and_unforce
1451     MKSHLIB_FORCE_ALL=$force
1452     MKSHLIB_UNFORCE_ALL=$unforce
1453   fi
1454 fi # GNU_CC
1455 fi # COMPILE_ENVIRONMENT
1457 dnl =================================================================
1458 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1459 dnl which is bad when cross compiling.
1460 dnl =================================================================
1461 if test "$COMPILE_ENVIRONMENT"; then
1462 configure_static_assert_macros='
1463 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1464 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1465 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1468 dnl test that the macros actually work:
1469 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1470 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1471  [AC_LANG_SAVE
1472   AC_LANG_C
1473   ac_cv_static_assertion_macros_work="yes"
1474   AC_TRY_COMPILE([$configure_static_assert_macros],
1475                  [CONFIGURE_STATIC_ASSERT(1)],
1476                  ,
1477                  ac_cv_static_assertion_macros_work="no")
1478   AC_TRY_COMPILE([$configure_static_assert_macros],
1479                  [CONFIGURE_STATIC_ASSERT(0)],
1480                  ac_cv_static_assertion_macros_work="no",
1481                  )
1482   AC_LANG_CPLUSPLUS
1483   AC_TRY_COMPILE([$configure_static_assert_macros],
1484                  [CONFIGURE_STATIC_ASSERT(1)],
1485                  ,
1486                  ac_cv_static_assertion_macros_work="no")
1487   AC_TRY_COMPILE([$configure_static_assert_macros],
1488                  [CONFIGURE_STATIC_ASSERT(0)],
1489                  ac_cv_static_assertion_macros_work="no",
1490                  )
1491   AC_LANG_RESTORE
1492  ])
1493 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1494 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1495     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1497 fi # COMPILE_ENVIRONMENT
1499 dnl ========================================================
1500 dnl Checking for 64-bit OS
1501 dnl ========================================================
1502 if test "$COMPILE_ENVIRONMENT"; then
1503 AC_LANG_SAVE
1504 AC_LANG_C
1505 AC_MSG_CHECKING(for 64-bit OS)
1506 AC_TRY_COMPILE([$configure_static_assert_macros],
1507                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1508                result="yes", result="no")
1509 AC_MSG_RESULT("$result")
1510 if test "$result" = "yes"; then
1511     AC_DEFINE(HAVE_64BIT_OS)
1512     HAVE_64BIT_OS=1
1514 AC_SUBST(HAVE_64BIT_OS)
1515 AC_LANG_RESTORE
1516 fi # COMPILE_ENVIRONMENT
1518 dnl ========================================================
1519 dnl Enable high-memory support on OS/2 by default.
1520 dnl ========================================================
1521 MOZ_OS2_HIGH_MEMORY=1
1522 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1523 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1524     MOZ_OS2_HIGH_MEMORY=,
1525     MOZ_OS2_HIGH_MEMORY=1 )
1526 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1528 dnl ========================================================
1529 dnl System overrides of the defaults for host
1530 dnl ========================================================
1531 case "$host" in
1532 *-beos*)
1533     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1534     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1535     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1536     ;;
1538 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1539     if test -n "$_WIN32_MSVC"; then
1540         HOST_AR=lib
1541         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1542         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1543         HOST_RANLIB='echo ranlib'
1544     else
1545         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1546     fi
1547     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1548     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1549     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1550     HOST_BIN_SUFFIX=.exe
1551     case "$host" in
1552     *mingw*)
1553     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1554         ;;
1555     *)
1556         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1557         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1558             _pwd=`pwd`
1559             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1560         fi
1561         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1562             AS_PERL=1
1563             PERL="${CYGWIN_WRAPPER} $PERL"
1564         fi
1566         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1567             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1568         fi
1569         ;;
1570     esac
1571     ;;
1573 *-darwin*)
1574     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1575     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1576     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1577     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1578     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1579     ;;
1581 *-linux*|*-kfreebsd*-gnu)
1582     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1583     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1584     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1585     ;;
1587 *os2*)
1588     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1589     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1590     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1591     HOST_BIN_SUFFIX=.exe
1592     MOZ_FIX_LINK_PATHS=
1593     ;;
1595 *-osf*)
1596     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1597     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1598     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1599     ;;
1602     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1603     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1604     ;;
1605 esac
1607 dnl Get mozilla version from central milestone file
1608 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1610 dnl Get version of various core apps from the version files.
1611 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1613 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1614 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1616 dnl ========================================================
1617 dnl System overrides of the defaults for target
1618 dnl ========================================================
1620 case "$target" in
1621 *-aix*)
1622     AC_DEFINE(AIX)
1623     if test ! "$GNU_CC"; then
1624         if test ! "$HAVE_64BIT_OS"; then
1625             # Compiling with Visual Age C++ object model compat is the
1626             # default. To compile with object model ibm, add 
1627             # AIX_OBJMODEL=ibm to .mozconfig.
1628             if test "$AIX_OBJMODEL" = "ibm"; then
1629                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1630             else
1631                 AIX_OBJMODEL=compat
1632             fi
1633         else
1634             AIX_OBJMODEL=compat
1635         fi
1636         AC_SUBST(AIX_OBJMODEL)
1637         DSO_LDOPTS='-qmkshrobj=1'
1638         DSO_CFLAGS='-qflag=w:w'
1639         DSO_PIC_CFLAGS=
1640         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1641         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1642         MOZ_FIX_LINK_PATHS=
1643         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1644         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1645         if test "$COMPILE_ENVIRONMENT"; then
1646             AC_LANG_SAVE
1647             AC_LANG_CPLUSPLUS
1648             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1649             AC_TRY_COMPILE([],
1650                 [#if (__IBMCPP__ < 600)
1651                  #error "Bad compiler"
1652                  #endif],
1653                 _BAD_COMPILER=,_BAD_COMPILER=1)
1654             if test -n "$_BAD_COMPILER"; then
1655                 AC_MSG_RESULT([no])    
1656                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1657             else
1658                 AC_MSG_RESULT([yes])    
1659             fi
1660             AC_LANG_RESTORE
1661             TARGET_COMPILER_ABI="ibmc"
1662             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1663             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1664         fi
1665     fi
1666     case "${target_os}" in
1667     aix4.1*)
1668         DLL_SUFFIX='_shr.a'
1669         ;;
1670     esac
1671     if test "$COMPILE_ENVIRONMENT"; then
1672         AC_CHECK_HEADERS(sys/inttypes.h)
1673     fi
1674     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1675     ;;
1677 *-beos*)
1678     no_x=yes
1679     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1680     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1681     DSO_LDOPTS='-nostart'
1682     TK_LIBS='-lbe -lroot'
1683     LIBS="$LIBS -lbe"
1684     if test "$COMPILE_ENVIRONMENT"; then
1685         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1686         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1687     fi
1688     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1689     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1690     _MOZ_USE_RTTI=1
1691     USE_DEPENDENT_LIBS=
1692     MOZ_USER_DIR="Mozilla"
1693     ;;
1695 *-bsdi*)
1696     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1697     _PEDANTIC=
1698     _IGNORE_LONG_LONG_WARNINGS=
1699     case $OS_RELEASE in
1700         4.*|5.*)
1701             STRIP="$STRIP -d"
1702             ;;
1703         *)
1704             DSO_CFLAGS=''
1705             DSO_LDOPTS='-r'
1706             _WARNINGS_CFLAGS="-Wall"
1707             _WARNINGS_CXXFLAGS="-Wall"
1708             # The test above doesn't work properly, at least on 3.1.
1709             MKSHLIB_FORCE_ALL=''
1710             MKSHLIB_UNFORCE_ALL=''
1711         ;;
1712     esac
1713     ;;
1715 *-darwin*) 
1716     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1717     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1718     MOZ_OPTIMIZE_FLAGS="-O2"
1719     _PEDANTIC=
1720     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1721     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1722     DLL_SUFFIX=".dylib"
1723     DSO_LDOPTS=''
1724     STRIP="$STRIP -x -S"
1725     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1726     MOZ_ENABLE_POSTSCRIPT=
1727     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1728     LDFLAGS="$LDFLAGS -framework Cocoa"
1729     # The ExceptionHandling framework is needed for Objective-C exception
1730     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1731     # builds.
1732     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1733     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1734     MACOSX=1
1736     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1737     dnl ===================================================================
1738     if test "x$enable_dtrace" = "xyes"; then
1739         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1740     else
1741         dnl check for the presence of the -dead_strip linker flag
1742         AC_MSG_CHECKING([for -dead_strip option to ld])
1743         _SAVE_LDFLAGS=$LDFLAGS
1744         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1745         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1746         if test -n "$_HAVE_DEAD_STRIP" ; then
1747             AC_MSG_RESULT([yes])
1748             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1749         else
1750             AC_MSG_RESULT([no])
1751         fi
1752         
1753         LDFLAGS=$_SAVE_LDFLAGS
1754     fi
1755     ;;
1757 *-freebsd*)
1758     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1759         DLL_SUFFIX=".so.1.0"
1760         DSO_LDOPTS="-shared"
1761     fi
1762     if test ! "$GNU_CC"; then
1763         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1764     fi
1765 # Can't have force w/o an unforce.
1766 #    # Hack for FreeBSD 2.2
1767 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1768 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1769 #       MKSHLIB_UNFORCE_ALL=''
1770 #    fi
1771     ;; 
1773 *-hpux*)
1774     DLL_SUFFIX=".sl"
1775     if test ! "$GNU_CC"; then
1776         DSO_LDOPTS='-b -Wl,+s'
1777         DSO_CFLAGS=""
1778         DSO_PIC_CFLAGS="+Z"
1779         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1780         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1781         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1782     else
1783         DSO_LDOPTS='-b -E +s'
1784         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1785         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1786     fi
1787     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1788     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1789     ;;
1791 *-irix5*)
1792     AC_DEFINE(IRIX)
1793     DSO_LDOPTS='-elf -shared'
1795     if test "$GNU_CC"; then
1796        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1797        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1798        MKSHLIB_FORCE_ALL='-Wl,-all'
1799        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1800        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1801     else
1802        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1803        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1804        MKSHLIB_FORCE_ALL='-all'
1805        MKSHLIB_UNFORCE_ALL='-none'
1806     fi
1807     ;;
1809 *-irix6*)
1810     AC_DEFINE(IRIX)
1811     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1812     dnl compile and link using -n32
1813     USE_N32=1
1814     TARGET_COMPILER_ABI=n32
1815     DSO_LDOPTS='-elf -shared'
1816     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1817     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1818     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1819     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1820     if test "$GNU_CC"; then
1821        MKSHLIB_FORCE_ALL='-Wl,-all'
1822        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1823        _WARNINGS_CFLAGS="-Wall"
1824        _WARNINGS_CXXFLAGS="-Wall"
1825        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1826     else
1827        MKSHLIB_FORCE_ALL='-all'
1828        MKSHLIB_UNFORCE_ALL='-none'
1829            AR_LIST="$AR t"
1830            AR_EXTRACT="$AR x"
1831            AR_DELETE="$AR d"
1832            AR='$(CXX) -ar'
1833            AR_FLAGS='-o $@'
1834        CFLAGS="$CFLAGS -woff 3262 -G 4"
1835        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1836        if test -n "$USE_N32"; then
1837            ASFLAGS="$ASFLAGS -n32"
1838            CFLAGS="$CFLAGS -n32"
1839            CXXFLAGS="$CXXFLAGS -n32"
1840            LDFLAGS="$LDFLAGS -n32"
1841        fi
1842        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1843        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1844        MOZ_FIX_LINK_PATHS=
1845     fi
1846     if test -z "$GNU_CXX"; then
1847       MIPSPRO_CXX=1
1848     fi
1849     ;;
1851 *-*linux*)
1852     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1853     # Similarly for GNU_CXX and INTEL_CXX.
1854     if test "$INTEL_CC" || test "$INTEL_CXX"; then
1855         # -Os has been broken on Intel's C/C++ compilers for quite a
1856         # while; Intel recommends against using it.
1857         MOZ_OPTIMIZE_FLAGS="-O2"
1858         MOZ_DEBUG_FLAGS="-g -fno-inline"
1859     elif test "$GNU_CC" || test "$GNU_CXX"; then
1860         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1861         case $GCC_VERSION in
1862         4.1.*|4.2.*)
1863             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1864             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1865         esac
1866         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1867         MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1868                                           # and that combo is not yet good at
1869                                           # debugging inlined functions (even
1870                                           # when using DWARF2 as the debugging
1871                                           # format)
1872     fi
1874     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1876     MOZ_MEMORY=1
1878     case "${target_cpu}" in
1879     alpha*)
1880         CFLAGS="$CFLAGS -mieee"
1881         CXXFLAGS="$CXXFLAGS -mieee"
1882     ;;
1883     i*86)
1884         USE_ELF_DYNSTR_GC=1
1885         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1886     ;;
1887     mips*)
1888         MOZ_DEBUG_FLAGS="-g" # We want inlining
1889     ;;
1890     esac
1891     ;;
1893 *-wince*)
1895     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1896     AR_LIST="$AR -list"
1897     AR_EXTRACT="$AR -extract"
1898     AR_DELETE="$AR d"
1899     AR_FLAGS='-OUT:"$@"'
1901     if test -z "$AS_BIN"; then
1902         AS="$AS_BIN"
1903     fi
1904     DSO_CFLAGS=
1905     DSO_PIC_CFLAGS=
1906     DLL_SUFFIX=.dll
1907     BIN_SUFFIX='.exe'
1908     if test -z "$RC"; then 
1909         RC=rc.exe  
1910     fi
1911     # certain versions of cygwin's makedepend barf on the 
1912     # #include <string> vs -I./dist/include/string issue so don't use it
1913     SYSTEM_MAKEDEPEND=
1915     HOST_CC=cl
1916     HOST_CXX=cl
1917     HOST_LD=link
1918     HOST_AR='lib -OUT:$@'
1919     HOST_RANLIB='echo ranlib'
1920     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1921         
1922         
1923     WARNINGS_AS_ERRORS='-WX'
1924         MOZ_OPTIMIZE_FLAGS='-O1'
1925     AR_FLAGS='-NOLOGO -OUT:"$@"'
1926     ASM_SUFFIX=asm
1927     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1928     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1929     DLL_PREFIX=
1930     DOXYGEN=:
1931     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1932     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1933     GARBAGE=
1934     IMPORT_LIB_SUFFIX=lib
1935     LIBS="$LIBS"
1936     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1937     LIB_PREFIX=
1938     LIB_SUFFIX=lib 
1939     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1940     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1941     MKSHLIB_FORCE_ALL=
1942     MKSHLIB_UNFORCE_ALL=
1943     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1944     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1945     MOZ_DEBUG_FLAGS='-Zi'
1946     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1947     MOZ_FIX_LINK_PATHS=
1948     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1949     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1950     OBJ_SUFFIX=obj
1951     RANLIB='echo not_ranlib'
1952     STRIP='echo not_strip'
1953     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1954     UNZIP=unzip
1955     XARGS=xargs
1956     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1957     ZIP=zip
1958     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1959     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1960     STATIC_LIBIDL=1
1962     AC_DEFINE(HAVE_SNPRINTF)
1963     AC_DEFINE(_WINDOWS)
1964     AC_DEFINE(_WIN32)
1965     AC_DEFINE(WIN32)
1966     AC_DEFINE(XP_WIN)
1967     AC_DEFINE(XP_WIN32)
1968     AC_DEFINE(HW_THREADS)
1969     AC_DEFINE(STDC_HEADERS)
1970     AC_DEFINE(NEW_H, <new>)
1971     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1973     TARGET_MD_ARCH=win32
1974     _PLATFORM_DEFAULT_TOOLKIT='windows'
1975     BIN_SUFFIX='.exe'
1976     USE_SHORT_LIBNAME=1
1977     MOZ_ENABLE_POSTSCRIPT=
1978     MOZ_USER_DIR="Mozilla"
1982 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1983     DSO_CFLAGS=
1984     DSO_PIC_CFLAGS=
1985     DLL_SUFFIX=.dll
1986     RC=rc.exe
1987     # certain versions of cygwin's makedepend barf on the 
1988     # #include <string> vs -I./dist/include/string issue so don't use it
1989     SYSTEM_MAKEDEPEND=
1990     if test -n "$GNU_CC"; then
1991         CC="$CC -mno-cygwin"
1992         CXX="$CXX -mno-cygwin"
1993         CPP="$CPP -mno-cygwin"
1994         CFLAGS="$CFLAGS -mms-bitfields"
1995         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1996         DSO_LDOPTS='-shared'
1997         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1998         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1999         RC='$(WINDRES)'
2000         # Use temp file for windres (bug 213281)
2001         RCFLAGS='-O coff --use-temp-file'
2002         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2003         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
2004         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
2005         MOZ_FIX_LINK_PATHS=
2006         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
2007         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
2008         DLL_PREFIX=
2009         IMPORT_LIB_SUFFIX=dll.a
2010     else
2011         TARGET_COMPILER_ABI=msvc
2012         HOST_CC='$(CC)'
2013         HOST_CXX='$(CXX)'
2014         HOST_LD='$(LD)'
2015         AR='lib -NOLOGO -OUT:"$@"'
2016         AR_FLAGS=
2017         RANLIB='echo not_ranlib'
2018         STRIP='echo not_strip'
2019         XARGS=xargs
2020         ZIP=zip
2021         UNZIP=unzip
2022         DOXYGEN=:
2023         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2024         OBJ_SUFFIX=obj
2025         LIB_SUFFIX=lib
2026         DLL_PREFIX=
2027         LIB_PREFIX=
2028         IMPORT_LIB_SUFFIX=lib
2029         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2030         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2031         MKSHLIB_FORCE_ALL=
2032         MKSHLIB_UNFORCE_ALL=
2033         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2034         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2035         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2036         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2037         MOZ_DEBUG_FLAGS='-Zi'
2038         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2039         WARNINGS_AS_ERRORS='-WX'
2040         MOZ_OPTIMIZE_FLAGS='-O1'
2041         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2042         MOZ_FIX_LINK_PATHS=
2043         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2044         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2045         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2046         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2047         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2048         if test $_MSC_VER -ge 1400; then
2049             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2050             dnl For profile-guided optimization
2051             PROFILE_GEN_CFLAGS="-GL"
2052             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2053             dnl XXX: PGO builds can fail with warnings treated as errors,
2054             dnl specifically "no profile data available" appears to be
2055             dnl treated as an error sometimes. This might be a consequence
2056             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2057             dnl with the linker doing most of the work in the whole-program
2058             dnl optimization/PGO case. I think it's probably a compiler bug,
2059             dnl but we work around it here.
2060             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2061             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2062             dnl Probably also a compiler bug, but what can you do?
2063             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2064             if test -n "$_USE_DYNAMICBASE"; then
2065                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2066             fi
2067         fi
2068     fi
2069     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2070     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2071     AC_DEFINE(HAVE_SNPRINTF)
2072     AC_DEFINE(_WINDOWS)
2073     AC_DEFINE(_WIN32)
2074     AC_DEFINE(WIN32)
2075     AC_DEFINE(XP_WIN)
2076     AC_DEFINE(XP_WIN32)
2077     AC_DEFINE(HW_THREADS)
2078     AC_DEFINE(STDC_HEADERS)
2079     AC_DEFINE(NEW_H, <new>)
2080     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2081     TARGET_MD_ARCH=win32
2082     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2083     BIN_SUFFIX='.exe'
2084     USE_SHORT_LIBNAME=1
2085     MOZ_ENABLE_POSTSCRIPT=
2086     MOZ_USER_DIR="Mozilla"
2088     dnl Hardcode to win95 for now - cls
2089     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2091     dnl set NO_X11 defines here as the general check is skipped on win32
2092     no_x=yes
2093     AC_DEFINE(NO_X11)
2095     dnl MinGW/MSYS doesn't provide or need cygpath
2096     case "$host" in
2097     *-mingw*)
2098         CYGPATH_W=echo
2099         CYGPATH_S=cat
2100         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2101         ;;
2102     *-cygwin*|*-msvc*|*-mks*)
2103         CYGPATH_W="cygpath -a -w"
2104         CYGPATH_S="sed -e s|\\\\|/|g"
2105         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2106         ;;
2107     esac
2108     case "$host" in
2109     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2111     if test -z "$MOZ_TOOLS"; then
2112         AC_MSG_ERROR([MOZ_TOOLS is not set])
2113     fi
2115     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2116     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2117         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2118     fi
2119     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2120         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2121     fi
2122     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2124     if test -n "$GLIB_PREFIX"; then
2125         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2126         if test "$?" = "0"; then
2127             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2128                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2129             fi
2130             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2131         else
2132             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2133         fi
2134     else
2135         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2136     fi
2137     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2138         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2139     fi
2140     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2141     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2142         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2143     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2144         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2145     else
2146         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2147     fi
2149     if test -n "$LIBIDL_PREFIX"; then
2150         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2151         if test "$?" = "0"; then
2152             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2153                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2154             fi
2155             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2156         else
2157             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2158         fi
2159     else
2160         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2161     fi        
2162     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2163         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2164     fi
2165     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2166     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2167         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2168         STATIC_LIBIDL=1
2169     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2170         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2171     else
2172         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2173     fi
2174     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2175     ;;
2177     *) # else cross-compiling
2178         if test -n "$GLIB_PREFIX"; then
2179             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2180             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2181                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2182             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2183                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2184             else
2185                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2186             fi
2187         fi
2188         if test -n "$LIBIDL_PREFIX"; then
2189             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2190             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2191                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2192                 STATIC_LIBIDL=1
2193             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2194                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2195             else
2196                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2197             fi
2198         fi
2199         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2200         ;;
2201     esac 
2204     case "$host_os" in
2205     cygwin*|msvc*|mks*)
2206         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])
2207         ;;
2209     *)
2210         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2212         AC_LANG_SAVE
2213         AC_LANG_CPLUSPLUS
2214         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2215         AC_LANG_RESTORE
2216         ;;
2217     esac
2219     case "$target" in
2220     i*86-*)
2221         AC_DEFINE(_X86_)
2222         ;;
2223     alpha-*)
2224         AC_DEFINE(_ALPHA_)
2225         ;;
2226     mips-*)
2227         AC_DEFINE(_MIPS_)
2228         ;;
2229     *)
2230         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2231         ;;
2232     esac
2233     ;;
2235 *-netbsd*)
2236     DSO_CFLAGS=''
2237     CFLAGS="$CFLAGS -Dunix"
2238     CXXFLAGS="$CXXFLAGS -Dunix"
2239     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2240         DLL_SUFFIX=".so"
2241         DSO_PIC_CFLAGS='-fPIC -DPIC'
2242         DSO_LDOPTS='-shared'
2243         BIN_FLAGS='-Wl,--export-dynamic'
2244     else
2245         DSO_PIC_CFLAGS='-fPIC -DPIC'
2246         DLL_SUFFIX=".so.1.0"
2247         DSO_LDOPTS='-shared'
2248     fi
2249     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2250     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2251     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2252     if test "$LIBRUNPATH"; then
2253         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2254     fi
2255     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2256     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2257     ;;
2259 *-nto*) 
2260         AC_DEFINE(NTO)  
2261         AC_DEFINE(_QNX_SOURCE)
2262         AC_DEFINE(_i386)
2263         OS_TARGET=NTO
2264         WARNINGS_AS_ERRORS=''
2265         MOZ_OPTIMIZE_FLAGS="-O"
2266         MOZ_DEBUG_FLAGS="-gstabs"
2267         USE_PTHREADS=1
2268         _PEDANTIC=
2269         LIBS="$LIBS -lsocket -lstdc++"
2270         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2271         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2272         if test "$with_x" != "yes"
2273         then
2274                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2275             TK_CFLAGS='-I/usr/include/photon'
2276                 TK_LIBS='-lph'
2277         fi
2278         case "${target_cpu}" in
2279         ppc*)
2280         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2281         ;;
2282         esac
2283         case "${host_cpu}" in
2284         i*86)
2285         USE_ELF_DYNSTR_GC=1
2286         ;;
2287         esac
2288         ;;
2290 *-openbsd*)
2291     DLL_SUFFIX=".so.1.0"
2292     DSO_CFLAGS=''
2293     DSO_PIC_CFLAGS='-fPIC'
2294     DSO_LDOPTS='-shared -fPIC'
2295     if test "$LIBRUNPATH"; then
2296         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2297     fi
2298     ;;
2300 *-openvms*) 
2301     AC_DEFINE(NO_PW_GECOS)
2302     AC_DEFINE(NO_UDSOCK)
2303     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2304     USE_PTHREADS=1
2305     MKSHLIB_FORCE_ALL='-all'
2306     MKSHLIB_UNFORCE_ALL='-none'
2307     AS='as'
2308     AS_DASH_C_FLAG='-Wc/names=as_is'
2309     AR_FLAGS='c $@'
2310     DSO_LDOPTS='-shared -auto_symvec'
2311     DSO_PIC_CFLAGS=
2312     MOZ_DEBUG_LDFLAGS='-g'
2313     COMPAQ_CXX=1
2314     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2315     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2316     ;;
2319 *-os2*)
2320     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2321     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2322     AC_DEFINE(OS2)
2323     AC_DEFINE(XP_OS2)
2324     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2325     AC_DEFINE(TCPV40HDRS)
2326     USE_SHORT_LIBNAME=1
2327     DLL_PREFIX=
2328     LIB_PREFIX=
2329     LIB_SUFFIX=lib
2330     BIN_SUFFIX=".exe"
2331     DLL_SUFFIX=".dll"
2332     IMPORT_LIB_SUFFIX=lib
2333     DSO_PIC_CFLAGS=
2334     AR=emxomfar
2335     AR_FLAGS='r $@'
2336     CFLAGS="$CFLAGS -Zomf"
2337     CXXFLAGS="$CXXFLAGS -Zomf"
2338     DSO_LDOPTS='-Zdll'
2339     BIN_FLAGS='-Zlinker /ST:0x100000'
2340     IMPLIB='emximp -o'
2341     FILTER='emxexp -o'
2342     LDFLAGS='-Zmap'
2343     WARNINGS_AS_ERRORS='-Werror'
2344     MOZ_DEBUG_FLAGS="-g -fno-inline"
2345     MOZ_OPTIMIZE_FLAGS="-O2"
2346     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2347     MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2348     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2349     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2350     TARGET_MD_ARCH=os2
2351     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2352     MOZ_ENABLE_POSTSCRIPT=
2353     RC=rc.exe
2354     RCFLAGS='-n'
2355     MOZ_USER_DIR="Mozilla"
2357     if test "$MOZTOOLS"; then
2358         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2359     else
2360         AC_MSG_ERROR([MOZTOOLS is not set])
2361     fi
2362     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2363         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2364         LDFLAGS="$LDFLAGS -Zhigh-mem"
2365         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2366         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2367     fi
2369     # GCC for OS/2 currently predefines these, but we don't want them
2370     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2371     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2373     AC_CACHE_CHECK(for __declspec(dllexport),
2374         ac_os2_declspec,
2375         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2376                         [return 0;],
2377                         ac_os2_declspec="yes",
2378                         ac_os2_declspec="no")])
2379     if test "$ac_os2_declspec" = "yes"; then
2380         FILTER='true'
2381         MOZ_OS2_USE_DECLSPEC='1'
2382     fi
2383     ;;
2385 alpha*-*-osf*)
2386     if test "$GNU_CC"; then
2387       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2388       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2390     else
2391         MOZ_DEBUG_FLAGS='-g'
2392         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2393         CFLAGS="$CFLAGS -ieee"
2394         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2395         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2396         DSO_CFLAGS=
2397         DSO_PIC_CFLAGS=
2398         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2399         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2400         MKSHLIB_FORCE_ALL='-all'
2401         MKSHLIB_UNFORCE_ALL='-none'
2402         dnl Might fix the libxpcom.so breakage on this platform as well....
2403         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2404         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2405     fi
2406     if test -z "$GNU_CXX"; then
2407       COMPAQ_CXX=1
2408     fi
2409     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2410     ;;
2412 *-qnx*) 
2413     DIRENT_INO=d_stat.st_ino
2414     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2415     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2416     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2417     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2418     AC_DEFINE(STDC_HEADERS)
2419     if test "$no_x" = "yes"; then
2420             _PLATFORM_DEFAULT_TOOLKIT='photon'
2421             TK_CFLAGS='-I/usr/nto/include/photon'
2422             TK_LIBS='-lphoton -lphrender'
2423     fi
2424     ;;
2426 *-sco*) 
2427     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2428     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2429     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2430     if test ! "$GNU_CC"; then
2431        DSO_LDOPTS='-G'
2432     fi
2433     ;;
2435 dnl the qsort routine under solaris is faulty
2436 *-solaris*) 
2437     AC_DEFINE(SOLARIS)
2438     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2439     SYSTEM_MAKEDEPEND=
2440     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2441     # libraries one level up (e.g. libnspr4.so)
2442     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2443     LIBS="-lCrun -lCstd $LIBS"
2444     MOZ_MEMORY=1
2445     if test -z "$GNU_CC"; then
2446        NS_USE_NATIVE=1
2447        MOZ_FIX_LINK_PATHS=
2448        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2450        if test "$CPU_ARCH" != "sparc"; then
2451           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2452           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2453        else
2454           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2455           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2456           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2457        fi
2459        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2460        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2461            _SAVE_LDFLAGS=$LDFLAGS
2462            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2463            AC_TRY_LINK([#include <stdio.h>],
2464                        [printf("Hello World\n");],
2465                        ,
2466                        [LDFLAGS=$_SAVE_LDFLAGS])
2467        fi
2468        WARNINGS_AS_ERRORS='-Werror'
2469        MOZ_OPTIMIZE_FLAGS="-xO4"
2470        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2471        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2472        MKSHLIB_FORCE_ALL='-z allextract'
2473        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2474        DSO_LDOPTS='-G -z muldefs'
2475        AR_LIST="$AR t"
2476        AR_EXTRACT="$AR x"
2477        AR_DELETE="$AR d"
2478        AR='$(CXX) -xar'
2479        AR_FLAGS='-o $@'
2480        AS='/usr/ccs/bin/as'
2481        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2482        AS_DASH_C_FLAG=''
2483        TARGET_COMPILER_ABI="sunc"
2484         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2485         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2486        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2487        AC_LANG_SAVE
2488        AC_LANG_CPLUSPLUS
2489        AC_TRY_COMPILE([],
2490            [#if (__SUNPRO_CC < 0x530)
2491            #error "Denied"
2492            #endif],
2493            _BAD_COMPILER=,_BAD_COMPILER=1)
2494         if test -n "$_BAD_COMPILER"; then
2495             _res="no"
2496             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2497         else
2498             _res="yes"
2499         fi
2500         AC_MSG_RESULT([$_res])
2501         AC_LANG_RESTORE
2502     else
2503        ASFLAGS="$ASFLAGS -fPIC"
2504        DSO_LDOPTS='-G'
2505        _WARNINGS_CFLAGS=''
2506        _WARNINGS_CXXFLAGS=''
2507        if test "$OS_RELEASE" = "5.3"; then
2508           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2509        fi
2510     fi
2511     if test "$OS_RELEASE" = "5.5.1"; then
2512        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2513     fi
2514     ;;
2516 *-sunos*) 
2517     DSO_LDOPTS='-Bdynamic'
2518     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2519     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2520     AC_DEFINE(SUNOS4)
2521     AC_DEFINE(SPRINTF_RETURNS_STRING)
2522     case "$(target_os)" in
2523     sunos4.1*)
2524         DLL_SUFFIX='.so.1.0'
2525         ;;
2526     esac
2527     ;;
2529 *-sysv4.2uw7*) 
2530         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2531     ;;
2533 *-os2*)
2534     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2535     ;;
2537 esac
2539 dnl Only one oddball right now (QNX), but this gives us flexibility
2540 dnl if any other platforms need to override this in the future.
2541 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2543 dnl ========================================================
2544 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2545 dnl by now will not have any way to link most binaries (tests
2546 dnl as well as viewer, apprunner, etc.), because some symbols
2547 dnl will be left out of the "composite" .so's by ld as unneeded.
2548 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2549 dnl they can link in the static libs that provide the missing
2550 dnl symbols.
2551 dnl ========================================================
2552 NO_LD_ARCHIVE_FLAGS=
2553 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2554     NO_LD_ARCHIVE_FLAGS=1
2556 case "$target" in
2557 *-os2*)
2558     NO_LD_ARCHIVE_FLAGS=
2559     ;;
2560 *-aix4.3*|*-aix5*)
2561     NO_LD_ARCHIVE_FLAGS=
2562     ;;
2563 *-openvms*)
2564     NO_LD_ARCHIVE_FLAGS=
2565     ;;
2566 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2567     if test -z "$GNU_CC"; then
2568         NO_LD_ARCHIVE_FLAGS=
2569     fi
2570     ;;
2571 esac
2572 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2575 dnl Indicate that platform requires special thread safe 
2576 dnl locking when starting up the OJI JVM 
2577 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2578 dnl ========================================================
2579 case "$target" in
2580     *-hpux*)      
2581         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2582         ;;
2583 esac
2585 dnl ========================================================
2586 dnl = Flags to strip unused symbols from .so components
2587 dnl ========================================================
2588 case "$target" in
2589     *-linux*|*-kfreebsd*-gnu)
2590         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2591         ;;
2592     *-solaris*)
2593         if test -z "$GNU_CC"; then
2594          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2595         else
2596          if test -z "$GCC_USE_GNU_LD"; then
2597           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2598          else
2599           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2600          fi
2601         fi
2602         ;;
2603     *-nto*) 
2604         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2605         ;;
2606     *-darwin*)
2607         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2608         ;;
2609     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2610         if test -n "$GNU_CC"; then
2611            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2612         fi
2613         ;;
2614 esac
2616 if test -z "$COMPILE_ENVIRONMENT"; then
2617     SKIP_COMPILER_CHECKS=1
2618     SKIP_LIBRARY_CHECKS=1
2621 if test -z "$SKIP_COMPILER_CHECKS"; then
2622 dnl Checks for typedefs, structures, and compiler characteristics.
2623 dnl ========================================================
2624 AC_LANG_C
2625 AC_HEADER_STDC
2626 AC_C_CONST
2627 AC_TYPE_MODE_T
2628 AC_TYPE_OFF_T
2629 AC_TYPE_PID_T
2630 AC_TYPE_SIZE_T
2631 AC_STRUCT_ST_BLKSIZE
2632 AC_MSG_CHECKING(for siginfo_t)
2633 AC_CACHE_VAL(ac_cv_siginfo_t,
2634  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2635                   #include <signal.h>],
2636                  [siginfo_t* info;],
2637                  [ac_cv_siginfo_t=true],
2638                  [ac_cv_siginfo_t=false])])
2639 if test "$ac_cv_siginfo_t" = true ; then
2640   AC_DEFINE(HAVE_SIGINFO_T)
2641   AC_MSG_RESULT(yes)
2642 else
2643   AC_MSG_RESULT(no)
2646 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2647 dnl ========================================================
2648 AC_MSG_CHECKING(for int16_t)
2649 AC_CACHE_VAL(ac_cv_int16_t,
2650  [AC_TRY_COMPILE([#include <stdio.h>
2651                   #include <sys/types.h>],
2652                  [int16_t foo = 0;],
2653                  [ac_cv_int16_t=true],
2654                  [ac_cv_int16_t=false])])
2655 if test "$ac_cv_int16_t" = true ; then
2656   AC_DEFINE(HAVE_INT16_T)
2657   AC_MSG_RESULT(yes)
2658 else
2659   AC_MSG_RESULT(no)
2661 AC_MSG_CHECKING(for int32_t)
2662 AC_CACHE_VAL(ac_cv_int32_t,
2663  [AC_TRY_COMPILE([#include <stdio.h>
2664                   #include <sys/types.h>],
2665                  [int32_t foo = 0;],
2666                  [ac_cv_int32_t=true],
2667                  [ac_cv_int32_t=false])])
2668 if test "$ac_cv_int32_t" = true ; then
2669   AC_DEFINE(HAVE_INT32_T)
2670   AC_MSG_RESULT(yes)
2671 else
2672   AC_MSG_RESULT(no)
2674 AC_MSG_CHECKING(for int64_t)
2675 AC_CACHE_VAL(ac_cv_int64_t,
2676  [AC_TRY_COMPILE([#include <stdio.h>
2677                   #include <sys/types.h>],
2678                  [int64_t foo = 0;],
2679                  [ac_cv_int64_t=true],
2680                  [ac_cv_int64_t=false])])
2681 if test "$ac_cv_int64_t" = true ; then
2682   AC_DEFINE(HAVE_INT64_T)
2683   AC_MSG_RESULT(yes)
2684 else
2685   AC_MSG_RESULT(no)
2687 AC_MSG_CHECKING(for int64)
2688 AC_CACHE_VAL(ac_cv_int64,
2689  [AC_TRY_COMPILE([#include <stdio.h>
2690                   #include <sys/types.h>],
2691                  [int64 foo = 0;],
2692                  [ac_cv_int64=true],
2693                  [ac_cv_int64=false])])
2694 if test "$ac_cv_int64" = true ; then
2695   AC_DEFINE(HAVE_INT64)
2696   AC_MSG_RESULT(yes)
2697 else
2698   AC_MSG_RESULT(no)
2700 AC_MSG_CHECKING(for uint)
2701 AC_CACHE_VAL(ac_cv_uint,
2702  [AC_TRY_COMPILE([#include <stdio.h>
2703                   #include <sys/types.h>],
2704                  [uint foo = 0;],
2705                  [ac_cv_uint=true],
2706                  [ac_cv_uint=false])])
2707 if test "$ac_cv_uint" = true ; then
2708   AC_DEFINE(HAVE_UINT)
2709   AC_MSG_RESULT(yes)
2710 else
2711   AC_MSG_RESULT(no)
2713 AC_MSG_CHECKING(for uint_t)
2714 AC_CACHE_VAL(ac_cv_uint_t,
2715  [AC_TRY_COMPILE([#include <stdio.h>
2716                   #include <sys/types.h>],
2717                  [uint_t foo = 0;],
2718                  [ac_cv_uint_t=true],
2719                  [ac_cv_uint_t=false])])
2720 if test "$ac_cv_uint_t" = true ; then
2721   AC_DEFINE(HAVE_UINT_T)
2722   AC_MSG_RESULT(yes)
2723 else
2724   AC_MSG_RESULT(no)
2726 AC_MSG_CHECKING(for uint16_t)
2727 AC_CACHE_VAL(ac_cv_uint16_t,
2728  [AC_TRY_COMPILE([#include <stdio.h>
2729                   #include <sys/types.h>],
2730                  [uint16_t foo = 0;],
2731                  [ac_cv_uint16_t=true],
2732                  [ac_cv_uint16_t=false])])
2733 if test "$ac_cv_uint16_t" = true ; then
2734   AC_DEFINE(HAVE_UINT16_T)
2735   AC_MSG_RESULT(yes)
2736 else
2737   AC_MSG_RESULT(no)
2740 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2741 dnl are defined when compiling C++ but not C.  Since the result of this
2742 dnl test is used only in C++, do it in C++.
2743 AC_LANG_CPLUSPLUS
2745 AC_MSG_CHECKING(for uname.domainname)
2746 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2747     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2748         [ struct utsname *res; char *domain; 
2749             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2750         [ac_cv_have_uname_domainname_field=true],
2751         [ac_cv_have_uname_domainname_field=false])])
2753 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2754     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2755     AC_MSG_RESULT(yes)
2756 else
2757     AC_MSG_RESULT(no)
2760 AC_MSG_CHECKING(for uname.__domainname)
2761 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2762     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2763         [ struct utsname *res; char *domain; 
2764             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2765         [ac_cv_have_uname_us_domainname_field=true],
2766         [ac_cv_have_uname_us_domainname_field=false])])
2768 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2769     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2770     AC_MSG_RESULT(yes)
2771 else
2772     AC_MSG_RESULT(no)
2775 AC_LANG_C
2777 dnl Check for usable wchar_t (2 bytes, unsigned)
2778 dnl (we really don't need the unsignedness check anymore)
2779 dnl ========================================================
2781 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2782     ac_cv_have_usable_wchar_v2,
2783     [AC_TRY_COMPILE([#include <stddef.h>
2784                      $configure_static_assert_macros],
2785                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2786                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2787                     ac_cv_have_usable_wchar_v2="yes",
2788                     ac_cv_have_usable_wchar_v2="no")])
2789 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2790     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2791     HAVE_CPP_2BYTE_WCHAR_T=1
2792 else
2793 dnl This is really gcc-only
2794 dnl Do this test using CXX only since some versions of gcc
2795 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2796 dnl only have short-wchar support for c++.
2797 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2799     AC_LANG_SAVE
2800     AC_LANG_CPLUSPLUS
2801     _SAVE_CXXFLAGS=$CXXFLAGS
2802     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2804     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2805         ac_cv_have_usable_wchar_option_v2,
2806         [AC_TRY_LINK([#include <stddef.h>
2807                       $configure_static_assert_macros],
2808                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2809                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2810                      ac_cv_have_usable_wchar_option_v2="yes",
2811                      ac_cv_have_usable_wchar_option_v2="no")])
2813     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2814         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2815         HAVE_CPP_2BYTE_WCHAR_T=1
2816         WCHAR_CFLAGS="-fshort-wchar"
2817     else    
2818         CXXFLAGS=$_SAVE_CXXFLAGS
2819     fi
2820     AC_LANG_RESTORE
2823 dnl Check for .hidden assembler directive and visibility attribute.
2824 dnl Borrowed from glibc configure.in
2825 dnl ===============================================================
2826 if test "$GNU_CC"; then
2827   AC_CACHE_CHECK(for visibility(hidden) attribute,
2828                  ac_cv_visibility_hidden,
2829                  [cat > conftest.c <<EOF
2830                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2832                   ac_cv_visibility_hidden=no
2833                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2834                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2835                       ac_cv_visibility_hidden=yes
2836                     fi
2837                   fi
2838                   rm -f conftest.[cs]
2839                  ])
2840   if test "$ac_cv_visibility_hidden" = "yes"; then
2841     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2843     AC_CACHE_CHECK(for visibility(default) attribute,
2844                    ac_cv_visibility_default,
2845                    [cat > conftest.c <<EOF
2846                     int foo __attribute__ ((visibility ("default"))) = 1;
2848                     ac_cv_visibility_default=no
2849                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2850                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2851                         ac_cv_visibility_default=yes
2852                       fi
2853                     fi
2854                     rm -f conftest.[cs]
2855                    ])
2856     if test "$ac_cv_visibility_default" = "yes"; then
2857       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2859       AC_CACHE_CHECK(for visibility pragma support,
2860                      ac_cv_visibility_pragma,
2861                      [cat > conftest.c <<EOF
2862 #pragma GCC visibility push(hidden)
2863                       int foo_hidden = 1;
2864 #pragma GCC visibility push(default)
2865                       int foo_default = 1;
2867                       ac_cv_visibility_pragma=no
2868                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2869                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2870                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2871                             ac_cv_visibility_pragma=yes
2872                           fi
2873                         fi
2874                       fi
2875                       rm -f conftest.[cs]
2876                     ])
2877       if test "$ac_cv_visibility_pragma" = "yes"; then
2878         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2879                        ac_cv_have_visibility_class_bug,
2880                        [cat > conftest.c <<EOF
2881 #pragma GCC visibility push(hidden)
2882 struct __attribute__ ((visibility ("default"))) TestStruct {
2883   static void Init();
2885 __attribute__ ((visibility ("default"))) void TestFunc() {
2886   TestStruct::Init();
2889                        ac_cv_have_visibility_class_bug=no
2890                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2891                          ac_cv_have_visibility_class_bug=yes
2892                        else
2893                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2894                            ac_cv_have_visibility_class_bug=yes
2895                          fi
2896                        fi
2897                        rm -rf conftest.{c,S}
2898                        ])
2900         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2901                        ac_cv_have_visibility_builtin_bug,
2902                        [cat > conftest.c <<EOF
2903 #pragma GCC visibility push(hidden)
2904 #pragma GCC visibility push(default)
2905 #include <string.h>
2906 #pragma GCC visibility pop
2908 __attribute__ ((visibility ("default"))) void Func() {
2909   char c[[100]];
2910   memset(c, 0, sizeof(c));
2913                        ac_cv_have_visibility_builtin_bug=no
2914                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2915                          ac_cv_have_visibility_builtin_bug=yes
2916                        else
2917                          if test `grep -c "@PLT" conftest.S` = 0; then
2918                            ac_cv_visibility_builtin_bug=yes
2919                          fi
2920                        fi
2921                        rm -f conftest.{c,S}
2922                        ])
2923         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2924                 "$ac_cv_have_visibility_class_bug" = "no"; then
2925           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2926           WRAP_SYSTEM_INCLUDES=1
2927         else
2928           VISIBILITY_FLAGS='-fvisibility=hidden'
2929         fi # have visibility pragma bug
2930       fi   # have visibility pragma
2931     fi     # have visibility(default) attribute
2932   fi       # have visibility(hidden) attribute
2933 fi         # GNU_CC
2935 # visibility hidden flag for Sun Studio on Solaris
2936 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
2937 VISIBILITY_FLAGS='-xldscope=hidden'
2938 fi         # Sun Studio on Solaris
2940 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2941 AC_SUBST(VISIBILITY_FLAGS)
2943 dnl Checks for header files.
2944 dnl ========================================================
2945 AC_HEADER_DIRENT
2946 case "$target_os" in
2947 freebsd*)
2948 # for stuff like -lXshm
2949     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2950     ;;
2951 esac
2952 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2953 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2954 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2955 AC_CHECK_HEADERS(malloc.h)
2956 AC_CHECK_HEADERS(X11/XKBlib.h)
2958 dnl These are all the places some variant of statfs can be hiding.
2959 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2961 dnl Try for MMX support
2962 dnl NB - later gcc versions require -mmmx for this header to be successfully
2963 dnl included (or another option which implies it, such as -march=pentium-mmx)
2964 AC_CHECK_HEADERS(mmintrin.h)
2966 dnl Check whether the compiler supports the new-style C++ standard
2967 dnl library headers (i.e. <new>) or needs the old "new.h"
2968 AC_LANG_CPLUSPLUS
2969 NEW_H=new.h
2970 AC_CHECK_HEADER(new, [NEW_H=new])
2971 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2972 AC_LANG_C
2974 AC_ARG_ENABLE(dtrace,
2975               [  --enable-dtrace         build with dtrace support if available (default=no)],
2976               [enable_dtrace="yes"],)
2977 if test "x$enable_dtrace" = "xyes"; then
2978   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2979   if test -n "$HAVE_DTRACE"; then
2980       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2981   else
2982       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2983   fi
2985 AC_SUBST(HAVE_DTRACE)
2987 case $target in
2988 *-aix4.3*|*-aix5*)
2989         ;;
2991         AC_CHECK_HEADERS(sys/cdefs.h)
2992         ;;
2993 esac
2995 dnl Checks for libraries.
2996 dnl ========================================================
2997 case $target in
2998 *-hpux11.*)
2999         ;;
3001         AC_CHECK_LIB(c_r, gethostbyname_r)
3002         ;;
3003 esac
3005 dnl We don't want to link with libdl even if it's present on OS X, since
3006 dnl it's not used and not part of the default installation.
3007 dnl The same goes for BeOS.
3008 dnl We don't want to link against libm or libpthread on Darwin since
3009 dnl they both are just symlinks to libSystem and explicitly linking
3010 dnl against libSystem causes issues when debugging (see bug 299601).
3011 case $target in
3012 *-darwin*)
3013     ;;
3014 *-beos*)
3015     ;;
3017     AC_CHECK_LIB(m, atan)
3018     AC_CHECK_LIB(dl, dlopen,
3019     AC_CHECK_HEADER(dlfcn.h, 
3020         LIBS="-ldl $LIBS"
3021         AC_DEFINE(HAVE_LIBDL)))
3022     ;;
3023 esac
3025 _SAVE_CFLAGS="$CFLAGS"
3026 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3027 AC_CHECK_FUNCS(dladdr)
3028 CFLAGS="$_SAVE_CFLAGS"
3030 if test ! "$GNU_CXX"; then
3032     case $target in
3033     *-aix*)
3034         AC_CHECK_LIB(C_r, demangle)
3035         ;;
3036      *)
3037         AC_CHECK_LIB(C, demangle)
3038         ;;
3039      esac
3041 AC_CHECK_LIB(socket, socket)
3043 XLDFLAGS="$X_LIBS"
3044 XLIBS="$X_EXTRA_LIBS"
3046 dnl ========================================================
3047 dnl Checks for X libraries.
3048 dnl Ordering is important.
3049 dnl Xt is dependent upon SM as of X11R6
3050 dnl ========================================================
3051 if test "$no_x" = "yes"; then
3052     AC_DEFINE(NO_X11)
3053 else
3054     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3055         XLIBS="-lX11 $XLIBS"
3056         _SAVE_LDFLAGS="$LDFLAGS"
3057         LDFLAGS="$XLDFLAGS $LDFLAGS"
3058         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3059                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3060         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3061                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3062    
3063      
3064         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3065         unset ac_cv_lib_Xt_XtFree
3066             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3067             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3068         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3069                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3070         ])
3072     # AIX needs the motif library linked before libXt to prevent
3073     # crashes in plugins linked against Motif - Bug #98892
3074     case "${target_os}" in
3075     aix*)
3076         XT_LIBS="-lXm $XT_LIBS"
3077         ;;
3078     esac
3080     dnl ========================================================
3081     dnl = Check for XShm
3082     dnl ========================================================
3083     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3084         $XLIBS $XEXT_LIBS)
3085     AC_CHECK_HEADER(X11/extensions/XShm.h)
3086     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3087         test -n "$_HAVE_XSHM_XEXT"; then
3088         AC_DEFINE(HAVE_XSHM)
3089     fi
3091     dnl ========================================================
3092     dnl = Check for XIE
3093     dnl ========================================================
3094     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3095         $XLIBS $XEXT_LIBS)
3096     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3098     if test "$MOZ_XIE_LIBS"; then
3099         dnl ====================================================
3100         dnl = If XIE is present and is desired, turn it on
3101         dnl ====================================================
3102         case $target in
3103             *-hpux*)
3104                 ;;
3105             *)
3106                 HAVE_XIE=1
3107                 ;;
3108         esac
3109     fi
3111         LDFLAGS="$_SAVE_LDFLAGS"
3113     dnl ========================================================
3114     dnl = Check for freetype2 and its functionality
3115     dnl ========================================================
3116     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3118     if test "$_HAVE_FREETYPE2"; then
3119         _SAVE_LIBS="$LIBS"
3120         _SAVE_CFLAGS="$CFLAGS"
3121         LIBS="$LIBS $FT2_LIBS"
3122         CFLAGS="$CFLAGS $FT2_CFLAGS"
3124         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3125             ac_cv_member_FT_Bitmap_Size_y_ppem,
3126             [AC_TRY_COMPILE([#include <ft2build.h>
3127                              #include FT_FREETYPE_H],
3128                             [FT_Bitmap_Size s;
3129                              if (sizeof s.y_ppem) return 0;
3130                              return 1],
3131                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3132                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3133         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3134             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3135         else
3136             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3137         fi
3138         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3139                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3140                            [FT_Bitmap_Size structure includes y_ppem field])
3142         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3144         LIBS="$_SAVE_LIBS"
3145         CFLAGS="$_SAVE_CFLAGS"
3146     fi
3148 fi # $no_x
3150 AC_SUBST(XCFLAGS)
3151 AC_SUBST(XLDFLAGS)
3152 AC_SUBST(XLIBS)
3153 AC_SUBST(XT_LIBS)
3155 AC_MSG_CHECKING(for ARM SIMD support)
3156 AC_TRY_COMPILE([],
3157                [asm("uqadd8 r1, r1, r2");],
3158                result="yes", result="no")
3159 AC_MSG_RESULT("$result")
3160 if test "$result" = "yes"; then
3161     AC_DEFINE(HAVE_ARM_SIMD)
3162     HAVE_ARM_SIMD=1
3164 AC_SUBST(HAVE_ARM_SIMD)
3166 dnl ========================================================
3167 dnl = pthread support
3168 dnl = Start by checking whether the system support pthreads
3169 dnl ========================================================
3170 case "$target_os" in
3171 darwin*)
3172     USE_PTHREADS=1
3173     ;;
3175     MOZ_CHECK_PTHREADS(pthreads,
3176         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3177         MOZ_CHECK_PTHREADS(pthread,
3178             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3179             MOZ_CHECK_PTHREADS(c_r,
3180                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3181                 MOZ_CHECK_PTHREADS(c,
3182                     USE_PTHREADS=1
3183                 )
3184             )
3185         )
3186     )
3187     ;;
3188 esac
3190 dnl ========================================================
3191 dnl Check the command line for --with-pthreads 
3192 dnl ========================================================
3193 MOZ_ARG_WITH_BOOL(pthreads,
3194 [  --with-pthreads         Force use of system pthread library with NSPR ],
3195 [ if test "$USE_PTHREADS"x = x; then
3196     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3197 fi],
3198     USE_PTHREADS=
3199     _PTHREAD_LDFLAGS=
3202 dnl ========================================================
3203 dnl Do the platform specific pthread hackery
3204 dnl ========================================================
3205 if test "$USE_PTHREADS"x != x
3206 then
3207         dnl
3208         dnl See if -pthread is supported.
3209         dnl
3210         rm -f conftest*
3211         ac_cv_have_dash_pthread=no
3212         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3213         echo 'int main() { return 0; }' | cat > conftest.c
3214         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3215         if test $? -eq 0; then
3216                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3217                         ac_cv_have_dash_pthread=yes
3218                 case "$target_os" in
3219                 freebsd*)
3220 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3221                 ;;
3222                 *)
3223                             CFLAGS="$CFLAGS -pthread"
3224                             CXXFLAGS="$CXXFLAGS -pthread"
3225                 ;;
3226                 esac
3227                 fi
3228         fi
3229         rm -f conftest*
3230     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3232         dnl
3233         dnl See if -pthreads is supported.
3234         dnl
3235     ac_cv_have_dash_pthreads=no
3236     if test "$ac_cv_have_dash_pthread" = "no"; then
3237             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3238         echo 'int main() { return 0; }' | cat > conftest.c
3239             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3240         if test $? -eq 0; then
3241                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3242                             ac_cv_have_dash_pthreads=yes
3243                             CFLAGS="$CFLAGS -pthreads"
3244                             CXXFLAGS="$CXXFLAGS -pthreads"
3245                     fi
3246             fi
3247             rm -f conftest*
3248         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3249     fi
3251         case "$target" in
3252             *-*-freebsd*)
3253                         AC_DEFINE(_REENTRANT)
3254                         AC_DEFINE(_THREAD_SAFE)
3255                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3256                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3257                                 _PTHREAD_LDFLAGS="-pthread"
3258                         else
3259                                 _PTHREAD_LDFLAGS="-lc_r"
3260                         fi
3261                         ;;
3263             *-*-openbsd*|*-*-bsdi*)
3264                         AC_DEFINE(_REENTRANT)
3265                         AC_DEFINE(_THREAD_SAFE)
3266                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3267                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3268                 _PTHREAD_LDFLAGS="-pthread"
3269                         fi
3270                         ;;
3272             *-*-linux*|*-*-kfreebsd*-gnu)
3273                         AC_DEFINE(_REENTRANT) 
3274                         ;;
3276             *-*-nto*) 
3277                         AC_DEFINE(_REENTRANT) 
3278                         ;;
3280             *-aix4.3*|*-aix5*)
3281                         AC_DEFINE(_REENTRANT) 
3282                         ;;
3284             *-hpux11.*)
3285                         AC_DEFINE(_REENTRANT) 
3286                         ;;
3288             alpha*-*-osf*)
3289                         AC_DEFINE(_REENTRANT)
3290                         ;;
3292             *-*-solaris*) 
3293                         AC_DEFINE(_REENTRANT) 
3294                         if test ! "$GNU_CC"; then
3295                                 CFLAGS="$CFLAGS -mt" 
3296                                 CXXFLAGS="$CXXFLAGS -mt" 
3297                         fi
3298                         ;;
3299         esac
3300     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3303 dnl ========================================================
3304 dnl See if mmap sees writes
3305 dnl For cross compiling, just define it as no, which is a safe default
3306 dnl ========================================================
3307 AC_MSG_CHECKING(whether mmap() sees write()s)
3309 changequote(,)
3310 mmap_test_prog='
3311     #include <stdlib.h>
3312     #include <unistd.h>
3313     #include <sys/mman.h>
3314     #include <sys/types.h>
3315     #include <sys/stat.h>
3316     #include <fcntl.h>
3318     char fname[] = "conftest.file";
3319     char zbuff[1024]; /* Fractional page is probably worst case */
3321     int main() {
3322         char *map;
3323         int fd;
3324         int i;
3325         unlink(fname);
3326         fd = open(fname, O_RDWR | O_CREAT, 0660);
3327         if(fd<0) return 1;
3328         unlink(fname);
3329         write(fd, zbuff, sizeof(zbuff));
3330         lseek(fd, 0, SEEK_SET);
3331         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3332         if(map==(char*)-1) return 2;
3333         for(i=0; fname[i]; i++) {
3334             int rc = write(fd, &fname[i], 1);
3335             if(map[i]!=fname[i]) return 4;
3336         }
3337         return 0;
3338     }
3340 changequote([,])
3342 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3344 AC_MSG_RESULT("$result")
3346 if test "$result" = "no"; then
3347     AC_DEFINE(MMAP_MISSES_WRITES)
3351 dnl Checks for library functions.
3352 dnl ========================================================
3353 AC_PROG_GCC_TRADITIONAL
3354 AC_FUNC_MEMCMP
3355 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3356 AC_CHECK_FUNCS(flockfile getpagesize)
3357 AC_CHECK_FUNCS(localtime_r strtok_r)
3359 dnl check for wcrtomb/mbrtowc
3360 dnl =======================================================================
3361 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3362 AC_LANG_SAVE
3363 AC_LANG_CPLUSPLUS
3364 AC_CACHE_CHECK(for wcrtomb,
3365     ac_cv_have_wcrtomb,
3366     [AC_TRY_LINK([#include <wchar.h>],
3367                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3368                  ac_cv_have_wcrtomb="yes",
3369                  ac_cv_have_wcrtomb="no")])
3370 if test "$ac_cv_have_wcrtomb" = "yes"; then
3371     AC_DEFINE(HAVE_WCRTOMB)
3373 AC_CACHE_CHECK(for mbrtowc,
3374     ac_cv_have_mbrtowc,
3375     [AC_TRY_LINK([#include <wchar.h>],
3376                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3377                  ac_cv_have_mbrtowc="yes",
3378                  ac_cv_have_mbrtowc="no")])
3379 if test "$ac_cv_have_mbrtowc" = "yes"; then
3380     AC_DEFINE(HAVE_MBRTOWC)
3382 AC_LANG_RESTORE
3385 AC_CACHE_CHECK(
3386     [for res_ninit()],
3387     ac_cv_func_res_ninit,
3388     [AC_TRY_LINK([
3389         #ifdef linux
3390         #define _BSD_SOURCE 1
3391         #endif
3392         #include <resolv.h>
3393         ],
3394         [int foo = res_ninit(&_res);],
3395         [ac_cv_func_res_ninit=yes],
3396         [ac_cv_func_res_ninit=no])
3397     ])
3399 if test "$ac_cv_func_res_ninit" = "yes"; then
3400     AC_DEFINE(HAVE_RES_NINIT)
3401 dnl must add the link line we do something as foolish as this... dougt
3402 dnl else
3403 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3404 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3407 AC_LANG_CPLUSPLUS
3408 AC_CACHE_CHECK(
3409     [for gnu_get_libc_version()],
3410     ac_cv_func_gnu_get_libc_version,
3411     [AC_TRY_LINK([
3412         #ifdef HAVE_GNU_LIBC_VERSION_H
3413         #include <gnu/libc-version.h>
3414         #endif
3415         ],
3416         [const char *glibc_version = gnu_get_libc_version();],
3417         [ac_cv_func_gnu_get_libc_version=yes],
3418         [ac_cv_func_gnu_get_libc_version=no] 
3419         )]
3420     )
3422 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3423     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3426 case $target_os in
3427     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3428         ;;
3429     *)
3430     
3431 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3432     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3433         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3434 _SAVE_LIBS=$LIBS
3435 LIBS="$LIBS $_ICONV_LIBS"
3436 AC_CACHE_CHECK(
3437     [for iconv()],
3438     ac_cv_func_iconv,
3439     [AC_TRY_LINK([
3440         #include <stdlib.h>
3441         #include <iconv.h>
3442         ],
3443         [
3444             iconv_t h = iconv_open("", "");
3445             iconv(h, NULL, NULL, NULL, NULL);
3446             iconv_close(h);
3447         ],
3448         [ac_cv_func_iconv=yes],
3449         [ac_cv_func_iconv=no] 
3450         )]
3451     )
3452 if test "$ac_cv_func_iconv" = "yes"; then
3453     AC_DEFINE(HAVE_ICONV)
3454     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3455     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3456     LIBICONV="$_ICONV_LIBS"
3457     AC_CACHE_CHECK(
3458         [for iconv() with const input],
3459         ac_cv_func_const_iconv,
3460         [AC_TRY_COMPILE([
3461             #include <stdlib.h>
3462             #include <iconv.h>
3463             ],
3464             [
3465                 const char *input = "testing";
3466                 iconv_t h = iconv_open("", "");
3467                 iconv(h, &input, NULL, NULL, NULL);
3468                 iconv_close(h);
3469             ],
3470             [ac_cv_func_const_iconv=yes],
3471             [ac_cv_func_const_iconv=no] 
3472             )]
3473         )
3474     if test "$ac_cv_func_const_iconv" = "yes"; then
3475         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3476     fi
3478 LIBS=$_SAVE_LIBS
3480     ;;
3481 esac
3483 AM_LANGINFO_CODESET
3485 AC_LANG_C
3487 dnl **********************
3488 dnl *** va_copy checks ***
3489 dnl **********************
3490 dnl we currently check for all three va_copy possibilities, so we get
3491 dnl all results in config.log for bug reports.
3492 AC_MSG_CHECKING(for an implementation of va_copy())
3493 AC_CACHE_VAL(ac_cv_va_copy,[
3494     AC_TRY_RUN([
3495         #include <stdarg.h>
3496         void f (int i, ...) {
3497             va_list args1, args2;
3498             va_start (args1, i);
3499             va_copy (args2, args1);
3500             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3501                 exit (1);
3502             va_end (args1); va_end (args2);
3503         }
3504         int main() { f (0, 42); return 0; }],
3505         ac_cv_va_copy=yes,
3506         ac_cv_va_copy=no,
3507         ac_cv_va_copy=no
3508     )
3510 AC_MSG_RESULT($ac_cv_va_copy)
3511 AC_MSG_CHECKING(for an implementation of __va_copy())
3512 AC_CACHE_VAL(ac_cv___va_copy,[
3513     AC_TRY_RUN([
3514         #include <stdarg.h>
3515         void f (int i, ...) {
3516             va_list args1, args2;
3517             va_start (args1, i);
3518             __va_copy (args2, args1);
3519             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3520                 exit (1);
3521             va_end (args1); va_end (args2);
3522         }
3523         int main() { f (0, 42); return 0; }],
3524         ac_cv___va_copy=yes,
3525         ac_cv___va_copy=no,
3526         ac_cv___va_copy=no
3527     )
3529 AC_MSG_RESULT($ac_cv___va_copy)
3530 AC_MSG_CHECKING(whether va_lists can be copied by value)
3531 AC_CACHE_VAL(ac_cv_va_val_copy,[
3532     AC_TRY_RUN([
3533         #include <stdarg.h>
3534         void f (int i, ...) {
3535             va_list args1, args2;
3536             va_start (args1, i);
3537             args2 = args1;
3538             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3539                 exit (1);
3540             va_end (args1); va_end (args2);
3541         }
3542         int main() { f (0, 42); return 0; }],
3543         ac_cv_va_val_copy=yes,
3544         ac_cv_va_val_copy=no,
3545         ac_cv_va_val_copy=yes
3546     )
3548 if test "x$ac_cv_va_copy" = "xyes"; then
3549     AC_DEFINE(VA_COPY, va_copy)
3550     AC_DEFINE(HAVE_VA_COPY)
3551 elif test "x$ac_cv___va_copy" = "xyes"; then
3552     AC_DEFINE(VA_COPY, __va_copy)
3553     AC_DEFINE(HAVE_VA_COPY)
3556 if test "x$ac_cv_va_val_copy" = "xno"; then
3557    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3559 AC_MSG_RESULT($ac_cv_va_val_copy)
3561 dnl Check for dll-challenged libc's.
3562 dnl This check is apparently only needed for Linux.
3563 case "$target" in
3564         *-linux*)
3565             dnl ===================================================================
3566             _curdir=`pwd`
3567             export _curdir
3568             rm -rf conftest* _conftest
3569             mkdir _conftest
3570             cat >> conftest.C <<\EOF
3571 #include <stdio.h>
3572 #include <link.h>
3573 #include <dlfcn.h>
3574 #ifdef _dl_loaded
3575 void __dump_link_map(void) {
3576   struct link_map *map = _dl_loaded;
3577   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3579 int main() {
3580   dlopen("./conftest1.so",RTLD_LAZY);
3581   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3582   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3583   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3584   __dump_link_map();
3586 #else
3587 /* _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).*/
3588 int main() { printf("./conftest1.so\n"); }
3589 #endif
3592             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3594             cat >> conftest1.C <<\EOF
3595 #include <stdio.h>
3596 void foo(void) {printf("foo in dll called\n");}
3598             ${CXX-g++} -fPIC -c -g conftest1.C
3599             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3600             ${CXX-g++} -g conftest.C -o conftest -ldl
3601             cp -f conftest1.so conftest _conftest
3602             cd _conftest
3603             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3604             then
3605                 echo
3606                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3607                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3608                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3609                 echo "*** will be excessive memory usage at runtime."
3610                 echo
3611             fi
3612             cd ${_curdir}
3613             rm -rf conftest* _conftest
3614             dnl ===================================================================
3615             ;;
3616 esac
3618 dnl ===================================================================
3619 dnl ========================================================
3620 dnl By default, turn rtti and exceptions off on g++/egcs
3621 dnl ========================================================
3622 if test "$GNU_CXX"; then
3624   AC_MSG_CHECKING(for C++ exceptions flag)
3626   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3627   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3628   [echo "int main() { return 0; }" | cat > conftest.C
3630   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3632   if egrep "warning.*renamed" conftest.out >/dev/null; then
3633     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3634   else
3635     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3636   fi
3638   rm -f conftest*])
3640   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3641   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3642   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3645 dnl ========================================================
3646 dnl Put your C++ language/feature checks below
3647 dnl ========================================================
3648 AC_LANG_CPLUSPLUS
3650 HAVE_GCC3_ABI=
3651 if test "$GNU_CC"; then
3652   AC_CACHE_CHECK(for gcc 3.0 ABI,
3653       ac_cv_gcc_three_abi,
3654       [AC_TRY_COMPILE([],
3655                       [
3656 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3657   return 0;
3658 #else
3659 #error Not gcc3.
3660 #endif
3661                       ],
3662                       ac_cv_gcc_three_abi="yes",
3663                       ac_cv_gcc_three_abi="no")])
3664   if test "$ac_cv_gcc_three_abi" = "yes"; then
3665       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3666       HAVE_GCC3_ABI=1
3667   else
3668       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3669   fi
3671 AC_SUBST(HAVE_GCC3_ABI)
3674 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3675                ac_cv_cpp_explicit,
3676                [AC_TRY_COMPILE(class X {
3677                                public: explicit X(int i) : i_(i) {}
3678                                private: int i_;
3679                                };,
3680                                X x(3);,
3681                                ac_cv_cpp_explicit=yes,
3682                                ac_cv_cpp_explicit=no)])
3683 if test "$ac_cv_cpp_explicit" = yes ; then
3684    AC_DEFINE(HAVE_CPP_EXPLICIT)
3687 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3688                ac_cv_cpp_typename,
3689                [AC_TRY_COMPILE(class param {
3690                                public:
3691                                    typedef unsigned long num_type;
3692                                };
3694                                template <class T> class tplt {
3695                                public:
3696                                    typedef typename T::num_type t_num_type;
3697                                    t_num_type foo(typename T::num_type num) {
3698                                        return num;
3699                                    }
3700                                };,
3701                                tplt<param> A;
3702                                A.foo(0);,
3703                                ac_cv_cpp_typename=yes,
3704                                ac_cv_cpp_typename=no)])
3705 if test "$ac_cv_cpp_typename" = yes ; then
3706    AC_DEFINE(HAVE_CPP_TYPENAME)
3709 dnl Check for support of modern template specialization syntax
3710 dnl Test code and requirement from scc@netscape.com.
3711 dnl Autoconf cut-and-paste job by waterson@netscape.com
3712 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3713                ac_cv_cpp_modern_specialize_template_syntax,
3714                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3715                                class Y {};
3716                                template <> struct X<Y> { double a; };,
3717                                X<int> int_x;
3718                                X<Y> y_x;,
3719                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3720                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3721 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3722   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3726 dnl Some compilers support only full specialization, and some don't.
3727 AC_CACHE_CHECK(whether partial template specialization works,
3728                ac_cv_cpp_partial_specialization,
3729                [AC_TRY_COMPILE(template <class T> class Foo {};
3730                                template <class T> class Foo<T*> {};,
3731                                return 0;,
3732                                ac_cv_cpp_partial_specialization=yes,
3733                                ac_cv_cpp_partial_specialization=no)])
3734 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3735   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3738 dnl Some compilers have limited support for operators with templates;
3739 dnl specifically, it is necessary to define derived operators when a base
3740 dnl class's operator declaration should suffice.
3741 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3742                ac_cv_need_derived_template_operators,
3743                [AC_TRY_COMPILE([template <class T> class Base { };
3744                                 template <class T>
3745                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3746                                 template <class T> class Derived : public Base<T> { };],
3747                                [Derived<char> a, b;
3748                                 Base<char> c = a + b;
3749                                 return 0;],
3750                                ac_cv_need_derived_template_operators=no,
3751                                ac_cv_need_derived_template_operators=yes)])
3752 if test "$ac_cv_need_derived_template_operators" = yes ; then
3753   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3757 dnl Some compilers have trouble detecting that a template class
3758 dnl that derives from another template is actually an instance
3759 dnl of the base class. This test checks for that.
3760 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3761                ac_cv_need_cpp_template_cast_to_base,
3762                [AC_TRY_COMPILE([template <class T> class Base { };
3763                                 template <class T> class Derived : public Base<T> { };
3764                                 template <class T> int foo(const Base<T>&) { return 0; }],
3765                                [Derived<char> bar; return foo(bar);],
3766                                ac_cv_need_cpp_template_cast_to_base=no,
3767                                ac_cv_need_cpp_template_cast_to_base=yes)])
3768 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3769   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3772 dnl Some compilers have trouble resolving the ambiguity between two
3773 dnl functions whose arguments differ only by cv-qualifications.
3774 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3775                ac_cv_can_resolve_const_ambiguity,
3776                [AC_TRY_COMPILE([
3777                                 template <class T> class ptrClass {
3778                                   public: T* ptr;
3779                                 };
3781                                 template <class T> T* a(ptrClass<T> *arg) {
3782                                   return arg->ptr;
3783                                 }
3785                                 template <class T>
3786                                 const T* a(const ptrClass<T> *arg) {
3787                                   return arg->ptr;
3788                                 }
3789                                ],
3790                                [ ptrClass<int> i;
3791                                  a(&i); ],
3792                                ac_cv_can_resolve_const_ambiguity=yes,
3793                                ac_cv_can_resolve_const_ambiguity=no)])
3794 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3795   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3799 dnl We don't do exceptions on unix.  The only reason this used to be here
3800 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3801 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3802 dnl So im commenting this out until someone writes some artificial 
3803 dnl intelligence to detect not only if the compiler has exceptions, but if 
3804 dnl they are enabled as well.
3805 dnl 
3806 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3807 dnl                ac_cv_cpp_exceptions,
3808 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3809 dnl                                static void F() { throw X(); },
3810 dnl                                try { F(); } catch(X & e) { },
3811 dnl                                ac_cv_cpp_exceptions=yes,
3812 dnl                                ac_cv_cpp_exceptions=no)])
3813 dnl if test $ac_cv_cpp_exceptions = yes ; then
3814 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3815 dnl fi
3817 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3818 dnl supports it well enough to allow us to use it to change access, but not
3819 dnl to resolve ambiguity. The next two tests determine how well the |using|
3820 dnl keyword is supported.
3822 dnl Check to see if we can change access with |using|.  Test both a
3823 dnl legal and an illegal example.
3824 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3825                ac_cv_cpp_access_changing_using2,
3826                [AC_TRY_COMPILE(
3827                    class A { protected: int foo() { return 0; } };
3828                    class B : public A { public: using A::foo; };,
3829                    B b; return b.foo();,
3830                    [AC_TRY_COMPILE(
3831                        class A { public: int foo() { return 1; } };
3832                        class B : public A { private: using A::foo; };,
3833                        B b; return b.foo();,
3834                        ac_cv_cpp_access_changing_using2=no,
3835                        ac_cv_cpp_access_changing_using2=yes)],
3836                    ac_cv_cpp_access_changing_using2=no)])
3837 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3838    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3841 dnl Check to see if we can resolve ambiguity with |using|.
3842 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3843                ac_cv_cpp_ambiguity_resolving_using,
3844                [AC_TRY_COMPILE(class X { 
3845                                  public: int go(const X&) {return 3;}
3846                                          int jo(const X&) {return 3;}
3847                                };
3848                                class Y : public X {
3849                                  public:  int go(int) {return 2;}
3850                                           int jo(int) {return 2;}
3851                                           using X::jo;
3852                                  private: using X::go;
3853                                };,
3854                                X x; Y y; y.jo(x);,
3855                                ac_cv_cpp_ambiguity_resolving_using=yes,
3856                                ac_cv_cpp_ambiguity_resolving_using=no)])
3857 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3858    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3861 dnl Check to see if the |std| namespace is supported. If so, we'll want
3862 dnl to qualify any standard library calls with "std::" to ensure that
3863 dnl those functions can be resolved.
3864 AC_CACHE_CHECK(for \"std::\" namespace,
3865                ac_cv_cpp_namespace_std,
3866                [AC_TRY_COMPILE([#include <algorithm>],
3867                                [return std::min(0, 1);],
3868                                ac_cv_cpp_namespace_std=yes,
3869                                ac_cv_cpp_namespace_std=no)])
3870 if test "$ac_cv_cpp_namespace_std" = yes ; then
3871    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3874 dnl Older compilers are overly ambitious with respect to using the standard
3875 dnl template library's |operator!=()| when |operator==()| is defined. In
3876 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3877 dnl ambiguity at compile-time. This test checks for that case.
3878 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3879                ac_cv_cpp_unambiguous_std_notequal,
3880                [AC_TRY_COMPILE([#include <algorithm>
3881                                 struct T1 {};
3882                                 int operator==(const T1&, const T1&) { return 0; }
3883                                 int operator!=(const T1&, const T1&) { return 0; }],
3884                                [T1 a,b; return a != b;],
3885                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3886                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3887 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3888   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3892 AC_CACHE_CHECK(for C++ reinterpret_cast,
3893                ac_cv_cpp_reinterpret_cast,
3894                [AC_TRY_COMPILE(struct X { int i; };
3895                                struct Y { int i; };,
3896                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3897                                ac_cv_cpp_reinterpret_cast=yes,
3898                                ac_cv_cpp_reinterpret_cast=no)])
3899 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3900    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3903 dnl See if a dynamic_cast to void* gives the most derived object.
3904 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3905                ac_cv_cpp_dynamic_cast_void_ptr,
3906                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3907                             class Y { int j; public: virtual ~Y() { } };
3908                             class Z : public X, public Y { int k; };
3910                             int main() {
3911                                  Z mdo;
3912                                  X *subx = (X*)&mdo;
3913                                  Y *suby = (Y*)&mdo;
3914                                  return !((((void*)&mdo != (void*)subx) &&
3915                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3916                                           (((void*)&mdo != (void*)suby) &&
3917                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3918                             }],
3919                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3920                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3921                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3922 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3923    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3927 dnl note that this one is reversed - if the test fails, then
3928 dnl we require implementations of unused virtual methods. Which
3929 dnl really blows because it means we'll have useless vtable
3930 dnl bloat.
3931 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3932                ac_cv_cpp_unused_required,
3933                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3934                                X x;,
3935                                ac_cv_cpp_unused_required=no,
3936                                ac_cv_cpp_unused_required=yes)])
3937 if test "$ac_cv_cpp_unused_required" = yes ; then
3938    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3942 dnl Some compilers have trouble comparing a constant reference to a templatized
3943 dnl class to zero, and require an explicit operator==() to be defined that takes
3944 dnl an int. This test separates the strong from the weak.
3946 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3947                ac_cv_trouble_comparing_to_zero,
3948                [AC_TRY_COMPILE([#include <algorithm>
3949                                 template <class T> class Foo {};
3950                                 class T2;
3951                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3952                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3953                                [Foo<int> f; return (0 != f);],
3954                                ac_cv_trouble_comparing_to_zero=no,
3955                                ac_cv_trouble_comparing_to_zero=yes)])
3956 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3957   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3962 dnl End of C++ language/feature checks
3963 AC_LANG_C
3965 dnl ========================================================
3966 dnl =  Internationalization checks
3967 dnl ========================================================
3969 dnl Internationalization and Locale support is different
3970 dnl on various UNIX platforms.  Checks for specific i18n
3971 dnl features go here.
3973 dnl check for LC_MESSAGES
3974 AC_CACHE_CHECK(for LC_MESSAGES,
3975                 ac_cv_i18n_lc_messages,
3976                 [AC_TRY_COMPILE([#include <locale.h>],
3977                                 [int category = LC_MESSAGES;],
3978                                 ac_cv_i18n_lc_messages=yes,
3979                                 ac_cv_i18n_lc_messages=no)])
3980 if test "$ac_cv_i18n_lc_messages" = yes; then
3981    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3982 fi      
3984 fi # SKIP_COMPILER_CHECKS
3986 TARGET_XPCOM_ABI=
3987 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3988     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3991 dnl Mozilla specific options
3992 dnl ========================================================
3993 dnl The macros used for command line options
3994 dnl are defined in build/autoconf/altoptions.m4.
3997 dnl ========================================================
3998 dnl =
3999 dnl = Check for external package dependencies
4000 dnl =
4001 dnl ========================================================
4002 MOZ_ARG_HEADER(External Packages)
4004 MOZ_ENABLE_LIBXUL=
4006 MOZ_ARG_WITH_STRING(libxul-sdk,
4007 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4008   LIBXUL_SDK_DIR=$withval)
4010 if test "$LIBXUL_SDK_DIR" = "yes"; then
4011     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4012 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4013     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4015     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
4016         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
4017     fi
4019     MOZ_ENABLE_LIBXUL=1
4021 AC_SUBST(LIBXUL_SDK)
4023 if test -n "$LIBXUL_SDK"; then
4024     LIBXUL_DIST="$LIBXUL_SDK"
4025 else
4026     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4028 AC_SUBST(LIBXUL_DIST)
4030 dnl ========================================================
4031 dnl = If NSPR was not detected in the system, 
4032 dnl = use the one in the source tree (mozilla/nsprpub)
4033 dnl ========================================================
4034 MOZ_ARG_WITH_BOOL(system-nspr,
4035 [  --with-system-nspr      Use system installed NSPR],
4036     _USE_SYSTEM_NSPR=1 )
4038 if test -n "$_USE_SYSTEM_NSPR"; then
4039     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4042 if test -n "$MOZ_NATIVE_NSPR"; then
4043     _SAVE_CFLAGS=$CFLAGS
4044     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4045     AC_TRY_COMPILE([#include "prlog.h"],
4046                 [#ifndef PR_STATIC_ASSERT
4047                  #error PR_STATIC_ASSERT not defined
4048                  #endif],
4049                 [MOZ_NATIVE_NSPR=1],
4050                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4051     CFLAGS=$_SAVE_CFLAGS
4052 else
4053     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4054     if test "$OS_ARCH" = "WINCE"; then
4055         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4056         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4057     elif test "$OS_ARCH" = "WINNT"; then
4058         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4059         if test -n "$GNU_CC"; then
4060             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4061         else
4062             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4063         fi
4064     else
4065         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4066     fi
4069 dnl ========================================================
4070 dnl = If NSS was not detected in the system, 
4071 dnl = use the one in the source tree (mozilla/security/nss)
4072 dnl ========================================================
4074 MOZ_ARG_WITH_BOOL(system-nss,
4075 [  --with-system-nss      Use system installed NSS],
4076     _USE_SYSTEM_NSS=1 )
4078 if test -n "$_USE_SYSTEM_NSS"; then
4079     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4082 if test -n "$MOZ_NATIVE_NSS"; then
4083    NSS_LIBS="$NSS_LIBS -lcrmf"
4084 else
4085    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4086    NSS_DEP_LIBS="\
4087         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4088         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4089         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4090         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4091         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4092         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4094    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4095        NSS_LIBS="\
4096         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4097         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4098         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4099         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4100         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4101         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4102    else
4103        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4104    fi
4107 if test -z "$SKIP_LIBRARY_CHECKS"; then
4108 dnl system JPEG support
4109 dnl ========================================================
4110 MOZ_ARG_WITH_STRING(system-jpeg,
4111 [  --with-system-jpeg[=PFX]
4112                           Use system libjpeg [installed at prefix PFX]],
4113     JPEG_DIR=$withval)
4115 _SAVE_CFLAGS=$CFLAGS
4116 _SAVE_LDFLAGS=$LDFLAGS
4117 _SAVE_LIBS=$LIBS
4118 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4119     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4120     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4122 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4123     SYSTEM_JPEG=
4124 else
4125     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4128 if test "$SYSTEM_JPEG" = 1; then
4129     LIBS="$JPEG_LIBS $LIBS"
4130     AC_TRY_COMPILE([ #include <stdio.h>
4131                      #include <sys/types.h>
4132                      #include <jpeglib.h> ],
4133                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4134                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4135                      #endif ],
4136                    SYSTEM_JPEG=1,
4137                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4138 fi 
4139 CFLAGS=$_SAVE_CFLAGS
4140 LDFLAGS=$_SAVE_LDFLAGS
4141 LIBS=$_SAVE_LIBS
4143 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4144     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4145     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4148 dnl system ZLIB support
4149 dnl ========================================================
4150 MOZ_ARG_WITH_STRING(system-zlib,
4151 [  --with-system-zlib[=PFX]
4152                           Use system libz [installed at prefix PFX]],
4153     ZLIB_DIR=$withval)
4155 _SAVE_CFLAGS=$CFLAGS
4156 _SAVE_LDFLAGS=$LDFLAGS
4157 _SAVE_LIBS=$LIBS
4158 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4159     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4160     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4162 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4163     SYSTEM_ZLIB=
4164 else
4165     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4166         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4168 if test "$SYSTEM_ZLIB" = 1; then
4169     LIBS="$ZLIB_LIBS $LIBS"
4170     AC_TRY_COMPILE([ #include <stdio.h>
4171                      #include <string.h>
4172                      #include <zlib.h> ],
4173                    [ #if ZLIB_VERNUM < $MOZZLIB 
4174                      #error "Insufficient zlib version ($MOZZLIB required)."
4175                      #endif ],
4176                    SYSTEM_ZLIB=1,
4177                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4179 CFLAGS=$_SAVE_CFLAGS
4180 LDFLAGS=$_SAVE_LDFLAGS
4181 LIBS=$_SAVE_LIBS
4183 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4184     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4185     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4188 dnl system BZIP2 Support
4189 dnl ========================================================
4190 MOZ_ARG_WITH_STRING(system-bz2,
4191 [  --with-system-bz2[=PFX]
4192                           Use system libbz2 [installed at prefix PFX]],
4193     BZ2_DIR=$withval)
4195 _SAVE_CFLAGS=$CFLAGS
4196 _SAVE_LDFLAGS=$LDFLAGS
4197 _SAVE_LIBS=$LIBS
4198 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4199     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4200     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4202 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4203     SYSTEM_BZ2=
4204 else
4205     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4206         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4208 CFLAGS=$_SAVE_CFLAGS
4209 LDFLAGS=$_SAVE_LDFLAGS
4210 LIBS=$_SAVE_LIBS
4212 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4213     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4214     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4217 dnl system PNG Support
4218 dnl ========================================================
4219 MOZ_ARG_WITH_STRING(system-png, 
4220 [  --with-system-png[=PFX]
4221                           Use system libpng [installed at prefix PFX]],
4222     PNG_DIR=$withval)
4224 _SAVE_CFLAGS=$CFLAGS
4225 _SAVE_LDFLAGS=$LDFLAGS
4226 _SAVE_LIBS=$LIBS
4227 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4228 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4229 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4230     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4231     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4233 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4234     SYSTEM_PNG=
4235 else
4236     _SAVE_PNG_LIBS=$PNG_LIBS
4237     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4238                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4239                  $PNG_LIBS)
4240     AC_CHECK_LIB(png, png_get_acTL, ,
4241                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4242                  $_SAVE_PNG_LIBS)
4244 if test "$SYSTEM_PNG" = 1; then
4245     LIBS="$PNG_LIBS $LIBS"
4246     AC_TRY_COMPILE([ #include <stdio.h>
4247                      #include <sys/types.h>
4248                      #include <png.h> ],
4249                    [ #if PNG_LIBPNG_VER < $MOZPNG
4250                      #error "Insufficient libpng version ($MOZPNG required)."
4251                      #endif
4252                      #ifndef PNG_UINT_31_MAX
4253                      #error "Insufficient libpng version."
4254                      #endif ],
4255                    SYSTEM_PNG=1,
4256                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4258 CFLAGS=$_SAVE_CFLAGS
4259 LDFLAGS=$_SAVE_LDFLAGS
4260 LIBS=$_SAVE_LIBS
4262 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4263     PNG_CFLAGS="-I${PNG_DIR}/include"
4264     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4267 fi # SKIP_LIBRARY_CHECKS
4269 dnl system HunSpell Support
4270 dnl ========================================================
4271 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4272 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4273     SYSTEM_HUNSPELL=1 )
4275 if test -n "$SYSTEM_HUNSPELL"; then
4276     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4279 AC_SUBST(SYSTEM_HUNSPELL)
4281 dnl ========================================================
4282 dnl Java SDK support
4283 dnl ========================================================
4284 JAVA_INCLUDE_PATH=
4285 MOZ_ARG_WITH_STRING(java-include-path,
4286 [  --with-java-include-path=dir   Location of Java SDK headers],
4287     JAVA_INCLUDE_PATH=$withval)
4289 JAVA_BIN_PATH=
4290 MOZ_ARG_WITH_STRING(java-bin-path,
4291 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4292     JAVA_BIN_PATH=$withval)
4294 dnl ========================================================
4295 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4296 dnl their usage and use them in spidermonkey.
4297 dnl ========================================================
4298 MOZ_ARG_WITH_BOOL(arm-kuser,
4299 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4300     USE_ARM_KUSER=1,
4301     USE_ARM_KUSER=)
4302 if test -n "$USE_ARM_KUSER"; then
4303    AC_DEFINE(USE_ARM_KUSER)
4306 dnl ========================================================
4307 dnl =
4308 dnl = Application
4309 dnl =
4310 dnl ========================================================
4312 MOZ_ARG_HEADER(Application)
4314 BUILD_STATIC_LIBS=
4315 ENABLE_TESTS=1
4316 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4317 MOZ_BRANDING_DIRECTORY=
4318 MOZ_DBGRINFO_MODULES=
4319 MOZ_ENABLE_CANVAS=1
4320 MOZ_FEEDS=1
4321 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4322 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4323 MOZ_JAVAXPCOM=
4324 MOZ_JSDEBUGGER=1
4325 MOZ_JSLOADER=1
4326 MOZ_LIBART_CFLAGS=
4327 MOZ_LIBART_LIBS=
4328 MOZ_MATHML=1
4329 MOZ_MORK=1
4330 MOZ_MORKREADER=
4331 MOZ_AUTH_EXTENSION=1
4332 MOZ_NO_ACTIVEX_SUPPORT=1
4333 MOZ_NO_INSPECTOR_APIS=
4334 MOZ_NO_XPCOM_OBSOLETE=
4335 MOZ_NO_FAST_LOAD=
4336 MOZ_OGG=1
4337 MOZ_SYDNEYAUDIO=
4338 MOZ_WAVE=1
4339 MOZ_MEDIA=
4340 MOZ_OJI=1
4341 MOZ_PERMISSIONS=1
4342 MOZ_PLACES=
4343 MOZ_PLAINTEXT_EDITOR_ONLY=
4344 MOZ_PLUGINS=1
4345 MOZ_PREF_EXTENSIONS=1
4346 MOZ_PROFILELOCKING=1
4347 MOZ_PSM=1
4348 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4349 MOZ_PYTHON=
4350 MOZ_PYTHON_DEBUG_SUFFIX=
4351 MOZ_PYTHON_DLL_SUFFIX=
4352 MOZ_PYTHON_INCLUDES=
4353 MOZ_PYTHON_LIBS=
4354 MOZ_PYTHON_PREFIX=
4355 MOZ_PYTHON_VER=
4356 MOZ_PYTHON_VER_DOTTED=
4357 MOZ_RDF=1
4358 MOZ_REFLOW_PERF=
4359 MOZ_SAFE_BROWSING=
4360 MOZ_HELP_VIEWER=
4361 MOZ_SPELLCHECK=1
4362 MOZ_STATIC_MAIL_BUILD=
4363 MOZ_STORAGE=1
4364 MOZ_SVG=1
4365 MOZ_TIMELINE=
4366 MOZ_UI_LOCALE=en-US
4367 MOZ_UNIVERSALCHARDET=1
4368 MOZ_URL_CLASSIFIER=
4369 MOZ_USE_NATIVE_UCONV=
4370 MOZ_VIEW_SOURCE=1
4371 MOZ_XPFE_COMPONENTS=1
4372 MOZ_XPINSTALL=1
4373 MOZ_XSLT_STANDALONE=
4374 MOZ_XTF=1
4375 MOZ_XUL=1
4376 MOZ_XUL_APP=1
4377 MOZ_ZIPWRITER=1
4378 NS_PRINTING=1
4379 NECKO_COOKIES=1
4380 NECKO_DISK_CACHE=1
4381 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4382 NECKO_SMALL_BUFFERS=
4383 JS_STATIC_BUILD=
4384 XPC_IDISPATCH_SUPPORT=
4387 case "$target_os" in
4388 darwin*)
4389     ACCESSIBILITY=
4390     ;;
4392     ACCESSIBILITY=1
4393     ;;
4394 esac
4396 case "$target_os" in
4397     msvc*|mks*|cygwin*|mingw*)
4398         if test -z "$GNU_CC"; then 
4399             XPC_IDISPATCH_SUPPORT=1
4400             MOZ_NO_ACTIVEX_SUPPORT=
4401             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4402         fi
4403         ;;
4404 esac
4406 MOZ_ARG_ENABLE_STRING(application,
4407 [  --enable-application=APP
4408                           Options include:
4409                             browser (Firefox)
4410                             xulrunner
4411                             content/xslt (Standalone Transformiix XSLT)
4412                             netwerk (Standalone Necko)
4413                             tools/update-packaging (AUS-related packaging tools)
4414                             standalone (use this for standalone
4415                               xpcom/xpconnect or to manually drive a build)],
4416 [ MOZ_BUILD_APP=$enableval ] )
4418 MOZ_EMBEDDING_PROFILE=default
4419 MOZ_ARG_WITH_STRING(embedding-profile,
4420 [  --with-embedding-profile=default|basic|minimal
4421                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4422 [ MOZ_EMBEDDING_PROFILE=$withval ])
4424 case "$MOZ_EMBEDDING_PROFILE" in
4425 default)
4426   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4427   MOZ_EMBEDDING_LEVEL_BASIC=1
4428   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4429   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4430   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4431   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4432   ;;
4434 basic)
4435   MOZ_EMBEDDING_LEVEL_DEFAULT=
4436   MOZ_EMBEDDING_LEVEL_BASIC=1
4437   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4438   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4439   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4440   ENABLE_TESTS=
4441   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4442   MOZ_ENABLE_CANVAS=
4443   MOZ_ENABLE_POSTSCRIPT=
4444   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4445   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4446   MOZ_IMG_ENCODERS_DEFAULT=
4447   MOZ_IMG_ENCODERS=
4448   MOZ_INSTALLER=
4449   MOZ_JSDEBUGGER=
4450   MOZ_MATHML=
4451   MOZ_AUTH_EXTENSION=
4452   MOZ_NO_ACTIVEX_SUPPORT=1
4453   MOZ_NO_INSPECTOR_APIS=1
4454   MOZ_NO_XPCOM_OBSOLETE=1
4455   MOZ_NO_FAST_LOAD=1
4456   MOZ_OJI=
4457   MOZ_PLAINTEXT_EDITOR_ONLY=1
4458 #  MOZ_PLUGINS=
4459   MOZ_PREF_EXTENSIONS=
4460   MOZ_PROFILELOCKING=
4461   MOZ_SPELLCHECK=
4462   MOZ_SVG=
4463   MOZ_UNIVERSALCHARDET=
4464   MOZ_UPDATER=
4465   MOZ_USE_NATIVE_UCONV=
4466   MOZ_VIEW_SOURCE=
4467   MOZ_XPFE_COMPONENTS=
4468   MOZ_XPINSTALL=
4469   MOZ_XTF=
4470   MOZ_ZIPWRITER=
4471   NECKO_DISK_CACHE=
4472   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4473   NECKO_SMALL_BUFFERS=1
4474   NS_DISABLE_LOGGING=1
4475   NS_PRINTING=
4476   JS_STATIC_BUILD=1
4477   ;;
4479 minimal)
4480   MOZ_EMBEDDING_LEVEL_DEFAULT=
4481   MOZ_EMBEDDING_LEVEL_BASIC=
4482   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4483   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4484   ENABLE_TESTS=
4485   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4486   MOZ_ENABLE_CANVAS=
4487   MOZ_ENABLE_POSTSCRIPT=
4488   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4489   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4490   MOZ_IMG_ENCODERS_DEFAULT=
4491   MOZ_IMG_ENCODERS=
4492   MOZ_INSTALLER=
4493   MOZ_JSDEBUGGER=
4494   MOZ_MATHML=
4495   MOZ_AUTH_EXTENSION=
4496   MOZ_NO_ACTIVEX_SUPPORT=1
4497   MOZ_NO_INSPECTOR_APIS=1
4498   MOZ_NO_XPCOM_OBSOLETE=1
4499   MOZ_NO_FAST_LOAD=1
4500   MOZ_OJI=
4501   MOZ_PLAINTEXT_EDITOR_ONLY=1
4502   MOZ_PLUGINS=
4503   MOZ_PREF_EXTENSIONS=
4504   MOZ_PROFILELOCKING=
4505   MOZ_SPELLCHECK=
4506   MOZ_STORAGE=1
4507   MOZ_PLACES=
4508   MOZ_SVG=
4509   MOZ_UNIVERSALCHARDET=
4510   MOZ_UPDATER=
4511   MOZ_USE_NATIVE_UCONV=1
4512   MOZ_VIEW_SOURCE=
4513   MOZ_XPFE_COMPONENTS=
4514   MOZ_XPINSTALL=
4515   MOZ_XTF=
4516   MOZ_XUL=
4517   MOZ_ZIPWRITER=
4518   MOZ_RDF=
4519   NECKO_DISK_CACHE=
4520   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4521   NECKO_SMALL_BUFFERS=1
4522   NS_DISABLE_LOGGING=1
4523   NS_PRINTING=
4524   JS_STATIC_BUILD=1
4525   ;;
4528   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4529   ;;
4530 esac
4532 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4533 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4534 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4536 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4537 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4538   XULRUNNER_STUB_NAME=$withval)
4540 if test -z "$XULRUNNER_STUB_NAME"; then
4541   case "$target_os" in
4542   darwin*)
4543     XULRUNNER_STUB_NAME=xulrunner
4544     ;;
4545   *)
4546     XULRUNNER_STUB_NAME=xulrunner-stub
4547   esac
4549 AC_SUBST(XULRUNNER_STUB_NAME)
4551 if test -z "$MOZ_BUILD_APP"; then
4552   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4553 else
4554   # We have a valid application only if it has a build.mk file in its top
4555   # directory.
4556   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4557     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4558   fi
4561 # Allow the application to influence configure with a confvars.sh script.
4563 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4564 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4565   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4566   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4567 else
4568   AC_MSG_RESULT([no])
4571 # Now is a good time to test for logic errors, define mismatches, etc.
4572 case "$MOZ_BUILD_APP" in
4573 xulrunner)
4574   if test "$LIBXUL_SDK"; then
4575     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4576   fi
4577   ;;
4579   # Fix this case for folks who forget. Warn them.
4580   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4581     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4582     MOZ_XUL_APP=1
4583   fi
4584   ;;
4585 esac
4587 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4588 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4589 # MOZ_BUILD_APP.
4590 case "$MOZ_BUILD_APP" in
4591 browser)
4592   AC_DEFINE(MOZ_PHOENIX)
4593   ;;
4595 xulrunner)
4596   AC_DEFINE(MOZ_XULRUNNER)
4597   ;;
4599 content/xslt)
4600   AC_DEFINE(TX_EXE)
4601   ;;
4603 standalone) 
4604   MOZ_APP_NAME=mozilla
4605   MOZ_APP_DISPLAYNAME=Mozilla
4606   MOZ_APP_VERSION=$MOZILLA_VERSION
4607   ;;
4609 esac
4611 if test -z "$MOZ_XUL_APP"; then
4612         AC_MSG_ERROR([builds with unsetting MOZ_XUL_APP in confvars.sh are not supported.])
4615 AC_SUBST(MOZ_BUILD_APP)
4616 AC_SUBST(MOZ_XUL_APP)
4617 AC_SUBST(MOZ_PHOENIX)
4618 AC_SUBST(MOZ_XULRUNNER)
4620 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4622 if test "$MOZ_XUL_APP"; then
4623   AC_DEFINE(MOZ_XUL_APP)
4626 dnl ========================================================
4627 dnl = 
4628 dnl = Toolkit Options
4629 dnl = 
4630 dnl ========================================================
4631 MOZ_ARG_HEADER(Toolkit Options)
4633     dnl ========================================================
4634     dnl = Select the default toolkit
4635     dnl ========================================================
4636         MOZ_ARG_ENABLE_STRING(default-toolkit,
4637         [  --enable-default-toolkit=TK
4638                           Select default toolkit
4639                           Platform specific defaults:
4640                             BeOS - cairo-beos
4641                             Mac OS X - cairo-cocoa
4642                             Neutrino/QNX - photon
4643                             OS/2 - cairo-os2
4644                             Win32 - cairo-windows
4645                             WinCE - windows
4646                             Gtk2 with DirectFB - cairo-gtk2-dfb
4647                             * - cairo-gtk2
4648                             * - cairo-qt],
4649     [ _DEFAULT_TOOLKIT=$enableval ],
4650     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4652     if test "$_DEFAULT_TOOLKIT" = "photon" \
4653         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4654         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4655         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4656         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4657         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4658         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4659         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4660         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4661     then
4662         dnl nglayout only supports building with one toolkit,
4663         dnl so ignore everything after the first comma (",").
4664         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4665     else
4666         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4667     fi
4669 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4671 dnl ========================================================
4672 dnl = Enable the toolkit as needed                         =
4673 dnl ========================================================
4675 case "$MOZ_WIDGET_TOOLKIT" in
4676 photon)
4677         MOZ_ENABLE_PHOTON=1
4678         AC_DEFINE(MOZ_WIDGET_PHOTON)
4679     ;;
4681 cairo-windows)
4682     MOZ_WIDGET_TOOLKIT=windows
4683     MOZ_GFX_TOOLKIT=cairo
4684     ;;
4686 cairo-gtk2|cairo-gtk2-x11)
4687     MOZ_WIDGET_TOOLKIT=gtk2
4688     MOZ_GFX_TOOLKIT=cairo
4689     MOZ_ENABLE_GTK2=1
4690     MOZ_ENABLE_XREMOTE=1
4692     AC_DEFINE(MOZ_X11)
4693     MOZ_X11=1
4695     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4696     TK_LIBS='$(MOZ_GTK2_LIBS)'
4697     AC_DEFINE(MOZ_WIDGET_GTK2)
4698     ;;
4700 cairo-gtk2-dfb)
4701     MOZ_WIDGET_TOOLKIT=gtk2
4702     MOZ_GFX_TOOLKIT=cairo
4703     MOZ_ENABLE_GTK2=1
4705     AC_DEFINE(MOZ_DFB)
4706     MOZ_DFB=1
4708     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4709     TK_LIBS='$(MOZ_GTK2_LIBS)'
4710     AC_DEFINE(MOZ_WIDGET_GTK2)
4711     if test "$no_x" != "yes"; then
4712         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4713         no_x=yes
4714     fi
4715     ;;
4717 cairo-qt)
4718     MOZ_WIDGET_TOOLKIT=qt
4719     MOZ_GFX_TOOLKIT=cairo
4720     MOZ_ENABLE_QT=1
4721     MOZ_ENABLE_XREMOTE=1
4722     USE_ELF_DYNSTR_GC=
4723     NS_PRINTING=
4725     AC_DEFINE(MOZ_X11)
4726     MOZ_X11=1
4728     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4729     TK_LIBS='$(MOZ_QT_LIBS)'
4730     AC_DEFINE(MOZ_WIDGET_QT)
4731     ;;
4733 cairo-beos)
4734     MOZ_WIDGET_TOOLKIT=beos
4735     MOZ_GFX_TOOLKIT=cairo
4736     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4737     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4738     ;;
4740 cairo-os2)
4741     MOZ_WIDGET_TOOLKIT=os2
4742     MOZ_GFX_TOOLKIT=cairo
4743     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4744     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4745     ;;
4747 cairo-cocoa)
4748     MOZ_WIDGET_TOOLKIT=cocoa
4749     AC_DEFINE(MOZ_WIDGET_COCOA)
4750     MOZ_ENABLE_COCOA=1
4751     MOZ_GFX_TOOLKIT=cairo
4752     MOZ_USER_DIR="Mozilla"
4753     AC_DEFINE(XP_MACOSX)
4754     AC_DEFINE(TARGET_CARBON)
4755     AC_DEFINE(TARGET_API_MAC_CARBON)
4756     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4757     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4758     CFLAGS="$CFLAGS $TK_CFLAGS"
4759     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4760     ;;
4761 esac
4763 if test "$MOZ_ENABLE_XREMOTE"; then
4764     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4767 if test "$COMPILE_ENVIRONMENT"; then
4768   if test "$MOZ_ENABLE_GTK2"; then
4769     if test "$MOZ_X11"; then
4770       GDK_PACKAGES=gdk-x11-2.0
4771     elif test "$MOZ_DFB"; then
4772       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4773       GDK_PACKAGES=directfb
4774     fi
4776     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4777   fi
4779 fi # COMPILE_ENVIRONMENT
4781 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4783 dnl ========================================================
4784 dnl = startup-notification support module
4785 dnl ========================================================
4787 if test "$MOZ_ENABLE_GTK2"
4788 then
4789     MOZ_ENABLE_STARTUP_NOTIFICATION=
4791     MOZ_ARG_ENABLE_BOOL(startup-notification,
4792     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4793         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4794         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4795     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4796     then
4797         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4798                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4799         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4800             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4801             then
4802                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4803             fi
4804             MOZ_ENABLE_STARTUP_NOTIFICATION=
4805         ])
4806     fi
4808     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4809         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4810     fi
4812     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4814 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4815 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4816 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4818 dnl ========================================================
4819 dnl = QT support
4820 dnl ========================================================
4821 if test "$MOZ_ENABLE_QT"
4822 then
4823     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4824     AC_SUBST(MOZ_QT_CFLAGS)
4825     AC_SUBST(MOZ_QT_LIBS)
4827     MOZ_ARG_WITH_STRING(qtdir,
4828     [  --with-qtdir=\$dir       Specify Qt directory ],
4829     [ QTDIR=$withval])
4831     if test -z "$QTDIR"; then
4832       QTDIR="/usr"
4833     fi
4834     QTINCDIR="/include/qt"
4835     if test ! -d "$QTDIR$QTINCDIR"; then
4836        QTINCDIR="/include/X11/qt"
4837     fi
4838     if test ! -d "$QTDIR$QTINCDIR"; then
4839        QTINCDIR="/include"
4840     fi
4842     if test -x "$QTDIR/bin/moc-qt4"; then
4843       HOST_MOC="$QTDIR/bin/moc-qt4"
4844     else
4845       if test -x "$QTDIR/bin/moc"; then
4846         HOST_MOC="$QTDIR/bin/moc"
4847       else
4848         AC_CHECK_PROGS(HOST_MOC, moc, "")
4849       fi
4850     fi
4851     if test -z "$HOST_MOC"; then
4852       AC_MSG_ERROR([no acceptable moc preprocessor found])
4853     fi
4854     MOC=$HOST_MOC
4857 AC_SUBST(GTK_CONFIG)
4858 AC_SUBST(TK_CFLAGS)
4859 AC_SUBST(TK_LIBS)
4861 AC_SUBST(MOZ_ENABLE_GTK2)
4862 AC_SUBST(MOZ_ENABLE_PHOTON)
4863 AC_SUBST(MOZ_ENABLE_COCOA)
4864 AC_SUBST(MOZ_ENABLE_QT)
4865 AC_SUBST(MOZ_ENABLE_XREMOTE)
4866 AC_SUBST(MOZ_GTK2_CFLAGS)
4867 AC_SUBST(MOZ_GTK2_LIBS)
4868 AC_SUBST(MOZ_QT_CFLAGS)
4869 AC_SUBST(MOZ_QT_LIBS)
4871 AC_SUBST(MOC)
4873 AC_SUBST(MOZ_DFB)
4874 AC_SUBST(MOZ_X11)
4876 dnl ========================================================
4877 dnl =
4878 dnl = Components & Features
4879 dnl = 
4880 dnl ========================================================
4881 MOZ_ARG_HEADER(Components and Features)
4883 dnl ========================================================
4884 dnl = Localization
4885 dnl ========================================================
4886 MOZ_ARG_ENABLE_STRING(ui-locale,
4887 [  --enable-ui-locale=ab-CD
4888                           Select the user interface locale (default: en-US)],
4889     MOZ_UI_LOCALE=$enableval )
4890 AC_SUBST(MOZ_UI_LOCALE)
4892 dnl ========================================================
4893 dnl = Trademarked Branding 
4894 dnl ========================================================
4895 MOZ_ARG_ENABLE_BOOL(official-branding,
4896 [  --enable-official-branding Enable Official mozilla.org Branding
4897                           Do not distribute builds with
4898                           --enable-official-branding unless you have
4899                           permission to use trademarks per
4900                           http://www.mozilla.org/foundation/trademarks/ .],
4901 [case "$MOZ_BUILD_APP" in
4902 browser)
4903     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4904     MOZ_APP_DISPLAYNAME=Firefox
4905     ;;
4908     AC_MSG_ERROR([Official branding is only available for Firefox.])
4909 esac
4912 MOZ_ARG_WITH_STRING(branding,
4913 [  --with-branding=dir    Use branding from the specified directory.],
4914     MOZ_BRANDING_DIRECTORY=$withval)
4916 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4917 if test -z "$REAL_BRANDING_DIRECTORY"; then
4918   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4921 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4922   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4925 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4927 dnl ========================================================
4928 dnl = Distribution ID
4929 dnl ========================================================
4930 MOZ_ARG_WITH_STRING(distribution-id,
4931 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4932 [ val=`echo $withval`
4933     MOZ_DISTRIBUTION_ID="$val"])
4935 if test -z "$MOZ_DISTRIBUTION_ID"; then
4936    MOZ_DISTRIBUTION_ID="org.mozilla"
4939 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4940 AC_SUBST(MOZ_DISTRIBUTION_ID)
4943 dnl ========================================================
4944 dnl complex text support off by default
4945 dnl ========================================================
4946 MOZ_PANGO=1
4947 MOZ_ARG_DISABLE_BOOL(pango,
4948 [  --disable-pango Disable usage of Pango ],
4949     MOZ_PANGO=,
4950     MOZ_PANGO=1)
4953 dnl ========================================================
4954 dnl = Pango
4955 dnl ========================================================
4956 if test "$MOZ_ENABLE_GTK2"
4957 then
4958     AC_SUBST(MOZ_PANGO)
4960     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4962     if test "$MOZ_PANGO"
4963     then
4964         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4965         AC_SUBST(MOZ_PANGO_CFLAGS)
4966         AC_SUBST(MOZ_PANGO_LIBS)
4967         AC_DEFINE(MOZ_PANGO)
4968     else
4969         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4970         AC_SUBST(MOZ_PANGO_CFLAGS)
4971         AC_SUBST(MOZ_PANGO_LIBS)
4973         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
4974         AC_SUBST(FT2_CFLAGS)
4975         AC_SUBST(FT2_LIBS)
4976     fi
4979 dnl ========================================================
4980 dnl = PostScript print module
4981 dnl ========================================================
4982 MOZ_ARG_DISABLE_BOOL(postscript,
4983 [  --disable-postscript    Disable PostScript printing support ],
4984     MOZ_ENABLE_POSTSCRIPT=,
4985     MOZ_ENABLE_POSTSCRIPT=1 )
4987 dnl ========================================================
4988 dnl = GnomeVFS support module
4989 dnl ========================================================
4991 if test "$MOZ_X11"
4992 then
4993     dnl build the gnomevfs extension by default only when the
4994     dnl GTK2 toolkit is in use.
4995     if test "$MOZ_ENABLE_GTK2"
4996     then
4997         MOZ_ENABLE_GNOMEVFS=1
4998         MOZ_ENABLE_GCONF=1
4999         MOZ_ENABLE_LIBGNOME=1
5000     fi
5002     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5003     [  --disable-gnomevfs      Disable GnomeVFS support ],
5004         MOZ_ENABLE_GNOMEVFS=,
5005         MOZ_ENABLE_GNOMEVFS=force)
5007     if test "$MOZ_ENABLE_GNOMEVFS"
5008     then
5009         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5010             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5011             MOZ_ENABLE_GNOMEVFS=1
5012         ],[
5013             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5014             then
5015                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5016             fi
5017             MOZ_ENABLE_GNOMEVFS=
5018         ])
5019     fi
5021     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5022     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5024     if test "$MOZ_ENABLE_GCONF"
5025     then
5026         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5027             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5028             MOZ_ENABLE_GCONF=1
5029         ],[
5030             MOZ_ENABLE_GCONF=
5031         ])
5032     fi
5034     if test "$MOZ_ENABLE_GCONF"; then
5035         AC_DEFINE(MOZ_ENABLE_GCONF)
5036     fi
5038     AC_SUBST(MOZ_ENABLE_GCONF)
5039     AC_SUBST(MOZ_GCONF_CFLAGS)
5040     AC_SUBST(MOZ_GCONF_LIBS)
5042     if test "$MOZ_ENABLE_LIBGNOME"
5043     then
5044         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5045             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5046             MOZ_ENABLE_LIBGNOME=1
5047         ],[
5048             MOZ_ENABLE_LIBGNOME=
5049         ])
5050     fi
5052     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5053     AC_SUBST(MOZ_LIBGNOME_LIBS)
5055     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5056     # are all available.
5058     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5059             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5060       MOZ_ENABLE_GNOME_COMPONENT=1
5061     else
5062       MOZ_ENABLE_GNOME_COMPONENT=
5063     fi
5065     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5068 dnl ========================================================
5069 dnl = libgnomeui support module
5070 dnl ========================================================
5072 if test "$MOZ_ENABLE_GTK2"
5073 then
5074     MOZ_ENABLE_GNOMEUI=1
5076     MOZ_ARG_DISABLE_BOOL(gnomeui,
5077     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5078         MOZ_ENABLE_GNOMEUI=,
5079         MOZ_ENABLE_GNOMEUI=force)
5081     if test "$MOZ_ENABLE_GNOMEUI"
5082     then
5083         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5084         [
5085             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5086             MOZ_ENABLE_GNOMEUI=1
5087         ],[
5088             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5089             then
5090                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5091             fi
5092             MOZ_ENABLE_GNOMEUI=
5093         ])
5094     fi
5096     if test "$MOZ_ENABLE_GNOMEUI"; then
5097         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5098     fi
5100 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5101 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5102 AC_SUBST(MOZ_GNOMEUI_LIBS)
5104 dnl ========================================================
5105 dnl = dbus support
5106 dnl ========================================================
5108 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5109 then
5110     MOZ_ENABLE_DBUS=1
5112     MOZ_ARG_DISABLE_BOOL(dbus,
5113     [  --disable-dbus       Disable dbus support ],
5114         MOZ_ENABLE_DBUS=,
5115         MOZ_ENABLE_DBUS=1)
5117     if test "$MOZ_ENABLE_DBUS"
5118     then
5119         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5120         AC_DEFINE(MOZ_ENABLE_DBUS)
5121     fi
5123 AC_SUBST(MOZ_ENABLE_DBUS)
5124 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5125 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5127 dnl ========================================================
5128 dnl = Build Personal Security Manager
5129 dnl ========================================================
5130 MOZ_ARG_DISABLE_BOOL(crypto,
5131 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5132     MOZ_PSM=,
5133     MOZ_PSM=1 )
5135 dnl ========================================================
5136 dnl = JS Debugger XPCOM component (js/jsd)
5137 dnl ========================================================
5138 MOZ_ARG_DISABLE_BOOL(jsd,
5139 [  --disable-jsd           Disable JavaScript debug library],
5140     MOZ_JSDEBUGGER=,
5141     MOZ_JSDEBUGGER=1)
5144 dnl ========================================================
5145 dnl = Disable plugin support
5146 dnl ========================================================
5147 MOZ_ARG_DISABLE_BOOL(plugins,
5148 [  --disable-plugins       Disable plugins support],
5149     MOZ_PLUGINS=,
5150     MOZ_PLUGINS=1)
5152 dnl ========================================================
5153 dnl = Disable building dbm
5154 dnl ========================================================
5155 MOZ_ARG_DISABLE_BOOL(dbm,
5156 [  --disable-dbm       Disable building dbm],
5157     NSS_DISABLE_DBM=1,
5158     NSS_DISABLE_DBM=)
5160 dnl ========================================================
5161 dnl = Open JVM Interface (OJI) support
5162 dnl ========================================================
5163 MOZ_ARG_DISABLE_BOOL(oji,
5164 [  --disable-oji           Disable Open JVM Integration support],
5165     MOZ_OJI=,
5166     MOZ_OJI=1)
5167 if test -n "$MOZ_OJI"; then
5168     AC_DEFINE(OJI)
5171 dnl bi-directional support always on
5172 IBMBIDI=1
5173 AC_DEFINE(IBMBIDI)
5175 dnl ========================================================
5176 dnl view source support on by default
5177 dnl ========================================================
5178 MOZ_ARG_DISABLE_BOOL(view-source,
5179 [  --disable-view-source     Disable view source support],
5180     MOZ_VIEW_SOURCE=,
5181     MOZ_VIEW_SOURCE=1 )
5182 if test "$MOZ_VIEW_SOURCE"; then
5183     AC_DEFINE(MOZ_VIEW_SOURCE)
5187 dnl ========================================================
5188 dnl accessibility support on by default on all platforms 
5189 dnl except OS X.
5190 dnl ========================================================
5191 MOZ_ARG_DISABLE_BOOL(accessibility,
5192 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5193     ACCESSIBILITY=,
5194     ACCESSIBILITY=1 )
5195 if test "$ACCESSIBILITY"; then
5196     AC_DEFINE(ACCESSIBILITY)
5199 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5200 case "$target" in
5201 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5202     if test "$ac_cv_header_atlbase_h" = "no"; then
5203         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.])
5204     fi
5205     if test "$ac_cv_header_oleacc_idl" = "no"; then
5206         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.])
5207     fi
5208     ;;
5209 esac
5212 dnl ========================================================
5213 dnl xpfe/components on by default
5214 dnl ========================================================
5215 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5216 [  --disable-xpfe-components
5217                           Disable xpfe components],
5218     MOZ_XPFE_COMPONENTS=,
5219     MOZ_XPFE_COMPONENTS=1 )
5221 dnl ========================================================
5222 dnl xpinstall support on by default
5223 dnl ========================================================
5224 MOZ_ARG_DISABLE_BOOL(xpinstall,
5225 [  --disable-xpinstall     Disable xpinstall support],
5226     MOZ_XPINSTALL=,
5227     MOZ_XPINSTALL=1 )
5228 if test "$MOZ_XPINSTALL"; then
5229     AC_DEFINE(MOZ_XPINSTALL)
5232 dnl ========================================================
5233 dnl xpcom js loader support on by default
5234 dnl ========================================================
5235 MOZ_ARG_DISABLE_BOOL(jsloader,
5236 [  --disable-jsloader      Disable xpcom js loader support],
5237     MOZ_JSLOADER=,
5238     MOZ_JSLOADER=1 )
5239 if test "$MOZ_JSLOADER"; then
5240     AC_DEFINE(MOZ_JSLOADER)
5243 dnl ========================================================
5244 dnl Disable printing
5245 dnl ========================================================
5246 MOZ_ARG_DISABLE_BOOL(printing,
5247 [  --disable-printing  Disable printing support],
5248     NS_PRINTING=,
5249     NS_PRINTING=1 )
5251 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5252     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5253     NS_PRINTING=
5256 if test "$NS_PRINTING"; then
5257     AC_DEFINE(NS_PRINTING)
5258     AC_DEFINE(NS_PRINT_PREVIEW)
5261 dnl ========================================================
5262 dnl use native unicode converters
5263 dnl ========================================================
5264 MOZ_ARG_ENABLE_BOOL(native-uconv,
5265 [  --enable-native-uconv   Enable iconv support],
5266     MOZ_USE_NATIVE_UCONV=1,
5267     MOZ_USE_NATIVE_UCONV= )
5268 if test "$MOZ_USE_NATIVE_UCONV"; then
5269     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5271 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5272     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5276 dnl ========================================================
5277 dnl Libeditor can be build as plaintext-only,
5278 dnl or as a full html and text editing component.
5279 dnl We build both by default.
5280 dnl ========================================================
5281 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5282 [  --enable-plaintext-editor-only
5283                           Allow only plaintext editing],
5284     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5285     MOZ_PLAINTEXT_EDITOR_ONLY= )
5286 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5287 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5289 dnl ========================================================
5290 dnl = Drop XPCOM Obsolete library
5291 dnl ========================================================
5292 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5293 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5294     MOZ_NO_XPCOM_OBSOLETE=1,
5295     MOZ_NO_XPCOM_OBSOLETE=)
5297 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5298     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5301 dnl ========================================================
5302 dnl = Disable Fast Load
5303 dnl ========================================================
5304 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5305 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5306     MOZ_NO_FAST_LOAD=1,
5307     MOZ_NO_FAST_LOAD=)
5309 AC_SUBST(MOZ_NO_FAST_LOAD)
5311 if test -n "$MOZ_NO_FAST_LOAD"; then
5312     AC_DEFINE(MOZ_NO_FAST_LOAD)
5315 dnl ========================================================
5316 dnl = Disable Ogg Codecs
5317 dnl ========================================================
5318 MOZ_ARG_DISABLE_BOOL(ogg,
5319 [  --disable-ogg           Disable Ogg Codec support],
5320     MOZ_OGG=,
5321     MOZ_OGG=1)
5323 AC_SUBST(MOZ_OGG)
5325 if test -n "$MOZ_OGG"; then
5326     AC_DEFINE(MOZ_OGG)
5327     MOZ_SYDNEYAUDIO=1
5328     MOZ_MEDIA=1
5331 dnl ========================================================
5332 dnl = Disable Wave decoder support
5333 dnl ========================================================
5334 MOZ_ARG_DISABLE_BOOL(wave,
5335 [  --disable-wave          Disable Wave decoder support],
5336     MOZ_WAVE=,
5337     MOZ_WAVE=1)
5339 AC_SUBST(MOZ_WAVE)
5341 if test -n "$MOZ_WAVE"; then
5342     AC_DEFINE(MOZ_WAVE)
5343     MOZ_SYDNEYAUDIO=1
5344     MOZ_MEDIA=1
5347 dnl ========================================================
5348 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5349 dnl ========================================================
5351 AC_SUBST(MOZ_SYDNEYAUDIO)
5353 if test -n "$MOZ_SYDNEYAUDIO"; then
5354     AC_DEFINE(MOZ_SYDNEYAUDIO)
5357 AC_SUBST(MOZ_MEDIA)
5359 if test -n "$MOZ_MEDIA"; then
5360     AC_DEFINE(MOZ_MEDIA)
5363 dnl ========================================================
5364 dnl = Check alsa availability on Linux if using sydneyaudio
5365 dnl ========================================================
5367 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5368 if test "$COMPILE_ENVIRONMENT"; then
5369 if test -n "$MOZ_SYDNEYAUDIO"; then
5370    case "$target_os" in
5371 linux*)
5372       AC_CHECK_LIB(asound, snd_pcm_open,,AC_MSG_ERROR([Ogg support on Linux requires the alsa library]))
5373       ;;
5374    esac
5378 dnl ========================================================
5379 dnl Permissions System
5380 dnl ========================================================
5381 MOZ_ARG_DISABLE_BOOL(permissions,
5382 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5383     MOZ_PERMISSIONS=,
5384     MOZ_PERMISSIONS=1
5387 dnl ========================================================
5388 dnl NegotiateAuth
5389 dnl ========================================================
5390 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5391 [  --disable-negotiateauth Disable GSS-API negotiation ],
5392     MOZ_AUTH_EXTENSION=,
5393     MOZ_AUTH_EXTENSION=1 )
5395 dnl ========================================================
5396 dnl XTF
5397 dnl ========================================================
5398 MOZ_ARG_DISABLE_BOOL(xtf,
5399 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5400     MOZ_XTF=,
5401     MOZ_XTF=1 )
5402 if test "$MOZ_XTF"; then
5403   AC_DEFINE(MOZ_XTF)
5406 dnl ========================================================
5407 dnl Inspector APIs
5408 dnl ========================================================
5409 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5410 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5411     MOZ_NO_INSPECTOR_APIS=1,
5412     MOZ_NO_INSPECTOR_APIS= )
5414 dnl ========================================================
5415 dnl Pref extensions (autoconfig and system-pref)
5416 dnl ========================================================
5417 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5418 [  --disable-pref-extensions
5419                           Disable pref extensions such as autoconfig and
5420                           system-pref],
5421   MOZ_PREF_EXTENSIONS=,
5422   MOZ_PREF_EXTENSIONS=1 )
5424 dnl ========================================================
5425 dnl = Universalchardet
5426 dnl ========================================================
5427 MOZ_ARG_DISABLE_BOOL(universalchardet,
5428 [  --disable-universalchardet
5429                           Disable universal encoding detection],
5430   MOZ_UNIVERSALCHARDET=,
5431   MOZ_UNIVERSALCHARDET=1 )
5433 dnl ========================================================
5434 dnl JavaXPCOM
5435 dnl ========================================================
5436 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5437 [  --enable-javaxpcom
5438                           Enable Java-XPCOM bridge],
5439     MOZ_JAVAXPCOM=1,
5440     MOZ_JAVAXPCOM= )
5442 if test -n "${MOZ_JAVAXPCOM}"; then
5443   case "$host_os" in
5444     cygwin*|msvc*|mks*)
5445       if test -n "$JAVA_HOME"; then
5446         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5447       fi
5448       ;;
5449     *mingw*)
5450       if test -n "$JAVA_HOME"; then
5451         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5452       fi
5453       ;;
5454   esac
5456   if test -n "${JAVA_INCLUDE_PATH}"; then
5457     dnl Make sure jni.h exists in the given include path.
5458     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5459       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5460     fi
5461   else
5462     case "$target_os" in
5463       darwin*)
5464         dnl Default to java system location
5465         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5466         ;;
5467       *)
5468         dnl Try $JAVA_HOME
5469         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5470         ;;
5471     esac
5472     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5473       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.])
5474     fi
5475   fi
5477   if test -n "${JAVA_BIN_PATH}"; then
5478     dnl Look for javac and jar in the specified path.
5479     JAVA_PATH="$JAVA_BIN_PATH"
5480   else
5481     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5482     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5483   fi
5485   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5486   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5487   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5488   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5489     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.])
5490   fi
5493 dnl ========================================================
5494 dnl = Breakpad crash reporting (on by default on supported platforms)
5495 dnl ========================================================
5497 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5498     || test "$OS_ARCH" = "Darwin" \
5499     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5500     || test "$OS_ARCH" = "SunOS") \
5501    && test -z "$HAVE_64BIT_OS"; then
5502    MOZ_CRASHREPORTER=1
5505 MOZ_ARG_DISABLE_BOOL(crashreporter,
5506 [  --disable-crashreporter          Disable breakpad crash reporting],
5507     MOZ_CRASHREPORTER=,
5508     MOZ_CRASHREPORTER=1)
5510 if test -n "$MOZ_CRASHREPORTER"; then
5511    AC_DEFINE(MOZ_CRASHREPORTER)
5513   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5514     test -z "$SKIP_LIBRARY_CHECKS"; then
5515     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5516     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5517     AC_SUBST(MOZ_GTHREAD_LIBS)
5519     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.])])
5520   fi
5523 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5524 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5525 [ val=`echo $withval | sed 's/[^0-9]//g'`
5526     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5528 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5529    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5531 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5533 dnl ========================================================
5534 dnl = Enable compilation of specific extension modules
5535 dnl ========================================================
5537 MOZ_ARG_ENABLE_STRING(extensions,
5538 [  --enable-extensions     Enable extensions],
5539 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5540     if test "$option" = "yes" || test "$option" = "all"; then
5541         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5542     elif test "$option" = "no" || test "$option" = "none"; then
5543         MOZ_EXTENSIONS=""
5544     elif test "$option" = "default"; then
5545         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5546     elif test `echo "$option" | grep -c \^-` != 0; then
5547         option=`echo $option | sed 's/^-//'`
5548         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5549     else
5550         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5551     fi
5552 done],
5553     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5555 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5556     # Suppress warning on non-X11 platforms
5557     if test -n "$MOZ_X11"; then
5558         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5559     fi
5560     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5563 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5564     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5565     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5568 dnl This might be temporary: build tridentprofile only on Windows
5569 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5570     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5571     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5574 dnl cookie must be built before tridentprofile. put it at list's end.
5575 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5576   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5577   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5580 dnl xforms requires xtf and schema-validation
5581 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5582     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5583     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5585 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5586     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5587     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5590 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5591     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5592     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5595 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5596     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5597     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5600 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5601     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5602     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5605 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5606     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5607     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5610 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5611     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5612     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5615 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5616     AC_MSG_WARN([spellcheck is no longer an extension.])
5617     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5620 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5621     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5622     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5625 dnl Remove dupes
5626 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5628 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5629 dnl when trying to build a non-existent extension.
5630 for extension in $MOZ_EXTENSIONS; do
5631     if test ! -d "${srcdir}/extensions/${extension}"; then
5632         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5633     fi
5634 done
5637 dnl ========================================================
5638 dnl Image decoders
5639 dnl ========================================================
5640 case "$MOZ_WIDGET_TOOLKIT" in
5641 beos|windows|os2|mac|cocoa)
5642     ;;
5644     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
5645        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
5646     fi
5647     ;;
5648 esac
5650 MOZ_ARG_ENABLE_STRING(image-decoders,
5651 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5652                           Enable specific image decoders],
5653 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5654     if test "$option" = "yes" || test "$option" = "all"; then
5655         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5656     elif test "$option" = "no" || test "$option" = "none"; then
5657         MOZ_IMG_DECODERS=""
5658     elif test "$option" = "default"; then
5659         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5660     elif test `echo "$option" | grep -c \^-` != 0; then
5661         option=`echo $option | sed 's/^-//'`
5662         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5663     else
5664         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5665     fi
5666 done],
5667     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5669 dnl Dupes are removed in the encoder section because it will also add decoders
5671 dnl ========================================================
5672 dnl Image encoders
5673 dnl ========================================================
5674 MOZ_ARG_ENABLE_STRING(image-encoders,
5675 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5676                           Enable specific image encoders],
5677 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5678     if test "$option" = "yes" || test "$option" = "all"; then
5679         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5680     elif test "$option" = "no" || test "$option" = "none"; then
5681         MOZ_IMG_ENCODERS=""
5682         addencoder=""
5683     elif test "$option" = "default"; then
5684         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5685     elif test `echo "$option" | grep -c \^-` != 0; then
5686         option=`echo $option | sed 's/^-//'`
5687         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5688     else
5689         addencoder="$option"
5690     fi
5691     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5692 done],
5693     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5695 dnl Remove dupes
5696 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5697 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5699 dnl ========================================================
5700 dnl MathML on by default
5701 dnl ========================================================
5702 MOZ_ARG_DISABLE_BOOL(mathml,
5703 [  --disable-mathml        Disable MathML support],
5704     MOZ_MATHML=,
5705     MOZ_MATHML=1 )
5706 if test "$MOZ_MATHML"; then
5707   AC_DEFINE(MOZ_MATHML)
5710 dnl ========================================================
5711 dnl Canvas
5712 dnl ========================================================
5713 MOZ_ARG_DISABLE_BOOL(canvas,
5714 [  --disable-canvas          Disable html:canvas feature],
5715     MOZ_ENABLE_CANVAS=,
5716     MOZ_ENABLE_CANVAS=1 )
5717 if test -n "$MOZ_ENABLE_CANVAS"; then
5718     AC_DEFINE(MOZ_ENABLE_CANVAS)
5720 AC_SUBST(MOZ_ENABLE_CANVAS)
5722 dnl ========================================================
5723 dnl SVG
5724 dnl ========================================================
5725 MOZ_ARG_DISABLE_BOOL(svg,
5726 [  --disable-svg            Disable SVG support],
5727     MOZ_SVG=,
5728     MOZ_SVG=1 )
5729 if test -n "$MOZ_SVG"; then
5730   AC_DEFINE(MOZ_SVG)
5733 dnl ========================================================
5734 dnl Installer
5735 dnl ========================================================
5736 case "$target_os" in
5737     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5738         MOZ_INSTALLER=1
5739         ;;
5740 esac
5742 MOZ_ARG_DISABLE_BOOL(installer,
5743 [  --disable-installer     Disable building of installer],
5744     MOZ_INSTALLER=,
5745     MOZ_INSTALLER=1 )
5746 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5747     # Disable installer for Windows builds that use the new toolkit if NSIS
5748     # isn't in the path.
5749     AC_PATH_PROGS(MAKENSIS, makensis)
5750     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5751         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5752     fi
5753     # The Windows build for NSIS requires the iconv command line utility to
5754     # convert the charset of the locale files.
5755     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5756     if test -z "$HOST_ICONV"; then
5757         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5758     fi
5761 # Automatically disable installer if xpinstall isn't built
5762 if test -z "$MOZ_XPINSTALL"; then
5763     MOZ_INSTALLER=
5765 AC_SUBST(MOZ_INSTALLER)
5767 AC_MSG_CHECKING([for tar archiver])
5768 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5769 if test -z "$TAR"; then
5770     AC_MSG_ERROR([no tar archiver found in \$PATH])
5772 AC_MSG_RESULT([$TAR])
5773 AC_SUBST(TAR)
5775 AC_MSG_CHECKING([for wget])
5776 AC_CHECK_PROGS(WGET, wget, "")
5777 AC_MSG_RESULT([$WGET])
5778 AC_SUBST(WGET)
5780 dnl ========================================================
5781 dnl Updater
5782 dnl ========================================================
5784 MOZ_ARG_DISABLE_BOOL(updater,
5785 [  --disable-updater       Disable building of updater],
5786     MOZ_UPDATER=,
5787     MOZ_UPDATER=1 )
5788 # The Windows build requires the iconv command line utility
5789 # in order to build the updater.
5790 case "$target_os" in
5791     msvc*|mks*|cygwin*|mingw*|wince*)
5792         if test -n "$MOZ_UPDATER"; then
5793             AC_MSG_CHECKING([for iconv])
5794             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5795             if test -z "$HOST_ICONV"; then
5796                 AC_MSG_ERROR([iconv not found in \$PATH])
5797             fi
5798         fi
5799         ;;
5800 esac
5801 AC_SUBST(MOZ_UPDATER)
5803 # app update channel is 'default' when not supplied.
5804 MOZ_ARG_ENABLE_STRING([update-channel],
5805 [  --enable-update-channel=CHANNEL
5806                            Select application update channel (default=default)],
5807     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5809 if test -z "$MOZ_UPDATE_CHANNEL"; then
5810     MOZ_UPDATE_CHANNEL=default
5812 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5814 # tools/update-packaging is not checked out by default.
5815 MOZ_ARG_ENABLE_BOOL(update-packaging,
5816 [  --enable-update-packaging
5817                            Enable tools/update-packaging],
5818     MOZ_UPDATE_PACKAGING=1,
5819     MOZ_UPDATE_PACKAGING= )
5820 AC_SUBST(MOZ_UPDATE_PACKAGING)
5822 dnl ========================================================
5823 dnl ActiveX
5824 dnl ========================================================
5826 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5827 [  --disable-xpconnect-idispatch
5828                           Disable building of xpconnect support for IDispatch
5829                           (win32 only)],
5830     XPC_IDISPATCH_SUPPORT=,
5831     XPC_IDISPATCH_SUPPORT=1)
5832 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5834 MOZ_ARG_DISABLE_BOOL(activex,
5835 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5836     MOZ_NO_ACTIVEX_SUPPORT=1,
5837     MOZ_NO_ACTIVEX_SUPPORT= )
5838 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5840 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5841 [  --disable-activex-scripting
5842                           Disable building of ActiveX scripting support (win32)],
5843     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5844     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5845 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5847 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5848 then
5849     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5852 if test "$COMPILE_ENVIRONMENT" = "1"; then
5853 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5854 case "$target" in
5855 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5856     if test "$ac_cv_header_atlbase_h" = "no"; then
5857         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.])
5858     fi
5859     ;;
5860 esac
5864 dnl ========================================================
5865 dnl leaky
5866 dnl ========================================================
5867 MOZ_ARG_ENABLE_BOOL(leaky,
5868 [  --enable-leaky          Build leaky memory tool],
5869     MOZ_LEAKY=1,
5870     MOZ_LEAKY=)
5873 dnl ========================================================
5874 dnl xpctools
5875 dnl ========================================================
5876 MOZ_ARG_ENABLE_BOOL(xpctools,
5877 [  --enable-xpctools       Build JS profiling tool],
5878     MOZ_XPCTOOLS=1,
5879     MOZ_XPCTOOLS= )
5882 dnl ========================================================
5883 dnl build the tests by default
5884 dnl ========================================================
5885 MOZ_ARG_DISABLE_BOOL(tests,
5886 [  --disable-tests         Do not build test libraries & programs],
5887     ENABLE_TESTS=,
5888     ENABLE_TESTS=1 )
5890 dnl ========================================================
5891 dnl parental controls (for Windows Vista)
5892 dnl ========================================================
5893 MOZ_ARG_DISABLE_BOOL(parental-controls,
5894 [  --disable-parental-controls
5895                            Do not build parental controls],
5896    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5897    MOZ_DISABLE_PARENTAL_CONTROLS=)
5898 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5899     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5902 dnl ========================================================
5903 dnl Vista SDK specific api
5904 dnl ========================================================
5905 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
5906 [  --disable-vista-sdk-requirements
5907                            Do not build Vista SDK specific code],
5908    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
5909    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
5910 if test -n "$COMPILE_ENVIRONMENT"; then
5911 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
5912     AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
5913     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5914     if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5915         AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5916     fi
5917     MOZ_DISABLE_PARENTAL_CONTROLS=1
5918 else
5919 case "$target" in
5920 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5921     if test "$ac_cv_header_wpcapi_h" = "no"; then
5922         AC_MSG_ERROR([System header wpcapi.h is not available. See updated http://developer.mozilla.org/en/docs/wpcapi.h for details on fixing this problem.])
5923     fi
5924     ;;
5925 esac
5928 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5929 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5931 dnl ========================================================
5932 dnl =
5933 dnl = Module specific options
5934 dnl =
5935 dnl ========================================================
5936 MOZ_ARG_HEADER(Individual module options)
5938 dnl ========================================================
5939 dnl = Enable Lea malloc in xpcom. OFF by default.
5940 dnl ========================================================
5941 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
5942 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
5943     XPCOM_USE_LEA=1,
5944     XPCOM_USE_LEA= )
5945 if test -n "$XPCOM_USE_LEA"; then
5946     AC_DEFINE(XPCOM_USE_LEA)
5949 dnl ========================================================
5950 dnl = Enable places (new history/bookmarks)
5951 dnl ========================================================
5952 MOZ_ARG_ENABLE_BOOL(places,
5953 [  --enable-places        Enable 'places' bookmark/history implementation],
5954     MOZ_PLACES=1,
5955     MOZ_PLACES= )
5956 if test -n "$MOZ_PLACES"; then
5957     AC_DEFINE(MOZ_PLACES)
5958     if test -z "$MOZ_MAIL_NEWS"; then
5959       MOZ_MORK=
5960     fi
5961     MOZ_MORKREADER=1
5962 else
5963   if test "$MOZ_BUILD_APP" = "browser"; then
5964     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5965   fi
5968 dnl ========================================================
5969 dnl = Disable feed handling components
5970 dnl ========================================================
5971 MOZ_ARG_DISABLE_BOOL(feeds,
5972 [  --disable-feeds        Disable feed handling and processing components],
5973     MOZ_FEEDS=,
5974     MOZ_FEEDS=1 )
5975 if test -n "$MOZ_FEEDS"; then
5976     AC_DEFINE(MOZ_FEEDS)
5977 else
5978     if test "$MOZ_BUILD_APP" = "browser"; then
5979         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
5980     fi
5983 dnl ========================================================
5984 dnl = Enable mozStorage
5985 dnl ========================================================
5986 dnl Implicitly enabled by default if building calendar or places
5987 MOZ_ARG_ENABLE_BOOL(storage,
5988 [  --enable-storage        Enable mozStorage module and related components],
5989     MOZ_STORAGE=1,
5990     MOZ_STORAGE= )
5991 if test -n "$MOZ_STORAGE"; then
5992     AC_DEFINE(MOZ_STORAGE)
5995 dnl ========================================================
5996 dnl Check for sqlite
5997 dnl ========================================================
5999 MOZ_NATIVE_SQLITE=
6000 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6001 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6002 MOZ_NATIVE_SQLITE=1,
6003 MOZ_NATIVE_SQLITE= )
6005 if test -z "$MOZ_NATIVE_SQLITE"
6006 then
6007     SQLITE_CFLAGS=
6008     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6009 else
6010     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6013 AC_SUBST(MOZ_NATIVE_SQLITE)
6015 dnl ========================================================
6016 dnl = Enable help viewer (off by default)
6017 dnl ========================================================
6018 MOZ_ARG_ENABLE_BOOL(help-viewer,
6019 [  --enable-help-viewer        Enable help viewer],
6020     MOZ_HELP_VIEWER=1,
6021     MOZ_HELP_VIEWER= )
6022 if test -n "$MOZ_HELP_VIEWER"; then
6023      AC_DEFINE(MOZ_HELP_VIEWER)
6025 AC_SUBST(MOZ_HELP_VIEWER)
6026 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6027     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6030 dnl ========================================================
6031 dnl = Enable safe browsing (anti-phishing)
6032 dnl ========================================================
6033 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6034 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6035     MOZ_SAFE_BROWSING=1,
6036     MOZ_SAFE_BROWSING= )
6037 if test -n "$MOZ_SAFE_BROWSING"; then
6038     AC_DEFINE(MOZ_SAFE_BROWSING)
6040 AC_SUBST(MOZ_SAFE_BROWSING)
6042 dnl ========================================================
6043 dnl = Enable url-classifier
6044 dnl ========================================================
6045 dnl Implicitly enabled by default if building with safe-browsing
6046 if test -n "$MOZ_SAFE_BROWSING"; then
6047     MOZ_URL_CLASSIFIER=1
6049 MOZ_ARG_ENABLE_BOOL(url-classifier,
6050 [  --enable-url-classifier        Enable url classifier module],
6051     MOZ_URL_CLASSIFIER=1,
6052     MOZ_URL_CLASSIFIER= )
6053 if test -n "$MOZ_URL_CLASSIFIER"; then
6054     AC_DEFINE(MOZ_URL_CLASSIFIER)
6056 AC_SUBST(MOZ_URL_CLASSIFIER)
6058 dnl ========================================================
6059 dnl = Disable zipwriter
6060 dnl ========================================================
6061 MOZ_ARG_DISABLE_BOOL(zipwriter,
6062 [  --disable-zipwriter             Disable zipwriter component],
6063     MOZ_ZIPWRITER=,
6064     MOZ_ZIPWRITER=1 )
6065 AC_SUBST(MOZ_ZIPWRITER)
6067 dnl ========================================================
6068 dnl = Enable Ultrasparc specific optimizations for JS
6069 dnl ========================================================
6070 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6071 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6072     JS_ULTRASPARC_OPTS=1,
6073     JS_ULTRASPARC_OPTS= )
6075 dnl only enable option for ultrasparcs
6076 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6077     "$OS_TEST" != "sun4u"; then
6078     JS_ULTRASPARC_OPTS=
6080 AC_SUBST(JS_ULTRASPARC_OPTS)
6082 dnl ========================================================
6083 dnl = Hildon and OSSO checks
6084 dnl ========================================================
6085 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
6086                   MOZ_PLATFORM_HILDON=1,
6087                   MOZ_PLATFORM_HILDON=)
6088 if test $MOZ_PLATFORM_HILDON; then
6089    AC_DEFINE(MOZ_PLATFORM_HILDON)
6091 AC_SUBST(LIBHILDONMIME_CFLAGS)
6092 AC_SUBST(LIBHILDONMIME_LIBS)
6094 PKG_CHECK_MODULES(LIBOSSO,libosso,
6095                   NS_OSSO=1,
6096                   NS_OSSO=)
6098 if test $NS_OSSO; then
6099     if test -z "$MOZ_ENABLE_DBUS"; then
6100         AC_MSG_ERROR([DBus is required when building for OSSO])
6101     fi
6102     AC_DEFINE(NS_OSSO)
6103     dnl XXX this should go somewhere else; it's not just for OSSO
6104     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6106 AC_SUBST(LIBOSSO_CFLAGS)
6107 AC_SUBST(LIBOSSO_LIBS)
6109 PKG_CHECK_MODULES(MOZ_LOCATION, [liblocation gpsbt],
6110                   NS_MAEMO_LOCATION=1,
6111                   NS_MAEMO_LOCATION=)
6113 if test $NS_MAEMO_LOCATION; then
6114   AC_DEFINE(NS_MAEMO_LOCATION)
6117 AC_SUBST(MOZ_LOCATION_CFLAGS)
6118 AC_SUBST(MOZ_LOCATION_LIBS)
6120 dnl ========================================================
6121 dnl =
6122 dnl = Feature options that require extra sources to be pulled
6123 dnl =
6124 dnl ========================================================
6125 dnl MOZ_ARG_HEADER(Features that require extra sources)
6127 dnl ========================================================
6128 dnl =
6129 dnl = Debugging Options
6130 dnl = 
6131 dnl ========================================================
6132 MOZ_ARG_HEADER(Debugging and Optimizations)
6134 dnl ========================================================
6135 dnl = Disable building with debug info.
6136 dnl = Debugging is OFF by default
6137 dnl ========================================================
6138 if test -z "$MOZ_DEBUG_FLAGS"
6139 then
6140     case "$target" in
6141     *-irix*)
6142         if test "$GNU_CC"; then
6143             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6144             case "$GCC_VERSION" in
6145             2.95.*)
6146                 MOZ_DEBUG_FLAGS=""
6147                 ;;
6148             *)
6149                 MOZ_DEBUG_FLAGS="-g"
6150                 ;;
6151             esac
6152         else
6153             MOZ_DEBUG_FLAGS="-g"
6154         fi
6155         ;;
6156     *)
6157         MOZ_DEBUG_FLAGS="-g"
6158         ;;
6159     esac
6162 MOZ_ARG_ENABLE_STRING(debug,
6163 [  --enable-debug[=DBG]    Enable building with developer debug info
6164                           (Using compiler flags DBG)],
6165 [ if test "$enableval" != "no"; then
6166     MOZ_DEBUG=1
6167     if test -n "$enableval" && test "$enableval" != "yes"; then
6168         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6169     fi
6170   else
6171     MOZ_DEBUG=
6172   fi ],
6173   MOZ_DEBUG=)
6175 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6176  case "${target_os}" in
6177     beos*)
6178         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6179         ;;
6180     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6181         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6182         ;;
6183     *) 
6184         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6185         ;;
6186   esac
6187 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6189 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6191 if test -n "$MOZ_DEBUG"; then
6192     AC_MSG_CHECKING([for valid debug flags])
6193     _SAVE_CFLAGS=$CFLAGS
6194     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6195     AC_TRY_COMPILE([#include <stdio.h>], 
6196         [printf("Hello World\n");],
6197         _results=yes,
6198         _results=no)
6199     AC_MSG_RESULT([$_results])
6200     if test "$_results" = "no"; then
6201         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6202     fi
6203     CFLAGS=$_SAVE_CFLAGS
6206 dnl ========================================================
6207 dnl = Enable code optimization. ON by default.
6208 dnl ========================================================
6209 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6210         MOZ_OPTIMIZE_FLAGS="-O"
6213 MOZ_ARG_ENABLE_STRING(optimize,
6214 [  --disable-optimize      Disable compiler optimization
6215   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6216 [ if test "$enableval" != "no"; then
6217     MOZ_OPTIMIZE=1
6218     if test -n "$enableval" && test "$enableval" != "yes"; then
6219         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6220         MOZ_OPTIMIZE=2
6221     fi
6222 else
6223     MOZ_OPTIMIZE=
6224 fi ], MOZ_OPTIMIZE=1)
6226 if test "$COMPILE_ENVIRONMENT"; then
6227 if test -n "$MOZ_OPTIMIZE"; then
6228     AC_MSG_CHECKING([for valid optimization flags])
6229     _SAVE_CFLAGS=$CFLAGS
6230     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6231     AC_TRY_COMPILE([#include <stdio.h>], 
6232         [printf("Hello World\n");],
6233         _results=yes,
6234         _results=no)
6235     AC_MSG_RESULT([$_results])
6236     if test "$_results" = "no"; then
6237         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6238     fi
6239     CFLAGS=$_SAVE_CFLAGS
6241 fi # COMPILE_ENVIRONMENT
6243 AC_SUBST(MOZ_OPTIMIZE)
6244 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6245 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6246 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6248 dnl ========================================================
6249 dnl = Enable/disable debug for specific modules only
6250 dnl =   module names beginning with ^ will be disabled 
6251 dnl ========================================================
6252 MOZ_ARG_ENABLE_STRING(debug-modules,
6253 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6254 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6256 dnl ========================================================
6257 dnl = Enable/disable generation of debugger info for specific modules only
6258 dnl =    the special module name ALL_MODULES can be used to denote all modules
6259 dnl =    module names beginning with ^ will be disabled
6260 dnl ========================================================
6261 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6262 [  --enable-debugger-info-modules
6263                           Enable/disable debugger info for specific modules],
6264 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6265       dnl note that the list of module names is reversed as it is copied
6266       dnl this is important, as it will allow config.mk to interpret stuff like
6267       dnl "^ALL_MODULES xpcom" properly
6268       if test "$i" = "no"; then
6269         i="^ALL_MODULES"
6270       fi
6271       if test "$i" = "yes"; then
6272         i="ALL_MODULES"
6273       fi
6274       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6275     done ])
6277 dnl ========================================================
6278 dnl Enable garbage collector
6279 dnl ========================================================
6280 MOZ_ARG_ENABLE_BOOL(boehm,
6281 [  --enable-boehm          Enable the Boehm Garbage Collector],
6282     GC_LEAK_DETECTOR=1,
6283     GC_LEAK_DETECTOR= )
6284 if test -n "$GC_LEAK_DETECTOR"; then
6285     AC_DEFINE(GC_LEAK_DETECTOR)
6288 dnl ========================================================
6289 dnl Disable runtime logging checks
6290 dnl ========================================================
6291 MOZ_ARG_DISABLE_BOOL(logging,
6292 [  --disable-logging       Disable logging facilities],
6293     NS_DISABLE_LOGGING=1,
6294     NS_DISABLE_LOGGING= )
6295 if test "$NS_DISABLE_LOGGING"; then
6296     AC_DEFINE(NS_DISABLE_LOGGING)
6297 else
6298     AC_DEFINE(MOZ_LOGGING)
6301 dnl ========================================================
6302 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6303 dnl ========================================================
6304 _ENABLE_LOGREFCNT=42
6305 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6306 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6307     _ENABLE_LOGREFCNT=1,
6308     _ENABLE_LOGREFCNT= )
6309 if test "$_ENABLE_LOGREFCNT" = "1"; then
6310     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6311 elif test -z "$_ENABLE_LOGREFCNT"; then
6312     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6315 dnl ========================================================
6316 dnl = Enable trace malloc
6317 dnl ========================================================
6318 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6319 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6320 [  --enable-trace-malloc   Enable malloc tracing],
6321     NS_TRACE_MALLOC=1,
6322     NS_TRACE_MALLOC= )
6323 if test "$NS_TRACE_MALLOC"; then
6324   # Please, Mr. Linker Man, don't take away our symbol names
6325   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6326   USE_ELF_DYNSTR_GC=
6327   AC_DEFINE(NS_TRACE_MALLOC)
6329 AC_SUBST(NS_TRACE_MALLOC)
6331 dnl ========================================================
6332 dnl = Enable jemalloc
6333 dnl ========================================================
6334 MOZ_ARG_ENABLE_BOOL(jemalloc,
6335 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6336     MOZ_MEMORY=1,
6337     MOZ_MEMORY=)
6339 if test "$NS_TRACE_MALLOC"; then
6340     MOZ_MEMORY=
6343 if test "$MOZ_MEMORY"; then
6345   dnl Don't try to run compiler tests on Windows  
6346   if test "$OS_ARCH" = "WINNT"; then
6347     if test -z "$HAVE_64BIT_OS"; then
6348       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6349     else
6350       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6351     fi
6352   else
6353     AC_CHECK_SIZEOF([int *], [4])
6354     case "${ac_cv_sizeof_int_p}" in
6355     4)
6356       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6357       ;;
6358     8)
6359       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6360       ;;
6361     *)
6362       AC_MSG_ERROR([Unexpected pointer size])
6363       ;;
6364     esac
6365   fi
6367   AC_DEFINE(MOZ_MEMORY)
6368   if test "x$MOZ_DEBUG" = "x1"; then
6369     AC_DEFINE(MOZ_MEMORY_DEBUG)
6370   fi
6371   dnl The generic feature tests that determine how to compute ncpus are long and
6372   dnl complicated.  Therefore, simply define special cpp variables for the
6373   dnl platforms we have special knowledge of.
6374   case "${target_os}" in
6375   darwin*)
6376     AC_DEFINE(MOZ_MEMORY_DARWIN)
6377     ;;
6378   *freebsd*)
6379     AC_DEFINE(MOZ_MEMORY_BSD)
6380     ;;
6381   *linux*)
6382     AC_DEFINE(MOZ_MEMORY_LINUX)
6383     ;;
6384   netbsd*)
6385     AC_DEFINE(MOZ_MEMORY_BSD)
6386     ;;
6387   solaris*)
6388     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6389     ;;
6390   msvc*|mks*|cygwin*|mingw*)
6391     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6392     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6393     dnl will fail miserably
6394     if test "$_CC_SUITE" -lt "8"; then
6395         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6396     fi
6397     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6398       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6399         AC_MSG_ERROR([When building jemalloc, either set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src), or set WIN32_CUSTOM_CRT_DIR to the path to a folder containing a pre-built CRT DLL.])
6400       else
6401         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6402       fi
6403     fi
6404     if test -z "$WIN32_CRT_SRC_DIR"; then
6405       # pre-built dll
6406       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6407       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6408     else
6409       # CRT source directory
6410       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6411       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6412       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6413     fi
6414     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6415     dnl are to avoid m4
6416     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6417     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6418     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6419     dnl This needs to be unix style.
6420     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6421     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6422     AC_DEFINE(_STATIC_CPPLIB)
6423     dnl Don't generate a manifest, since we're linking to a custom CRT.
6424     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6425     dnl Also pass this to NSPR/NSS
6426     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6427     export DLLFLAGS
6428     ;;
6429   *)
6430     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6431     ;;
6432   esac
6434   AC_ARG_WITH([valgrind],
6435     [  --with-valgrind         Enable valgrind integration hooks],
6436     [enable_valgrind="yes"], [enable_valgrind="no"])
6437   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6438   if test "x$enable_valgrind" = "xyes" ; then
6439     AC_DEFINE(MOZ_VALGRIND)
6440   fi
6442 AC_SUBST(MOZ_MEMORY)
6443 AC_SUBST(WIN32_CRT_SRC_DIR)
6444 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6445 AC_SUBST(MOZ_LIB)
6446 AC_SUBST(MOZ_PATH)
6447 dnl Need to set this for make because NSS doesn't have configure
6448 AC_SUBST(DLLFLAGS)
6450 dnl ========================================================
6451 dnl = Use malloc wrapper lib
6452 dnl ========================================================
6453 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6454 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6455     _WRAP_MALLOC=1,
6456     _WRAP_MALLOC= )
6458 if test -n "$_WRAP_MALLOC"; then
6459     if test "$GNU_CC"; then
6460     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"
6461     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6462     fi
6465 dnl ========================================================
6466 dnl = Location of malloc wrapper lib
6467 dnl ========================================================
6468 MOZ_ARG_WITH_STRING(wrap-malloc,
6469 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6470     WRAP_MALLOC_LIB=$withval)
6472 dnl ========================================================
6473 dnl = Use Electric Fence
6474 dnl ========================================================
6475 MOZ_ARG_ENABLE_BOOL(efence,
6476 [  --enable-efence         Link with Electric Fence],
6477     _ENABLE_EFENCE=1,
6478     _ENABLE_EFENCE= )
6479 if test -n "$_ENABLE_EFENCE"; then
6480     AC_CHECK_LIB(efence,malloc)
6483 dnl ========================================================
6484 dnl jprof
6485 dnl ========================================================
6486 MOZ_ARG_ENABLE_BOOL(jprof,
6487 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6488     MOZ_JPROF=1,
6489     MOZ_JPROF= )
6490 if test -n "$MOZ_JPROF"; then
6491     AC_DEFINE(MOZ_JPROF)
6494 dnl ========================================================
6495 dnl shark
6496 dnl ========================================================
6497 MOZ_ARG_ENABLE_BOOL(shark,
6498 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6499     MOZ_SHARK=1,
6500     MOZ_SHARK= )
6501 if test -n "$MOZ_SHARK"; then
6502     AC_DEFINE(MOZ_SHARK)
6505 dnl ========================================================
6506 dnl callgrind
6507 dnl ========================================================
6508 MOZ_ARG_ENABLE_BOOL(callgrind,
6509 [  --enable-callgrind      Enable callgrind profiling],
6510     MOZ_CALLGRIND=1,
6511     MOZ_CALLGRIND= )
6512 if test -n "$MOZ_CALLGRIND"; then
6513     AC_DEFINE(MOZ_CALLGRIND)
6516 dnl ========================================================
6517 dnl vtune
6518 dnl ========================================================
6519 MOZ_ARG_ENABLE_BOOL(vtune,
6520 [  --enable-vtune          Enable vtune profiling],
6521     MOZ_VTUNE=1,
6522     MOZ_VTUNE= )
6523 if test -n "$MOZ_VTUNE"; then
6524     AC_DEFINE(MOZ_VTUNE)
6527 dnl ========================================================
6528 dnl = Enable static checking using gcc-dehydra
6529 dnl ========================================================
6531 MOZ_ARG_WITH_STRING(static-checking,
6532 [  --with-static-checking=path/to/gcc_dehydra.so
6533                             Enable static checking of code using GCC-dehydra],
6534     DEHYDRA_PATH=$withval,
6535     DEHYDRA_PATH= )
6537 if test -n "$DEHYDRA_PATH"; then
6538     if ! test -f "$DEHYDRA_PATH"; then
6539         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6540     fi
6541     AC_DEFINE(NS_STATIC_CHECKING)
6543 AC_SUBST(DEHYDRA_PATH)
6545 dnl ========================================================
6546 dnl = Enable stripping of libs & executables
6547 dnl ========================================================
6548 MOZ_ARG_ENABLE_BOOL(strip,
6549 [  --enable-strip          Enable stripping of libs & executables ],
6550     ENABLE_STRIP=1,
6551     ENABLE_STRIP= )
6553 dnl ========================================================
6554 dnl = Enable stripping of libs & executables when packaging
6555 dnl ========================================================
6556 MOZ_ARG_ENABLE_BOOL(install-strip,
6557 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6558     PKG_SKIP_STRIP= ,
6559     PKG_SKIP_STRIP=1)
6561 dnl ========================================================
6562 dnl = --enable-elf-dynstr-gc
6563 dnl ========================================================
6564 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6565 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6566     USE_ELF_DYNSTR_GC=1,
6567     USE_ELF_DYNSTR_GC= )
6569 dnl ========================================================
6570 dnl = --enable-old-abi-compat-wrappers
6571 dnl ========================================================
6572 dnl on x86 linux, the current builds of some popular plugins (notably
6573 dnl flashplayer and real) expect a few builtin symbols from libgcc
6574 dnl which were available in some older versions of gcc.  However,
6575 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6576 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6577 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6578 dnl to true on x86 linux, and false everywhere else.
6581 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6582 [  --enable-old-abi-compat-wrappers
6583                           Support old GCC ABI symbols to ease the pain 
6584                           of the linux compiler change],
6585     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6586     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6587 if test "$COMPILE_ENVIRONMENT"; then
6588 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6589     AC_LANG_SAVE
6590     AC_LANG_CPLUSPLUS
6591     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6592     AC_LANG_RESTORE
6593     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6595 fi # COMPILE_ENVIRONMENT
6597 dnl ========================================================
6598 dnl = 
6599 dnl = Profiling and Instrumenting
6600 dnl = 
6601 dnl ========================================================
6602 MOZ_ARG_HEADER(Profiling and Instrumenting)
6604 dnl ========================================================
6605 dnl = Enable timeline service, which provides lightweight
6606 dnl = instrumentation of mozilla for performance measurement.
6607 dnl = Timeline is off by default.
6608 dnl ========================================================
6609 MOZ_ARG_ENABLE_BOOL(timeline,
6610 [  --enable-timeline       Enable timeline services ],
6611     MOZ_TIMELINE=1,
6612     MOZ_TIMELINE= )
6613 if test -n "$MOZ_TIMELINE"; then
6614     AC_DEFINE(MOZ_TIMELINE)
6617 dnl ========================================================
6618 dnl Turn on reflow counting
6619 dnl ========================================================
6620 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6621 [  --enable-reflow-perf    Enable reflow performance tracing],
6622     MOZ_REFLOW_PERF=1,
6623     MOZ_REFLOW_PERF= )
6624 if test -n "$MOZ_REFLOW_PREF"; then
6625     AC_DEFINE(MOZ_REFLOW_PREF)
6627 AC_SUBST(MOZ_REFLOW_PERF)
6629 dnl ========================================================
6630 dnl Enable performance metrics.
6631 dnl ========================================================
6632 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6633 [  --enable-perf-metrics   Enable performance metrics],
6634     MOZ_PERF_METRICS=1,
6635     MOZ_PERF_METRICS= )
6636 if test -n "$MOZ_PERF_METRICS"; then
6637     AC_DEFINE(MOZ_PERF_METRICS)
6640 dnl ========================================================
6641 dnl Enable code size metrics.
6642 dnl ========================================================
6643 MOZ_ARG_ENABLE_BOOL(codesighs,
6644 [  --enable-codesighs      Enable code size analysis tools],
6645     _ENABLE_CODESIGHS=1,
6646     _ENABLE_CODESIGHS= )
6647 if test -n "$_ENABLE_CODESIGHS"; then
6648     if test -d $srcdir/tools/codesighs; then 
6649         MOZ_MAPINFO=1
6650     else
6651         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6652     fi
6655 dnl ========================================================
6656 dnl = Add support for Eazel profiler
6657 dnl ========================================================
6658 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6659 [  --enable-eazel-profiler-support
6660                           Enable Corel/Eazel profiler support],
6661     ENABLE_EAZEL_PROFILER=1,
6662     ENABLE_EAZEL_PROFILER= )
6663 if test -n "$ENABLE_EAZEL_PROFILER"; then
6664     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6665     USE_ELF_DYNSTR_GC=
6666     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6667     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6668     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6671 MOZ_ARG_ENABLE_STRING(profile-modules,
6672 [  --enable-profile-modules
6673                           Enable/disable profiling for specific modules],
6674 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6676 MOZ_ARG_ENABLE_BOOL(insure,
6677 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6678     _ENABLE_INSURE=1,
6679     _ENABLE_INSURE= )
6680 if test -n "$_ENABLE_INSURE"; then
6681     MOZ_INSURE="insure"
6682     MOZ_INSURIFYING=1
6683     MOZ_INSURE_DIRS="."
6684     MOZ_INSURE_EXCLUDE_DIRS="config"
6687 MOZ_ARG_WITH_STRING(insure-dirs,
6688 [  --with-insure-dirs=DIRS
6689                           Dirs to instrument with insure ],
6690     MOZ_INSURE_DIRS=$withval )
6692 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6693 [  --with-insure-exclude-dirs=DIRS
6694                           Dirs to not instrument with insure ],
6695     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6697 dnl ========================================================
6698 dnl = Support for Quantify (Windows)
6699 dnl ========================================================
6700 MOZ_ARG_ENABLE_BOOL(quantify,
6701 [  --enable-quantify      Enable Quantify support (Windows only) ],
6702     MOZ_QUANTIFY=1,
6703     MOZ_QUANTIFY= )
6705 dnl ========================================================
6706 dnl = Support for demangling undefined symbols
6707 dnl ========================================================
6708 if test -z "$SKIP_LIBRARY_CHECKS"; then
6709     AC_LANG_SAVE
6710     AC_LANG_CPLUSPLUS
6711     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6712     AC_LANG_RESTORE
6715 # Demangle only for debug or trace-malloc builds
6716 MOZ_DEMANGLE_SYMBOLS=
6717 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6718     MOZ_DEMANGLE_SYMBOLS=1
6719     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6721 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6723 dnl ========================================================
6724 dnl = Support for gcc stack unwinding (from gcc 3.3)
6725 dnl ========================================================
6726 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6727     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6730 dnl ========================================================
6731 dnl =
6732 dnl = Misc. Options
6733 dnl = 
6734 dnl ========================================================
6735 MOZ_ARG_HEADER(Misc. Options)
6737 dnl ========================================================
6738 dnl update xterm title
6739 dnl ========================================================
6740 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6741 [  --enable-xterm-updates  Update XTERM titles with current command.],
6742     MOZ_UPDATE_XTERM=1,
6743     MOZ_UPDATE_XTERM= )
6745 dnl =========================================================
6746 dnl = Chrome format
6747 dnl =========================================================
6748 MOZ_ARG_ENABLE_STRING([chrome-format],
6749 [  --enable-chrome-format=jar|flat|both|symlink
6750                           Select FORMAT of chrome files (default=jar)],
6751     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6753 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6754     MOZ_CHROME_FILE_FORMAT=jar
6757 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6758     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6759     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6760     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6761     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6764 dnl ========================================================
6765 dnl = Define default location for MOZILLA_FIVE_HOME
6766 dnl ========================================================
6767 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6768 [  --with-default-mozilla-five-home
6769                           Set the default value for MOZILLA_FIVE_HOME],
6770 [ val=`echo $withval`
6771   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6773 dnl ========================================================
6774 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6775 dnl ========================================================
6776 MOZ_ARG_WITH_STRING(user-appdir,
6777 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6778 [ val=`echo $withval`
6779 if echo "$val" | grep "\/" >/dev/null; then
6780     AC_MSG_ERROR("Homedir must be single relative path.")
6781 else 
6782     MOZ_USER_DIR="$val"
6783 fi])
6785 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6787 dnl ========================================================
6788 dnl = Doxygen configuration
6789 dnl ========================================================
6790 dnl Use commas to specify multiple dirs to this arg
6791 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6792 MOZ_ARG_WITH_STRING(doc-input-dirs,
6793 [  --with-doc-input-dirs=DIRS
6794                           Header/idl dirs to create docs from],
6795 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6796 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6798 dnl Use commas to specify multiple dirs to this arg
6799 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6800 MOZ_ARG_WITH_STRING(doc-include-dirs,
6801 [  --with-doc-include-dirs=DIRS  
6802                           Include dirs to preprocess doc headers],
6803 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6804 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6806 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6807 MOZ_ARG_WITH_STRING(doc-output-dir,
6808 [  --with-doc-output-dir=DIR
6809                           Dir to generate docs into],
6810 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6811 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6813 if test -z "$SKIP_COMPILER_CHECKS"; then
6814 dnl ========================================================
6815 dnl =
6816 dnl = Compiler Options
6817 dnl = 
6818 dnl ========================================================
6819 MOZ_ARG_HEADER(Compiler Options)
6821 dnl ========================================================
6822 dnl Check for gcc -pipe support
6823 dnl ========================================================
6824 AC_MSG_CHECKING([for gcc -pipe support])
6825 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6826     echo '#include <stdio.h>' > dummy-hello.c
6827     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6828     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6829     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6830     if test $? = 0; then
6831         _res_as_stdin="yes"
6832     else
6833         _res_as_stdin="no"
6834     fi
6835     if test "$_res_as_stdin" = "yes"; then
6836         _SAVE_CFLAGS=$CFLAGS
6837         CFLAGS="$CFLAGS -pipe"
6838         AC_TRY_COMPILE( [ #include <stdio.h> ],
6839             [printf("Hello World\n");],
6840             [_res_gcc_pipe="yes"],
6841             [_res_gcc_pipe="no"] )
6842         CFLAGS=$_SAVE_CFLAGS
6843     fi
6844     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6845         _res="yes";
6846         CFLAGS="$CFLAGS -pipe"
6847         CXXFLAGS="$CXXFLAGS -pipe"
6848     else
6849         _res="no"
6850     fi
6851     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6852     AC_MSG_RESULT([$_res])
6853 else
6854     AC_MSG_RESULT([no])
6857 dnl pass -Wno-long-long to the compiler
6858 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6859 [  --enable-long-long-warning 
6860                           Warn about use of non-ANSI long long type],
6861     _IGNORE_LONG_LONG_WARNINGS=,
6862     _IGNORE_LONG_LONG_WARNINGS=1)
6864 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6865      _SAVE_CFLAGS="$CFLAGS"
6866      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6867      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6868      AC_TRY_COMPILE([], [return(0);], 
6869         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6870           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6871           result="yes" ], result="no")
6872      AC_MSG_RESULT([$result])
6873      CFLAGS="$_SAVE_CFLAGS"
6876 dnl ========================================================
6877 dnl Profile guided optimization
6878 dnl ========================================================
6879 dnl Test for profiling options
6880 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6881 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6883 dnl Provide a switch to disable PGO even when called via profiledbuild.
6884 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6885 [  --disable-profile-guided-optimization
6886                            Don't build with PGO even if called via make profiledbuild],
6887 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6888 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6890 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6892 _SAVE_CFLAGS="$CFLAGS"
6893 CFLAGS="$CFLAGS -fprofile-generate"
6895 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6896 AC_TRY_COMPILE([], [return 0;],
6897                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6898                  result="yes" ], result="no")
6899 AC_MSG_RESULT([$result])
6901 if test $result = "yes"; then
6902   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6903   PROFILE_USE_CFLAGS="-fprofile-use"
6904   PROFILE_USE_LDFLAGS="-fprofile-use"
6905 else
6906   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6907   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6908   AC_TRY_COMPILE([], [return 0;],
6909                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6910                    result="yes" ], result="no")
6911   AC_MSG_RESULT([$result])
6912   if test $result = "yes"; then
6913     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6914   fi
6915   # don't really care, this is an old GCC
6916   PROFILE_GEN_LDFLAGS=
6917   PROFILE_USE_LDFLAGS=
6920 CFLAGS="$_SAVE_CFLAGS"
6922 if test -n "$INTEL_CC"; then
6923   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6924   PROFILE_GEN_LDFLAGS=
6925   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6926   PROFILE_USE_LDFLAGS=
6929 dnl Sun Studio on Solaris
6930 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6931   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6932   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6933   if test "$CPU_ARCH" != "sparc"; then
6934     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6935     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6936   else
6937     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6938     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6939   fi
6942 AC_SUBST(PROFILE_GEN_CFLAGS)
6943 AC_SUBST(PROFILE_GEN_LDFLAGS)
6944 AC_SUBST(PROFILE_USE_CFLAGS)
6945 AC_SUBST(PROFILE_USE_LDFLAGS)
6947 AC_LANG_CPLUSPLUS
6949 dnl ========================================================
6950 dnl Test for -pedantic bustage
6951 dnl ========================================================
6952 MOZ_ARG_DISABLE_BOOL(pedantic,
6953 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6954 _PEDANTIC= )
6955 if test "$_PEDANTIC"; then
6956     _SAVE_CXXFLAGS=$CXXFLAGS
6957     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6958     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6959     AC_TRY_COMPILE([$configure_static_assert_macros],
6960                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6961                    result="no", result="yes" )
6962     AC_MSG_RESULT([$result])
6963     CXXFLAGS="$_SAVE_CXXFLAGS"
6965     case "$result" in
6966     no)
6967         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6968         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6969         ;;
6970     yes)
6971         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
6972         ;;
6973     esac
6976 dnl ========================================================
6977 dnl Test for correct temporary object destruction order
6978 dnl ========================================================
6979 dnl We want to make sure the compiler follows the C++ spec here as 
6980 dnl xpcom and the string classes depend on it (bug 235381).
6981 AC_MSG_CHECKING([for correct temporary object destruction order])
6982 AC_TRY_RUN([ class A {
6983              public:  A(int& x) : mValue(x) {}
6984                       ~A() { mValue--; }
6985                       operator char**() { return 0; }
6986              private:  int& mValue;
6987              };
6988              void func(char **arg) {}
6989              int m=2;
6990              void test() {
6991                   func(A(m));
6992                   if (m==1) m = 0;
6993              }
6994              int main() {
6995                  test();
6996                  return(m);
6997              }
6998              ],
6999      result="yes", result="no", result="maybe")
7000 AC_MSG_RESULT([$result])
7002 if test "$result" = "no"; then
7003     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7006 dnl ========================================================
7007 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7008 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7009 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7010 dnl ========================================================
7011 _SAVE_CXXFLAGS=$CXXFLAGS
7012 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7013 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7014     ac_nscap_nonconst_opeq_bug,
7015     [AC_TRY_COMPILE([
7016                       template <class T>
7017                       class Pointer
7018                         {
7019                         public:
7020                           T* myPtr;
7021                         };
7022                       
7023                       template <class T, class U>
7024                       int operator==(const Pointer<T>& rhs, U* lhs)
7025                         {
7026                           return rhs.myPtr == lhs;
7027                         }
7028                       
7029                       template <class T, class U>
7030                       int operator==(const Pointer<T>& rhs, const U* lhs)
7031                         {
7032                           return rhs.myPtr == lhs;
7033                         }
7034                     ],
7035                     [
7036                       Pointer<int> foo;
7037                       const int* bar;
7038                       return foo == bar;
7039                     ],
7040                     ac_nscap_nonconst_opeq_bug="no",
7041                     ac_nscap_nonconst_opeq_bug="yes")])
7042 CXXFLAGS="$_SAVE_CXXFLAGS"
7044 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7045     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7047 fi # SKIP_COMPILER_CHECKS
7049 dnl ========================================================
7050 dnl C++ rtti
7051 dnl Should be smarter and check that the compiler does indeed have rtti
7052 dnl ========================================================
7053 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7054 [  --enable-cpp-rtti       Enable C++ RTTI ],
7055 [ _MOZ_USE_RTTI=1 ],
7056 [ _MOZ_USE_RTTI= ])
7058 if test "$_MOZ_USE_RTTI"; then
7059    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7060 else
7061    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7064 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7066 dnl ========================================================
7067 dnl C++ exceptions (g++/egcs only - for now)
7068 dnl Should be smarter and check that the compiler does indeed have exceptions
7069 dnl ========================================================
7070 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7071 [  --enable-cpp-exceptions Enable C++ exceptions ],
7072 [ _MOZ_CPP_EXCEPTIONS=1 ],
7073 [ _MOZ_CPP_EXCEPTIONS= ])
7075 if test "$_MOZ_CPP_EXCEPTIONS"; then
7076     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7077 else
7078     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7081 # Irix & OSF native compilers do not like exception declarations 
7082 # when exceptions are disabled
7083 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7084     AC_DEFINE(CPP_THROW_NEW, [])
7085 else
7086     AC_DEFINE(CPP_THROW_NEW, [throw()])
7088 AC_LANG_C
7090 dnl ========================================================
7091 dnl =
7092 dnl = Build depencency options
7093 dnl =
7094 dnl ========================================================
7095 MOZ_ARG_HEADER(Build dependencies)
7097 dnl ========================================================
7098 dnl = Do not auto generate dependency info
7099 dnl ========================================================
7100 MOZ_AUTO_DEPS=1
7101 MOZ_ARG_DISABLE_BOOL(auto-deps,
7102 [  --disable-auto-deps     Do not automatically generate dependency info],
7103     MOZ_AUTO_DEPS=,
7104     MOZ_AUTO_DEPS=1)
7106 if test -n "$MOZ_AUTO_DEPS"; then
7107 dnl ========================================================
7108 dnl = Use mkdepend instead of $CC -MD for dependency generation
7109 dnl ========================================================
7110 _cpp_md_flag=
7111 MOZ_ARG_DISABLE_BOOL(md,
7112 [  --disable-md            Do not use compiler-based dependencies ],
7113   [_cpp_md_flag=],
7114   [_cpp_md_flag=1],
7115   [dnl Default is to turn on -MD if using GNU-compatible compilers
7116    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7117      _cpp_md_flag=1
7118    fi
7119   dnl Default is to use -xM if using Sun Studio on Solaris
7120    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7121      _cpp_md_flag=1
7122    fi])
7123 if test "$_cpp_md_flag"; then
7124   COMPILER_DEPEND=1
7125   if test "$OS_ARCH" = "OpenVMS"; then
7126     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7127   else
7128     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7129   fi
7130   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7131   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7132     _DEPEND_CFLAGS=
7133   fi
7134 else
7135   COMPILER_DEPEND=
7136   _USE_CPP_INCLUDE_FLAG=
7137   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7138   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7140 fi # MOZ_AUTO_DEPS
7141 MDDEPDIR='.deps'
7142 AC_SUBST(MOZ_AUTO_DEPS)
7143 AC_SUBST(COMPILER_DEPEND)
7144 AC_SUBST(MDDEPDIR)
7147 dnl ========================================================
7148 dnl =
7149 dnl = Static Build Options
7150 dnl =
7151 dnl ========================================================
7152 MOZ_ARG_HEADER(Static build options)
7154 MOZ_ARG_ENABLE_BOOL(static,
7155 [  --enable-static         Enable building of internal static libs],
7156     BUILD_STATIC_LIBS=1,
7157     BUILD_STATIC_LIBS=)
7159 dnl Disable libxul in debug builds, but not for xulrunner.
7160 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7161    MOZ_ENABLE_LIBXUL=
7164 MOZ_ARG_ENABLE_BOOL(libxul,
7165 [  --enable-libxul         Enable building of libxul],
7166     MOZ_ENABLE_LIBXUL=1,
7167     MOZ_ENABLE_LIBXUL=)
7169 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7170         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7173 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7174         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7177 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
7178         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
7181 if test -n "$MOZ_ENABLE_LIBXUL"; then
7182     XPCOM_LIBS="$LIBXUL_LIBS"
7183     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7184 else
7185     if test -n "$BUILD_STATIC_LIBS"; then
7186         AC_DEFINE(MOZ_STATIC_BUILD)
7187     fi
7188     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7191 dnl ========================================================
7192 dnl = Force JS to be a static lib
7193 dnl ========================================================
7194 MOZ_ARG_ENABLE_BOOL(js-static-build,
7195 [  --enable-js-static-build  Force js to be a static lib],
7196     JS_STATIC_BUILD=1,
7197     JS_STATIC_BUILD= )
7199 AC_SUBST(JS_STATIC_BUILD)
7200         
7201 if test -n "$JS_STATIC_BUILD"; then
7202     AC_DEFINE(EXPORT_JS_API)
7204 if test -z "$BUILD_STATIC_LIBS"; then
7205     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
7210 dnl ========================================================
7211 dnl =
7212 dnl = Standalone module options
7213 dnl = 
7214 dnl ========================================================
7215 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7217 dnl Check for GLib and libIDL.
7218 dnl ========================================================
7219 case "$target_os" in
7220 msvc*|mks*|cygwin*|mingw*|wince*)
7221     SKIP_IDL_CHECK="yes"
7222     ;;
7224     SKIP_IDL_CHECK="no"
7225     ;;
7226 esac
7228 if test -z "$COMPILE_ENVIRONMENT"; then
7229     SKIP_IDL_CHECK="yes"
7232 dnl = Allow users to disable libIDL checking for standalone modules
7233 MOZ_ARG_WITHOUT_BOOL(libIDL,
7234 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7235         SKIP_IDL_CHECK="yes")
7237 if test "$SKIP_IDL_CHECK" = "no"
7238 then
7239     _LIBIDL_FOUND=
7240     if test "$MACOS_SDK_DIR"; then 
7241       dnl xpidl, and therefore libIDL, is only needed on the build host.
7242       dnl Don't build it against the SDK, as that causes problems.
7243       _MACSAVE_CFLAGS="$CFLAGS"
7244       _MACSAVE_LIBS="$LIBS"
7245       _MACSAVE_LDFLAGS="$LDFLAGS"
7246       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7247       changequote(,)
7248       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"`
7249       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7250       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7251       changequote([,])
7252       unset NEXT_ROOT
7253     fi
7255     if test "$MOZ_ENABLE_GTK2"; then
7256         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7257     fi
7258     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7259     dnl to either libIDL1 or libIDL2.
7260     if test -z "$_LIBIDL_FOUND"; then
7261         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7262         if test -z "$_LIBIDL_FOUND"; then
7263             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7264         fi
7265     fi
7266     dnl
7267     dnl If we don't have a libIDL config program & not cross-compiling, 
7268     dnl     look for orbit-config instead.
7269     dnl
7270     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7271         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7272         if test -n "$ORBIT_CONFIG"; then
7273             AC_MSG_CHECKING([for ORBit libIDL usability])
7274                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7275             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7276             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7277             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7278             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7279             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7280             LIBIDL_CONFIG=
7281             _SAVE_CFLAGS="$CFLAGS"
7282             _SAVE_LIBS="$LIBS"
7283             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7284             LIBS="$LIBIDL_LIBS $LIBS"
7285             AC_TRY_RUN([
7286 #include <stdlib.h>
7287 #include <libIDL/IDL.h>
7288 int main() {
7289   char *s;
7290   s=strdup(IDL_get_libver_string());
7291   if(s==NULL) {
7292     exit(1);
7293   }
7294   exit(0);
7296             ], [_LIBIDL_FOUND=1
7297                 result="yes"],
7298                [LIBIDL_CFLAGS=
7299                 LIBIDL_LIBS=
7300                 result="no"],
7301                [_LIBIDL_FOUND=1
7302                 result="maybe"] )
7303             AC_MSG_RESULT($result)
7304             CFLAGS="$_SAVE_CFLAGS"
7305             LIBS="$_SAVE_LIBS"
7306         fi
7307     fi
7308     if test -z "$_LIBIDL_FOUND"; then
7309         AC_MSG_ERROR([libIDL not found.
7310         libIDL $LIBIDL_VERSION or higher is required.])
7311     fi
7312     if test "$MACOS_SDK_DIR"; then
7313       CFLAGS="$_MACSAVE_CFLAGS"
7314       LIBS="$_MACSAVE_LIBS"
7315       LDFLAGS="$_MACSAVE_LDFLAGS"
7316       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7317         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7318       fi
7319     fi
7322 if test -n "$CROSS_COMPILE"; then
7323      if test -z "$HOST_LIBIDL_CONFIG"; then
7324         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7325     fi
7326     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7327         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7328         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7329     else
7330         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7331         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7332     fi
7335 if test -z "$SKIP_PATH_CHECKS"; then
7336 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7337     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7338         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7339     else
7340         AM_PATH_GLIB(${GLIB_VERSION})
7341     fi
7345 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7346     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7349 AC_SUBST(LIBIDL_CFLAGS)
7350 AC_SUBST(LIBIDL_LIBS)
7351 AC_SUBST(STATIC_LIBIDL)
7352 AC_SUBST(GLIB_CFLAGS)
7353 AC_SUBST(GLIB_LIBS)
7354 AC_SUBST(GLIB_GMODULE_LIBS)
7355 AC_SUBST(HOST_LIBIDL_CONFIG)
7356 AC_SUBST(HOST_LIBIDL_CFLAGS)
7357 AC_SUBST(HOST_LIBIDL_LIBS)
7359 dnl ========================================================
7360 dnl Check for libart
7361 dnl ========================================================
7362 if test "$MOZ_SVG_RENDERER_LIBART"; then
7363   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
7364     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
7365 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
7366   fi
7368   dnl libart's configure hasn't been run yet, but we know what the
7369   dnl answer should be anyway
7370   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
7371   case "$target_os" in
7372   msvc*|mks*|cygwin*|mingw*|wince*)
7373       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
7374       ;;
7375   os2*)
7376       MOZ_LIBART_LIBS='-lmoz_art -lm'
7377       ;;
7378   beos*)
7379       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
7380       ;;
7381   *)
7382       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
7383       ;;
7384   esac
7385   AC_FUNC_ALLOCA
7388 AC_SUBST(MOZ_LIBART_CFLAGS)
7389 AC_SUBST(MOZ_LIBART_LIBS)
7391 dnl ========================================================
7392 dnl Check for cairo
7393 dnl ========================================================
7394 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7396 MOZ_TREE_CAIRO=1
7397 MOZ_ARG_ENABLE_BOOL(system-cairo,
7398 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7399 MOZ_TREE_CAIRO=,
7400 MOZ_TREE_CAIRO=1 )
7402 # Check for headers defining standard int types.
7403 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7405 if test "$MOZ_TREE_CAIRO"; then
7406     AC_DEFINE(MOZ_TREE_CAIRO)
7408     # For now we assume that we will have a uint64_t available through
7409     # one of the above headers or mozstdint.h.
7410     AC_DEFINE(HAVE_UINT64_T)
7412     # Define macros for cairo-features.h
7413     if test "$MOZ_X11"; then
7414         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7415         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7416         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7417         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7418         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7419         MOZ_ENABLE_CAIRO_FT=1
7420         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7421     fi
7422     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7423         QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7424     fi
7425     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7426         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7427         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7428         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7429     fi
7430     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7431         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7432         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7433         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7434     fi
7435     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7436         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7437         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7438         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7439         MOZ_ENABLE_CAIRO_FT=1
7440         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7441         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7442     fi
7443     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7444         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7445         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7446         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7447         MOZ_ENABLE_CAIRO_FT=1
7448     fi
7449     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7450     AC_SUBST(CAIRO_FT_CFLAGS)
7452     if test "$MOZ_DEBUG"; then
7453       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7454     else
7455       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7456     fi
7458     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7460     AC_SUBST(PS_SURFACE_FEATURE)
7461     AC_SUBST(PDF_SURFACE_FEATURE)
7462     AC_SUBST(SVG_SURFACE_FEATURE)
7463     AC_SUBST(XLIB_SURFACE_FEATURE)
7464     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7465     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7466     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7467     AC_SUBST(XCB_SURFACE_FEATURE)
7468     AC_SUBST(WIN32_SURFACE_FEATURE)
7469     AC_SUBST(OS2_SURFACE_FEATURE)
7470     AC_SUBST(BEOS_SURFACE_FEATURE)
7471     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7472     AC_SUBST(FT_FONT_FEATURE)
7473     AC_SUBST(WIN32_FONT_FEATURE)
7474     AC_SUBST(QUARTZ_FONT_FEATURE)
7475     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7476     AC_SUBST(QPAINTER_SURFACE_FEATURE)
7478     if test "$_WIN32_MSVC"; then
7479         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7480     else
7481         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"
7483         if test "$MOZ_X11"; then
7484             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7485         fi
7486     fi
7488     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7489     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7491 else
7492    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7493    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7494    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7495    if test "$MOZ_X11"; then
7496         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7497         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7498         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7499    fi
7502 AC_SUBST(MOZ_TREE_CAIRO)
7503 AC_SUBST(MOZ_CAIRO_CFLAGS)
7504 AC_SUBST(MOZ_CAIRO_LIBS)
7506 dnl ========================================================
7507 dnl Check for lcms
7508 dnl ========================================================
7510 MOZ_NATIVE_LCMS=
7511 MOZ_ARG_ENABLE_BOOL(system-lcms,
7512 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7513 MOZ_NATIVE_LCMS=1,
7514 MOZ_NATIVE_LCMS= )
7516 if test -z "$MOZ_NATIVE_LCMS"
7517 then
7518     LCMS_CFLAGS=
7519     if test "$_WIN32_MSVC"; then
7520         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7521             LCMS_CFLAGS=-DLCMS_DLL
7522         fi
7523         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7524     else
7525         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7526     fi
7527 else
7528     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7531 AC_SUBST(MOZ_NATIVE_LCMS)
7532 AC_SUBST(LCMS_CFLAGS)
7533 AC_SUBST(LCMS_LIBS)
7535 dnl ========================================================
7536 dnl disable xul
7537 dnl ========================================================
7538 MOZ_ARG_DISABLE_BOOL(xul,
7539 [  --disable-xul           Disable XUL],
7540     MOZ_XUL= )
7541 if test "$MOZ_XUL"; then
7542   AC_DEFINE(MOZ_XUL)
7543 else
7544   dnl remove extensions that require XUL
7545   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7548 AC_SUBST(MOZ_XUL)
7550 dnl ========================================================
7551 dnl Two ways to enable Python support:
7552 dnl   --enable-extensions=python # select all available.
7553 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7554 dnl or:
7555 dnl   --enable-extensions=python/xpcom,... # select individual ones
7557 dnl If either is used, we locate the Python to use.
7558 dnl ========================================================
7560 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7561 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7562     dnl Allow PYTHON to point to the Python interpreter to use
7563     dnl (note that it must be the python executable - which we
7564     dnl run to locate the relevant paths etc)
7565     dnl If not set, we use whatever Python we can find.
7566     MOZ_PYTHON=$PYTHON
7567     dnl Ask Python what its version number is
7568     changequote(,)
7569     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7570     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7571     changequote([,])
7572     dnl Ask for the Python "prefix" (ie, home/source dir)
7573     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7574     dnl Setup the include and library directories.
7575     if test "$OS_ARCH" = "WINNT"; then
7576         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7577         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7578         dnl Binary trees have "include" for .h, and "libs" for .lib
7579         dnl We add 'em both - along with quotes, to handle spaces.
7580         MOZ_PYTHON_DLL_SUFFIX=.pyd
7581         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7582         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7583     else
7584         dnl Non-Windows include and libs
7585         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7586         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7587         dnl Check for dynamic Python lib
7588         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7589         dnl - core, xpcom loader, pydom etc) all need to share Python.
7590         dnl - Python 2.3's std --enable-shared configure option will
7591         dnl   create a libpython2.3.so.1.0. We should first try this
7592         dnl   dotted versioned .so file because this is the one that
7593         dnl   the PyXPCOM build mechanics tries to link to.
7594         dnl   XXX Should find a better way than hardcoding "1.0".
7595         dnl - Python developement tree dir layouts are NOT allowed here
7596         dnl   because the PyXPCOM build just dies on it later anyway.
7597         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7598         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7599             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7600         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7601             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7602         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7603             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7604         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7605             dnl Don't Python development tree directory layout.
7606             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7607             AC_MSG_ERROR([The Python at $MOZ_PYTHON_PREFIX looks like a dev tree. The PyXPCOM build cannot handle this yet. You must 'make install' Python and use the installed tree.])
7608         elif test "$OS_ARCH" = "Darwin"; then
7609             dnl We do Darwin last, so if a custom non-framework build of
7610             dnl python is used on OSX, then it will be picked up first by
7611             dnl the logic above.
7612             MOZ_PYTHON_LIBS="-framework Python"
7613         else
7614             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7615         fi
7616         if test "$OS_ARCH" = "Linux"; then
7617             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7618         fi
7619     fi
7620     dnl Handle "_d" on Windows
7621     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7622         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7623     else
7624         MOZ_PYTHON_DEBUG_SUFFIX=
7625     fi
7626     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7629 dnl If the user asks for the 'python' extension, then we add
7630 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7631 dnl Note the careful regex - it must match 'python' followed by anything
7632 dnl other than a '/', including the end-of-string.
7633 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7634     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7635         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7636     done
7638 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7639 dnl command-line, but not yet
7640 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7641 AC_SUBST(MOZ_PYTHON)
7642 AC_SUBST(MOZ_PYTHON_PREFIX)
7643 AC_SUBST(MOZ_PYTHON_INCLUDES)
7644 AC_SUBST(MOZ_PYTHON_LIBS)
7645 AC_SUBST(MOZ_PYTHON_VER)
7646 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7647 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7648 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7650 dnl ========================================================
7651 dnl disable profile locking
7652 dnl   do no use this in applications that can have more than
7653 dnl   one process accessing the profile directory.
7654 dnl ========================================================
7655 MOZ_ARG_DISABLE_BOOL(profilelocking,
7656 [  --disable-profilelocking           Disable profile locking],
7657     MOZ_PROFILELOCKING=,
7658     MOZ_PROFILELOCKING=1 )
7659 if test "$MOZ_PROFILELOCKING"; then
7660   AC_DEFINE(MOZ_PROFILELOCKING)
7663 dnl ========================================================
7664 dnl disable rdf services
7665 dnl ========================================================
7666 MOZ_ARG_DISABLE_BOOL(rdf,
7667 [  --disable-rdf           Disable RDF],
7668     MOZ_RDF= )
7669 if test "$MOZ_RDF"; then
7670   AC_DEFINE(MOZ_RDF)
7673 AC_SUBST(MOZ_RDF)
7675 dnl ========================================================
7676 dnl necko configuration options
7677 dnl ========================================================
7680 dnl option to disable various necko protocols
7682 MOZ_ARG_ENABLE_STRING(necko-protocols,
7683 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7684                           Enable/disable specific protocol handlers],
7685 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7686     if test "$option" = "yes" || test "$option" = "all"; then
7687         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7688     elif test "$option" = "no" || test "$option" = "none"; then
7689         NECKO_PROTOCOLS=""
7690     elif test "$option" = "default"; then
7691         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7692     elif test `echo "$option" | grep -c \^-` != 0; then
7693         option=`echo $option | sed 's/^-//'`
7694         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7695     else
7696         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7697     fi
7698 done],
7699     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7700 dnl Remove dupes
7701 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7702 AC_SUBST(NECKO_PROTOCOLS)
7703 for p in $NECKO_PROTOCOLS; do
7704     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7705 done
7708 dnl option to disable necko's disk cache
7710 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7711 [  --disable-necko-disk-cache
7712                           Disable necko disk cache],
7713     NECKO_DISK_CACHE=,
7714     NECKO_DISK_CACHE=1)
7715 AC_SUBST(NECKO_DISK_CACHE)
7716 if test "$NECKO_DISK_CACHE"; then
7717     AC_DEFINE(NECKO_DISK_CACHE)
7721 dnl option to minimize size of necko's i/o buffers
7723 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7724 [  --enable-necko-small-buffers
7725                           Minimize size of necko's i/o buffers],
7726     NECKO_SMALL_BUFFERS=1,
7727     NECKO_SMALL_BUFFERS=)
7728 AC_SUBST(NECKO_SMALL_BUFFERS)
7729 if test "$NECKO_SMALL_BUFFERS"; then
7730     AC_DEFINE(NECKO_SMALL_BUFFERS)
7731 fi 
7734 dnl option to disable cookies
7736 MOZ_ARG_DISABLE_BOOL(cookies,
7737 [  --disable-cookies       Disable cookie support],
7738     NECKO_COOKIES=,
7739     NECKO_COOKIES=1)
7740 AC_SUBST(NECKO_COOKIES)
7741 if test "$NECKO_COOKIES"; then
7742     AC_DEFINE(NECKO_COOKIES)
7745 dnl NECKO_ configuration options are not global
7746 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7748 dnl Only build Mork if it's required
7749 AC_SUBST(MOZ_MORK)
7750 if test "$MOZ_MORK"; then
7751   AC_DEFINE(MOZ_MORK)
7754 dnl Build the lightweight Mork reader if required
7755 AC_SUBST(MOZ_MORKREADER)
7756 if test "$MOZ_MORKREADER"; then
7757   AC_DEFINE(MOZ_MORKREADER)
7760 dnl ========================================================
7761 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7762     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7765 dnl ========================================================
7766 dnl =
7767 dnl = Maintainer debug option (no --enable equivalent)
7768 dnl =
7769 dnl ========================================================
7771 AC_SUBST(AR)
7772 AC_SUBST(AR_FLAGS)
7773 AC_SUBST(AR_LIST)
7774 AC_SUBST(AR_EXTRACT)
7775 AC_SUBST(AR_DELETE)
7776 AC_SUBST(AS)
7777 AC_SUBST(ASFLAGS)
7778 AC_SUBST(AS_DASH_C_FLAG)
7779 AC_SUBST(LD)
7780 AC_SUBST(RC)
7781 AC_SUBST(RCFLAGS)
7782 AC_SUBST(WINDRES)
7783 AC_SUBST(USE_SHORT_LIBNAME)
7784 AC_SUBST(IMPLIB)
7785 AC_SUBST(FILTER)
7786 AC_SUBST(BIN_FLAGS)
7787 AC_SUBST(NS_USE_NATIVE)
7788 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7789 AC_SUBST(MOZ_GFX_TOOLKIT)
7790 AC_SUBST(MOZ_UPDATE_XTERM)
7791 AC_SUBST(MINIMO)
7792 AC_SUBST(MOZ_PLATFORM_HILDON)
7793 AC_SUBST(NS_OSSO)
7794 AC_SUBST(NS_MAEMO_LOCATION)
7795 AC_SUBST(MOZ_AUTH_EXTENSION)
7796 AC_SUBST(MOZ_MATHML)
7797 AC_SUBST(MOZ_PERMISSIONS)
7798 AC_SUBST(MOZ_XTF)
7799 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7800 AC_SUBST(MOZ_PREF_EXTENSIONS)
7801 AC_SUBST(MOZ_SVG)
7802 AC_SUBST(MOZ_XSLT_STANDALONE)
7803 AC_SUBST(MOZ_JS_LIBS)
7804 AC_SUBST(MOZ_PSM)
7805 AC_SUBST(MOZ_DEBUG)
7806 AC_SUBST(MOZ_DEBUG_MODULES)
7807 AC_SUBST(MOZ_PROFILE_MODULES)
7808 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7809 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7810 AC_SUBST(MOZ_DEBUG_FLAGS)
7811 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7812 AC_SUBST(WARNINGS_AS_ERRORS)
7813 AC_SUBST(MOZ_DBGRINFO_MODULES)
7814 AC_SUBST(MOZ_EXTENSIONS)
7815 AC_SUBST(MOZ_IMG_DECODERS)
7816 AC_SUBST(MOZ_IMG_ENCODERS)
7817 AC_SUBST(MOZ_JSDEBUGGER)
7818 AC_SUBST(MOZ_OJI)
7819 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7820 AC_SUBST(MOZ_PLUGINS)
7821 AC_SUBST(ENABLE_EAZEL_PROFILER)
7822 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7823 AC_SUBST(EAZEL_PROFILER_LIBS)
7824 AC_SUBST(MOZ_PERF_METRICS)
7825 AC_SUBST(GC_LEAK_DETECTOR)
7826 AC_SUBST(MOZ_LOG_REFCNT)
7827 AC_SUBST(MOZ_LEAKY)
7828 AC_SUBST(MOZ_JPROF)
7829 AC_SUBST(MOZ_SHARK)
7830 AC_SUBST(MOZ_CALLGRIND)
7831 AC_SUBST(MOZ_VTUNE)
7832 AC_SUBST(MOZ_XPCTOOLS)
7833 AC_SUBST(MOZ_JSLOADER)
7834 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7835 AC_SUBST(MOZ_INSURE)
7836 AC_SUBST(MOZ_INSURE_DIRS)
7837 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7838 AC_SUBST(MOZ_QUANTIFY)
7839 AC_SUBST(MOZ_INSURIFYING)
7840 AC_SUBST(LIBICONV)
7841 AC_SUBST(MOZ_PLACES)
7842 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7843 AC_SUBST(MOZ_STORAGE)
7844 AC_SUBST(MOZ_FEEDS)
7845 AC_SUBST(NS_PRINTING)
7847 AC_SUBST(MOZ_JAVAXPCOM)
7848 AC_SUBST(JAVA_INCLUDE_PATH)
7849 AC_SUBST(JAVA)
7850 AC_SUBST(JAVAC)
7851 AC_SUBST(JAR)
7853 AC_SUBST(MOZ_PROFILELOCKING)
7855 AC_SUBST(HAVE_XIE)
7856 AC_SUBST(MOZ_XIE_LIBS)
7857 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7859 AC_SUBST(XPCOM_USE_LEA)
7860 AC_SUBST(BUILD_STATIC_LIBS)
7861 AC_SUBST(MOZ_ENABLE_LIBXUL)
7862 AC_SUBST(ENABLE_TESTS)
7863 AC_SUBST(IBMBIDI)
7864 AC_SUBST(MOZ_UNIVERSALCHARDET)
7865 AC_SUBST(ACCESSIBILITY)
7866 AC_SUBST(MOZ_XPINSTALL)
7867 AC_SUBST(MOZ_VIEW_SOURCE)
7868 AC_SUBST(MOZ_SPELLCHECK)
7869 AC_SUBST(MOZ_XPFE_COMPONENTS)
7870 AC_SUBST(MOZ_USER_DIR)
7871 AC_SUBST(MOZ_CRASHREPORTER)
7873 AC_SUBST(ENABLE_STRIP)
7874 AC_SUBST(PKG_SKIP_STRIP)
7875 AC_SUBST(USE_ELF_DYNSTR_GC)
7876 AC_SUBST(INCREMENTAL_LINKER)
7877 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7878 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7879 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7881 AC_SUBST(MOZ_FIX_LINK_PATHS)
7882 AC_SUBST(XPCOM_LIBS)
7883 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7884 AC_SUBST(XPCOM_GLUE_LDOPTS)
7885 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7887 AC_SUBST(USE_DEPENDENT_LIBS)
7889 AC_SUBST(MOZ_BUILD_ROOT)
7890 AC_SUBST(MOZ_OS2_TOOLS)
7891 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7893 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7894 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7895 AC_SUBST(MOZ_TIMELINE)
7896 AC_SUBST(WINCE)
7897 AC_SUBST(WINCE_SDK)
7898 AC_SUBST(TARGET_DEVICE)
7900 AC_SUBST(MOZ_APP_NAME)
7901 AC_SUBST(MOZ_APP_DISPLAYNAME)
7902 AC_SUBST(MOZ_APP_VERSION)
7903 AC_SUBST(FIREFOX_VERSION)
7905 AC_SUBST(MOZ_PKG_SPECIAL)
7907 AC_SUBST(MOZILLA_OFFICIAL)
7908 AC_SUBST(BUILD_OFFICIAL)
7909 AC_SUBST(MOZ_MILESTONE_RELEASE)
7911 dnl win32 options
7912 AC_SUBST(MOZ_PROFILE)
7913 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7914 AC_SUBST(MOZ_MAPINFO)
7915 AC_SUBST(MOZ_BROWSE_INFO)
7916 AC_SUBST(MOZ_TOOLS_DIR)
7917 AC_SUBST(CYGWIN_WRAPPER)
7918 AC_SUBST(AS_PERL)
7919 AC_SUBST(WIN32_REDIST_DIR)
7920 AC_SUBST(PYTHON)
7922 dnl Echo the CFLAGS to remove extra whitespace.
7923 CFLAGS=`echo \
7924         $_WARNINGS_CFLAGS \
7925         $CFLAGS`
7927 CXXFLAGS=`echo \
7928         $_MOZ_RTTI_FLAGS \
7929         $_MOZ_EXCEPTIONS_FLAGS \
7930         $_WARNINGS_CXXFLAGS \
7931         $CXXFLAGS`
7933 COMPILE_CFLAGS=`echo \
7934     $_DEFINES_CFLAGS \
7935         $_DEPEND_CFLAGS \
7936     $COMPILE_CFLAGS`
7938 COMPILE_CXXFLAGS=`echo \
7939     $_DEFINES_CXXFLAGS \
7940         $_DEPEND_CFLAGS \
7941     $COMPILE_CXXFLAGS`
7943 AC_SUBST(SYSTEM_MAKEDEPEND)
7944 AC_SUBST(SYSTEM_JPEG)
7945 AC_SUBST(SYSTEM_PNG)
7946 AC_SUBST(SYSTEM_ZLIB)
7947 AC_SUBST(SYSTEM_BZ2)
7949 AC_SUBST(JPEG_CFLAGS)
7950 AC_SUBST(JPEG_LIBS)
7951 AC_SUBST(ZLIB_CFLAGS)
7952 AC_SUBST(ZLIB_LIBS)
7953 AC_SUBST(BZ2_CFLAGS)
7954 AC_SUBST(BZ2_LIBS)
7955 AC_SUBST(PNG_CFLAGS)
7956 AC_SUBST(PNG_LIBS)
7958 AC_SUBST(MOZ_JPEG_CFLAGS)
7959 AC_SUBST(MOZ_JPEG_LIBS)
7960 AC_SUBST(MOZ_ZLIB_CFLAGS)
7961 AC_SUBST(MOZ_ZLIB_LIBS)
7962 AC_SUBST(MOZ_BZ2_CFLAGS)
7963 AC_SUBST(MOZ_BZ2_LIBS)
7964 AC_SUBST(MOZ_PNG_CFLAGS)
7965 AC_SUBST(MOZ_PNG_LIBS)
7967 AC_SUBST(NSPR_CFLAGS)
7968 AC_SUBST(NSPR_LIBS)
7969 AC_SUBST(MOZ_NATIVE_NSPR)
7971 AC_SUBST(NSS_CFLAGS)
7972 AC_SUBST(NSS_LIBS)
7973 AC_SUBST(NSS_DEP_LIBS)
7974 AC_SUBST(MOZ_NATIVE_NSS)
7975 AC_SUBST(NSS_DISABLE_DBM)
7977 AC_SUBST(CFLAGS)
7978 AC_SUBST(CXXFLAGS)
7979 AC_SUBST(CPPFLAGS)
7980 AC_SUBST(COMPILE_CFLAGS)
7981 AC_SUBST(COMPILE_CXXFLAGS)
7982 AC_SUBST(LDFLAGS)
7983 AC_SUBST(LIBS)
7984 AC_SUBST(CROSS_COMPILE)
7985 AC_SUBST(WCHAR_CFLAGS)
7987 AC_SUBST(HOST_CC)
7988 AC_SUBST(HOST_CXX)
7989 AC_SUBST(HOST_CFLAGS)
7990 AC_SUBST(HOST_CXXFLAGS)
7991 AC_SUBST(HOST_OPTIMIZE_FLAGS)
7992 AC_SUBST(HOST_AR)
7993 AC_SUBST(HOST_AR_FLAGS)
7994 AC_SUBST(HOST_LD)
7995 AC_SUBST(HOST_RANLIB)
7996 AC_SUBST(HOST_NSPR_MDCPUCFG)
7997 AC_SUBST(HOST_BIN_SUFFIX)
7998 AC_SUBST(HOST_OS_ARCH)
8000 AC_SUBST(TARGET_CPU)
8001 AC_SUBST(TARGET_VENDOR)
8002 AC_SUBST(TARGET_OS)
8003 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8004 AC_SUBST(TARGET_MD_ARCH)
8005 AC_SUBST(TARGET_XPCOM_ABI)
8006 AC_SUBST(OS_TARGET)
8007 AC_SUBST(OS_ARCH)
8008 AC_SUBST(OS_RELEASE)
8009 AC_SUBST(OS_TEST)
8011 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8012 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8014 AC_SUBST(WRAP_MALLOC_CFLAGS)
8015 AC_SUBST(WRAP_MALLOC_LIB)
8016 AC_SUBST(MKSHLIB)
8017 AC_SUBST(MKCSHLIB)
8018 AC_SUBST(MKSHLIB_FORCE_ALL)
8019 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8020 AC_SUBST(DSO_CFLAGS)
8021 AC_SUBST(DSO_PIC_CFLAGS)
8022 AC_SUBST(DSO_LDOPTS)
8023 AC_SUBST(LIB_PREFIX)
8024 AC_SUBST(DLL_PREFIX)
8025 AC_SUBST(DLL_SUFFIX)
8026 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8027 AC_SUBST(LIB_SUFFIX)
8028 AC_SUBST(OBJ_SUFFIX)
8029 AC_SUBST(BIN_SUFFIX)
8030 AC_SUBST(ASM_SUFFIX)
8031 AC_SUBST(IMPORT_LIB_SUFFIX)
8032 AC_SUBST(USE_N32)
8033 AC_SUBST(CC_VERSION)
8034 AC_SUBST(CXX_VERSION)
8035 AC_SUBST(MSMANIFEST_TOOL)
8037 if test "$USING_HCC"; then
8038    CC='${topsrcdir}/build/hcc'
8039    CC="$CC '$_OLDCC'"
8040    CXX='${topsrcdir}/build/hcpp'
8041    CXX="$CXX '$_OLDCXX'"
8042    AC_SUBST(CC)
8043    AC_SUBST(CXX)
8046 dnl Check for missing components
8047 if test "$COMPILE_ENVIRONMENT"; then
8048 if test "$MOZ_X11"; then
8049     dnl ====================================================
8050     dnl = Check if X headers exist
8051     dnl ====================================================
8052     _SAVE_CFLAGS=$CFLAGS
8053     CFLAGS="$CFLAGS $XCFLAGS"
8054     AC_TRY_COMPILE([
8055         #include <stdio.h>
8056         #include <stdlib.h>
8057         #include <X11/Xlib.h>
8058         #include <X11/Intrinsic.h>
8059     ],
8060     [
8061         Display *dpy = 0;
8062         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8063             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8064             exit(1);
8065         }
8066     ], [], 
8067     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8068     CFLAGS="$_SAVE_CFLAGS"
8070     if test ! -z "$MISSING_X"; then
8071         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8072     fi
8074 fi # MOZ_X11
8075 fi # COMPILE_ENVIRONMENT
8077 dnl Set various defines and substitutions
8078 dnl ========================================================
8080 if test "$OS_ARCH" = "BeOS"; then
8081   AC_DEFINE(XP_BEOS)
8082   MOZ_MOVEMAIL=1
8083 elif test "$OS_ARCH" = "Darwin"; then
8084   AC_DEFINE(XP_UNIX)
8085   AC_DEFINE(UNIX_ASYNC_DNS)
8086   MOZ_MOVEMAIL=1
8087 elif test "$OS_ARCH" = "OpenVMS"; then
8088   AC_DEFINE(XP_UNIX)
8089 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8090   AC_DEFINE(XP_UNIX)
8091   AC_DEFINE(UNIX_ASYNC_DNS)
8092   MOZ_MOVEMAIL=1
8094 AC_SUBST(MOZ_MOVEMAIL)
8096 if test "$MOZ_DEBUG"; then
8097     AC_DEFINE(MOZ_REFLOW_PERF)
8098     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8101 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8102     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8103     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8104     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8105     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8106     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8107     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8108     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8109     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8112 # Used for LD_LIBRARY_PATH of run_viewer target
8113 LIBS_PATH=
8114 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8115   case $lib_arg in
8116     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8117       * ) ;;
8118   esac
8119 done
8120 AC_SUBST(LIBS_PATH)
8122 dnl ========================================================
8123 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8124 dnl ========================================================
8125 case "$host_os" in
8126 mingw*)
8127     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8128     ;;
8129 cygwin*|msvc*|mks*)
8130     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8131     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8132     CC="\$(CYGWIN_WRAPPER) $CC"
8133     CXX="\$(CYGWIN_WRAPPER) $CXX"
8134     CPP="\$(CYGWIN_WRAPPER) $CPP"
8135     LD="\$(CYGWIN_WRAPPER) $LD"
8136     AS="\$(CYGWIN_WRAPPER) $AS"
8137     RC="\$(CYGWIN_WRAPPER) $RC"
8138     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8139     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8140     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8141     ;;
8142 esac
8144 AC_SUBST(CYGDRIVE_MOUNT)
8145 AC_SUBST(WIN_TOP_SRC)
8147 AC_SUBST(MOZILLA_VERSION)
8149 AC_SUBST(ac_configure_args)
8151 dnl Spit out some output
8152 dnl ========================================================
8154 dnl The following defines are used by xpcom
8155 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8156 CPP_THROW_NEW
8157 HAVE_CPP_2BYTE_WCHAR_T
8158 HAVE_CPP_ACCESS_CHANGING_USING
8159 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8160 HAVE_CPP_BOOL
8161 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8162 HAVE_CPP_EXPLICIT
8163 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8164 HAVE_CPP_NAMESPACE_STD
8165 HAVE_CPP_NEW_CASTS
8166 HAVE_CPP_PARTIAL_SPECIALIZATION
8167 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8168 HAVE_CPP_TYPENAME
8169 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8170 HAVE_STATVFS
8171 NEED_CPP_UNUSED_IMPLEMENTATIONS
8172 NEW_H
8173 HAVE_GETPAGESIZE
8174 HAVE_ICONV
8175 HAVE_ICONV_WITH_CONST_INPUT
8176 HAVE_MBRTOWC
8177 HAVE_SYS_MOUNT_H
8178 HAVE_SYS_VFS_H
8179 HAVE_WCRTOMB
8182 AC_CONFIG_HEADER(
8183 netwerk/necko-config.h
8184 xpcom/xpcom-config.h
8185 xpcom/xpcom-private.h
8188 # Save the defines header file before autoconf removes it.
8189 # (Do not add AC_DEFINE calls after this line.)
8190   _CONFIG_TMP=confdefs-tmp.h
8191   _CONFIG_DEFS_H=mozilla-config.h
8193   cat > $_CONFIG_TMP <<\EOF
8194 /* List of defines generated by configure. Included with preprocessor flag,
8195  * -include, to avoid long list of -D defines on the compile command-line.
8196  * Do not edit.
8197  */
8199 #ifndef _MOZILLA_CONFIG_H_
8200 #define _MOZILLA_CONFIG_H_
8203 _EGREP_PATTERN='^#define ('
8204 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8205     for f in $_NON_GLOBAL_ACDEFINES; do
8206         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8207     done
8209 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8211   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8213   cat >> $_CONFIG_TMP <<\EOF
8215 #endif /* _MOZILLA_CONFIG_H_ */
8219   # Only write mozilla-config.h when something changes (or it doesn't exist)
8220   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8221     rm $_CONFIG_TMP
8222   else
8223     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8224     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8226     echo ==== $_CONFIG_DEFS_H =================================
8227     cat $_CONFIG_DEFS_H
8228   fi
8230 dnl Probably shouldn't call this manually but we always want the output of DEFS
8231 rm -f confdefs.h.save
8232 mv confdefs.h confdefs.h.save
8233 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8234 AC_OUTPUT_MAKE_DEFS()
8235 MOZ_DEFINES=$DEFS
8236 AC_SUBST(MOZ_DEFINES)
8237 rm -f confdefs.h
8238 mv confdefs.h.save confdefs.h
8240 dnl Load the list of Makefiles to generate.
8241 dnl   To add new Makefiles, edit allmakefiles.sh.
8242 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8243 . ${srcdir}/allmakefiles.sh
8244 dnl 
8245 dnl Run a perl script to quickly create the makefiles.
8246 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8247 dnl   for the files it cannot handle correctly. This way, config.status
8248 dnl   will handle these files.
8249 dnl If it fails, nothing is set and config.status will run as usual.
8251 dnl This does not change the $MAKEFILES variable.
8253 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8255 if test -z "${AS_PERL}"; then
8256 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8257 else
8258 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8260 . ./conftest.sh
8261 rm conftest.sh
8263 echo $MAKEFILES > unallmakefiles
8265 AC_OUTPUT($MAKEFILES)
8267 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8268 if test "$CAIRO_FEATURES_H"; then
8269   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8270     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8271   else
8272     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8273   fi
8276 dnl ========================================================
8277 dnl = Setup a nice relatively clean build environment for
8278 dnl = sub-configures.
8279 dnl ========================================================
8280 CC="$_SUBDIR_CC" 
8281 CXX="$_SUBDIR_CXX" 
8282 CFLAGS="$_SUBDIR_CFLAGS" 
8283 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8284 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8285 LDFLAGS="$_SUBDIR_LDFLAGS"
8286 HOST_CC="$_SUBDIR_HOST_CC" 
8287 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8288 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8291 unset MAKEFILES
8292 unset CONFIG_FILES
8294 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8295 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8297 if test -z "$MOZ_NATIVE_NSPR"; then
8298     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8299     if test -z "$MOZ_DEBUG"; then
8300         ac_configure_args="$ac_configure_args --disable-debug"
8301     fi
8302     if test "$MOZ_OPTIMIZE" = "1"; then
8303         ac_configure_args="$ac_configure_args --enable-optimize"
8304     fi
8305     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8306        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8307     fi
8308     if test -n "$HAVE_64BIT_OS"; then
8309         ac_configure_args="$ac_configure_args --enable-64bit"
8310     fi
8311     if test -n "$USE_ARM_KUSER"; then
8312         ac_configure_args="$ac_configure_args --with-arm-kuser"
8313     fi
8314     AC_OUTPUT_SUBDIRS(nsprpub)
8315     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8318 if test -z "$MOZ_NATIVE_NSPR"; then
8319     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8320     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8321     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8322        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8323        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8324        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8325        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8326     fi
8327     rm -f config/autoconf.mk.bak
8330 # Run the SpiderMonkey 'configure' script.
8331 dist=$MOZ_BUILD_ROOT/dist
8332 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8333 ac_configure_args="$ac_configure_args --enable-threadsafe"
8334 if test -z "$MOZ_NATIVE_NSPR"; then
8335     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8336     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8338 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8339 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8340 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8341 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8342 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8343 if test "$MOZ_MEMORY"; then
8344    ac_configure_args="$ac_configure_args --enable-jemalloc"  
8346 AC_OUTPUT_SUBDIRS(js/src)
8347 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8349 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR