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