Bug 327977 ? Password manager overwrites page data for password-only forms. r=gavin
[wine-gecko.git] / configure.in
blobb2343789c1b3fe8b95eb3b19af2b6e91d620e41f
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 GLITZ_VERSION=0.4.0
124 PANGO_VERSION=1.10.0
125 GTK2_VERSION=2.10.0
126 MAKE_VERSION=3.78
127 WINDRES_VERSION=2.14.90
128 W32API_VERSION=3.8
129 GNOMEVFS_VERSION=2.0
130 GNOMEUI_VERSION=2.2.0
131 GCONF_VERSION=1.2.1
132 LIBGNOME_VERSION=2.0
133 STARTUP_NOTIFICATION_VERSION=0.8
134 DBUS_VERSION=0.60
135 LCMS_VERSION=1.17
136 SQLITE_VERSION=3.5.4
138 MSMANIFEST_TOOL=
140 dnl Set various checks
141 dnl ========================================================
142 MISSING_X=
143 AC_PROG_AWK
145 dnl Initialize the Pthread test variables early so they can be
146 dnl  overridden by each platform.
147 dnl ========================================================
148 USE_PTHREADS=
149 _PTHREAD_LDFLAGS=""
151 dnl Do not allow a separate objdir build if a srcdir build exists.
152 dnl ==============================================================
153 _topsrcdir=`cd \`dirname $0\`; pwd`
154 _objdir=`pwd`
156 if test "$_topsrcdir" != "$_objdir"
157 then
158   # Check for a couple representative files in the source tree
159   _conflict_files=
160   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
161     if test -f $file; then
162       _conflict_files="$_conflict_files $file"
163     fi
164   done
165   if test "$_conflict_files"; then
166     echo "***"
167     echo "*   Your source tree contains these files:"
168     for file in $_conflict_files; do
169       echo "*         $file"
170     done
171     cat 1>&2 <<-EOF
172         *   This indicates that you previously built in the source tree.
173         *   A source tree build can confuse the separate objdir build.
174         *
175         *   To clean up the source tree:
176         *     1. cd $_topsrcdir
177         *     2. gmake distclean
178         ***
179         EOF
180     exit 1
181     break
182   fi
184 MOZ_BUILD_ROOT=`pwd`
186 dnl Default to MSVC for win32
187 dnl ==============================================================
188 if test -z "$CROSS_COMPILE"; then
189 case "$target" in
190 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
191     MAKE_VERSION=3.79
192     if test -z "$CC"; then CC=cl; fi
193     if test -z "$CXX"; then CXX=cl; fi
194     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
195     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
196     if test -z "$LD"; then LD=link; fi
197     if test -z "$AS"; then AS=ml; fi
198     if test -z "$MIDL"; then MIDL=midl; fi
199     ;;
200 esac
203 COMPILE_ENVIRONMENT=1
204 MOZ_ARG_ENABLE_BOOL(compile-environment,
205 [  --disable-compile-environment
206                            Disable compiler/library checks.],
207     COMPILE_ENVIRONMENT=1,
208     COMPILE_ENVIRONMENT= )
210 dnl ========================================================
211 dnl Checks for compilers.
212 dnl ========================================================
213 dnl Set CROSS_COMPILE in the environment when running configure
214 dnl to use the cross-compile setup for now
215 dnl ========================================================
217 if test "$COMPILE_ENVIRONMENT"; then
219 dnl Do some special WinCE toolchain stuff
220 case "$target" in
221 *wince)
222     echo -----------------------------------------------------------------------------
223     echo Building Windows CE Shunt Library and Tool Chain
224     echo -----------------------------------------------------------------------------
226     ac_exeext=.exe
228     echo -n "#define TOPSRCDIR \"" > $srcdir/build/wince/tools/topsrcdir.h
229     echo `cd "$_topsrcdir" && pwd -W | tr '\n' '\"'` >> $srcdir/build/wince/tools/topsrcdir.h
230     make -C $srcdir/build/wince/tools
231     echo -----------------------------------------------------------------------------
232     ;;
233 esac
235 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
236     echo "cross compiling from $host to $target"
237     cross_compiling=yes
239     _SAVE_CC="$CC"
240     _SAVE_CFLAGS="$CFLAGS"
241     _SAVE_LDFLAGS="$LDFLAGS"
243     AC_MSG_CHECKING([for host c compiler])
244     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
245     if test -z "$HOST_CC"; then
246         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
247     fi
248     AC_MSG_RESULT([$HOST_CC])
249     AC_MSG_CHECKING([for host c++ compiler])
250     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
251     if test -z "$HOST_CXX"; then
252         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
253     fi
254     AC_MSG_RESULT([$HOST_CXX])
256     if test -z "$HOST_CFLAGS"; then
257         HOST_CFLAGS="$CFLAGS"
258     fi
259     if test -z "$HOST_CXXFLAGS"; then
260         HOST_CXXFLAGS="$CXXFLAGS"
261     fi
262     if test -z "$HOST_LDFLAGS"; then
263         HOST_LDFLAGS="$LDFLAGS"
264     fi
265     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
266     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
267     CC="$HOST_CC"
268     CFLAGS="$HOST_CFLAGS"
269     LDFLAGS="$HOST_LDFLAGS"
271     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
272     AC_TRY_COMPILE([], [return(0);], 
273         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
274         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
276     CC="$HOST_CXX"
277     CFLAGS="$HOST_CXXFLAGS"
279     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
280     AC_TRY_COMPILE([], [return(0);], 
281         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
282         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
283     
284     CC=$_SAVE_CC
285     CFLAGS=$_SAVE_CFLAGS
286     LDFLAGS=$_SAVE_LDFLAGS
288     case "$build:$target" in
289       powerpc-apple-darwin8*:i?86-apple-darwin*)
290         dnl The Darwin cross compiler doesn't necessarily point itself at a
291         dnl root that has libraries for the proper architecture, it defaults
292         dnl to the system root.  The libraries in the system root on current
293         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
294         dnl checks will fail.  Fake a working SDK in that case.
295         _SAVE_CFLAGS=$CFLAGS
296         _SAVE_CXXFLAGS=$CXXLAGS
297         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
298         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
299         ;;
300     esac
302     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
303     unset ac_cv_prog_CC
304     AC_PROG_CC
305     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
306     unset ac_cv_prog_CXX
307     AC_PROG_CXX
309     case "$build:$target" in
310       powerpc-apple-darwin8*:i?86-apple-darwin*)
311         dnl Revert the changes made above.  From this point on, the target
312         dnl compiler will never be used without applying the SDK to CFLAGS
313         dnl (see --with-macos-sdk below).
314         CFLAGS=$_SAVE_CFLAGS
315         CXXFLAGS=$_SAVE_CXXFLAGS
316         ;;
317     esac
319     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
320     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
321     AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
322     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
323     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
324     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
325     AC_DEFINE(CROSS_COMPILE)
326 else
327     AC_PROG_CC
328     AC_PROG_CXX
329     AC_PROG_RANLIB
330     AC_PATH_PROGS(AS, $AS as, $CC)
331     AC_CHECK_PROGS(AR, ar, :)
332     AC_CHECK_PROGS(LD, ld, :)
333     AC_CHECK_PROGS(STRIP, strip, :)
334     AC_CHECK_PROGS(WINDRES, windres, :)
335     if test -z "$HOST_CC"; then
336         HOST_CC="$CC"
337     fi
338     if test -z "$HOST_CFLAGS"; then
339         HOST_CFLAGS="$CFLAGS"
340     fi
341     if test -z "$HOST_CXX"; then
342         HOST_CXX="$CXX"
343     fi
344     if test -z "$HOST_CXXFLAGS"; then
345         HOST_CXXFLAGS="$CXXFLAGS"
346     fi
347     if test -z "$HOST_LDFLAGS"; then
348         HOST_LDFLAGS="$LDFLAGS"
349     fi
350     if test -z "$HOST_RANLIB"; then
351         HOST_RANLIB="$RANLIB"
352     fi
353     if test -z "$HOST_AR"; then
354        HOST_AR="$AR"
355     fi
358 GNU_AS=
359 GNU_LD=
360 GNU_CC=
361 GNU_CXX=
362 CC_VERSION='N/A'
363 CXX_VERSION='N/A'
364 if test "$GCC" = "yes"; then
365     GNU_CC=1
366     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
368 if test "$GXX" = "yes"; then
369     GNU_CXX=1
370     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
372 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
373     GNU_AS=1
375 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
376     GNU_LD=1
378 if test "$GNU_CC"; then
379     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
380         GCC_USE_GNU_LD=1
381     fi
384 INTEL_CC=
385 INTEL_CXX=
386 if test "$GCC" = yes; then
387    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
388      INTEL_CC=1
389    fi
392 if test "$GXX" = yes; then
393    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
394      INTEL_CXX=1
395    fi
398 dnl Special win32 checks
399 dnl ========================================================
400 case "$target" in
401 *-wince)
402     WINVER=500
403     ;;
405     if test -n "$GNU_CC"; then  
406         WINVER=501
407     else    
408         WINVER=500
409     fi
410     ;;
411 esac
413 MOZ_ARG_WITH_STRING(windows-version,
414 [  --with-windows-version=WINVER
415                           Minimum Windows version (WINVER) to support
416                               400: Windows 95
417                               500: Windows 2000
418                               501: Windows XP],
419   WINVER=$withval)
421 case "$WINVER" in
422 400|500|501)
423     ;;
426     AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
427     ;;
429 esac
431 case "$target" in
432 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
433     if test "$GCC" != "yes"; then
434         # Check to see if we are really running in a msvc environemnt
435         _WIN32_MSVC=1
436         AC_CHECK_PROGS(MIDL, midl)
438         # Make sure compilers are valid
439         CFLAGS="$CFLAGS -TC -nologo"
440         CXXFLAGS="$CXXFLAGS -TP -nologo"
441         AC_LANG_SAVE
442         AC_LANG_C
443         AC_TRY_COMPILE([#include <stdio.h>],
444             [ printf("Hello World\n"); ],,
445             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
447         AC_LANG_CPLUSPLUS
448         AC_TRY_COMPILE([#include <new.h>],
449             [ unsigned *test = new unsigned(42); ],,
450             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
451         AC_LANG_RESTORE
452         
453         changequote(,)
454         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
455         changequote([,])
456         
457         # Determine compiler version
458         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
459         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
460         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
461         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
462         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
463         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
465         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
466         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
468         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
469             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
470         fi
471         if test "$_CC_MAJOR_VERSION" = "12"; then
472             _CC_SUITE=6
473         elif test "$_CC_MAJOR_VERSION" = "13"; then
474             _CC_SUITE=7
475         elif test "$_CC_MAJOR_VERSION" = "14"; then
476             _CC_SUITE=8
477             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
478             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
479             dnl so be very specific here!
480             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
481             if test $_CC_RELEASE -gt 50727; then
482                _USE_DYNAMICBASE=1
483             elif test $_CC_BUILD -ge 762; then
484                _USE_DYNAMICBASE=1
485             fi
486             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
487             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
488         elif test "$_CC_MAJOR_VERSION" = "15"; then
489             _CC_SUITE=9
490             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
491             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
492             _USE_DYNAMICBASE=1
493             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
494             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
495         else
496             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
497         fi
499         _MOZ_RTTI_FLAGS_ON='-GR'
500         _MOZ_RTTI_FLAGS_OFF='-GR-'
501         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
502         _MOZ_EXCEPTIONS_FLAGS_OFF=''
504         if test -n "$WIN32_REDIST_DIR"; then
505             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
506         fi
507         
508         # bug #249782
509         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
510         if test "$_CC_SUITE" -ge "8"; then
511                 changequote(,)
512                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
513                 changequote([,])
515                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
516                 if test -n "$MSMT_TOOL"; then
517                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
518                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
519                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
520                         fi
521                         MSMANIFEST_TOOL=1
522                         unset MSMT_TOOL
523                 else
524                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
525                 fi
526         fi
528         # Check linker version
529         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
530         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
531         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
532             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
533         fi
534         INCREMENTAL_LINKER=1
536         # Check midl version
537         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
538         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
539         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
540         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
541          # Add flags if necessary
542          AC_MSG_CHECKING([for midl flags])
543          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
544              # Starting with MIDL version 6.0.359, the MIDL compiler
545              # generates /Oicf /robust stubs by default, which is not
546              # compatible with versions of Windows older than Win2k.
547              # This switches us back to the old behaviour. When we drop
548              # support for Windows older than Win2k, we should remove
549              # this.
550              MIDL_FLAGS="${MIDL_FLAGS} -no_robust"
551              AC_MSG_RESULT([need -no_robust])
552          else
553              MIDL_FLAGS="${MIDL_FLAGS}"
554              AC_MSG_RESULT([none needed])
555         fi
556         
557         unset _MSVC_VER_FILTER
558         
559     else
560         # Check w32api version
561         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
562         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
563         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
564         AC_TRY_COMPILE([#include <w32api.h>],
565             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
566                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
567                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
568                 #error "test failed."
569             #endif
570             , [ res=yes ], [ res=no ])
571         AC_MSG_RESULT([$res])
572         if test "$res" != "yes"; then
573             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
574         fi
575         # Check windres version
576         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
577         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
578         AC_MSG_RESULT([$_WINDRES_VERSION])
579         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
580         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
581         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
582         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
583         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
584         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
585         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
586                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
587                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
588                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
589                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
590                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
591         then
592             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
593         fi
594     fi # !GNU_CC
596     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
597     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
598     # Require OS features provided by IE 5.0
599     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
600     ;;
601 esac
603 dnl Test breaks icc on OS/2 && MSVC
604 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
605     AC_PROG_CC_C_O
606     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
607         USING_HCC=1
608         _OLDCC=$CC
609         _OLDCXX=$CXX
610         CC="${srcdir}/build/hcc '$CC'"
611         CXX="${srcdir}/build/hcpp '$CXX'"
612     fi
615 AC_PROG_CPP
616 AC_PROG_CXXCPP
618 if test -n "$_WIN32_MSVC"; then
619     SKIP_PATH_CHECKS=1
620     SKIP_COMPILER_CHECKS=1
621     SKIP_LIBRARY_CHECKS=1
624 fi # COMPILE_ENVIRONMENT
626 AC_SUBST(MIDL_FLAGS)
627 AC_SUBST(_MSC_VER)
629 AC_SUBST(GNU_AS)
630 AC_SUBST(GNU_LD)
631 AC_SUBST(GNU_CC)
632 AC_SUBST(GNU_CXX)
633 AC_SUBST(INTEL_CC)
634 AC_SUBST(INTEL_CXX)
636 dnl ========================================================
637 dnl Checks for programs.
638 dnl ========================================================
639 AC_PROG_INSTALL
640 AC_PROG_LN_S
641 AC_PATH_PROGS(PERL, $PERL perl5 perl )
642 if test -z "$PERL" || test "$PERL" = ":"; then
643     AC_MSG_ERROR([perl not found in \$PATH])
646 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
647 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
648 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
649 _perl_res=$?
650 AC_MSG_RESULT([$_perl_version])
652 if test "$_perl_res" != 0; then
653     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
657 AC_MSG_CHECKING([for full perl installation])
658 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
659 _perl_res=$?
660 if test "$_perl_res" != 0; then
661     AC_MSG_RESULT([no])
662     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
663 else
664     AC_MSG_RESULT([yes])    
667 AC_PATH_PROGS(PYTHON, $PYTHON python)
668 if test -z "$PYTHON"; then
669     AC_MSG_ERROR([python was not found in \$PATH])
671 echo PYTHON="$PYTHON"
673 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
674 if test -z "$COMPILE_ENVIRONMENT"; then
675 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
676     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
679 AC_SUBST(NSINSTALL_BIN)
681 AC_PATH_PROG(DOXYGEN, doxygen, :)
682 AC_PATH_PROG(WHOAMI, whoami, :)
683 AC_PATH_PROG(AUTOCONF, autoconf, :)
684 AC_PATH_PROG(UNZIP, unzip, :)
685 AC_PATH_PROGS(ZIP, zip)
686 if test -z "$ZIP" || test "$ZIP" = ":"; then
687     AC_MSG_ERROR([zip not found in \$PATH])
689 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
690 AC_PATH_PROG(XARGS, xargs)
691 if test -z "$XARGS" || test "$XARGS" = ":"; then
692     AC_MSG_ERROR([xargs not found in \$PATH .])
695 if test "$COMPILE_ENVIRONMENT"; then
697 dnl ========================================================
698 dnl = Mac OS X toolchain support
699 dnl ========================================================
701 case "$target_os" in
702 darwin*)
703     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
704     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
705     dnl the environment and includedir purposes (when using an SDK, below),
706     dnl but remember the full version number for the libdir (SDK).
707     changequote(,)
708     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
709     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
710     changequote([,])
711     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
712         dnl Bug 280479, but this keeps popping up in bug 292530 too because
713         dnl 4.0.0/4061 is the default compiler in Tiger.
714         changequote(,)
715         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
716         changequote([,])
717         if test "$GCC_BUILD" = "4061" ; then
718             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
719 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
720 from building Mozilla. Upgrade to Xcode 2.1 or later.])
721         fi
722     fi
724     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
725     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
726     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
727     AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
729     case "$PBBUILD" in
730       *xcodebuild*)
731         changequote(,)
732         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
733         changequote([,])
734         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
735           HAS_XCODE_2_1=1;
736         fi
737       ;;
738     esac
740     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
741     dnl it has moved into /usr/bin.
742     AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
743     ;;
744 esac
746 AC_SUBST(GCC_VERSION)
747 AC_SUBST(XCODEBUILD_VERSION)
748 AC_SUBST(HAS_XCODE_2_1)
750 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
751 dnl that a universal binary is being produced.
752 AC_SUBST(UNIVERSAL_BINARY)
754 dnl ========================================================
755 dnl Check for MacOS deployment target version
756 dnl ========================================================
758 MOZ_ARG_ENABLE_STRING(macos-target,
759                       [  --enable-macos-target=VER (default=10.4)
760                           Set the minimum MacOS version needed at runtime],
761                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
763 case "$target" in
764 *-darwin*)
765     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
766         dnl Use the specified value
767         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
768         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
769     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
770         dnl No value specified on the command line or in the environment,
771         dnl use the lesser of the application's minimum or the architecture's
772         dnl minimum.
773         export MACOSX_DEPLOYMENT_TARGET=10.4
774     fi
775     ;;
776 esac
778 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
780 dnl ========================================================
781 dnl = Mac OS X SDK support
782 dnl ========================================================
783 MACOS_SDK_DIR=
784 NEXT_ROOT=
785 MOZ_ARG_WITH_STRING(macos-sdk,
786 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
787     MACOS_SDK_DIR=$withval)
789 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
790 dnl NEXT_ROOT will be set and exported only if it's needed.
791 AC_SUBST(MACOS_SDK_DIR)
792 AC_SUBST(NEXT_ROOT)
794 if test "$MACOS_SDK_DIR"; then
795   dnl Sync this section with the ones in NSPR and NSS.
796   dnl Changes to the cross environment here need to be accounted for in
797   dnl the libIDL checks (below) and xpidl build.
799   if test ! -d "$MACOS_SDK_DIR"; then
800     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
801 specify a valid SDK.  SDKs are installed when the optional cross-development
802 tools are selected during the Xcode/Developer Tools installation.])
803   fi
805   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
806   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
807     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"
808     if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
809       SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
810     fi
811     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"
813     CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
814     CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
816     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
817     CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
818     CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
820     dnl ld support for -syslibroot is compiler-agnostic, but only available
821     dnl on Tiger.  Although it's possible to switch on the build host's
822     dnl OS release to use ld -syslibroot when available, ld -syslibroot will
823     dnl cause warnings as long as NEXT_ROOT is set.  NEXT_ROOT should be
824     dnl set because both the compiler and linker use it.
825     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"
826     export NEXT_ROOT=$MACOS_SDK_DIR
828     if test -n "$CROSS_COMPILE" ; then
829       dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
830       dnl the build host.  HOST_CXX is presently unused.
831       HOST_CC="NEXT_ROOT= $HOST_CC"
832       HOST_CXX="NEXT_ROOT= $HOST_CXX"
833     fi
834   else
835     dnl gcc >= 4.0 uses different paths than above, but knows how to find
836     dnl them itself.
837     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
838     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
840     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
841     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
842     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
844     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
845       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
846       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
847       dnl be ignored and cause warnings when -syslibroot is specified.
848       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
849       dnl the -isysroot it receives, so this is only needed with 4.0.0.
850       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
851     fi
852   fi
854   AC_LANG_SAVE
855   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
856   AC_LANG_CPLUSPLUS
857   AC_TRY_COMPILE([#include <new>
858                  int main() { return 0; }],
859    result=yes,
860    result=no)
861   AC_LANG_RESTORE
862   AC_MSG_RESULT($result)
864   if test "$result" = "no" ; then
865     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
866   fi
869 fi # COMPILE_ENVIRONMENT
871 dnl Be sure the make we use is GNU make.
872 dnl on win32, gmake.exe is the generally the wrong version
873 case "$host_os" in
874 cygwin*|mingw*|mks*|msvc*)
875     AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
876     ;;
878     AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
879     ;;
880 esac
881 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
882 if test ! "$_make_try"
883 then
884         echo
885         echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
886         echo
887         exit 1
889 dnl Now exit if version if < MAKE_VERSION
890 rm -f dummy.mk
891 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
892 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
893 rm -f dummy.mk
894 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
895 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
896 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
897 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
898 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
899    test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
900         "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
901    AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
903 AC_SUBST(MAKE)
905 if test "$COMPILE_ENVIRONMENT"; then
907 AC_PATH_XTRA
909 dnl Check in X11 include directory too.
910 if test "$no_x" != "yes"; then
911     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
914 XCFLAGS="$X_CFLAGS"
916 fi # COMPILE_ENVIRONMENT
918 dnl ========================================================
919 dnl set the defaults first
920 dnl ========================================================
921 AS_BIN=$AS
922 AR_FLAGS='cr $@'
923 AR_LIST='$(AR) t'
924 AR_EXTRACT='$(AR) x'
925 AR_DELETE='$(AR) d'
926 AS='$(CC)'
927 AS_DASH_C_FLAG='-c'
928 DLL_PREFIX=lib
929 LIB_PREFIX=lib
930 DLL_SUFFIX=.so
931 OBJ_SUFFIX=o
932 LIB_SUFFIX=a
933 ASM_SUFFIX=s
934 IMPORT_LIB_SUFFIX=
935 TARGET_MD_ARCH=unix
936 DIRENT_INO=d_ino
937 CYGWIN_WRAPPER=
938 WIN_TOP_SRC=
939 MOZ_USER_DIR=".mozilla"
940 HOST_AR='$(AR)'
941 HOST_AR_FLAGS='$(AR_FLAGS)'
943 MOZ_JPEG_CFLAGS=
944 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
945 MOZ_ZLIB_CFLAGS=
946 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
947 MOZ_BZ2_CFLAGS=
948 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
949 MOZ_PNG_CFLAGS=
950 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
952 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
953 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
954 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin'
955 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
956 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
957 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
958 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
960 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
961 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
963 USE_DEPENDENT_LIBS=1
965 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
966 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
968 MOZ_ENABLE_POSTSCRIPT=1 
970 if test -n "$CROSS_COMPILE"; then
971     OS_TARGET="${target_os}"
972     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
973     OS_RELEASE=
974     case "${target_os}" in
975         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
976         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
977         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
978         mingw*)       OS_ARCH=WINNT ;;
979         wince*)       OS_ARCH=WINCE ;;
980         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
981     esac
982 else
983     OS_TARGET=`uname -s`
984     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
985     OS_RELEASE=`uname -r`
988 # Before this used `uname -m` when not cross compiling
989 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
990 OS_TEST="${target_cpu}"
992 _COMPILER_PREFIX=
994 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
996 #######################################################################
997 # Master "Core Components" macros for getting the OS target           #
998 #######################################################################
1001 # Note: OS_TARGET should be specified on the command line for gmake.
1002 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
1003 # The difference between the Win95 target and the WinNT target is that
1004 # the WinNT target uses Windows NT specific features not available
1005 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
1006 # at lesser performance (the Win95 target uses threads; the WinNT target
1007 # uses fibers).
1009 # When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target
1010 # is built. See: win16_3.11.mk for lots more about the Win16 target.
1012 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1013 # cross-compilation.
1017 # The following hack allows one to build on a WIN95 machine (as if
1018 # s/he were cross-compiling on a WINNT host for a WIN95 target).
1019 # It also accomodates for MKS's uname.exe.  If you never intend
1020 # to do development on a WIN95 machine, you don't need this hack.
1022 case "$OS_ARCH" in
1023 WIN95)
1024     OS_ARCH=WINNT
1025     OS_TARGET=WIN95
1026     ;;
1027 Windows_95)
1028     OS_ARCH=Windows_NT
1029     OS_TARGET=WIN95
1030     ;;
1031 Windows_98)
1032     OS_ARCH=Windows_NT
1033     OS_TARGET=WIN95
1034     ;;
1035 CYGWIN_9*|CYGWIN_ME*)
1036     OS_ARCH='CYGWIN_NT-4.0'
1037     OS_TARGET=WIN95
1038     ;;
1039 esac
1042 # Define and override various archtecture-specific variables, including
1043 # HOST_OS_ARCH
1044 # OS_ARCH
1045 # OS_TEST
1046 # OS_TARGET
1047 # OS_RELEASE
1048 # OS_MINOR_RELEASE
1051 case "$HOST_OS_ARCH" in
1052 cygwin*|mingw*|mks*|msvc*)
1053     HOST_OS_ARCH=WINNT
1054     ;;
1055 linux*)
1056     HOST_OS_ARCH=Linux
1057     ;;
1058 solaris*)
1059     HOST_OS_ARCH=SunOS
1060     ;;
1061 BSD_386)
1062     HOST_OS_ARCH=BSD
1063     ;;
1064 dgux)
1065     HOST_OS_ARCH=DGUX
1066     ;;
1067 IRIX64)
1068     HOST_OS_ARCH=IRIX
1069     ;;
1070 UNIX_SV)
1071     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1072         HOST_OS_ARCH=NCR
1073     else
1074         HOST_OS_ARCH=UNIXWARE
1075     fi
1076     ;;
1077 ncr)
1078     HOST_OS_ARCH=NCR
1079     ;;
1080 UNIX_SYSTEM_V)
1081     HOST_OS_ARCH=NEC
1082     ;;
1083 OSF1)
1084     ;;
1085 *OpenVMS*)
1086     HOST_OS_ARCH=OpenVMS
1087     ;;
1088 OS_2)
1089     HOST_OS_ARCH=OS2
1090     ;;
1091 QNX)
1092     ;;
1093 SCO_SV)
1094     HOST_OS_ARCH=SCOOS
1095     ;;
1096 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1097     HOST_OS_ARCH=SINIX
1098     ;;
1099 UnixWare)
1100     HOST_OS_ARCH=UNIXWARE
1101     ;;
1102 esac
1104 case "$OS_ARCH" in
1105 WINNT)
1106     OS_TEST=`uname -p`
1107     ;;
1108 Windows_NT)
1110 # If uname -s returns "Windows_NT", we assume that we are using
1111 # the uname.exe in MKS toolkit.
1113 # The -r option of MKS uname only returns the major version number.
1114 # So we need to use its -v option to get the minor version number.
1115 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1117     OS_ARCH=WINNT
1118     OS_TARGET=WINNT
1119     OS_MINOR_RELEASE=`uname -v`
1120     if test "$OS_MINOR_RELEASE" = "00"; then
1121         OS_MINOR_RELEASE=0
1122     fi
1123     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1124     ;;
1125 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1127 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1128 # the uname.exe in the Cygwin tools.
1129 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1130 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1131 # the uname.exe in the GNU-Win32 tools.
1132 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1133 # the uname.exe in the MSYS tools.
1135     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1136     OS_ARCH=WINNT
1137     OS_TARGET=WINNT
1138     ;;
1139 AIX)
1140     OS_RELEASE=`uname -v`.`uname -r`
1141     OS_TEST=`uname -p`
1142     ;;
1143 BSD_386)
1144     OS_ARCH=BSD
1145     ;;
1146 dgux)
1147     OS_ARCH=DGUX
1148     ;;
1149 IRIX64)
1150     OS_ARCH=IRIX
1151     ;;
1152 UNIX_SV)
1153     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1154         OS_ARCH=NCR
1155     else
1156         OS_ARCH=UNIXWARE
1157         OS_RELEASE=`uname -v`
1158     fi
1159     ;;
1160 ncr)
1161     OS_ARCH=NCR
1162     ;;
1163 UNIX_SYSTEM_V)
1164     OS_ARCH=NEC
1165     ;;
1166 OSF1)
1167     case `uname -v` in
1168     148)
1169         OS_RELEASE=V3.2C
1170         ;;
1171     564)
1172         OS_RELEASE=V4.0B
1173         ;;
1174     878)
1175         OS_RELEASE=V4.0D
1176         ;;
1177     esac
1178     ;;
1179 *OpenVMS*)
1180     OS_ARCH=OpenVMS
1181     OS_RELEASE=`uname -v`
1182     OS_TEST=`uname -p`
1183     ;;
1184 OS_2)
1185     OS_ARCH=OS2
1186     OS_TARGET=OS2
1187     OS_RELEASE=`uname -v`
1188     ;;
1189 QNX)
1190     if test "$OS_TARGET" != "NTO"; then
1191         changequote(,)
1192         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1193         changequote([,])
1194     fi
1195     OS_TEST=x86
1196     ;;
1197 SCO_SV)
1198     OS_ARCH=SCOOS
1199     OS_RELEASE=5.0
1200     ;;
1201 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1202     OS_ARCH=SINIX
1203     OS_TEST=`uname -p`
1204     ;;
1205 UnixWare)
1206     OS_ARCH=UNIXWARE
1207     OS_RELEASE=`uname -v`
1208     ;;
1209 WINCE)
1210     OS_ARCH=WINCE
1211     OS_TARGET=WINCE
1212     ;;
1213 Darwin)
1214     case "${target_cpu}" in
1215     powerpc*)
1216         OS_TEST=ppc
1217         ;;
1218     i*86*)
1219         OS_TEST=i386 
1220         ;;
1221     *)
1222         if test -z "$CROSS_COMPILE" ; then
1223             OS_TEST=`uname -p`
1224         fi
1225         ;;
1226     esac
1227     ;;
1228 esac
1230 if test "$OS_ARCH" = "NCR"; then
1231     changequote(,)
1232     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1233     changequote([,])
1236 # Only set CPU_ARCH if we recognize the value of OS_TEST
1238 case "$OS_TEST" in
1239 *86 | i86pc)
1240     CPU_ARCH=x86
1241     ;;
1243 powerpc* | ppc)
1244     CPU_ARCH=ppc
1245     ;;
1247 Alpha | alpha | ALPHA)
1248     CPU_ARCH=Alpha
1249     ;;
1251 hppa* | parisc)
1252     CPU_ARCH=hppa
1253     ;;
1255 sun4u | sparc*)
1256     CPU_ARCH=sparc
1257     ;;
1259 x86_64 | ia64)
1260     CPU_ARCH="$OS_TEST"
1261     ;;
1262 esac
1264 if test -z "$OS_TARGET"; then
1265     OS_TARGET=$OS_ARCH
1267 if test "$OS_TARGET" = "WIN95"; then
1268     OS_RELEASE="4.0"
1270 if test "$OS_TARGET" = "WIN16"; then
1271     OS_RELEASE=
1273 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1275 dnl ========================================================
1276 dnl GNU specific defaults
1277 dnl ========================================================
1278 if test "$GNU_CC"; then
1279     # FIXME: Let us build with strict aliasing. bug 414641.
1280     CFLAGS="$CFLAGS -fno-strict-aliasing"
1281     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1282     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1283     DSO_LDOPTS='-shared'
1284     if test "$GCC_USE_GNU_LD"; then
1285         # Don't allow undefined symbols in libraries
1286         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1287     fi
1288     WARNINGS_AS_ERRORS='-Werror'
1289     DSO_CFLAGS=''
1290     DSO_PIC_CFLAGS='-fPIC'
1291     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1292     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1293     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1294     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1296     # Turn on GNU specific features
1297     # -Wall - turn on all warnings
1298     # -pedantic - make compiler warn about non-ANSI stuff, and
1299     #             be a little bit stricter
1300     # Warnings slamm took out for now (these were giving more noise than help):
1301     # -Wbad-function-cast - warns when casting a function to a new return type
1302     # -Wconversion - complained when char's or short's were used a function args
1303     # -Wshadow - removed because it generates more noise than help --pete
1304     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1305     if test -z "$INTEL_CC"; then
1306        # Don't use -Wcast-align with ICC
1307        case "$CPU_ARCH" in
1308            # And don't use it on hppa, ia64, sparc, since it's noisy there
1309            hppa | ia64 | sparc)
1310            ;;
1311            *)
1312         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1313            ;;
1314        esac
1315     fi
1317     dnl Turn pedantic on but disable the warnings for long long
1318     _PEDANTIC=1
1320     if test -z "$INTEL_CC"; then
1321       _IGNORE_LONG_LONG_WARNINGS=1
1322       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1323     else
1324       _IGNORE_LONG_LONG_WARNINGS=
1325     fi
1328     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1329     _USE_CPP_INCLUDE_FLAG=1
1330 else
1331     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1332     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1334     DSO_LDOPTS='-shared'
1335     if test "$GNU_LD"; then
1336         # Don't allow undefined symbols in libraries
1337         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1338     fi
1340     DSO_CFLAGS=''
1341     DSO_PIC_CFLAGS='-KPIC'
1342     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1345 if test "$GNU_CXX"; then
1346     # FIXME: Let us build with strict aliasing. bug 414641.
1347     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1348     # Turn on GNU specific features
1349     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wconversion -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1350     if test -z "$INTEL_CC"; then
1351        # Don't use -Wcast-align with ICC
1352        case "$CPU_ARCH" in
1353            # And don't use it on hppa, ia64, sparc, since it's noisy there
1354            hppa | ia64 | sparc)
1355            ;;
1356            *)
1357         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1358            ;;
1359        esac
1360     fi
1362     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1363     _USE_CPP_INCLUDE_FLAG=1
1364 else
1365     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1368 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1369 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1370 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1371 dnl normal behavior.
1372 dnl ========================================================
1373 MKSHLIB_FORCE_ALL=
1374 MKSHLIB_UNFORCE_ALL=
1376 if test "$COMPILE_ENVIRONMENT"; then
1377 if test "$GNU_CC"; then
1378   AC_MSG_CHECKING(whether ld has archive extraction flags)
1379   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1380    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1381     ac_cv_mkshlib_force_and_unforce="no"
1382     exec 3<&0 <<LOOP_INPUT
1383         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1384         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1385         force="-Wl,-all";              unforce="-Wl,-none"
1386 LOOP_INPUT
1387     while read line
1388     do
1389       eval $line
1390       LDFLAGS=$force
1391       LIBS=$unforce
1392       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1393     done
1394     exec 0<&3 3<&-
1395     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1396    ])
1397   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1398     AC_MSG_RESULT(no)
1399   else
1400     AC_MSG_RESULT(yes)
1401     eval $ac_cv_mkshlib_force_and_unforce
1402     MKSHLIB_FORCE_ALL=$force
1403     MKSHLIB_UNFORCE_ALL=$unforce
1404   fi
1405 fi # GNU_CC
1406 fi # COMPILE_ENVIRONMENT
1408 dnl =================================================================
1409 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1410 dnl which is bad when cross compiling.
1411 dnl =================================================================
1412 if test "$COMPILE_ENVIRONMENT"; then
1413 configure_static_assert_macros='
1414 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1415 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1416 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1419 dnl test that the macros actually work:
1420 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1421 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1422  [AC_LANG_SAVE
1423   AC_LANG_C
1424   ac_cv_static_assertion_macros_work="yes"
1425   AC_TRY_COMPILE([$configure_static_assert_macros],
1426                  [CONFIGURE_STATIC_ASSERT(1)],
1427                  ,
1428                  ac_cv_static_assertion_macros_work="no")
1429   AC_TRY_COMPILE([$configure_static_assert_macros],
1430                  [CONFIGURE_STATIC_ASSERT(0)],
1431                  ac_cv_static_assertion_macros_work="no",
1432                  )
1433   AC_LANG_CPLUSPLUS
1434   AC_TRY_COMPILE([$configure_static_assert_macros],
1435                  [CONFIGURE_STATIC_ASSERT(1)],
1436                  ,
1437                  ac_cv_static_assertion_macros_work="no")
1438   AC_TRY_COMPILE([$configure_static_assert_macros],
1439                  [CONFIGURE_STATIC_ASSERT(0)],
1440                  ac_cv_static_assertion_macros_work="no",
1441                  )
1442   AC_LANG_RESTORE
1443  ])
1444 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1445 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1446     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1449 fi # COMPILE_ENVIRONMENT
1451 dnl ========================================================
1452 dnl Checking for 64-bit OS
1453 dnl ========================================================
1454 if test "$COMPILE_ENVIRONMENT"; then
1455 AC_LANG_SAVE
1456 AC_LANG_C
1457 AC_MSG_CHECKING(for 64-bit OS)
1458 AC_TRY_COMPILE([$configure_static_assert_macros],
1459                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1460                result="yes", result="no")
1461 AC_MSG_RESULT("$result")
1462 if test "$result" = "yes"; then
1463     AC_DEFINE(HAVE_64BIT_OS)
1464     HAVE_64BIT_OS=1
1466 AC_SUBST(HAVE_64BIT_OS)
1467 AC_LANG_RESTORE
1468 fi # COMPILE_ENVIRONMENT
1470 dnl ========================================================
1471 dnl Enable high-memory support on OS/2 by default.
1472 dnl ========================================================
1473 MOZ_OS2_HIGH_MEMORY=1
1474 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1475 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1476     MOZ_OS2_HIGH_MEMORY=,
1477     MOZ_OS2_HIGH_MEMORY=1 )
1478 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1480 dnl ========================================================
1481 dnl System overrides of the defaults for host
1482 dnl ========================================================
1483 case "$host" in
1484 *-beos*)
1485     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1486     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1487     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1488     ;;
1490 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1491     if test -n "$_WIN32_MSVC"; then
1492         HOST_AR=lib
1493         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1494         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1495         HOST_RANLIB='echo ranlib'
1496     else
1497         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1498     fi
1499     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1500     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1501     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1502     HOST_BIN_SUFFIX=.exe
1503     case "$host" in
1504     *mingw*)
1505     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1506         ;;
1507     *)
1508         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1509         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1510             _pwd=`pwd`
1511             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1512         fi
1513         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1514             AS_PERL=1
1515             PERL="${CYGWIN_WRAPPER} $PERL"
1516         fi
1518         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1519             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1520         fi
1521         ;;
1522     esac
1523     ;;
1525 *-darwin*)
1526     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1527     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1528     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1529     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1530     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1531     ;;
1533 *-linux*|*-kfreebsd*-gnu)
1534     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1535     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1536     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1537     ;;
1539 *os2*)
1540     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1541     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1542     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1543     HOST_BIN_SUFFIX=.exe
1544     MOZ_FIX_LINK_PATHS=
1545     ;;
1547 *-osf*)
1548     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1549     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1550     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1551     ;;
1554     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1555     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1556     ;;
1557 esac
1559 dnl Get mozilla version from central milestone file
1560 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1562 dnl Get version of various core apps from the version files.
1563 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1564 THUNDERBIRD_VERSION=`cat $topsrcdir/mail/config/version.txt`
1565 SUNBIRD_VERSION=`cat $topsrcdir/calendar/sunbird/config/version.txt`
1566 SEAMONKEY_VERSION=`cat $topsrcdir/suite/config/version.txt`
1568 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1569 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1571 PKG_CHECK_MODULES(LIBHILONMIME,libhildonmime,
1572                   NS_HILDON=1,
1573                   NS_HILDON=)
1574 if test $NS_HILDON; then
1575    AC_DEFINE(NS_HILDON)
1578 PKG_CHECK_MODULES(LIBOSSO,libosso,
1579                   NS_OSSO=1,
1580                   NS_OSSO=)
1582 if test $NS_OSSO; then
1583    AC_DEFINE(NS_OSSO)     
1586 dnl ========================================================
1587 dnl System overrides of the defaults for target
1588 dnl ========================================================
1590 case "$target" in
1591 *-aix*)
1592     AC_DEFINE(AIX)
1593     if test ! "$GNU_CC"; then
1594         if test ! "$HAVE_64BIT_OS"; then
1595             # Compiling with Visual Age C++ object model compat is the
1596             # default. To compile with object model ibm, add 
1597             # AIX_OBJMODEL=ibm to .mozconfig.
1598             if test "$AIX_OBJMODEL" = "ibm"; then
1599                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1600             else
1601                 AIX_OBJMODEL=compat
1602             fi
1603         else
1604             AIX_OBJMODEL=compat
1605         fi
1606         AC_SUBST(AIX_OBJMODEL)
1607         DSO_LDOPTS='-qmkshrobj=1'
1608         DSO_CFLAGS='-qflag=w:w'
1609         DSO_PIC_CFLAGS=
1610         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1611         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1612         MOZ_FIX_LINK_PATHS=
1613         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1614         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1615         if test "$COMPILE_ENVIRONMENT"; then
1616             AC_LANG_SAVE
1617             AC_LANG_CPLUSPLUS
1618             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 5.0.2.0])
1619             AC_TRY_COMPILE([],
1620                 [#if (__IBMCPP__ < 502)
1621                  #error "Bad compiler"
1622                  #endif],
1623                 _BAD_COMPILER=,_BAD_COMPILER=1)
1624             if test -n "$_BAD_COMPILER"; then
1625                 AC_MSG_RESULT([no])    
1626                 AC_MSG_ERROR([VisualAge C++ version 5.0.2.0 or higher is required to build.])
1627             else
1628                 AC_MSG_RESULT([yes])    
1629             fi
1630             AC_LANG_RESTORE
1631             TARGET_COMPILER_ABI="ibmc"
1632             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1633             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1634         fi
1635     fi
1636     case "${target_os}" in
1637     aix4.1*)
1638         DLL_SUFFIX='_shr.a'
1639         ;;
1640     esac
1641     if test "$COMPILE_ENVIRONMENT"; then
1642         AC_CHECK_HEADERS(sys/inttypes.h)
1643     fi
1644     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1645     ;;
1647 *-beos*)
1648     no_x=yes
1649     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1650     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1651     DSO_LDOPTS='-nostart'
1652     TK_LIBS='-lbe -lroot'
1653     LIBS="$LIBS -lbe"
1654     if test "$COMPILE_ENVIRONMENT"; then
1655         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1656         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1657     fi
1658     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1659     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1660     _MOZ_USE_RTTI=1
1661     USE_DEPENDENT_LIBS=
1662     MOZ_USER_DIR="Mozilla"
1663     ;;
1665 *-bsdi*)
1666     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1667     _PEDANTIC=
1668     _IGNORE_LONG_LONG_WARNINGS=
1669     case $OS_RELEASE in
1670         4.*|5.*)
1671             STRIP="$STRIP -d"
1672             ;;
1673         *)
1674             DSO_CFLAGS=''
1675             DSO_LDOPTS='-r'
1676             _WARNINGS_CFLAGS="-Wall"
1677             _WARNINGS_CXXFLAGS="-Wall"
1678             # The test above doesn't work properly, at least on 3.1.
1679             MKSHLIB_FORCE_ALL=''
1680             MKSHLIB_UNFORCE_ALL=''
1681         ;;
1682     esac
1683     ;;
1685 *-darwin*) 
1686     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1687     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1688     MOZ_OPTIMIZE_FLAGS="-O2"
1689     _PEDANTIC=
1690     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1691     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1692     DLL_SUFFIX=".dylib"
1693     DSO_LDOPTS=''
1694     STRIP="$STRIP -x -S"
1695     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1696     MOZ_ENABLE_POSTSCRIPT=
1697     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1698     LDFLAGS="$LDFLAGS -framework Cocoa"
1699     # The ExceptionHandling framework is needed for Objective-C exception
1700     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1701     # builds.
1702     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1703     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1704     MACOSX=1
1706     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1707     dnl ===================================================================
1708     if test "x$enable_dtrace" = "xyes"; then
1709         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1710     else
1711         dnl check for the presence of the -dead_strip linker flag
1712         AC_MSG_CHECKING([for -dead_strip option to ld])
1713         _SAVE_LDFLAGS=$LDFLAGS
1714         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1715         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1716         if test -n "$_HAVE_DEAD_STRIP" ; then
1717             AC_MSG_RESULT([yes])
1718             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1719         else
1720             AC_MSG_RESULT([no])
1721         fi
1722         
1723         LDFLAGS=$_SAVE_LDFLAGS
1724     fi
1725     ;;
1727 *-freebsd*)
1728     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1729         DLL_SUFFIX=".so.1.0"
1730         DSO_LDOPTS="-shared"
1731     fi
1732     if test ! "$GNU_CC"; then
1733         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1734     fi
1735 # Can't have force w/o an unforce.
1736 #    # Hack for FreeBSD 2.2
1737 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1738 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1739 #       MKSHLIB_UNFORCE_ALL=''
1740 #    fi
1741     ;; 
1743 *-hpux*)
1744     DLL_SUFFIX=".sl"
1745     if test ! "$GNU_CC"; then
1746         DSO_LDOPTS='-b -Wl,+s'
1747         DSO_CFLAGS=""
1748         DSO_PIC_CFLAGS="+Z"
1749         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1750         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1751         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1752     else
1753         DSO_LDOPTS='-b -E +s'
1754         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1755         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1756     fi
1757     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1758     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1759     ;;
1761 *-irix5*)
1762     AC_DEFINE(IRIX)
1763     DSO_LDOPTS='-elf -shared'
1765     if test "$GNU_CC"; then
1766        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1767        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1768        MKSHLIB_FORCE_ALL='-Wl,-all'
1769        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1770        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1771     else
1772        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1773        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1774        MKSHLIB_FORCE_ALL='-all'
1775        MKSHLIB_UNFORCE_ALL='-none'
1776     fi
1777     ;;
1779 *-irix6*)
1780     AC_DEFINE(IRIX)
1781     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1782     dnl compile and link using -n32
1783     USE_N32=1
1784     TARGET_COMPILER_ABI=n32
1785     DSO_LDOPTS='-elf -shared'
1786     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1787     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1788     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1789     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1790     if test "$GNU_CC"; then
1791        MKSHLIB_FORCE_ALL='-Wl,-all'
1792        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1793        _WARNINGS_CFLAGS="-Wall"
1794        _WARNINGS_CXXFLAGS="-Wall"
1795        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1796     else
1797        MKSHLIB_FORCE_ALL='-all'
1798        MKSHLIB_UNFORCE_ALL='-none'
1799            AR_LIST="$AR t"
1800            AR_EXTRACT="$AR x"
1801            AR_DELETE="$AR d"
1802            AR='$(CXX) -ar'
1803            AR_FLAGS='-o $@'
1804        CFLAGS="$CFLAGS -woff 3262 -G 4"
1805        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1806        if test -n "$USE_N32"; then
1807            ASFLAGS="$ASFLAGS -n32"
1808            CFLAGS="$CFLAGS -n32"
1809            CXXFLAGS="$CXXFLAGS -n32"
1810            LDFLAGS="$LDFLAGS -n32"
1811        fi
1812        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1813        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1814        MOZ_FIX_LINK_PATHS=
1815     fi
1816     if test -z "$GNU_CXX"; then
1817       MIPSPRO_CXX=1
1818     fi
1819     ;;
1821 *-*linux*)
1822     if test "$GNU_CC"; then
1823         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1824         case $GCC_VERSION in
1825         4.1.*|4.2.*)
1826             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1827             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1828         esac
1829     fi
1831     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1832     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1833     MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1834                                       # and that combo is not yet good at
1835                                       # debugging inlined functions (even
1836                                       # when using DWARF2 as the debugging
1837                                       # format)    
1839     MOZ_MEMORY=1
1841     case "${target_cpu}" in
1842     alpha*)
1843         CFLAGS="$CFLAGS -mieee"
1844         CXXFLAGS="$CXXFLAGS -mieee"
1845     ;;
1846     i*86)
1847         USE_ELF_DYNSTR_GC=1
1848         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1849     ;;
1850     mips*)
1851         CFLAGS="$CFLAGS -Wa,-xgot"
1852         CXXFLAGS="$CXXFLAGS -Wa,-xgot"
1853     ;;
1854     esac
1855     ;;
1857 *-wince*)
1859     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1860     AR_LIST="$AR -list"
1861     AR_EXTRACT="$AR -extract"
1862     AR_DELETE="$AR d"
1863     AR_FLAGS='-OUT:"$@"'
1865     DSO_CFLAGS=
1866     DSO_PIC_CFLAGS=
1867     DLL_SUFFIX=.dll
1868     BIN_SUFFIX='.exe'
1869     RC=rc.exe
1870     # certain versions of cygwin's makedepend barf on the 
1871     # #include <string> vs -I./dist/include/string issue so don't use it
1872     SYSTEM_MAKEDEPEND=
1874     HOST_CC=cl
1875     HOST_CXX=cl
1876     HOST_LD=link
1877     HOST_AR='lib -OUT:$@'
1878     HOST_RANLIB='echo ranlib'
1879     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1880         
1881         
1882     WARNINGS_AS_ERRORS='-WX'
1883         MOZ_OPTIMIZE_FLAGS='-O1'
1884     AR_FLAGS='-NOLOGO -OUT:"$@"'
1885     ASM_SUFFIX=asm
1886     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1887     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1888     DLL_PREFIX=
1889     DOXYGEN=:
1890     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1891     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1892     GARBAGE=
1893     IMPORT_LIB_SUFFIX=lib
1894     LIBS="$LIBS"
1895     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1896     LIB_PREFIX=
1897     LIB_SUFFIX=lib 
1898     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1899     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1900     MKSHLIB_FORCE_ALL=
1901     MKSHLIB_UNFORCE_ALL=
1902     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1903     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1904     MOZ_DEBUG_FLAGS='-Zi'
1905     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1906     MOZ_FIX_LINK_PATHS=
1907     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1908     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1909     OBJ_SUFFIX=obj
1910     RANLIB='echo not_ranlib'
1911     STRIP='echo not_strip'
1912     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1913     UNZIP=unzip
1914     XARGS=xargs
1915     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1916     ZIP=zip
1917     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1918     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1919     STATIC_LIBIDL=1
1921     AC_DEFINE(HAVE_SNPRINTF)
1922     AC_DEFINE(_WINDOWS)
1923     AC_DEFINE(_WIN32)
1924     AC_DEFINE(WIN32)
1925     AC_DEFINE(XP_WIN)
1926     AC_DEFINE(XP_WIN32)
1927     AC_DEFINE(HW_THREADS)
1928     AC_DEFINE(STDC_HEADERS)
1929     AC_DEFINE(NEW_H, <new>)
1930     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1932     TARGET_MD_ARCH=win32
1933     _PLATFORM_DEFAULT_TOOLKIT='windows'
1934     BIN_SUFFIX='.exe'
1935     USE_SHORT_LIBNAME=1
1936     MOZ_ENABLE_POSTSCRIPT=
1937     MOZ_USER_DIR="Mozilla"
1941 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1942     DSO_CFLAGS=
1943     DSO_PIC_CFLAGS=
1944     DLL_SUFFIX=.dll
1945     RC=rc.exe
1946     # certain versions of cygwin's makedepend barf on the 
1947     # #include <string> vs -I./dist/include/string issue so don't use it
1948     SYSTEM_MAKEDEPEND=
1949     if test -n "$GNU_CC"; then
1950         CC="$CC -mno-cygwin"
1951         CXX="$CXX -mno-cygwin"
1952         CPP="$CPP -mno-cygwin"
1953         CFLAGS="$CFLAGS -mms-bitfields"
1954         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1955         DSO_LDOPTS='-shared'
1956         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1957         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1958         RC='$(WINDRES)'
1959         # Use temp file for windres (bug 213281)
1960         RCFLAGS='-O coff --use-temp-file'
1961         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1962         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1963         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1964         MOZ_FIX_LINK_PATHS=
1965         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1966         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1967         DLL_PREFIX=
1968         IMPORT_LIB_SUFFIX=dll.a
1969     else
1970         TARGET_COMPILER_ABI=msvc
1971         HOST_CC='$(CC)'
1972         HOST_CXX='$(CXX)'
1973         HOST_LD='$(LD)'
1974         AR='lib -NOLOGO -OUT:"$@"'
1975         AR_FLAGS=
1976         RANLIB='echo not_ranlib'
1977         STRIP='echo not_strip'
1978         XARGS=xargs
1979         ZIP=zip
1980         UNZIP=unzip
1981         DOXYGEN=:
1982         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1983         OBJ_SUFFIX=obj
1984         LIB_SUFFIX=lib
1985         DLL_PREFIX=
1986         LIB_PREFIX=
1987         IMPORT_LIB_SUFFIX=lib
1988         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1989         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1990         MKSHLIB_FORCE_ALL=
1991         MKSHLIB_UNFORCE_ALL=
1992         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1993         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1994         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1995         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1996         MOZ_DEBUG_FLAGS='-Zi'
1997         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1998         WARNINGS_AS_ERRORS='-WX'
1999         MOZ_OPTIMIZE_FLAGS='-O1'
2000         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2001         MOZ_FIX_LINK_PATHS=
2002         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2003         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2004         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2005         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2006         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2007         if test $_MSC_VER -ge 1400; then
2008             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2009             dnl For profile-guided optimization
2010             PROFILE_GEN_CFLAGS="-GL"
2011             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2012             dnl XXX: PGO builds can fail with warnings treated as errors,
2013             dnl specifically "no profile data available" appears to be
2014             dnl treated as an error sometimes. This might be a consequence
2015             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2016             dnl with the linker doing most of the work in the whole-program
2017             dnl optimization/PGO case. I think it's probably a compiler bug,
2018             dnl but we work around it here.
2019             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2020             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2021             dnl Probably also a compiler bug, but what can you do?
2022             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2023             if test -n "$_USE_DYNAMICBASE"; then
2024                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2025             fi
2026         fi
2027     fi
2028     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2029     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2030     AC_DEFINE(HAVE_SNPRINTF)
2031     AC_DEFINE(_WINDOWS)
2032     AC_DEFINE(_WIN32)
2033     AC_DEFINE(WIN32)
2034     AC_DEFINE(XP_WIN)
2035     AC_DEFINE(XP_WIN32)
2036     AC_DEFINE(HW_THREADS)
2037     AC_DEFINE(STDC_HEADERS)
2038     AC_DEFINE(NEW_H, <new>)
2039     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2040     TARGET_MD_ARCH=win32
2041     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2042     BIN_SUFFIX='.exe'
2043     USE_SHORT_LIBNAME=1
2044     MOZ_ENABLE_POSTSCRIPT=
2045     MOZ_USER_DIR="Mozilla"
2047     dnl Hardcode to win95 for now - cls
2048     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2050     dnl set NO_X11 defines here as the general check is skipped on win32
2051     no_x=yes
2052     AC_DEFINE(NO_X11)
2054     dnl MinGW/MSYS doesn't provide or need cygpath
2055     case "$host" in
2056     *-mingw*)
2057         CYGPATH_W=echo
2058         CYGPATH_S=cat
2059         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2060         ;;
2061     *-cygwin*|*-msvc*|*-mks*)
2062         CYGPATH_W="cygpath -a -w"
2063         CYGPATH_S="sed -e s|\\\\|/|g"
2064         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2065         ;;
2066     esac
2067     case "$host" in
2068     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2070     if test -z "$MOZ_TOOLS"; then
2071         AC_MSG_ERROR([MOZ_TOOLS is not set])
2072     fi
2074     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2075     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2076         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2077     fi
2078     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2079         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2080     fi
2081     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2083     if test -n "$GLIB_PREFIX"; then
2084         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2085         if test "$?" = "0"; then
2086             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2087                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2088             fi
2089             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2090         else
2091             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2092         fi
2093     else
2094         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2095     fi
2096     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2097         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2098     fi
2099     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2100     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2101         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2102     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2103         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2104     else
2105         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2106     fi
2108     if test -n "$LIBIDL_PREFIX"; then
2109         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2110         if test "$?" = "0"; then
2111             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2112                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2113             fi
2114             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2115         else
2116             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2117         fi
2118     else
2119         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2120     fi        
2121     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2122         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2123     fi
2124     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2125     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2126         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2127         STATIC_LIBIDL=1
2128     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2129         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2130     else
2131         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2132     fi
2133     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2134     ;;
2136     *) # else cross-compiling
2137         if test -n "$GLIB_PREFIX"; then
2138             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2139             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2140                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2141             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2142                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2143             else
2144                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2145             fi
2146         fi
2147         if test -n "$LIBIDL_PREFIX"; then
2148             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2149             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2150                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2151                 STATIC_LIBIDL=1
2152             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2153                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2154             else
2155                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2156             fi
2157         fi
2158         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2159         ;;
2160     esac 
2163     case "$host_os" in
2164     cygwin*|msvc*|mks*)
2165         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])
2166         ;;
2168     *)
2169         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2171         AC_LANG_SAVE
2172         AC_LANG_CPLUSPLUS
2173         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2174         AC_LANG_RESTORE
2175         ;;
2176     esac
2178     case "$target" in
2179     i*86-*)
2180         AC_DEFINE(_X86_)
2181         ;;
2182     alpha-*)
2183         AC_DEFINE(_ALPHA_)
2184         ;;
2185     mips-*)
2186         AC_DEFINE(_MIPS_)
2187         ;;
2188     *)
2189         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2190         ;;
2191     esac
2192     ;;
2194 *-netbsd*)
2195     DSO_CFLAGS=''
2196     CFLAGS="$CFLAGS -Dunix"
2197     CXXFLAGS="$CXXFLAGS -Dunix"
2198     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2199         DLL_SUFFIX=".so"
2200         DSO_PIC_CFLAGS='-fPIC -DPIC'
2201         DSO_LDOPTS='-shared'
2202         BIN_FLAGS='-Wl,--export-dynamic'
2203     else
2204         DSO_PIC_CFLAGS='-fPIC -DPIC'
2205         DLL_SUFFIX=".so.1.0"
2206         DSO_LDOPTS='-shared'
2207     fi
2208     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2209     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2210     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2211     if test "$LIBRUNPATH"; then
2212         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2213     fi
2214     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2215     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2216     ;;
2218 *-nto*) 
2219         AC_DEFINE(NTO)  
2220         AC_DEFINE(_QNX_SOURCE)
2221         AC_DEFINE(_i386)
2222         OS_TARGET=NTO
2223         WARNINGS_AS_ERRORS=''
2224         MOZ_OPTIMIZE_FLAGS="-O"
2225         MOZ_DEBUG_FLAGS="-gstabs"
2226         USE_PTHREADS=1
2227         _PEDANTIC=
2228         LIBS="$LIBS -lsocket -lstdc++"
2229         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2230         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2231         if test "$with_x" != "yes"
2232         then
2233                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2234             TK_CFLAGS='-I/usr/include/photon'
2235                 TK_LIBS='-lph'
2236         fi
2237         case "${target_cpu}" in
2238         ppc*)
2239         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2240         ;;
2241         esac
2242         case "${host_cpu}" in
2243         i*86)
2244         USE_ELF_DYNSTR_GC=1
2245         ;;
2246         esac
2247         ;;
2249 *-openbsd*)
2250     DLL_SUFFIX=".so.1.0"
2251     DSO_CFLAGS=''
2252     DSO_PIC_CFLAGS='-fPIC'
2253     DSO_LDOPTS='-shared -fPIC'
2254     if test "$LIBRUNPATH"; then
2255         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2256     fi
2257     ;;
2259 *-openvms*) 
2260     AC_DEFINE(NO_PW_GECOS)
2261     AC_DEFINE(NO_UDSOCK)
2262     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2263     USE_PTHREADS=1
2264     MKSHLIB_FORCE_ALL='-all'
2265     MKSHLIB_UNFORCE_ALL='-none'
2266     AS='as'
2267     AS_DASH_C_FLAG='-Wc/names=as_is'
2268     AR_FLAGS='c $@'
2269     DSO_LDOPTS='-shared -auto_symvec'
2270     DSO_PIC_CFLAGS=
2271     MOZ_DEBUG_LDFLAGS='-g'
2272     COMPAQ_CXX=1
2273     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2274     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2275     ;;
2278 *-os2*)
2279     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2280     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2281     AC_DEFINE(XP_OS2)
2282     USE_SHORT_LIBNAME=1
2283     DLL_PREFIX=
2284     LIB_PREFIX=
2285     LIB_SUFFIX=lib
2286     BIN_SUFFIX=".exe"
2287     DLL_SUFFIX=".dll"
2288     IMPORT_LIB_SUFFIX=lib
2289     DSO_PIC_CFLAGS=
2290     TARGET_MD_ARCH=os2
2291     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2292     MOZ_ENABLE_POSTSCRIPT=
2293     RC=rc.exe
2294     RCFLAGS='-n'
2295     MOZ_USER_DIR="Mozilla"
2297     if test "$MOZTOOLS"; then
2298         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2299     else
2300         AC_MSG_ERROR([MOZTOOLS is not set])
2301     fi
2303     # EMX/GCC build
2304     if test -n "$GNU_CC"; then
2305         AC_DEFINE(OS2)
2306         AC_DEFINE(XP_OS2_EMX)
2307         AC_DEFINE(OS2EMX_PLAIN_CHAR)
2308         AC_DEFINE(TCPV40HDRS)
2309         AR=emxomfar
2310         AR_FLAGS='r $@'
2311         CFLAGS="$CFLAGS -Zomf"
2312         CXXFLAGS="$CXXFLAGS -Zomf"
2313         DSO_LDOPTS='-Zdll'
2314         BIN_FLAGS='-Zlinker /ST:0x100000'
2315         IMPLIB='emximp -o'
2316         FILTER='emxexp -o'
2317         LDFLAGS='-Zmap'
2318         WARNINGS_AS_ERRORS='-Werror'
2319         MOZ_DEBUG_FLAGS="-g -fno-inline"
2320         MOZ_OPTIMIZE_FLAGS="-O2"
2321         MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2322         MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2323         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2324         LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2325         if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2326           DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2327           LDFLAGS="$LDFLAGS -Zhigh-mem"
2328           MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2329           AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2330         fi
2332         # GCC for OS/2 currently predefines these, but we don't want them
2333         _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2334         _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2336         AC_CACHE_CHECK(for __declspec(dllexport),
2337            ac_os2_declspec,
2338            [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2339                            [return 0;],
2340                            ac_os2_declspec="yes",
2341                            ac_os2_declspec="no")])
2342         if test "$ac_os2_declspec" = "yes"; then
2343            FILTER='true'
2344            MOZ_OS2_USE_DECLSPEC='1'
2345         fi
2346         
2347     # Visual Age C++ build
2348     elif test "$VACPP" = "yes"; then
2349         MOZ_BUILD_ROOT=`pwd -D`
2350         OBJ_SUFFIX=obj
2351         AR=-ilib
2352         AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
2353         AR_LIST='/L'
2354         AR_EXTRACT='-*'
2355         AR_DELETE='-'
2356         AS=alp
2357         ASFLAGS='-Mb'
2358         AS_DASH_C_FLAG=''
2359         ASM_SUFFIX=asm
2360         LD='-ilink'
2361         CFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9"
2362         CXXFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9 /Gx+"
2363         MOZ_DEBUG_FLAGS="/Ti+"
2364         WARNINGS_AS_ERRORS='-WX'
2365         MOZ_OPTIMIZE_FLAGS="/O+ /Gl+ /G5 /qarch=pentium"
2366         LDFLAGS="/NOL /M"
2367         MOZ_DEBUG_LDFLAGS="/DE"
2368         MOZ_OPTIMIZE_LDFLAGS="/OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
2369         DSO_LDOPTS=''
2370         DSO_PIC_CFLAGS=
2371         IMPLIB='implib /NOL /NOI'
2372         FILTER='cppfilt -q -B -P'
2373         AC_DEFINE(NO_ANSI_KEYWORDS)
2374         AC_DEFINE(OS2,4)
2375         AC_DEFINE(_X86_)
2376         AC_DEFINE(XP_OS2_VACPP)
2377         AC_DEFINE(TCPV40HDRS)
2378         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2379         AC_DEFINE(STDC_HEADERS)
2380         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2381         MKSHLIB='$(LD) $(DSO_LDOPTS)'
2382         MKCSHLIB='$(LD) $(DSO_LDOPTS)'
2383         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2384         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcomct.lib'
2385         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2386         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2387     fi
2388     ;;
2390 alpha*-*-osf*)
2391     if test "$GNU_CC"; then
2392       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2393       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2395     else
2396         MOZ_DEBUG_FLAGS='-g'
2397         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2398         CFLAGS="$CFLAGS -ieee"
2399         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2400         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2401         DSO_CFLAGS=
2402         DSO_PIC_CFLAGS=
2403         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2404         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2405         MKSHLIB_FORCE_ALL='-all'
2406         MKSHLIB_UNFORCE_ALL='-none'
2407         dnl Might fix the libxpcom.so breakage on this platform as well....
2408         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2409         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2410     fi
2411     if test -z "$GNU_CXX"; then
2412       COMPAQ_CXX=1
2413     fi
2414     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2415     ;;
2417 *-qnx*) 
2418     DIRENT_INO=d_stat.st_ino
2419     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2420     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2421     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2422     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2423     AC_DEFINE(STDC_HEADERS)
2424     if test "$no_x" = "yes"; then
2425             _PLATFORM_DEFAULT_TOOLKIT='photon'
2426             TK_CFLAGS='-I/usr/nto/include/photon'
2427             TK_LIBS='-lphoton -lphrender'
2428     fi
2429     ;;
2431 *-sco*) 
2432     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2433     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2434     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2435     if test ! "$GNU_CC"; then
2436        DSO_LDOPTS='-G'
2437     fi
2438     ;;
2440 dnl the qsort routine under solaris is faulty
2441 *-solaris*) 
2442     AC_DEFINE(SOLARIS)
2443     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2444     SYSTEM_MAKEDEPEND=
2445     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2446     # libraries one level up (e.g. libnspr4.so)
2447     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2448     MOZ_MEMORY=1
2449     if test -z "$GNU_CC"; then
2450        NS_USE_NATIVE=1
2451        MOZ_FIX_LINK_PATHS='-R $(LIBXUL_DIST)/bin'
2452        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2454        if test "$CPU_ARCH" != "sparc"; then
2455           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2456           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2457        else
2458           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2459           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2460           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2461        fi
2463        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2464        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2465            _SAVE_LDFLAGS=$LDFLAGS
2466            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2467            AC_TRY_LINK([#include <stdio.h>],
2468                        [printf("Hello World\n");],
2469                        ,
2470                        [LDFLAGS=$_SAVE_LDFLAGS])
2471        fi
2472        WARNINGS_AS_ERRORS='-Werror'
2473        MOZ_OPTIMIZE_FLAGS="-xO4"
2474        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2475        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2476        MKSHLIB_FORCE_ALL='-z allextract'
2477        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2478        DSO_LDOPTS='-G -z muldefs'
2479        AR_LIST="$AR t"
2480        AR_EXTRACT="$AR x"
2481        AR_DELETE="$AR d"
2482        AR='$(CXX) -xar'
2483        AR_FLAGS='-o $@'
2484        AS='/usr/ccs/bin/as'
2485        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2486        AS_DASH_C_FLAG=''
2487        TARGET_COMPILER_ABI="sunc"
2488         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2489         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2490        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2491        AC_LANG_SAVE
2492        AC_LANG_CPLUSPLUS
2493        AC_TRY_COMPILE([],
2494            [#if (__SUNPRO_CC < 0x530)
2495            #error "Denied"
2496            #endif],
2497            _BAD_COMPILER=,_BAD_COMPILER=1)
2498         if test -n "$_BAD_COMPILER"; then
2499             _res="no"
2500             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2501         else
2502             _res="yes"
2503         fi
2504         AC_MSG_RESULT([$_res])
2505         AC_LANG_RESTORE
2506     else
2507        ASFLAGS="$ASFLAGS -fPIC"
2508        DSO_LDOPTS='-G'
2509        _WARNINGS_CFLAGS=''
2510        _WARNINGS_CXXFLAGS=''
2511        if test "$OS_RELEASE" = "5.3"; then
2512           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2513        fi
2514     fi
2515     if test "$OS_RELEASE" = "5.5.1"; then
2516        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2517     fi
2518     ;;
2520 *-sunos*) 
2521     DSO_LDOPTS='-Bdynamic'
2522     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2523     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2524     AC_DEFINE(SUNOS4)
2525     AC_DEFINE(SPRINTF_RETURNS_STRING)
2526     case "$(target_os)" in
2527     sunos4.1*)
2528         DLL_SUFFIX='.so.1.0'
2529         ;;
2530     esac
2531     ;;
2533 *-sysv4.2uw7*) 
2534         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2535     ;;
2537 *-os2*)
2538     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2539     ;;
2541 esac
2543 dnl Only one oddball right now (QNX), but this gives us flexibility
2544 dnl if any other platforms need to override this in the future.
2545 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2547 dnl ========================================================
2548 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2549 dnl by now will not have any way to link most binaries (tests
2550 dnl as well as viewer, apprunner, etc.), because some symbols
2551 dnl will be left out of the "composite" .so's by ld as unneeded.
2552 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2553 dnl they can link in the static libs that provide the missing
2554 dnl symbols.
2555 dnl ========================================================
2556 NO_LD_ARCHIVE_FLAGS=
2557 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2558     NO_LD_ARCHIVE_FLAGS=1
2560 case "$target" in
2561 *-os2*)
2562     NO_LD_ARCHIVE_FLAGS=
2563     ;;
2564 *-aix4.3*|*-aix5*)
2565     NO_LD_ARCHIVE_FLAGS=
2566     ;;
2567 *-openvms*)
2568     NO_LD_ARCHIVE_FLAGS=
2569     ;;
2570 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2571     if test -z "$GNU_CC"; then
2572         NO_LD_ARCHIVE_FLAGS=
2573     fi
2574     ;;
2575 esac
2576 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2579 dnl Indicate that platform requires special thread safe 
2580 dnl locking when starting up the OJI JVM 
2581 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2582 dnl ========================================================
2583 case "$target" in
2584     *-hpux*)      
2585         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2586         ;;
2587 esac
2589 dnl ========================================================
2590 dnl = Flags to strip unused symbols from .so components
2591 dnl ========================================================
2592 case "$target" in
2593     *-linux*|*-kfreebsd*-gnu)
2594         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2595         ;;
2596     *-solaris*)
2597         if test -z "$GNU_CC"; then
2598          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2599         else
2600          if test -z "$GCC_USE_GNU_LD"; then
2601           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2602          else
2603           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2604          fi
2605         fi
2606         ;;
2607     *-nto*) 
2608         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2609         ;;
2610     *-darwin*)
2611         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2612         ;;
2613     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2614         if test -n "$GNU_CC"; then
2615            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2616         fi
2617         ;;
2618 esac
2620 if test -z "$COMPILE_ENVIRONMENT"; then
2621     SKIP_COMPILER_CHECKS=1
2622     SKIP_LIBRARY_CHECKS=1
2625 if test -z "$SKIP_COMPILER_CHECKS"; then
2626 dnl Checks for typedefs, structures, and compiler characteristics.
2627 dnl ========================================================
2628 AC_LANG_C
2629 AC_HEADER_STDC
2630 AC_C_CONST
2631 AC_TYPE_MODE_T
2632 AC_TYPE_OFF_T
2633 AC_TYPE_PID_T
2634 AC_TYPE_SIZE_T
2635 AC_STRUCT_ST_BLKSIZE
2636 AC_MSG_CHECKING(for siginfo_t)
2637 AC_CACHE_VAL(ac_cv_siginfo_t,
2638  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2639                   #include <signal.h>],
2640                  [siginfo_t* info;],
2641                  [ac_cv_siginfo_t=true],
2642                  [ac_cv_siginfo_t=false])])
2643 if test "$ac_cv_siginfo_t" = true ; then
2644   AC_DEFINE(HAVE_SIGINFO_T)
2645   AC_MSG_RESULT(yes)
2646 else
2647   AC_MSG_RESULT(no)
2650 dnl Visual Age for os/2 also defines size_t and off_t in certain 
2651 dnl  header files.  These defines make Visual Age use the mozilla
2652 dnl  defines types.
2653 if test "$VACPP" = "yes"; then
2654    AC_DEFINE(__size_t)
2655    AC_DEFINE(__off_t)
2658 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2659 dnl ========================================================
2660 AC_MSG_CHECKING(for int16_t)
2661 AC_CACHE_VAL(ac_cv_int16_t,
2662  [AC_TRY_COMPILE([#include <stdio.h>
2663                   #include <sys/types.h>],
2664                  [int16_t foo = 0;],
2665                  [ac_cv_int16_t=true],
2666                  [ac_cv_int16_t=false])])
2667 if test "$ac_cv_int16_t" = true ; then
2668   AC_DEFINE(HAVE_INT16_T)
2669   AC_MSG_RESULT(yes)
2670 else
2671   AC_MSG_RESULT(no)
2673 AC_MSG_CHECKING(for int32_t)
2674 AC_CACHE_VAL(ac_cv_int32_t,
2675  [AC_TRY_COMPILE([#include <stdio.h>
2676                   #include <sys/types.h>],
2677                  [int32_t foo = 0;],
2678                  [ac_cv_int32_t=true],
2679                  [ac_cv_int32_t=false])])
2680 if test "$ac_cv_int32_t" = true ; then
2681   AC_DEFINE(HAVE_INT32_T)
2682   AC_MSG_RESULT(yes)
2683 else
2684   AC_MSG_RESULT(no)
2686 AC_MSG_CHECKING(for int64_t)
2687 AC_CACHE_VAL(ac_cv_int64_t,
2688  [AC_TRY_COMPILE([#include <stdio.h>
2689                   #include <sys/types.h>],
2690                  [int64_t foo = 0;],
2691                  [ac_cv_int64_t=true],
2692                  [ac_cv_int64_t=false])])
2693 if test "$ac_cv_int64_t" = true ; then
2694   AC_DEFINE(HAVE_INT64_T)
2695   AC_MSG_RESULT(yes)
2696 else
2697   AC_MSG_RESULT(no)
2699 AC_MSG_CHECKING(for int64)
2700 AC_CACHE_VAL(ac_cv_int64,
2701  [AC_TRY_COMPILE([#include <stdio.h>
2702                   #include <sys/types.h>],
2703                  [int64 foo = 0;],
2704                  [ac_cv_int64=true],
2705                  [ac_cv_int64=false])])
2706 if test "$ac_cv_int64" = true ; then
2707   AC_DEFINE(HAVE_INT64)
2708   AC_MSG_RESULT(yes)
2709 else
2710   AC_MSG_RESULT(no)
2712 AC_MSG_CHECKING(for uint)
2713 AC_CACHE_VAL(ac_cv_uint,
2714  [AC_TRY_COMPILE([#include <stdio.h>
2715                   #include <sys/types.h>],
2716                  [uint foo = 0;],
2717                  [ac_cv_uint=true],
2718                  [ac_cv_uint=false])])
2719 if test "$ac_cv_uint" = true ; then
2720   AC_DEFINE(HAVE_UINT)
2721   AC_MSG_RESULT(yes)
2722 else
2723   AC_MSG_RESULT(no)
2725 AC_MSG_CHECKING(for uint_t)
2726 AC_CACHE_VAL(ac_cv_uint_t,
2727  [AC_TRY_COMPILE([#include <stdio.h>
2728                   #include <sys/types.h>],
2729                  [uint_t foo = 0;],
2730                  [ac_cv_uint_t=true],
2731                  [ac_cv_uint_t=false])])
2732 if test "$ac_cv_uint_t" = true ; then
2733   AC_DEFINE(HAVE_UINT_T)
2734   AC_MSG_RESULT(yes)
2735 else
2736   AC_MSG_RESULT(no)
2738 AC_MSG_CHECKING(for uint16_t)
2739 AC_CACHE_VAL(ac_cv_uint16_t,
2740  [AC_TRY_COMPILE([#include <stdio.h>
2741                   #include <sys/types.h>],
2742                  [uint16_t foo = 0;],
2743                  [ac_cv_uint16_t=true],
2744                  [ac_cv_uint16_t=false])])
2745 if test "$ac_cv_uint16_t" = true ; then
2746   AC_DEFINE(HAVE_UINT16_T)
2747   AC_MSG_RESULT(yes)
2748 else
2749   AC_MSG_RESULT(no)
2752 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2753 dnl are defined when compiling C++ but not C.  Since the result of this
2754 dnl test is used only in C++, do it in C++.
2755 AC_LANG_CPLUSPLUS
2757 AC_MSG_CHECKING(for uname.domainname)
2758 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2759     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2760         [ struct utsname *res; char *domain; 
2761             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2762         [ac_cv_have_uname_domainname_field=true],
2763         [ac_cv_have_uname_domainname_field=false])])
2765 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2766     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2767     AC_MSG_RESULT(yes)
2768 else
2769     AC_MSG_RESULT(no)
2772 AC_MSG_CHECKING(for uname.__domainname)
2773 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2774     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2775         [ struct utsname *res; char *domain; 
2776             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2777         [ac_cv_have_uname_us_domainname_field=true],
2778         [ac_cv_have_uname_us_domainname_field=false])])
2780 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2781     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2782     AC_MSG_RESULT(yes)
2783 else
2784     AC_MSG_RESULT(no)
2787 AC_LANG_C
2789 dnl Check for usable wchar_t (2 bytes, unsigned)
2790 dnl (we really don't need the unsignedness check anymore)
2791 dnl ========================================================
2793 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2794     ac_cv_have_usable_wchar_v2,
2795     [AC_TRY_COMPILE([#include <stddef.h>
2796                      $configure_static_assert_macros],
2797                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2798                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2799                     ac_cv_have_usable_wchar_v2="yes",
2800                     ac_cv_have_usable_wchar_v2="no")])
2801 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2802     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2803     HAVE_CPP_2BYTE_WCHAR_T=1
2804 else
2805 dnl This is really gcc-only
2806 dnl Do this test using CXX only since some versions of gcc
2807 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2808 dnl only have short-wchar support for c++.
2809 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2811     AC_LANG_SAVE
2812     AC_LANG_CPLUSPLUS
2813     _SAVE_CXXFLAGS=$CXXFLAGS
2814     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2816     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2817         ac_cv_have_usable_wchar_option_v2,
2818         [AC_TRY_LINK([#include <stddef.h>
2819                       $configure_static_assert_macros],
2820                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2821                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2822                      ac_cv_have_usable_wchar_option_v2="yes",
2823                      ac_cv_have_usable_wchar_option_v2="no")])
2825     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2826         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2827         HAVE_CPP_2BYTE_WCHAR_T=1
2828     else    
2829         CXXFLAGS=$_SAVE_CXXFLAGS
2830     fi
2831     AC_LANG_RESTORE
2834 dnl Check for .hidden assembler directive and visibility attribute.
2835 dnl Borrowed from glibc configure.in
2836 dnl ===============================================================
2837 if test "$GNU_CC"; then
2838   AC_CACHE_CHECK(for visibility(hidden) attribute,
2839                  ac_cv_visibility_hidden,
2840                  [cat > conftest.c <<EOF
2841                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2843                   ac_cv_visibility_hidden=no
2844                   if ${CC-cc} -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_hidden=yes
2847                     fi
2848                   fi
2849                   rm -f conftest.[cs]
2850                  ])
2851   if test "$ac_cv_visibility_hidden" = "yes"; then
2852     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2854     AC_CACHE_CHECK(for visibility(default) attribute,
2855                    ac_cv_visibility_default,
2856                    [cat > conftest.c <<EOF
2857                     int foo __attribute__ ((visibility ("default"))) = 1;
2859                     ac_cv_visibility_default=no
2860                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2861                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2862                         ac_cv_visibility_default=yes
2863                       fi
2864                     fi
2865                     rm -f conftest.[cs]
2866                    ])
2867     if test "$ac_cv_visibility_default" = "yes"; then
2868       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2870       AC_CACHE_CHECK(for visibility pragma support,
2871                      ac_cv_visibility_pragma,
2872                      [cat > conftest.c <<EOF
2873 #pragma GCC visibility push(hidden)
2874                       int foo_hidden = 1;
2875 #pragma GCC visibility push(default)
2876                       int foo_default = 1;
2878                       ac_cv_visibility_pragma=no
2879                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2880                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2881                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2882                             ac_cv_visibility_pragma=yes
2883                           fi
2884                         fi
2885                       fi
2886                       rm -f conftest.[cs]
2887                     ])
2888       if test "$ac_cv_visibility_pragma" = "yes"; then
2889         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2890                        ac_cv_have_visibility_class_bug,
2891                        [cat > conftest.c <<EOF
2892 #pragma GCC visibility push(hidden)
2893 struct __attribute__ ((visibility ("default"))) TestStruct {
2894   static void Init();
2896 __attribute__ ((visibility ("default"))) void TestFunc() {
2897   TestStruct::Init();
2900                        ac_cv_have_visibility_class_bug=no
2901                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2902                          ac_cv_have_visibility_class_bug=yes
2903                        else
2904                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2905                            ac_cv_have_visibility_class_bug=yes
2906                          fi
2907                        fi
2908                        rm -rf conftest.{c,S}
2909                        ])
2911         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2912                        ac_cv_have_visibility_builtin_bug,
2913                        [cat > conftest.c <<EOF
2914 #pragma GCC visibility push(hidden)
2915 #pragma GCC visibility push(default)
2916 #include <string.h>
2917 #pragma GCC visibility pop
2919 __attribute__ ((visibility ("default"))) void Func() {
2920   char c[[100]];
2921   memset(c, 0, sizeof(c));
2924                        ac_cv_have_visibility_builtin_bug=no
2925                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2926                          ac_cv_have_visibility_builtin_bug=yes
2927                        else
2928                          if test `grep -c "@PLT" conftest.S` = 0; then
2929                            ac_cv_visibility_builtin_bug=yes
2930                          fi
2931                        fi
2932                        rm -f conftest.{c,S}
2933                        ])
2934         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2935                 "$ac_cv_have_visibility_class_bug" = "no"; then
2936           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2937           WRAP_SYSTEM_INCLUDES=1
2938         else
2939           VISIBILITY_FLAGS='-fvisibility=hidden'
2940         fi # have visibility pragma bug
2941       fi   # have visibility pragma
2942     fi     # have visibility(default) attribute
2943   fi       # have visibility(hidden) attribute
2944 fi         # GNU_CC
2946 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2947 AC_SUBST(VISIBILITY_FLAGS)
2949 dnl Checks for header files.
2950 dnl ========================================================
2951 AC_HEADER_DIRENT
2952 case "$target_os" in
2953 freebsd*)
2954 # for stuff like -lXshm
2955     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2956     ;;
2957 esac
2958 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2959 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2960 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2961 AC_CHECK_HEADERS(malloc.h)
2962 AC_CHECK_HEADERS(X11/XKBlib.h)
2964 dnl These are all the places some variant of statfs can be hiding.
2965 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2967 dnl Try for MMX support
2968 dnl NB - later gcc versions require -mmmx for this header to be successfully
2969 dnl included (or another option which implies it, such as -march=pentium-mmx)
2970 AC_CHECK_HEADERS(mmintrin.h)
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 dnl ========================================================
4023 dnl = If NSPR was not detected in the system, 
4024 dnl = use the one in the source tree (mozilla/nsprpub)
4025 dnl ========================================================
4026 MOZ_ARG_WITH_BOOL(system-nspr,
4027 [  --with-system-nspr      Use system installed NSPR],
4028     _USE_SYSTEM_NSPR=1 )
4030 if test -n "$_USE_SYSTEM_NSPR"; then
4031     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4034 if test -n "$MOZ_NATIVE_NSPR"; then
4035     _SAVE_CFLAGS=$CFLAGS
4036     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4037     AC_TRY_COMPILE([#include "prlog.h"],
4038                 [#ifndef PR_STATIC_ASSERT
4039                  #error PR_STATIC_ASSERT not defined
4040                  #endif],
4041                 [MOZ_NATIVE_NSPR=1],
4042                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4043     CFLAGS=$_SAVE_CFLAGS
4044 else
4045     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --includedir=$(LIBXUL_DIST)/include/nspr --cflags`'
4046     # explicitly set libs for Visual Age C++ for OS/2
4047     if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
4048         NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '$_PTHREAD_LDFLAGS''
4049     elif test "$OS_ARCH" = "WINCE"; then
4050         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4051         NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4052     elif test "$OS_ARCH" = "WINNT"; then
4053         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4054         if test -n "$GNU_CC"; then
4055             NSPR_LIBS="-L\$(LIBXUL_DIST)/lib -lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION"
4056         else
4057             NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4058         fi
4059     else
4060         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --libdir=$(LIBXUL_DIST)/lib --libs`'
4061     fi
4064 dnl ========================================================
4065 dnl = If NSS was not detected in the system, 
4066 dnl = use the one in the source tree (mozilla/security/nss)
4067 dnl ========================================================
4069 MOZ_ARG_WITH_BOOL(system-nss,
4070 [  --with-system-nss      Use system installed NSS],
4071     _USE_SYSTEM_NSS=1 )
4073 if test -n "$_USE_SYSTEM_NSS"; then
4074     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4077 if test -n "$MOZ_NATIVE_NSS"; then
4078    NSS_LIBS="$NSS_LIBS -lcrmf"
4079 else
4080    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4081    NSS_DEP_LIBS="\
4082         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4083         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4084         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4085         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4086         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4087         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4089    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4090        NSS_LIBS="\
4091         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4092         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4093         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4094         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4095         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4096         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4097    else
4098        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4099    fi
4102 if test -z "$SKIP_LIBRARY_CHECKS"; then
4103 dnl system JPEG support
4104 dnl ========================================================
4105 MOZ_ARG_WITH_STRING(system-jpeg,
4106 [  --with-system-jpeg[=PFX]
4107                           Use system libjpeg [installed at prefix PFX]],
4108     JPEG_DIR=$withval)
4110 _SAVE_CFLAGS=$CFLAGS
4111 _SAVE_LDFLAGS=$LDFLAGS
4112 _SAVE_LIBS=$LIBS
4113 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4114     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4115     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4117 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4118     SYSTEM_JPEG=
4119 else
4120     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4123 if test "$SYSTEM_JPEG" = 1; then
4124     LIBS="$JPEG_LIBS $LIBS"
4125     AC_TRY_COMPILE([ #include <stdio.h>
4126                      #include <sys/types.h>
4127                      #include <jpeglib.h> ],
4128                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4129                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4130                      #endif ],
4131                    SYSTEM_JPEG=1,
4132                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4133 fi 
4134 CFLAGS=$_SAVE_CFLAGS
4135 LDFLAGS=$_SAVE_LDFLAGS
4136 LIBS=$_SAVE_LIBS
4138 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4139     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4140     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4143 dnl system ZLIB support
4144 dnl ========================================================
4145 MOZ_ARG_WITH_STRING(system-zlib,
4146 [  --with-system-zlib[=PFX]
4147                           Use system libz [installed at prefix PFX]],
4148     ZLIB_DIR=$withval)
4150 _SAVE_CFLAGS=$CFLAGS
4151 _SAVE_LDFLAGS=$LDFLAGS
4152 _SAVE_LIBS=$LIBS
4153 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4154     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4155     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4157 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4158     SYSTEM_ZLIB=
4159 else
4160     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4161         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4163 if test "$SYSTEM_ZLIB" = 1; then
4164     LIBS="$ZLIB_LIBS $LIBS"
4165     AC_TRY_COMPILE([ #include <stdio.h>
4166                      #include <string.h>
4167                      #include <zlib.h> ],
4168                    [ #if ZLIB_VERNUM < $MOZZLIB 
4169                      #error "Insufficient zlib version ($MOZZLIB required)."
4170                      #endif ],
4171                    SYSTEM_ZLIB=1,
4172                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4174 CFLAGS=$_SAVE_CFLAGS
4175 LDFLAGS=$_SAVE_LDFLAGS
4176 LIBS=$_SAVE_LIBS
4178 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4179     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4180     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4183 dnl system BZIP2 Support
4184 dnl ========================================================
4185 MOZ_ARG_WITH_STRING(system-bz2,
4186 [  --with-system-bz2[=PFX]
4187                           Use system libbz2 [installed at prefix PFX]],
4188     BZ2_DIR=$withval)
4190 _SAVE_CFLAGS=$CFLAGS
4191 _SAVE_LDFLAGS=$LDFLAGS
4192 _SAVE_LIBS=$LIBS
4193 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4194     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4195     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4197 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4198     SYSTEM_BZ2=
4199 else
4200     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4201         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4203 CFLAGS=$_SAVE_CFLAGS
4204 LDFLAGS=$_SAVE_LDFLAGS
4205 LIBS=$_SAVE_LIBS
4207 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4208     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4209     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4212 dnl system PNG Support
4213 dnl ========================================================
4214 MOZ_ARG_WITH_STRING(system-png, 
4215 [  --with-system-png[=PFX]
4216                           Use system libpng [installed at prefix PFX]],
4217     PNG_DIR=$withval)
4219 _SAVE_CFLAGS=$CFLAGS
4220 _SAVE_LDFLAGS=$LDFLAGS
4221 _SAVE_LIBS=$LIBS
4222 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4223 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4224 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4225     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4226     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4228 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4229     SYSTEM_PNG=
4230 else
4231     _SAVE_PNG_LIBS=$PNG_LIBS
4232     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4233                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4234                  $PNG_LIBS)
4235     AC_CHECK_LIB(png, png_get_acTL, ,
4236                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4237                  $_SAVE_PNG_LIBS)
4239 if test "$SYSTEM_PNG" = 1; then
4240     LIBS="$PNG_LIBS $LIBS"
4241     AC_TRY_COMPILE([ #include <stdio.h>
4242                      #include <sys/types.h>
4243                      #include <png.h> ],
4244                    [ #if PNG_LIBPNG_VER < $MOZPNG
4245                      #error "Insufficient libpng version ($MOZPNG required)."
4246                      #endif
4247                      #ifndef PNG_UINT_31_MAX
4248                      #error "Insufficient libpng version."
4249                      #endif ],
4250                    SYSTEM_PNG=1,
4251                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4253 CFLAGS=$_SAVE_CFLAGS
4254 LDFLAGS=$_SAVE_LDFLAGS
4255 LIBS=$_SAVE_LIBS
4257 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4258     PNG_CFLAGS="-I${PNG_DIR}/include"
4259     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4262 fi # SKIP_LIBRARY_CHECKS
4264 dnl system HunSpell Support
4265 dnl ========================================================
4266 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4267 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4268     SYSTEM_HUNSPELL=1 )
4270 if test -n "$SYSTEM_HUNSPELL"; then
4271     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4274 AC_SUBST(SYSTEM_HUNSPELL)
4276 dnl check whether to enable glitz
4277 dnl ========================================================
4278 MOZ_ARG_ENABLE_BOOL(glitz,
4279 [  --enable-glitz          Enable Glitz for use with Cairo],
4280     MOZ_ENABLE_GLITZ=1,
4281     MOZ_ENABLE_GLITZ= )
4282 if test "$MOZ_ENABLE_GLITZ"; then
4283     AC_DEFINE(MOZ_ENABLE_GLITZ)
4286 dnl ========================================================
4287 dnl Java SDK support
4288 dnl ========================================================
4289 JAVA_INCLUDE_PATH=
4290 MOZ_ARG_WITH_STRING(java-include-path,
4291 [  --with-java-include-path=dir   Location of Java SDK headers],
4292     JAVA_INCLUDE_PATH=$withval)
4294 JAVA_BIN_PATH=
4295 MOZ_ARG_WITH_STRING(java-bin-path,
4296 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4297     JAVA_BIN_PATH=$withval)
4299 dnl ========================================================
4300 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4301 dnl their usage and use them in spidermonkey.
4302 dnl ========================================================
4303 MOZ_ARG_WITH_BOOL(arm-kuser,
4304 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4305     USE_ARM_KUSER=1,
4306     USE_ARM_KUSER=)
4307 if test -n "$USE_ARM_KUSER"; then
4308    AC_DEFINE(USE_ARM_KUSER)
4311 dnl ========================================================
4312 dnl =
4313 dnl = Application
4314 dnl =
4315 dnl ========================================================
4317 MOZ_ARG_HEADER(Application)
4319 BUILD_STATIC_LIBS=
4320 ENABLE_TESTS=1
4321 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4322 MOZ_BRANDING_DIRECTORY=
4323 MOZ_CALENDAR=
4324 MOZ_DBGRINFO_MODULES=
4325 MOZ_ENABLE_CANVAS=1
4326 MOZ_EXTENSIONS_ALL=" wallet p3p venkman inspector irc typeaheadfind gnomevfs sroaming datetime finger cview layout-debug tasks sql xforms schema-validation reporter"
4327 MOZ_FEEDS=1
4328 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4329 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4330 MOZ_IPCD=
4331 MOZ_JAVAXPCOM=
4332 MOZ_JSDEBUGGER=1
4333 MOZ_JSLOADER=1
4334 MOZ_LDAP_XPCOM=
4335 MOZ_LIBART_CFLAGS=
4336 MOZ_LIBART_LIBS=
4337 MOZ_MAIL_NEWS=
4338 MOZ_MATHML=1
4339 MOZ_MOCHITEST=1
4340 MOZ_MORK=1
4341 MOZ_MORKREADER=
4342 MOZ_AUTH_EXTENSION=1
4343 MOZ_NO_ACTIVEX_SUPPORT=1
4344 MOZ_NO_INSPECTOR_APIS=
4345 MOZ_NO_XPCOM_OBSOLETE=
4346 MOZ_NO_FAST_LOAD=
4347 MOZ_MEDIA=
4348 MOZ_OJI=
4349 MOZ_PERMISSIONS=1
4350 MOZ_PLACES=
4351 MOZ_PLAINTEXT_EDITOR_ONLY=
4352 MOZ_PLUGINS=1
4353 MOZ_PREF_EXTENSIONS=1
4354 MOZ_PROFILELOCKING=1
4355 MOZ_PROFILESHARING=1
4356 MOZ_PSM=1
4357 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4358 MOZ_PYTHON=
4359 MOZ_PYTHON_DEBUG_SUFFIX=
4360 MOZ_PYTHON_DLL_SUFFIX=
4361 MOZ_PYTHON_INCLUDES=
4362 MOZ_PYTHON_LIBS=
4363 MOZ_PYTHON_PREFIX=
4364 MOZ_PYTHON_VER=
4365 MOZ_PYTHON_VER_DOTTED=
4366 MOZ_RDF=1
4367 MOZ_REFLOW_PERF=
4368 MOZ_SAFE_BROWSING=
4369 MOZ_HELP_VIEWER=
4370 MOZ_SPELLCHECK=1
4371 MOZ_STATIC_MAIL_BUILD=
4372 MOZ_STORAGE=1
4373 MOZ_SVG=1
4374 MOZ_TIMELINE=
4375 MOZ_UI_LOCALE=en-US
4376 MOZ_UNIVERSALCHARDET=1
4377 MOZ_URL_CLASSIFIER=
4378 MOZ_USE_NATIVE_UCONV=
4379 MOZ_V1_STRING_ABI=
4380 MOZ_VIEW_SOURCE=1
4381 MOZ_XPFE_COMPONENTS=1
4382 MOZ_XPINSTALL=1
4383 MOZ_XSLT_STANDALONE=
4384 MOZ_XTF=1
4385 MOZ_XUL=1
4386 MOZ_XUL_APP=1
4387 MOZ_ZIPWRITER=1
4388 NS_PRINTING=1
4389 NECKO_COOKIES=1
4390 NECKO_DISK_CACHE=1
4391 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4392 NECKO_SMALL_BUFFERS=
4393 SUNCTL=
4394 JS_STATIC_BUILD=
4395 XPC_IDISPATCH_SUPPORT=
4398 case "$target_os" in
4399 darwin*)
4400     ACCESSIBILITY=
4401     ;;
4403     ACCESSIBILITY=1
4404     ;;
4405 esac
4407 case "$target_os" in
4408     msvc*|mks*|cygwin*|mingw*)
4409         if test -z "$GNU_CC"; then 
4410             XPC_IDISPATCH_SUPPORT=1
4411             MOZ_NO_ACTIVEX_SUPPORT=
4412             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4413         fi
4414         ;;
4415 esac
4417 MOZ_ARG_ENABLE_STRING(application,
4418 [  --enable-application=APP
4419                           Options include:
4420                             suite
4421                             browser (Firefox)
4422                             mail (Thunderbird)
4423                             composer
4424                             calendar (Sunbird)
4425                             xulrunner
4426                             camino
4427                             content/xslt (Standalone Transformiix XSLT)
4428                             netwerk (Standalone Necko)
4429                             tools/update-packaging (AUS-related packaging tools)
4430                             standalone (use this for standalone
4431                               xpcom/xpconnect or to manually drive a build)],
4432 [ MOZ_BUILD_APP=$enableval ] )
4434 if test "$MOZ_BUILD_APP" = "macbrowser"; then
4435     AC_MSG_WARN([--enable-application=macbrowser is deprecated. Use --enable-application=camino.])
4436     MOZ_BUILD_APP=camino
4439 MOZ_EMBEDDING_PROFILE=default
4440 MOZ_ARG_WITH_STRING(embedding-profile,
4441 [  --with-embedding-profile=default|basic|minimal
4442                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4443 [ MOZ_EMBEDDING_PROFILE=$withval ])
4445 case "$MOZ_EMBEDDING_PROFILE" in
4446 default)
4447   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4448   MOZ_EMBEDDING_LEVEL_BASIC=1
4449   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4450   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4451   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4452   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4453   ;;
4455 basic)
4456   MOZ_EMBEDDING_LEVEL_DEFAULT=
4457   MOZ_EMBEDDING_LEVEL_BASIC=1
4458   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4459   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4460   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4461   ENABLE_TESTS=
4462   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4463   MOZ_COMPOSER=
4464   MOZ_ENABLE_CANVAS=
4465   MOZ_ENABLE_POSTSCRIPT=
4466   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4467   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4468   MOZ_IMG_ENCODERS_DEFAULT=
4469   MOZ_IMG_ENCODERS=
4470   MOZ_INSTALLER=
4471   MOZ_JSDEBUGGER=
4472   MOZ_LDAP_XPCOM=
4473   MOZ_MAIL_NEWS=
4474   MOZ_MATHML=
4475   MOZ_AUTH_EXTENSION=
4476   MOZ_NO_ACTIVEX_SUPPORT=1
4477   MOZ_NO_INSPECTOR_APIS=1
4478   MOZ_NO_XPCOM_OBSOLETE=1
4479   MOZ_NO_FAST_LOAD=1
4480   MOZ_OJI=
4481   MOZ_PLAINTEXT_EDITOR_ONLY=1
4482 #  MOZ_PLUGINS=
4483   MOZ_PREF_EXTENSIONS=
4484   MOZ_PROFILELOCKING=
4485   MOZ_PROFILESHARING=
4486   MOZ_SPELLCHECK=
4487   MOZ_SVG=
4488   MOZ_UNIVERSALCHARDET=
4489   MOZ_UPDATER=
4490   MOZ_USE_NATIVE_UCONV=
4491   MOZ_VIEW_SOURCE=
4492   MOZ_XPFE_COMPONENTS=
4493   MOZ_XPINSTALL=
4494   MOZ_XTF=
4495   MOZ_ZIPWRITER=
4496   NECKO_DISK_CACHE=
4497   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4498   NECKO_SMALL_BUFFERS=1
4499   NS_DISABLE_LOGGING=1
4500   NS_PRINTING=
4501   JS_STATIC_BUILD=1
4502   ;;
4504 minimal)
4505   MOZ_EMBEDDING_LEVEL_DEFAULT=
4506   MOZ_EMBEDDING_LEVEL_BASIC=
4507   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4508   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4509   ENABLE_TESTS=
4510   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4511   MOZ_COMPOSER=
4512   MOZ_ENABLE_CANVAS=
4513   MOZ_ENABLE_POSTSCRIPT=
4514   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4515   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4516   MOZ_IMG_ENCODERS_DEFAULT=
4517   MOZ_IMG_ENCODERS=
4518   MOZ_INSTALLER=
4519   MOZ_JSDEBUGGER=
4520   MOZ_LDAP_XPCOM=
4521   MOZ_MAIL_NEWS=
4522   MOZ_MATHML=
4523   MOZ_AUTH_EXTENSION=
4524   MOZ_NO_ACTIVEX_SUPPORT=1
4525   MOZ_NO_INSPECTOR_APIS=1
4526   MOZ_NO_XPCOM_OBSOLETE=1
4527   MOZ_NO_FAST_LOAD=1
4528   MOZ_OJI=
4529   MOZ_PLAINTEXT_EDITOR_ONLY=1
4530   MOZ_PLUGINS=
4531   MOZ_PREF_EXTENSIONS=
4532   MOZ_PROFILELOCKING=
4533   MOZ_PROFILESHARING=
4534   MOZ_SPELLCHECK=
4535   MOZ_STORAGE=1
4536   MOZ_PLACES=
4537   MOZ_SVG=
4538   MOZ_UNIVERSALCHARDET=
4539   MOZ_UPDATER=
4540   MOZ_USE_NATIVE_UCONV=1
4541   MOZ_VIEW_SOURCE=
4542   MOZ_XPFE_COMPONENTS=
4543   MOZ_XPINSTALL=
4544   MOZ_XTF=
4545   MOZ_XUL=
4546   MOZ_ZIPWRITER=
4547   MOZ_RDF=
4548   NECKO_DISK_CACHE=
4549   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4550   NECKO_SMALL_BUFFERS=1
4551   NS_DISABLE_LOGGING=1
4552   NS_PRINTING=
4553   JS_STATIC_BUILD=1
4554   ;;
4557   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4558   ;;
4559 esac
4561 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4562 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4563 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4565 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4566 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4567   XULRUNNER_STUB_NAME=$withval)
4569 if test -z "$XULRUNNER_STUB_NAME"; then
4570   case "$target_os" in
4571   darwin*)
4572     XULRUNNER_STUB_NAME=xulrunner
4573     ;;
4574   *)
4575     XULRUNNER_STUB_NAME=xulrunner-stub
4576   esac
4578 AC_SUBST(XULRUNNER_STUB_NAME)
4580 if test -z "$MOZ_BUILD_APP"; then
4581   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4582 else
4583   # We have a valid application only if it has a build.mk file in its top
4584   # directory.
4585   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4586     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4587   fi
4590 # Allow the application to influence configure with a confvars.sh script.
4592 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4593 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4594   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4595   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4596 else
4597   AC_MSG_RESULT([no])
4600 # Now is a good time to test for logic errors, define mismatches, etc.
4601 case "$MOZ_BUILD_APP" in
4602 xulrunner)
4603   if test "$LIBXUL_SDK"; then
4604     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4605   fi
4606   ;;
4608   # Fix this case for folks who forget. Warn them.
4609   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4610     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4611     MOZ_XUL_APP=1
4612   fi
4613   ;;
4614 esac
4616 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4617 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4618 # MOZ_BUILD_APP.
4619 case "$MOZ_BUILD_APP" in
4620 suite)
4621   AC_DEFINE(MOZ_SUITE)
4622   ;;
4624 browser)
4625   AC_DEFINE(MOZ_PHOENIX)
4626   ;;
4628 mail)
4629   AC_DEFINE(MOZ_THUNDERBIRD)
4630   ;;
4632 composer)
4633   AC_DEFINE(MOZ_STANDALONE_COMPOSER)
4634   ;;
4636 calendar)
4637   AC_DEFINE(MOZ_SUNBIRD)
4638   ;;
4640 xulrunner)
4641   AC_DEFINE(MOZ_XULRUNNER)
4642   ;;
4644 camino) 
4645   AC_DEFINE(MOZ_MACBROWSER)
4646   ;;
4648 content/xslt)
4649   AC_DEFINE(TX_EXE)
4650   ;;
4652 standalone) 
4653   MOZ_APP_NAME=mozilla
4654   MOZ_APP_DISPLAYNAME=Mozilla
4655   MOZ_APP_VERSION=$MOZILLA_VERSION
4656   ;;
4658 esac
4660 AC_SUBST(MOZ_BUILD_APP)
4661 AC_SUBST(MOZ_XUL_APP)
4662 AC_SUBST(MOZ_SUITE)
4663 AC_SUBST(MOZ_PHOENIX)
4664 AC_SUBST(MOZ_THUNDERBIRD)
4665 AC_SUBST(MOZ_STANDALONE_COMPOSER)
4666 AC_SUBST(MOZ_SUNBIRD)
4667 AC_SUBST(MOZ_XULRUNNER)
4669 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4671 if test "$MOZ_XUL_APP"; then
4672   MOZ_PROFILESHARING=
4673   AC_DEFINE(MOZ_XUL_APP)
4676 dnl ========================================================
4677 dnl = 
4678 dnl = Toolkit Options
4679 dnl = 
4680 dnl ========================================================
4681 MOZ_ARG_HEADER(Toolkit Options)
4683     dnl ========================================================
4684     dnl = Select the default toolkit
4685     dnl ========================================================
4686         MOZ_ARG_ENABLE_STRING(default-toolkit,
4687         [  --enable-default-toolkit=TK
4688                           Select default toolkit
4689                           Platform specific defaults:
4690                             BeOS - cairo-beos
4691                             Mac OS X - cairo-cocoa
4692                             Neutrino/QNX - photon
4693                             OS/2 - cairo-os2
4694                             Win32 - cairo-windows
4695                             WinCE - windows
4696                             * - cairo-gtk2],
4697     [ _DEFAULT_TOOLKIT=$enableval ],
4698     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4700     if test "$_DEFAULT_TOOLKIT" = "photon" \
4701         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4702         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4703         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4704         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4705         -o "$_DEFAULT_TOOLKIT" = "cairo-mac" \
4706         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4707     then
4708         dnl nglayout only supports building with one toolkit,
4709         dnl so ignore everything after the first comma (",").
4710         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4711     else
4712         if test "$no_x" != "yes"; then
4713             AC_MSG_ERROR([Toolkit must be cairo-gtk2.])
4714         else
4715             AC_MSG_ERROR([Toolkit must be $_PLATFORM_DEFAULT_TOOLKIT (if supported).])
4716         fi
4717     fi
4719 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4721 dnl ========================================================
4722 dnl = Enable the toolkit as needed                         =
4723 dnl ========================================================
4725 case "$MOZ_WIDGET_TOOLKIT" in
4726 photon)
4727         MOZ_ENABLE_PHOTON=1
4728         AC_DEFINE(MOZ_WIDGET_PHOTON)
4729     ;;
4731 cairo-windows)
4732     MOZ_WIDGET_TOOLKIT=windows
4733     MOZ_GFX_TOOLKIT=cairo
4734     ;;
4736 cairo-gtk2)
4737     MOZ_WIDGET_TOOLKIT=gtk2
4738     MOZ_GFX_TOOLKIT=cairo
4739     MOZ_ENABLE_GTK2=1
4740     MOZ_ENABLE_XREMOTE=1
4741     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4742     TK_LIBS='$(MOZ_GTK2_LIBS)'
4743     AC_DEFINE(MOZ_WIDGET_GTK2)
4744     ;;
4745 cairo-beos)
4746     MOZ_WIDGET_TOOLKIT=beos
4747     MOZ_GFX_TOOLKIT=cairo
4748     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4749     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4750     ;;
4752 cairo-os2)
4753     MOZ_WIDGET_TOOLKIT=os2
4754     MOZ_GFX_TOOLKIT=cairo
4755     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4756     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4757     ;;
4759 cairo-mac|cairo-cocoa)
4760     if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
4761         MOZ_WIDGET_TOOLKIT=cocoa
4762         AC_DEFINE(MOZ_WIDGET_COCOA)
4763         MOZ_ENABLE_COCOA=1
4764     else
4765         MOZ_WIDGET_TOOLKIT=mac
4766     fi
4767     MOZ_GFX_TOOLKIT=cairo
4768     MOZ_USER_DIR="Mozilla"
4769     AC_DEFINE(XP_MACOSX)
4770     AC_DEFINE(TARGET_CARBON)
4771     AC_DEFINE(TARGET_API_MAC_CARBON)
4772     TK_LIBS='-framework Carbon'
4773     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4774     CFLAGS="$CFLAGS $TK_CFLAGS"
4775     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4776     ;;
4777 esac
4779 if test "$MOZ_ENABLE_XREMOTE"; then
4780     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4783 if test "$COMPILE_ENVIRONMENT"; then
4784 if test "$MOZ_ENABLE_GTK2"
4785 then
4786     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 gdk-x11-2.0 glib-2.0 gobject-2.0)
4788 fi # COMPILE_ENVIRONMENT
4790 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4792 dnl ========================================================
4793 dnl = startup-notification support module
4794 dnl ========================================================
4796 if test "$MOZ_ENABLE_GTK2"
4797 then
4798     MOZ_ENABLE_STARTUP_NOTIFICATION=
4800     MOZ_ARG_ENABLE_BOOL(startup-notification,
4801     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4802         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4803         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4804     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4805     then
4806         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4807                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4808         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4809             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4810             then
4811                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4812             fi
4813             MOZ_ENABLE_STARTUP_NOTIFICATION=
4814         ])
4815     fi
4817     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4818         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4819     fi
4821     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4823 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4824 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4825 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4827 AC_SUBST(GTK_CONFIG)
4828 AC_SUBST(TK_CFLAGS)
4829 AC_SUBST(TK_LIBS)
4831 AC_SUBST(MOZ_ENABLE_GTK2)
4832 AC_SUBST(MOZ_ENABLE_PHOTON)
4833 AC_SUBST(MOZ_ENABLE_COCOA)
4834 AC_SUBST(MOZ_ENABLE_GLITZ)
4835 AC_SUBST(MOZ_ENABLE_XREMOTE)
4836 AC_SUBST(MOZ_GTK2_CFLAGS)
4837 AC_SUBST(MOZ_GTK2_LIBS)
4839 AC_SUBST(MOC)
4841 if test "$MOZ_ENABLE_GTK2"
4842 then
4843     AC_DEFINE(MOZ_X11)
4844     MOZ_X11=1
4846 AC_SUBST(MOZ_X11)
4848 dnl ========================================================
4849 dnl =
4850 dnl = Components & Features
4851 dnl = 
4852 dnl ========================================================
4853 MOZ_ARG_HEADER(Components and Features)
4855 dnl ========================================================
4856 dnl = Localization
4857 dnl ========================================================
4858 MOZ_ARG_ENABLE_STRING(ui-locale,
4859 [  --enable-ui-locale=ab-CD
4860                           Select the user interface locale (default: en-US)],
4861     MOZ_UI_LOCALE=$enableval )
4862 AC_SUBST(MOZ_UI_LOCALE)
4864 dnl =========================================================
4865 dnl = Calendar client
4866 dnl =========================================================
4867 MOZ_ARG_ENABLE_BOOL(calendar,,
4868     MOZ_OLD_CALENDAR=1,
4869     MOZ_OLD_CALENDAR= )
4871 if test "$MOZ_OLD_CALENDAR"; then
4872     AC_MSG_WARN([Building with the calendar extension is no longer supported.])
4873     if test "$MOZ_THUNDERBIRD"; then
4874         AC_MSG_WARN([Since you're trying to build mail, you could try adding])
4875         AC_MSG_WARN(['--enable-extensions=default,lightning' to your mozconfig])
4876         AC_MSG_WARN([and building WITH A FRESH TREE.])
4877     fi
4878     AC_MSG_WARN([For more information, please visit:])
4879     AC_MSG_ERROR([http://www.mozilla.org/projects/calendar/])
4882 AC_SUBST(MOZ_CALENDAR)
4884 dnl =========================================================
4885 dnl = Mail & News
4886 dnl =========================================================
4887 MOZ_ARG_DISABLE_BOOL(mailnews,
4888 [  --disable-mailnews      Disable building of mail & news components],
4889     MOZ_MAIL_NEWS=,
4890     MOZ_MAIL_NEWS=1 )
4891 AC_SUBST(MOZ_MAIL_NEWS)
4893 dnl =========================================================
4894 dnl = LDAP
4895 dnl =========================================================
4896 MOZ_ARG_DISABLE_BOOL(ldap,
4897 [  --disable-ldap          Disable LDAP support],
4898     MOZ_LDAP_XPCOM=,
4899     MOZ_LDAP_XPCOM=1)
4901 dnl ========================================================
4902 dnl = Trademarked Branding 
4903 dnl ========================================================
4904 MOZ_ARG_ENABLE_BOOL(official-branding,
4905 [  --enable-official-branding Enable Official mozilla.org Branding
4906                           Do not distribute builds with
4907                           --enable-official-branding unless you have
4908                           permission to use trademarks per
4909                           http://www.mozilla.org/foundation/trademarks/ .],
4910 [case "$MOZ_BUILD_APP" in
4911 browser)
4912     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4913     MOZ_APP_DISPLAYNAME=Firefox
4914     ;;
4916 calendar)
4917     MOZ_BRANDING_DIRECTORY=other-licenses/branding/sunbird
4918     MOZ_APP_DISPLAYNAME=Sunbird
4919     ;;
4921 mail)
4922     MOZ_BRANDING_DIRECTORY=other-licenses/branding/thunderbird
4923     ;;
4926     AC_MSG_ERROR([Official branding is only available for Firefox Sunbird and Thunderbird.])
4927 esac
4930 MOZ_ARG_WITH_STRING(branding,
4931 [  --with-branding=dir    Use branding from the specified directory.],
4932     MOZ_BRANDING_DIRECTORY=$withval)
4934 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4935 if test -z "$REAL_BRANDING_DIRECTORY"; then
4936   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4939 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4940   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4943 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4945 dnl ========================================================
4946 dnl = Distribution ID
4947 dnl ========================================================
4948 MOZ_ARG_WITH_STRING(distribution-id,
4949 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4950 [ val=`echo $withval`
4951     MOZ_DISTRIBUTION_ID="$val"])
4953 if test -z "$MOZ_DISTRIBUTION_ID"; then
4954    MOZ_DISTRIBUTION_ID="org.mozilla"
4957 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4958 AC_SUBST(MOZ_DISTRIBUTION_ID)
4960 dnl ========================================================
4961 dnl = Xft and Pango
4962 dnl ========================================================
4963 if test "$MOZ_ENABLE_GTK2"
4964 then
4965     PKG_CHECK_MODULES(MOZ_XFT, xft)
4966     AC_SUBST(MOZ_XFT_CFLAGS)
4967     AC_SUBST(MOZ_XFT_LIBS)
4969     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4970     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangocairo >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4971     AC_SUBST(MOZ_PANGO_CFLAGS)
4972     AC_SUBST(MOZ_PANGO_LIBS)
4975 dnl ========================================================
4976 dnl = PostScript print module
4977 dnl ========================================================
4978 MOZ_ARG_DISABLE_BOOL(postscript,
4979 [  --disable-postscript    Disable PostScript printing support ],
4980     MOZ_ENABLE_POSTSCRIPT=,
4981     MOZ_ENABLE_POSTSCRIPT=1 )
4983 dnl ========================================================
4984 dnl = GnomeVFS support module
4985 dnl ========================================================
4987 if test "$MOZ_X11"
4988 then
4989     dnl build the gnomevfs extension by default only when the
4990     dnl GTK2 toolkit is in use.
4991     if test "$MOZ_ENABLE_GTK2"
4992     then
4993         MOZ_ENABLE_GNOMEVFS=1
4994         MOZ_ENABLE_GCONF=1
4995         MOZ_ENABLE_LIBGNOME=1
4996     fi
4998     MOZ_ARG_DISABLE_BOOL(gnomevfs,
4999     [  --disable-gnomevfs      Disable GnomeVFS support ],
5000         MOZ_ENABLE_GNOMEVFS=,
5001         MOZ_ENABLE_GNOMEVFS=force)
5003     if test "$MOZ_ENABLE_GNOMEVFS"
5004     then
5005         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5006             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5007             MOZ_ENABLE_GNOMEVFS=1
5008         ],[
5009             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5010             then
5011                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5012             fi
5013             MOZ_ENABLE_GNOMEVFS=
5014         ])
5015     fi
5017     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5018     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5020     if test "$MOZ_ENABLE_GCONF"
5021     then
5022         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5023             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5024             MOZ_ENABLE_GCONF=1
5025         ],[
5026             MOZ_ENABLE_GCONF=
5027         ])
5028     fi
5030     if test "$MOZ_ENABLE_GCONF"; then
5031         AC_DEFINE(MOZ_ENABLE_GCONF)
5032     fi
5034     AC_SUBST(MOZ_ENABLE_GCONF)
5035     AC_SUBST(MOZ_GCONF_CFLAGS)
5036     AC_SUBST(MOZ_GCONF_LIBS)
5038     if test "$MOZ_ENABLE_LIBGNOME"
5039     then
5040         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5041             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5042             MOZ_ENABLE_LIBGNOME=1
5043         ],[
5044             MOZ_ENABLE_LIBGNOME=
5045         ])
5046     fi
5048     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5049     AC_SUBST(MOZ_LIBGNOME_LIBS)
5051     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5052     # are all available.
5054     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5055             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5056       MOZ_ENABLE_GNOME_COMPONENT=1
5057     else
5058       MOZ_ENABLE_GNOME_COMPONENT=
5059     fi
5061     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5064 dnl ========================================================
5065 dnl = libgnomeui support module
5066 dnl ========================================================
5068 if test "$MOZ_ENABLE_GTK2"
5069 then
5070     MOZ_ENABLE_GNOMEUI=1
5072     MOZ_ARG_DISABLE_BOOL(gnomeui,
5073     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5074         MOZ_ENABLE_GNOMEUI=,
5075         MOZ_ENABLE_GNOMEUI=force)
5077     if test "$MOZ_ENABLE_GNOMEUI"
5078     then
5079         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5080         [
5081             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5082             MOZ_ENABLE_GNOMEUI=1
5083         ],[
5084             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5085             then
5086                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5087             fi
5088             MOZ_ENABLE_GNOMEUI=
5089         ])
5090     fi
5092     if test "$MOZ_ENABLE_GNOMEUI"; then
5093         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5094     fi
5096 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5097 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5098 AC_SUBST(MOZ_GNOMEUI_LIBS)
5100 dnl ========================================================
5101 dnl = dbus support
5102 dnl ========================================================
5104 if test "$MOZ_ENABLE_GTK2"
5105 then
5106     MOZ_ENABLE_DBUS=1
5108     MOZ_ARG_DISABLE_BOOL(dbus,
5109     [  --disable-dbus       Disable dbus support ],
5110         MOZ_ENABLE_DBUS=,
5111         MOZ_ENABLE_DBUS=1)
5113     if test "$MOZ_ENABLE_DBUS"
5114     then
5115         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5116         AC_DEFINE(MOZ_ENABLE_DBUS)
5117     fi
5119 AC_SUBST(MOZ_ENABLE_DBUS)
5120 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5121 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5123 dnl ========================================================
5124 dnl = Build Personal Security Manager
5125 dnl ========================================================
5126 MOZ_ARG_DISABLE_BOOL(crypto,
5127 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5128     MOZ_PSM=,
5129     MOZ_PSM=1 )
5131 dnl ========================================================
5132 dnl = JS Debugger XPCOM component (js/jsd)
5133 dnl ========================================================
5134 MOZ_ARG_DISABLE_BOOL(jsd,
5135 [  --disable-jsd           Disable JavaScript debug library],
5136     MOZ_JSDEBUGGER=,
5137     MOZ_JSDEBUGGER=1)
5140 dnl ========================================================
5141 dnl = Disable plugin support
5142 dnl ========================================================
5143 MOZ_ARG_DISABLE_BOOL(plugins,
5144 [  --disable-plugins       Disable plugins support],
5145     MOZ_PLUGINS=,
5146     MOZ_PLUGINS=1)
5148 dnl ========================================================
5149 dnl = Open JVM Interface (OJI) support
5150 dnl ========================================================
5151 MOZ_ARG_ENABLE_BOOL(oji,
5152 [  --enable-oji           Enable Open JVM Integration support],
5153     MOZ_OJI=1,
5154     MOZ_OJI=)
5155 if test -n "$MOZ_OJI"; then
5156     AC_DEFINE(OJI)
5159 dnl bi-directional support always on
5160 IBMBIDI=1
5161 AC_DEFINE(IBMBIDI)
5163 dnl ========================================================
5164 dnl complex text support off by default
5165 dnl ========================================================
5166 MOZ_ARG_ENABLE_BOOL(ctl,
5167 [  --enable-ctl            Enable Thai Complex Script support],
5168     SUNCTL=1,
5169     SUNCTL= )
5171 dnl ========================================================
5172 dnl view source support on by default
5173 dnl ========================================================
5174 MOZ_ARG_DISABLE_BOOL(view-source,
5175 [  --disable-view-source     Disable view source support],
5176     MOZ_VIEW_SOURCE=,
5177     MOZ_VIEW_SOURCE=1 )
5178 if test "$MOZ_VIEW_SOURCE"; then
5179     AC_DEFINE(MOZ_VIEW_SOURCE)
5183 dnl ========================================================
5184 dnl accessibility support on by default on all platforms 
5185 dnl except OS X.
5186 dnl ========================================================
5187 MOZ_ARG_DISABLE_BOOL(accessibility,
5188 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5189     ACCESSIBILITY=,
5190     ACCESSIBILITY=1 )
5191 if test "$ACCESSIBILITY"; then
5192     AC_DEFINE(ACCESSIBILITY)
5195 if test -n "$ACCESSIBILITY"; then
5196 case "$target" in
5197 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5198     if test "$ac_cv_header_atlbase_h" = "no"; then
5199         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.])
5200     fi
5201     if test "$ac_cv_header_oleacc_idl" = "no"; then
5202         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.])
5203     fi
5204     ;;
5205 esac
5208 dnl ========================================================
5209 dnl xpfe/components on by default
5210 dnl ========================================================
5211 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5212 [  --disable-xpfe-components
5213                           Disable xpfe components],
5214     MOZ_XPFE_COMPONENTS=,
5215     MOZ_XPFE_COMPONENTS=1 )
5217 dnl ========================================================
5218 dnl xpinstall support on by default
5219 dnl ========================================================
5220 MOZ_ARG_DISABLE_BOOL(xpinstall,
5221 [  --disable-xpinstall     Disable xpinstall support],
5222     MOZ_XPINSTALL=,
5223     MOZ_XPINSTALL=1 )
5224 if test "$MOZ_XPINSTALL"; then
5225     AC_DEFINE(MOZ_XPINSTALL)
5228 dnl ========================================================
5229 dnl xpcom js loader support on by default
5230 dnl ========================================================
5231 MOZ_ARG_DISABLE_BOOL(jsloader,
5232 [  --disable-jsloader      Disable xpcom js loader support],
5233     MOZ_JSLOADER=,
5234     MOZ_JSLOADER=1 )
5235 if test "$MOZ_JSLOADER"; then
5236     AC_DEFINE(MOZ_JSLOADER)
5239 dnl ========================================================
5240 dnl Disable printing
5241 dnl ========================================================
5242 MOZ_ARG_DISABLE_BOOL(printing,
5243 [  --disable-printing  Disable printing support],
5244     NS_PRINTING=,
5245     NS_PRINTING=1 )
5247 if test "$NS_PRINTING"; then
5248     AC_DEFINE(NS_PRINTING)
5249     AC_DEFINE(NS_PRINT_PREVIEW)
5252 dnl ========================================================
5253 dnl use native unicode converters
5254 dnl ========================================================
5255 MOZ_ARG_ENABLE_BOOL(native-uconv,
5256 [  --enable-native-uconv   Enable iconv support],
5257     MOZ_USE_NATIVE_UCONV=1,
5258     MOZ_USE_NATIVE_UCONV= )
5259 if test "$MOZ_USE_NATIVE_UCONV"; then
5260     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5262 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5263     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5267 dnl ========================================================
5268 dnl Libeditor can be build as plaintext-only,
5269 dnl or as a full html and text editing component.
5270 dnl We build both by default.
5271 dnl ========================================================
5272 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5273 [  --enable-plaintext-editor-only
5274                           Allow only plaintext editing],
5275     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5276     MOZ_PLAINTEXT_EDITOR_ONLY= )
5277 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5278 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5280 dnl ========================================================
5281 dnl Composer is on by default.
5282 dnl ========================================================
5283 MOZ_ARG_DISABLE_BOOL(composer,
5284 [  --disable-composer      Disable building of Composer],
5285     MOZ_COMPOSER=,
5286     MOZ_COMPOSER=1 )
5287 AC_SUBST(MOZ_COMPOSER)
5290 dnl ========================================================
5291 dnl = Drop XPCOM Obsolete library
5292 dnl ========================================================
5293 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5294 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5295     MOZ_NO_XPCOM_OBSOLETE=1,
5296     MOZ_NO_XPCOM_OBSOLETE=)
5298 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5299     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5302 dnl ========================================================
5303 dnl = Disable Fast Load
5304 dnl ========================================================
5305 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5306 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5307     MOZ_NO_FAST_LOAD=1,
5308     MOZ_NO_FAST_LOAD=)
5310 AC_SUBST(MOZ_NO_FAST_LOAD)
5312 if test -n "$MOZ_NO_FAST_LOAD"; then
5313     AC_DEFINE(MOZ_NO_FAST_LOAD)
5316 dnl ========================================================
5317 dnl = Enable HTML video and audio support
5318 dnl ========================================================
5319 MOZ_ARG_ENABLE_BOOL(media,
5320 [  --enable-media           Enable HTML5 media support],
5321     MOZ_MEDIA=1,
5322     MOZ_MEDIA=)
5324 AC_SUBST(MOZ_MEDIA)
5326 if test -n "$MOZ_MEDIA"; then
5327     AC_DEFINE(MOZ_MEDIA)
5330 dnl ========================================================
5331 dnl Permissions System
5332 dnl ========================================================
5333 MOZ_ARG_DISABLE_BOOL(permissions,
5334 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5335     MOZ_PERMISSIONS=,
5336     MOZ_PERMISSIONS=1
5339 dnl ========================================================
5340 dnl NegotiateAuth
5341 dnl ========================================================
5342 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5343 [  --disable-negotiateauth Disable GSS-API negotiation ],
5344     MOZ_AUTH_EXTENSION=,
5345     MOZ_AUTH_EXTENSION=1 )
5347 dnl ========================================================
5348 dnl XTF
5349 dnl ========================================================
5350 MOZ_ARG_DISABLE_BOOL(xtf,
5351 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5352     MOZ_XTF=,
5353     MOZ_XTF=1 )
5354 if test "$MOZ_XTF"; then
5355   AC_DEFINE(MOZ_XTF)
5358 dnl ========================================================
5359 dnl Inspector APIs
5360 dnl ========================================================
5361 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5362 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5363     MOZ_NO_INSPECTOR_APIS=1,
5364     MOZ_NO_INSPECTOR_APIS= )
5366 dnl ========================================================
5367 dnl Pref extensions (autoconfig and system-pref)
5368 dnl ========================================================
5369 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5370 [  --disable-pref-extensions
5371                           Disable pref extensions such as autoconfig and
5372                           system-pref],
5373   MOZ_PREF_EXTENSIONS=,
5374   MOZ_PREF_EXTENSIONS=1 )
5376 dnl ========================================================
5377 dnl = Universalchardet
5378 dnl ========================================================
5379 MOZ_ARG_DISABLE_BOOL(universalchardet,
5380 [  --disable-universalchardet
5381                           Disable universal encoding detection],
5382   MOZ_UNIVERSALCHARDET=,
5383   MOZ_UNIVERSALCHARDET=1 )
5385 dnl ========================================================
5386 dnl JavaXPCOM
5387 dnl ========================================================
5388 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5389 [  --enable-javaxpcom
5390                           Enable Java-XPCOM bridge],
5391     MOZ_JAVAXPCOM=1,
5392     MOZ_JAVAXPCOM= )
5394 if test -n "${MOZ_JAVAXPCOM}"; then
5395   case "$host_os" in
5396     cygwin*|msvc*|mks*)
5397       if test -n "$JAVA_HOME"; then
5398         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5399       fi
5400       ;;
5401     *mingw*)
5402       if test -n "$JAVA_HOME"; then
5403         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5404       fi
5405       ;;
5406   esac
5408   if test -n "${JAVA_INCLUDE_PATH}"; then
5409     dnl Make sure jni.h exists in the given include path.
5410     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5411       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5412     fi
5413   else
5414     case "$target_os" in
5415       darwin*)
5416         dnl Default to java system location
5417         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5418         ;;
5419       *)
5420         dnl Try $JAVA_HOME
5421         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5422         ;;
5423     esac
5424     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5425       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.])
5426     fi
5427   fi
5429   if test -n "${JAVA_BIN_PATH}"; then
5430     dnl Look for javac and jar in the specified path.
5431     JAVA_PATH="$JAVA_BIN_PATH"
5432   else
5433     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5434     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5435   fi
5437   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5438   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5439   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5440   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5441     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.])
5442   fi
5445 dnl ========================================================
5446 dnl = Breakpad crash reporting (on by default on supported platforms)
5447 dnl ========================================================
5449 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5450     || test "$OS_ARCH" = "Darwin" \
5451     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5452     || test "$OS_ARCH" = "SunOS") \
5453    && test -z "$HAVE_64BIT_OS"; then
5454    MOZ_CRASHREPORTER=1
5457 MOZ_ARG_DISABLE_BOOL(crashreporter,
5458 [  --disable-crashreporter          Disable breakpad crash reporting],
5459     MOZ_CRASHREPORTER=,
5460     MOZ_CRASHREPORTER=1)
5462 if test -n "$MOZ_CRASHREPORTER"; then
5463    AC_DEFINE(MOZ_CRASHREPORTER)
5465   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5466     test -z "$SKIP_LIBRARY_CHECKS"; then
5467     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5468     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5469     AC_SUBST(MOZ_GTHREAD_LIBS)
5471     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.])])
5472   fi
5475 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5476 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5477 [ val=`echo $withval | sed 's/[^0-9]//g'`
5478     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5480 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5481    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5483 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5486 dnl ========================================================
5487 dnl = Build mochitest JS/DOM tests (on by default)
5488 dnl ========================================================
5489 MOZ_ARG_DISABLE_BOOL(mochitest,
5490 [  --disable-mochitest        Disable mochitest harness],
5491     MOZ_MOCHITEST=,
5492     MOZ_MOCHITEST=1 )
5494 dnl ========================================================
5495 dnl = Enable compilation of specific extension modules
5496 dnl ========================================================
5498 MOZ_ARG_ENABLE_STRING(extensions,
5499 [  --enable-extensions     Enable extensions],
5500 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5501     if test "$option" = "yes" || test "$option" = "all"; then
5502         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
5503     elif test "$option" = "no" || test "$option" = "none"; then
5504         MOZ_EXTENSIONS=""
5505     elif test "$option" = "default"; then
5506         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5507     elif test `echo "$option" | grep -c \^-` != 0; then
5508         option=`echo $option | sed 's/^-//'`
5509         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5510     else
5511         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5512     fi
5513 done],
5514     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5516 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5517     # Suppress warning on non-X11 platforms
5518     if test -n "$MOZ_X11"; then
5519         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5520     fi
5521     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5524 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5525     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5526     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5529 dnl This might be temporary: build tridentprofile only on Windows
5530 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5531     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5532     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5535 dnl cookie must be built before tridentprofile. put it at list's end.
5536 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5537   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5538   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5541 dnl xforms requires xtf and schema-validation
5542 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5543     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5544     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5546 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5547     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5548     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5551 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5552     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5553     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5556 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5557     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5558     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5561 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5562     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5563     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5566 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5567     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5568     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5571 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5572     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5573     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5576 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5577     AC_MSG_WARN([spellcheck is no longer an extension.])
5578     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5581 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5582     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5583     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5586 dnl Remove dupes
5587 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5589 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5590 dnl when trying to build a non-existent extension.
5591 for extension in $MOZ_EXTENSIONS; do
5592     if test ! -d "${srcdir}/extensions/${extension}"; then
5593         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5594     fi
5595 done
5598 dnl ========================================================
5599 dnl Image decoders
5600 dnl ========================================================
5601 case "$MOZ_WIDGET_TOOLKIT" in
5602 beos|windows|os2|mac|cocoa)
5603     ;;
5605     if test -z "$MOZ_ENABLE_GTK2"; then
5606        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`                
5607     fi
5608     ;;
5609 esac
5611 MOZ_ARG_ENABLE_STRING(image-decoders,
5612 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5613                           Enable specific image decoders],
5614 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5615     if test "$option" = "yes" || test "$option" = "all"; then
5616         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5617     elif test "$option" = "no" || test "$option" = "none"; then
5618         MOZ_IMG_DECODERS=""
5619     elif test "$option" = "default"; then
5620         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5621     elif test `echo "$option" | grep -c \^-` != 0; then
5622         option=`echo $option | sed 's/^-//'`
5623         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5624     else
5625         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5626     fi
5627 done],
5628     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5630 dnl Dupes are removed in the encoder section because it will also add decoders
5632 dnl ========================================================
5633 dnl Image encoders
5634 dnl ========================================================
5635 MOZ_ARG_ENABLE_STRING(image-encoders,
5636 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5637                           Enable specific image encoders],
5638 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5639     if test "$option" = "yes" || test "$option" = "all"; then
5640         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5641     elif test "$option" = "no" || test "$option" = "none"; then
5642         MOZ_IMG_ENCODERS=""
5643         addencoder=""
5644     elif test "$option" = "default"; then
5645         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5646     elif test `echo "$option" | grep -c \^-` != 0; then
5647         option=`echo $option | sed 's/^-//'`
5648         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5649     else
5650         addencoder="$option"
5651     fi
5652     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5653 done],
5654     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5656 dnl Remove dupes
5657 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5658 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5660 dnl ========================================================
5661 dnl experimental ldap features
5662 dnl ========================================================
5663 MOZ_ARG_ENABLE_BOOL(ldap-experimental,
5664 [  --enable-ldap-experimental
5665                           Enable LDAP experimental features],
5666     MOZ_LDAP_XPCOM_EXPERIMENTAL=1,
5667     MOZ_LDAP_XPCOM_EXPERIMENTAL=)
5669 dnl ========================================================
5670 dnl MathML on by default
5671 dnl ========================================================
5672 MOZ_ARG_DISABLE_BOOL(mathml,
5673 [  --disable-mathml        Disable MathML support],
5674     MOZ_MATHML=,
5675     MOZ_MATHML=1 )
5676 if test "$MOZ_MATHML"; then
5677   AC_DEFINE(MOZ_MATHML)
5680 dnl ========================================================
5681 dnl Canvas
5682 dnl ========================================================
5683 MOZ_ARG_DISABLE_BOOL(canvas,
5684 [  --disable-canvas          Disable html:canvas feature],
5685     MOZ_ENABLE_CANVAS=,
5686     MOZ_ENABLE_CANVAS=1 )
5687 if test -n "$MOZ_ENABLE_CANVAS"; then
5688     AC_DEFINE(MOZ_ENABLE_CANVAS)
5690 AC_SUBST(MOZ_ENABLE_CANVAS)
5692 dnl ========================================================
5693 dnl SVG
5694 dnl ========================================================
5695 MOZ_ARG_DISABLE_BOOL(svg,
5696 [  --disable-svg            Disable SVG support],
5697     MOZ_SVG=,
5698     MOZ_SVG=1 )
5699 if test -n "$MOZ_SVG"; then
5700   AC_DEFINE(MOZ_SVG)
5703 MOZ_SVG_FOREIGNOBJECT=1
5704 dnl ========================================================
5705 dnl SVG <foreignObject>
5706 dnl ========================================================
5707 MOZ_ARG_DISABLE_BOOL(svg-foreignobject,
5708    [  --disable-svg-foreignobject
5709                         Disable SVG <foreignObject> support],
5710    MOZ_SVG_FOREIGNOBJECT=,
5711    MOZ_SVG_FOREIGNOBJECT=1 )
5712 if test "$MOZ_SVG_FOREIGNOBJECT"; then
5713   if test "$MOZ_SVG"; then
5714     AC_DEFINE(MOZ_SVG_FOREIGNOBJECT)
5715   else
5716     MOZ_SVG_FOREIGNOBEJCT=
5717   fi
5720 dnl ========================================================
5721 dnl Installer
5722 dnl ========================================================
5723 case "$target_os" in
5724     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5725         MOZ_INSTALLER=1
5726         ;;
5727 esac
5729 MOZ_ARG_DISABLE_BOOL(installer,
5730 [  --disable-installer     Disable building of installer],
5731     MOZ_INSTALLER=,
5732     MOZ_INSTALLER=1 )
5733 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5734     # Disable installer for Windows builds that use the new toolkit if NSIS
5735     # isn't in the path.
5736     AC_PATH_PROGS(MAKENSIS, makensis)
5737     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5738         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5739     fi
5740     # The Windows build for NSIS requires the iconv command line utility to
5741     # convert the charset of the locale files.
5742     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5743     if test -z "$HOST_ICONV"; then
5744         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5745     fi
5748 # Automatically disable installer if xpinstall isn't built
5749 if test -z "$MOZ_XPINSTALL"; then
5750     MOZ_INSTALLER=
5752 AC_SUBST(MOZ_INSTALLER)
5754 AC_MSG_CHECKING([for tar archiver])
5755 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5756 if test -z "$TAR"; then
5757     AC_MSG_ERROR([no tar archiver found in \$PATH])
5759 AC_MSG_RESULT([$TAR])
5760 AC_SUBST(TAR)
5762 dnl ========================================================
5763 dnl Updater
5764 dnl ========================================================
5766 MOZ_ARG_DISABLE_BOOL(updater,
5767 [  --disable-updater       Disable building of updater],
5768     MOZ_UPDATER=,
5769     MOZ_UPDATER=1 )
5770 # The Windows build requires the iconv command line utility
5771 # in order to build the updater.
5772 case "$target_os" in
5773     msvc*|mks*|cygwin*|mingw*|wince*)
5774         if test -n "$MOZ_UPDATER"; then
5775             AC_MSG_CHECKING([for iconv])
5776             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5777             if test -z "$HOST_ICONV"; then
5778                 AC_MSG_ERROR([iconv not found in \$PATH])
5779             fi
5780         fi
5781         ;;
5782 esac
5783 AC_SUBST(MOZ_UPDATER)
5785 # app update channel is 'default' when not supplied.
5786 MOZ_ARG_ENABLE_STRING([update-channel],
5787 [  --enable-update-channel=CHANNEL
5788                            Select application update channel (default=default)],
5789     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5791 if test -z "$MOZ_UPDATE_CHANNEL"; then
5792     MOZ_UPDATE_CHANNEL=default
5794 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5796 # tools/update-packaging is not checked out by default.
5797 MOZ_ARG_ENABLE_BOOL(update-packaging,
5798 [  --enable-update-packaging
5799                            Enable tools/update-packaging],
5800     MOZ_UPDATE_PACKAGING=1,
5801     MOZ_UPDATE_PACKAGING= )
5802 AC_SUBST(MOZ_UPDATE_PACKAGING)
5804 dnl ========================================================
5805 dnl ActiveX
5806 dnl ========================================================
5808 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5809 [  --disable-xpconnect-idispatch
5810                           Disable building of xpconnect support for IDispatch
5811                           (win32 only)],
5812     XPC_IDISPATCH_SUPPORT=,
5813     XPC_IDISPATCH_SUPPORT=1)
5814 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5816 MOZ_ARG_DISABLE_BOOL(activex,
5817 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5818     MOZ_NO_ACTIVEX_SUPPORT=1,
5819     MOZ_NO_ACTIVEX_SUPPORT= )
5820 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5822 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5823 [  --disable-activex-scripting
5824                           Disable building of ActiveX scripting support (win32)],
5825     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5826     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5827 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5829 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5830 then
5831     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5834 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5835 case "$target" in
5836 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5837     if test "$ac_cv_header_atlbase_h" = "no"; then
5838         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.])
5839     fi
5840     ;;
5841 esac
5844 dnl ========================================================
5845 dnl leaky
5846 dnl ========================================================
5847 MOZ_ARG_ENABLE_BOOL(leaky,
5848 [  --enable-leaky          Build leaky memory tool],
5849     MOZ_LEAKY=1,
5850     MOZ_LEAKY=)
5853 dnl ========================================================
5854 dnl xpctools
5855 dnl ========================================================
5856 MOZ_ARG_ENABLE_BOOL(xpctools,
5857 [  --enable-xpctools       Build JS profiling tool],
5858     MOZ_XPCTOOLS=1,
5859     MOZ_XPCTOOLS= )
5862 dnl ========================================================
5863 dnl build the tests by default
5864 dnl ========================================================
5865 MOZ_ARG_DISABLE_BOOL(tests,
5866 [  --disable-tests         Do not build test libraries & programs],
5867     ENABLE_TESTS=,
5868     ENABLE_TESTS=1 )
5870 dnl ========================================================
5871 dnl parental controls (for Windows Vista)
5872 dnl ========================================================
5873 MOZ_ARG_DISABLE_BOOL(parental-controls,
5874 [  --disable-parental-controls
5875                            Do not build parental controls],
5876    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5877    MOZ_DISABLE_PARENTAL_CONTROLS=)
5878 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5879     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5882 dnl ========================================================
5883 dnl Vista SDK specific api
5884 dnl ========================================================
5885 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
5886 [  --disable-vista-sdk-requirements
5887                            Do not build Vista SDK specific code],
5888    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
5889    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
5890 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
5891     AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
5892     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5893     if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5894         AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5895     fi
5896     MOZ_DISABLE_PARENTAL_CONTROLS=1
5897 else
5898 case "$target" in
5899 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5900     if test "$ac_cv_header_wpcapi_h" = "no"; then
5901         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.])
5902     fi
5903     ;;
5904 esac
5906 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5907 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5909 dnl ========================================================
5910 dnl =
5911 dnl = Module specific options
5912 dnl =
5913 dnl ========================================================
5914 MOZ_ARG_HEADER(Individual module options)
5916 dnl ========================================================
5917 dnl = Enable Lea malloc in xpcom. OFF by default.
5918 dnl ========================================================
5919 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
5920 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
5921     XPCOM_USE_LEA=1,
5922     XPCOM_USE_LEA= )
5923 if test -n "$XPCOM_USE_LEA"; then
5924     AC_DEFINE(XPCOM_USE_LEA)
5927 dnl ========================================================
5928 dnl = Enable places (new history/bookmarks)
5929 dnl ========================================================
5930 MOZ_ARG_ENABLE_BOOL(places,
5931 [  --enable-places        Enable 'places' bookmark/history implementation],
5932     MOZ_PLACES=1,
5933     MOZ_PLACES= )
5934 if test -n "$MOZ_PLACES"; then
5935     AC_DEFINE(MOZ_PLACES)
5936     if test -z "$MOZ_MAIL_NEWS"; then
5937       MOZ_MORK=
5938     fi
5939     MOZ_MORKREADER=1
5940 else
5941   if test "$MOZ_BUILD_APP" = "browser"; then
5942     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5943   fi
5946 dnl ========================================================
5947 dnl = Disable feed handling components
5948 dnl ========================================================
5949 MOZ_ARG_DISABLE_BOOL(feeds,
5950 [  --disable-feeds        Disable feed handling and processing components],
5951     MOZ_FEEDS=,
5952     MOZ_FEEDS=1 )
5953 if test -n "$MOZ_FEEDS"; then
5954     AC_DEFINE(MOZ_FEEDS)
5955 else
5956     if test "$MOZ_BUILD_APP" = "browser"; then
5957         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
5958     fi
5961 dnl ========================================================
5962 dnl = Enable mozStorage
5963 dnl ========================================================
5964 dnl Implicitly enabled by default if building calendar or places
5965 MOZ_ARG_ENABLE_BOOL(storage,
5966 [  --enable-storage        Enable mozStorage module and related components],
5967     MOZ_STORAGE=1,
5968     MOZ_STORAGE= )
5969 if test -n "$MOZ_STORAGE"; then
5970     AC_DEFINE(MOZ_STORAGE)
5973 dnl ========================================================
5974 dnl Check for sqlite
5975 dnl ========================================================
5977 MOZ_NATIVE_SQLITE=
5978 MOZ_ARG_ENABLE_BOOL(system-sqlite,
5979 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
5980 MOZ_NATIVE_SQLITE=1,
5981 MOZ_NATIVE_SQLITE= )
5983 if test -z "$MOZ_NATIVE_SQLITE"
5984 then
5985     SQLITE_CFLAGS=
5986     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
5987 else
5988     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
5991 AC_SUBST(MOZ_NATIVE_SQLITE)
5993 dnl = Enable help viewer (off by default)
5994 dnl ========================================================
5995 MOZ_ARG_ENABLE_BOOL(help-viewer,
5996 [  --enable-help-viewer        Enable help viewer],
5997     MOZ_HELP_VIEWER=1,
5998     MOZ_HELP_VIEWER= )
5999 if test -n "$MOZ_HELP_VIEWER"; then
6000      AC_DEFINE(MOZ_HELP_VIEWER)
6002 AC_SUBST(MOZ_HELP_VIEWER)
6004 dnl ========================================================
6005 dnl = Enable safe browsing (anti-phishing)
6006 dnl ========================================================
6007 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6008 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6009     MOZ_SAFE_BROWSING=1,
6010     MOZ_SAFE_BROWSING= )
6011 if test -n "$MOZ_SAFE_BROWSING"; then
6012     AC_DEFINE(MOZ_SAFE_BROWSING)
6014 AC_SUBST(MOZ_SAFE_BROWSING)
6016 dnl ========================================================
6017 dnl = Enable url-classifier
6018 dnl ========================================================
6019 dnl Implicitly enabled by default if building with safe-browsing
6020 if test -n "$MOZ_SAFE_BROWSING"; then
6021     MOZ_URL_CLASSIFIER=1
6023 MOZ_ARG_ENABLE_BOOL(url-classifier,
6024 [  --enable-url-classifier        Enable url classifier module],
6025     MOZ_URL_CLASSIFIER=1,
6026     MOZ_URL_CLASSIFIER= )
6027 if test -n "$MOZ_URL_CLASSIFIER"; then
6028     AC_DEFINE(MOZ_URL_CLASSIFIER)
6030 AC_SUBST(MOZ_URL_CLASSIFIER)
6032 dnl ========================================================
6033 dnl = Disable zipwriter
6034 dnl ========================================================
6035 MOZ_ARG_DISABLE_BOOL(zipwriter,
6036 [  --disable-zipwriter             Disable zipwriter component],
6037     MOZ_ZIPWRITER=,
6038     MOZ_ZIPWRITER=1 )
6039 AC_SUBST(MOZ_ZIPWRITER)
6041 dnl ========================================================
6042 dnl = Enable Ultrasparc specific optimizations for JS
6043 dnl ========================================================
6044 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6045 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6046     JS_ULTRASPARC_OPTS=1,
6047     JS_ULTRASPARC_OPTS= )
6049 dnl only enable option for ultrasparcs
6050 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6051     "$OS_TEST" != "sun4u"; then
6052     JS_ULTRASPARC_OPTS=
6054 AC_SUBST(JS_ULTRASPARC_OPTS)
6056 dnl ========================================================
6057 dnl =
6058 dnl = Feature options that require extra sources to be pulled
6059 dnl =
6060 dnl ========================================================
6061 dnl MOZ_ARG_HEADER(Features that require extra sources)
6063 dnl ========================================================
6064 dnl =
6065 dnl = Debugging Options
6066 dnl = 
6067 dnl ========================================================
6068 MOZ_ARG_HEADER(Debugging and Optimizations)
6070 dnl ========================================================
6071 dnl = Disable building with debug info.
6072 dnl = Debugging is OFF by default
6073 dnl ========================================================
6074 if test -z "$MOZ_DEBUG_FLAGS"
6075 then
6076     case "$target" in
6077     *-irix*)
6078         if test "$GNU_CC"; then
6079             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6080             case "$GCC_VERSION" in
6081             2.95.*)
6082                 MOZ_DEBUG_FLAGS=""
6083                 ;;
6084             *)
6085                 MOZ_DEBUG_FLAGS="-g"
6086                 ;;
6087             esac
6088         else
6089             MOZ_DEBUG_FLAGS="-g"
6090         fi
6091         ;;
6092     *)
6093         MOZ_DEBUG_FLAGS="-g"
6094         ;;
6095     esac
6098 MOZ_ARG_ENABLE_STRING(debug,
6099 [  --enable-debug[=DBG]    Enable building with developer debug info
6100                           (Using compiler flags DBG)],
6101 [ if test "$enableval" != "no"; then
6102     MOZ_DEBUG=1
6103     if test -n "$enableval" && test "$enableval" != "yes"; then
6104         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6105     fi
6106   else
6107     MOZ_DEBUG=
6108   fi ],
6109   MOZ_DEBUG=)
6111 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6112  case "${target_os}" in
6113     beos*)
6114         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6115         ;;
6116     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6117         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6118         ;;
6119     *) 
6120         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6121         ;;
6122   esac
6123 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6125 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6127 if test -n "$MOZ_DEBUG"; then
6128     AC_MSG_CHECKING([for valid debug flags])
6129     _SAVE_CFLAGS=$CFLAGS
6130     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6131     AC_TRY_COMPILE([#include <stdio.h>], 
6132         [printf("Hello World\n");],
6133         _results=yes,
6134         _results=no)
6135     AC_MSG_RESULT([$_results])
6136     if test "$_results" = "no"; then
6137         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6138     fi
6139     CFLAGS=$_SAVE_CFLAGS
6142 dnl ========================================================
6143 dnl = Enable code optimization. ON by default.
6144 dnl ========================================================
6145 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6146         MOZ_OPTIMIZE_FLAGS="-O"
6149 MOZ_ARG_ENABLE_STRING(optimize,
6150 [  --disable-optimize      Disable compiler optimization
6151   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6152 [ if test "$enableval" != "no"; then
6153     MOZ_OPTIMIZE=1
6154     if test -n "$enableval" && test "$enableval" != "yes"; then
6155         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6156         MOZ_OPTIMIZE=2
6157     fi
6158 else
6159     MOZ_OPTIMIZE=
6160 fi ], MOZ_OPTIMIZE=1)
6162 if test "$COMPILE_ENVIRONMENT"; then
6163 if test -n "$MOZ_OPTIMIZE"; then
6164     AC_MSG_CHECKING([for valid optimization flags])
6165     _SAVE_CFLAGS=$CFLAGS
6166     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6167     AC_TRY_COMPILE([#include <stdio.h>], 
6168         [printf("Hello World\n");],
6169         _results=yes,
6170         _results=no)
6171     AC_MSG_RESULT([$_results])
6172     if test "$_results" = "no"; then
6173         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6174     fi
6175     CFLAGS=$_SAVE_CFLAGS
6177 fi # COMPILE_ENVIRONMENT
6179 AC_SUBST(MOZ_OPTIMIZE)
6180 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6181 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6182 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6184 dnl ========================================================
6185 dnl = Enable/disable debug for specific modules only
6186 dnl =   module names beginning with ^ will be disabled 
6187 dnl ========================================================
6188 MOZ_ARG_ENABLE_STRING(debug-modules,
6189 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6190 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6192 dnl ========================================================
6193 dnl = Enable/disable generation of debugger info for specific modules only
6194 dnl =    the special module name ALL_MODULES can be used to denote all modules
6195 dnl =    module names beginning with ^ will be disabled
6196 dnl ========================================================
6197 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6198 [  --enable-debugger-info-modules
6199                           Enable/disable debugger info for specific modules],
6200 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6201       dnl note that the list of module names is reversed as it is copied
6202       dnl this is important, as it will allow config.mk to interpret stuff like
6203       dnl "^ALL_MODULES xpcom" properly
6204       if test "$i" = "no"; then
6205         i="^ALL_MODULES"
6206       fi
6207       if test "$i" = "yes"; then
6208         i="ALL_MODULES"
6209       fi
6210       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6211     done ])
6213 dnl ========================================================
6214 dnl Enable garbage collector
6215 dnl ========================================================
6216 MOZ_ARG_ENABLE_BOOL(boehm,
6217 [  --enable-boehm          Enable the Boehm Garbage Collector],
6218     GC_LEAK_DETECTOR=1,
6219     GC_LEAK_DETECTOR= )
6220 if test -n "$GC_LEAK_DETECTOR"; then
6221     AC_DEFINE(GC_LEAK_DETECTOR)
6224 dnl ========================================================
6225 dnl Disable runtime logging checks
6226 dnl ========================================================
6227 MOZ_ARG_DISABLE_BOOL(logging,
6228 [  --disable-logging       Disable logging facilities],
6229     NS_DISABLE_LOGGING=1,
6230     NS_DISABLE_LOGGING= )
6231 if test "$NS_DISABLE_LOGGING"; then
6232     AC_DEFINE(NS_DISABLE_LOGGING)
6233 else
6234     AC_DEFINE(MOZ_LOGGING)
6237 dnl ========================================================
6238 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6239 dnl ========================================================
6240 _ENABLE_LOGREFCNT=42
6241 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6242 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6243     _ENABLE_LOGREFCNT=1,
6244     _ENABLE_LOGREFCNT= )
6245 if test "$_ENABLE_LOGREFCNT" = "1"; then
6246     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6247 elif test -z "$_ENABLE_LOGREFCNT"; then
6248     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6251 dnl ========================================================
6252 dnl = Enable trace malloc
6253 dnl ========================================================
6254 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6255 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6256 [  --enable-trace-malloc   Enable malloc tracing],
6257     NS_TRACE_MALLOC=1,
6258     NS_TRACE_MALLOC= )
6259 if test "$NS_TRACE_MALLOC"; then
6260   # Please, Mr. Linker Man, don't take away our symbol names
6261   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6262   USE_ELF_DYNSTR_GC=
6263   AC_DEFINE(NS_TRACE_MALLOC)
6265 AC_SUBST(NS_TRACE_MALLOC)
6267 dnl ========================================================
6268 dnl = Enable jemalloc
6269 dnl ========================================================
6270 MOZ_ARG_ENABLE_BOOL(jemalloc,
6271 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6272     MOZ_MEMORY=1,
6273     MOZ_MEMORY=)
6275 if test "$NS_TRACE_MALLOC"; then
6276     MOZ_MEMORY=
6279 if test "$MOZ_MEMORY"; then
6281   dnl Don't try to run compiler tests on Windows  
6282   if test "$OS_ARCH" = "WINNT"; then
6283     if test -z "$HAVE_64BIT_OS"; then
6284       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6285     else
6286       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6287     fi
6288   else
6289     AC_CHECK_SIZEOF([int *], [4])
6290     case "${ac_cv_sizeof_int_p}" in
6291     4)
6292       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6293       ;;
6294     8)
6295       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6296       ;;
6297     *)
6298       AC_MSG_ERROR([Unexpected pointer size])
6299       ;;
6300     esac
6301   fi
6303   AC_DEFINE(MOZ_MEMORY)
6304   if test "x$MOZ_DEBUG" = "x1"; then
6305     AC_DEFINE(MOZ_MEMORY_DEBUG)
6306   fi
6307   dnl The generic feature tests that determine how to compute ncpus are long and
6308   dnl complicated.  Therefore, simply define special cpp variables for the
6309   dnl platforms we have special knowledge of.
6310   case "${target_os}" in
6311   darwin*)
6312     AC_DEFINE(MOZ_MEMORY_DARWIN)
6313     ;;
6314   *-freebsd*)
6315     AC_DEFINE(MOZ_MEMORY_BSD)
6316     ;;
6317   *linux*)
6318     AC_DEFINE(MOZ_MEMORY_LINUX)
6319     ;;
6320   netbsd*)
6321     AC_DEFINE(MOZ_MEMORY_BSD)
6322     ;;
6323   solaris*)
6324     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6325     ;;
6326   msvc*|mks*|cygwin*|mingw*)
6327     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6328     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6329     dnl will fail miserably
6330     if test "$_CC_SUITE" -lt "8"; then
6331         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6332     fi
6333     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6334       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6335         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.])
6336       else
6337         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6338       fi
6339     fi
6340     if test -z "$WIN32_CRT_SRC_DIR"; then
6341       # pre-built dll
6342       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6343       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6344     else
6345       # CRT source directory
6346       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6347       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6348       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6349     fi
6350     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6351     dnl are to avoid m4
6352     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6353     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6354     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6355     dnl This needs to be unix style.
6356     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6357     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6358     AC_DEFINE(_STATIC_CPPLIB)
6359     dnl Don't generate a manifest, since we're linking to a custom CRT.
6360     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6361     dnl Also pass this to NSPR/NSS
6362     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6363     export DLLFLAGS
6364     ;;
6365   *)
6366     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6367     ;;
6368   esac
6370   AC_ARG_WITH([valgrind],
6371     [  --with-valgrind         Enable valgrind integration hooks],
6372     [enable_valgrind="yes"], [enable_valgrind="no"])
6373   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6374   if test "x$enable_valgrind" = "xyes" ; then
6375     AC_DEFINE(MOZ_VALGRIND)
6376   fi
6378 AC_SUBST(MOZ_MEMORY)
6379 AC_SUBST(WIN32_CRT_SRC_DIR)
6380 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6381 AC_SUBST(MOZ_LIB)
6382 AC_SUBST(MOZ_PATH)
6383 dnl Need to set this for make because NSS doesn't have configure
6384 AC_SUBST(DLLFLAGS)
6386 dnl ========================================================
6387 dnl = Use malloc wrapper lib
6388 dnl ========================================================
6389 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6390 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6391     _WRAP_MALLOC=1,
6392     _WRAP_MALLOC= )
6394 if test -n "$_WRAP_MALLOC"; then
6395     if test "$GNU_CC"; then
6396     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"
6397     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6398     fi
6401 dnl ========================================================
6402 dnl = Location of malloc wrapper lib
6403 dnl ========================================================
6404 MOZ_ARG_WITH_STRING(wrap-malloc,
6405 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6406     WRAP_MALLOC_LIB=$withval)
6408 dnl ========================================================
6409 dnl = Use Electric Fence
6410 dnl ========================================================
6411 MOZ_ARG_ENABLE_BOOL(efence,
6412 [  --enable-efence         Link with Electric Fence],
6413     _ENABLE_EFENCE=1,
6414     _ENABLE_EFENCE= )
6415 if test -n "$_ENABLE_EFENCE"; then
6416     AC_CHECK_LIB(efence,malloc)
6419 dnl ========================================================
6420 dnl jprof
6421 dnl ========================================================
6422 MOZ_ARG_ENABLE_BOOL(jprof,
6423 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6424     MOZ_JPROF=1,
6425     MOZ_JPROF= )
6426 if test -n "$MOZ_JPROF"; then
6427     AC_DEFINE(MOZ_JPROF)
6430 dnl ========================================================
6431 dnl shark
6432 dnl ========================================================
6433 MOZ_ARG_ENABLE_BOOL(shark,
6434 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6435     MOZ_SHARK=1,
6436     MOZ_SHARK= )
6437 if test -n "$MOZ_SHARK"; then
6438     AC_DEFINE(MOZ_SHARK)
6441 dnl ========================================================
6442 dnl callgrind
6443 dnl ========================================================
6444 MOZ_ARG_ENABLE_BOOL(callgrind,
6445 [  --enable-callgrind          Enable callgrind profiling],
6446     MOZ_CALLGRIND=1,
6447     MOZ_CALLGRIND= )
6448 if test -n "$MOZ_CALLGRIND"; then
6449     AC_DEFINE(MOZ_CALLGRIND)
6452 dnl ========================================================
6453 dnl = Enable static checking using gcc-dehydra
6454 dnl ========================================================
6456 MOZ_ARG_WITH_STRING(static-checking,
6457 [  --with-static-checking=path/to/gcc_dehydra.so
6458                             Enable static checking of code using GCC-dehydra],
6459     DEHYDRA_PATH=$withval,
6460     DEHYDRA_PATH= )
6462 if test -n "$DEHYDRA_PATH"; then
6463     if ! test -f "$DEHYDRA_PATH"; then
6464         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6465     fi
6466     AC_DEFINE(NS_STATIC_CHECKING)
6468 AC_SUBST(DEHYDRA_PATH)
6470 dnl ========================================================
6471 dnl = Enable stripping of libs & executables
6472 dnl ========================================================
6473 MOZ_ARG_ENABLE_BOOL(strip,
6474 [  --enable-strip          Enable stripping of libs & executables ],
6475     ENABLE_STRIP=1,
6476     ENABLE_STRIP= )
6478 dnl ========================================================
6479 dnl = Enable stripping of libs & executables when packaging
6480 dnl ========================================================
6481 MOZ_ARG_ENABLE_BOOL(install-strip,
6482 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6483     PKG_SKIP_STRIP= ,
6484     PKG_SKIP_STRIP=1)
6486 dnl ========================================================
6487 dnl = --enable-elf-dynstr-gc
6488 dnl ========================================================
6489 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6490 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6491     USE_ELF_DYNSTR_GC=1,
6492     USE_ELF_DYNSTR_GC= )
6494 dnl ========================================================
6495 dnl = --enable-old-abi-compat-wrappers
6496 dnl ========================================================
6497 dnl on x86 linux, the current builds of some popular plugins (notably
6498 dnl flashplayer and real) expect a few builtin symbols from libgcc
6499 dnl which were available in some older versions of gcc.  However,
6500 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6501 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6502 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6503 dnl to true on x86 linux, and false everywhere else.
6506 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6507 [  --enable-old-abi-compat-wrappers
6508                           Support old GCC ABI symbols to ease the pain 
6509                           of the linux compiler change],
6510     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6511     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6512 if test "$COMPILE_ENVIRONMENT"; then
6513 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6514     AC_LANG_SAVE
6515     AC_LANG_CPLUSPLUS
6516     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6517     AC_LANG_RESTORE
6518     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6520 fi # COMPILE_ENVIRONMENT
6522 dnl ========================================================
6523 dnl = --enable-prebinding
6524 dnl ========================================================
6525 MOZ_ARG_ENABLE_BOOL(prebinding,
6526 [  --enable-prebinding     Enable prebinding (Mac OS X only)],
6527     USE_PREBINDING=1,
6528     USE_PREBINDING= )
6530 dnl ========================================================
6531 dnl = 
6532 dnl = Profiling and Instrumenting
6533 dnl = 
6534 dnl ========================================================
6535 MOZ_ARG_HEADER(Profiling and Instrumenting)
6537 dnl ========================================================
6538 dnl = Enable timeline service, which provides lightweight
6539 dnl = instrumentation of mozilla for performance measurement.
6540 dnl = Timeline is off by default.
6541 dnl ========================================================
6542 MOZ_ARG_ENABLE_BOOL(timeline,
6543 [  --enable-timeline       Enable timeline services ],
6544     MOZ_TIMELINE=1,
6545     MOZ_TIMELINE= )
6546 if test -n "$MOZ_TIMELINE"; then
6547     AC_DEFINE(MOZ_TIMELINE)
6550 dnl ========================================================
6551 dnl Turn on reflow counting
6552 dnl ========================================================
6553 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6554 [  --enable-reflow-perf    Enable reflow performance tracing],
6555     MOZ_REFLOW_PERF=1,
6556     MOZ_REFLOW_PERF= )
6557 if test -n "$MOZ_REFLOW_PREF"; then
6558     AC_DEFINE(MOZ_REFLOW_PREF)
6560 AC_SUBST(MOZ_REFLOW_PERF)
6562 dnl ========================================================
6563 dnl Enable performance metrics.
6564 dnl ========================================================
6565 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6566 [  --enable-perf-metrics   Enable performance metrics],
6567     MOZ_PERF_METRICS=1,
6568     MOZ_PERF_METRICS= )
6569 if test -n "$MOZ_PERF_METRICS"; then
6570     AC_DEFINE(MOZ_PERF_METRICS)
6573 dnl ========================================================
6574 dnl Enable code size metrics.
6575 dnl ========================================================
6576 MOZ_ARG_ENABLE_BOOL(codesighs,
6577 [  --enable-codesighs      Enable code size analysis tools],
6578     _ENABLE_CODESIGHS=1,
6579     _ENABLE_CODESIGHS= )
6580 if test -n "$_ENABLE_CODESIGHS"; then
6581     if test -d $srcdir/tools/codesighs; then 
6582         MOZ_MAPINFO=1
6583     else
6584         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6585     fi
6588 dnl ========================================================
6589 dnl = Add support for Eazel profiler
6590 dnl ========================================================
6591 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6592 [  --enable-eazel-profiler-support
6593                           Enable Corel/Eazel profiler support],
6594     ENABLE_EAZEL_PROFILER=1,
6595     ENABLE_EAZEL_PROFILER= )
6596 if test -n "$ENABLE_EAZEL_PROFILER"; then
6597     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6598     USE_ELF_DYNSTR_GC=
6599     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6600     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6601     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6604 MOZ_ARG_ENABLE_STRING(profile-modules,
6605 [  --enable-profile-modules
6606                           Enable/disable profiling for specific modules],
6607 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6609 MOZ_ARG_ENABLE_BOOL(insure,
6610 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6611     _ENABLE_INSURE=1,
6612     _ENABLE_INSURE= )
6613 if test -n "$_ENABLE_INSURE"; then
6614     MOZ_INSURE="insure"
6615     MOZ_INSURIFYING=1
6616     MOZ_INSURE_DIRS="."
6617     MOZ_INSURE_EXCLUDE_DIRS="config"
6620 MOZ_ARG_WITH_STRING(insure-dirs,
6621 [  --with-insure-dirs=DIRS
6622                           Dirs to instrument with insure ],
6623     MOZ_INSURE_DIRS=$withval )
6625 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6626 [  --with-insure-exclude-dirs=DIRS
6627                           Dirs to not instrument with insure ],
6628     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6630 dnl ========================================================
6631 dnl = Support for Quantify (Windows)
6632 dnl ========================================================
6633 MOZ_ARG_ENABLE_BOOL(quantify,
6634 [  --enable-quantify      Enable Quantify support (Windows only) ],
6635     MOZ_QUANTIFY=1,
6636     MOZ_QUANTIFY= )
6638 dnl ========================================================
6639 dnl = Support for demangling undefined symbols
6640 dnl ========================================================
6641 if test -z "$SKIP_LIBRARY_CHECKS"; then
6642     AC_LANG_SAVE
6643     AC_LANG_CPLUSPLUS
6644     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6645     AC_LANG_RESTORE
6648 # Demangle only for debug or trace-malloc builds
6649 MOZ_DEMANGLE_SYMBOLS=
6650 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6651     MOZ_DEMANGLE_SYMBOLS=1
6652     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6654 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6656 dnl ========================================================
6657 dnl = Support for gcc stack unwinding (from gcc 3.3)
6658 dnl ========================================================
6659 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6660     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6663 dnl ========================================================
6664 dnl =
6665 dnl = Misc. Options
6666 dnl = 
6667 dnl ========================================================
6668 MOZ_ARG_HEADER(Misc. Options)
6670 dnl ========================================================
6671 dnl update xterm title
6672 dnl ========================================================
6673 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6674 [  --enable-xterm-updates  Update XTERM titles with current command.],
6675     MOZ_UPDATE_XTERM=1,
6676     MOZ_UPDATE_XTERM= )
6678 dnl =========================================================
6679 dnl = Chrome format
6680 dnl =========================================================
6681 MOZ_ARG_ENABLE_STRING([chrome-format],
6682 [  --enable-chrome-format=jar|flat|both|symlink
6683                           Select FORMAT of chrome files (default=jar)],
6684     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6686 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6687     MOZ_CHROME_FILE_FORMAT=jar
6690 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6691     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6692     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6693     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6694     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6697 dnl ========================================================
6698 dnl = Define default location for MOZILLA_FIVE_HOME
6699 dnl ========================================================
6700 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6701 [  --with-default-mozilla-five-home
6702                           Set the default value for MOZILLA_FIVE_HOME],
6703 [ val=`echo $withval`
6704   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6706 dnl ========================================================
6707 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6708 dnl ========================================================
6709 MOZ_ARG_WITH_STRING(user-appdir,
6710 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6711 [ val=`echo $withval`
6712 if echo "$val" | grep "\/" >/dev/null; then
6713     AC_MSG_ERROR("Homedir must be single relative path.")
6714 else 
6715     MOZ_USER_DIR="$val"
6716 fi])
6718 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6720 dnl ========================================================
6721 dnl = Doxygen configuration
6722 dnl ========================================================
6723 dnl Use commas to specify multiple dirs to this arg
6724 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6725 MOZ_ARG_WITH_STRING(doc-input-dirs,
6726 [  --with-doc-input-dirs=DIRS
6727                           Header/idl dirs to create docs from],
6728 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6729 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6731 dnl Use commas to specify multiple dirs to this arg
6732 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6733 MOZ_ARG_WITH_STRING(doc-include-dirs,
6734 [  --with-doc-include-dirs=DIRS  
6735                           Include dirs to preprocess doc headers],
6736 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6737 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6739 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6740 MOZ_ARG_WITH_STRING(doc-output-dir,
6741 [  --with-doc-output-dir=DIR
6742                           Dir to generate docs into],
6743 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6744 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6746 if test -z "$SKIP_COMPILER_CHECKS"; then
6747 dnl ========================================================
6748 dnl =
6749 dnl = Compiler Options
6750 dnl = 
6751 dnl ========================================================
6752 MOZ_ARG_HEADER(Compiler Options)
6754 dnl ========================================================
6755 dnl Check for gcc -pipe support
6756 dnl ========================================================
6757 AC_MSG_CHECKING([for gcc -pipe support])
6758 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6759     echo '#include <stdio.h>' > dummy-hello.c
6760     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6761     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6762     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6763     if test $? = 0; then
6764         _res_as_stdin="yes"
6765     else
6766         _res_as_stdin="no"
6767     fi
6768     if test "$_res_as_stdin" = "yes"; then
6769         _SAVE_CFLAGS=$CFLAGS
6770         CFLAGS="$CFLAGS -pipe"
6771         AC_TRY_COMPILE( [ #include <stdio.h> ],
6772             [printf("Hello World\n");],
6773             [_res_gcc_pipe="yes"],
6774             [_res_gcc_pipe="no"] )
6775         CFLAGS=$_SAVE_CFLAGS
6776     fi
6777     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6778         _res="yes";
6779         CFLAGS="$CFLAGS -pipe"
6780         CXXFLAGS="$CXXFLAGS -pipe"
6781     else
6782         _res="no"
6783     fi
6784     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6785     AC_MSG_RESULT([$_res])
6786 else
6787     AC_MSG_RESULT([no])
6790 dnl pass -Wno-long-long to the compiler
6791 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6792 [  --enable-long-long-warning 
6793                           Warn about use of non-ANSI long long type],
6794     _IGNORE_LONG_LONG_WARNINGS=,
6795     _IGNORE_LONG_LONG_WARNINGS=1)
6797 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6798      _SAVE_CFLAGS="$CFLAGS"
6799      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6800      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6801      AC_TRY_COMPILE([], [return(0);], 
6802         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6803           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6804           result="yes" ], result="no")
6805      AC_MSG_RESULT([$result])
6806      CFLAGS="$_SAVE_CFLAGS"
6809 dnl ========================================================
6810 dnl Profile guided optimization
6811 dnl ========================================================
6812 dnl Test for profiling options
6813 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6814 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6816 dnl Provide a switch to disable PGO even when called via profiledbuild.
6817 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6818 [  --disable-profile-guided-optimization
6819                            Don't build with PGO even if called via make profiledbuild],
6820 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6821 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6823 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6825 _SAVE_CFLAGS="$CFLAGS"
6826 CFLAGS="$CFLAGS -fprofile-generate"
6828 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6829 AC_TRY_COMPILE([], [return 0;],
6830                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6831                  result="yes" ], result="no")
6832 AC_MSG_RESULT([$result])
6834 if test $result = "yes"; then
6835   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6836   PROFILE_USE_CFLAGS="-fprofile-use"
6837   PROFILE_USE_LDFLAGS="-fprofile-use"
6838 else
6839   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6840   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6841   AC_TRY_COMPILE([], [return 0;],
6842                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6843                    result="yes" ], result="no")
6844   AC_MSG_RESULT([$result])
6845   if test $result = "yes"; then
6846     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6847   fi
6848   # don't really care, this is an old GCC
6849   PROFILE_GEN_LDFLAGS=
6850   PROFILE_USE_LDFLAGS=
6853 CFLAGS="$_SAVE_CFLAGS"
6855 if test -n "$INTEL_CC"; then
6856   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6857   PROFILE_GEN_LDFLAGS=
6858   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6859   PROFILE_USE_LDFLAGS=
6862 dnl Sun Studio on Solaris
6863 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6864   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6865   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6866   if test "$CPU_ARCH" != "sparc"; then
6867     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6868     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6869   else
6870     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6871     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6872   fi
6875 AC_SUBST(PROFILE_GEN_CFLAGS)
6876 AC_SUBST(PROFILE_GEN_LDFLAGS)
6877 AC_SUBST(PROFILE_USE_CFLAGS)
6878 AC_SUBST(PROFILE_USE_LDFLAGS)
6880 AC_LANG_CPLUSPLUS
6882 dnl ========================================================
6883 dnl Test for -pedantic bustage
6884 dnl ========================================================
6885 MOZ_ARG_DISABLE_BOOL(pedantic,
6886 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6887 _PEDANTIC= )
6888 if test "$_PEDANTIC"; then
6889     _SAVE_CXXFLAGS=$CXXFLAGS
6890     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6891     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6892     AC_TRY_COMPILE([$configure_static_assert_macros],
6893                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6894                    result="no", result="yes" )
6895     AC_MSG_RESULT([$result])
6896     CXXFLAGS="$_SAVE_CXXFLAGS"
6898     case "$result" in
6899     no)
6900         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6901         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6902         ;;
6903     yes)
6904         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
6905         ;;
6906     esac
6909 dnl ========================================================
6910 dnl Test for correct temporary object destruction order
6911 dnl ========================================================
6912 dnl We want to make sure the compiler follows the C++ spec here as 
6913 dnl xpcom and the string classes depend on it (bug 235381).
6914 AC_MSG_CHECKING([for correct temporary object destruction order])
6915 AC_TRY_RUN([ class A {
6916              public:  A(int& x) : mValue(x) {}
6917                       ~A() { mValue--; }
6918                       operator char**() { return 0; }
6919              private:  int& mValue;
6920              };
6921              void func(char **arg) {}
6922              int m=2;
6923              void test() {
6924                   func(A(m));
6925                   if (m==1) m = 0;
6926              }
6927              int main() {
6928                  test();
6929                  return(m);
6930              }
6931              ],
6932      result="yes", result="no", result="maybe")
6933 AC_MSG_RESULT([$result])
6935 if test "$result" = "no"; then
6936     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
6939 dnl ========================================================
6940 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
6941 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
6942 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
6943 dnl ========================================================
6944 _SAVE_CXXFLAGS=$CXXFLAGS
6945 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
6946 AC_CACHE_CHECK(for correct overload resolution with const and templates,
6947     ac_nscap_nonconst_opeq_bug,
6948     [AC_TRY_COMPILE([
6949                       template <class T>
6950                       class Pointer
6951                         {
6952                         public:
6953                           T* myPtr;
6954                         };
6955                       
6956                       template <class T, class U>
6957                       int operator==(const Pointer<T>& rhs, U* lhs)
6958                         {
6959                           return rhs.myPtr == lhs;
6960                         }
6961                       
6962                       template <class T, class U>
6963                       int operator==(const Pointer<T>& rhs, const U* lhs)
6964                         {
6965                           return rhs.myPtr == lhs;
6966                         }
6967                     ],
6968                     [
6969                       Pointer<int> foo;
6970                       const int* bar;
6971                       return foo == bar;
6972                     ],
6973                     ac_nscap_nonconst_opeq_bug="no",
6974                     ac_nscap_nonconst_opeq_bug="yes")])
6975 CXXFLAGS="$_SAVE_CXXFLAGS"
6977 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
6978     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
6980 fi # SKIP_COMPILER_CHECKS
6982 dnl ========================================================
6983 dnl C++ rtti
6984 dnl Should be smarter and check that the compiler does indeed have rtti
6985 dnl ========================================================
6986 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
6987 [  --enable-cpp-rtti       Enable C++ RTTI ],
6988 [ _MOZ_USE_RTTI=1 ],
6989 [ _MOZ_USE_RTTI= ])
6991 if test "$_MOZ_USE_RTTI"; then
6992    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
6993 else
6994    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
6997 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
6999 dnl ========================================================
7000 dnl C++ exceptions (g++/egcs only - for now)
7001 dnl Should be smarter and check that the compiler does indeed have exceptions
7002 dnl ========================================================
7003 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7004 [  --enable-cpp-exceptions Enable C++ exceptions ],
7005 [ _MOZ_CPP_EXCEPTIONS=1 ],
7006 [ _MOZ_CPP_EXCEPTIONS= ])
7008 if test "$_MOZ_CPP_EXCEPTIONS"; then
7009     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7010 else
7011     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7014 # Irix & OSF native compilers do not like exception declarations 
7015 # when exceptions are disabled
7016 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7017     AC_DEFINE(CPP_THROW_NEW, [])
7018 else
7019     AC_DEFINE(CPP_THROW_NEW, [throw()])
7021 AC_LANG_C
7023 dnl ========================================================
7024 dnl =
7025 dnl = Build depencency options
7026 dnl =
7027 dnl ========================================================
7028 MOZ_ARG_HEADER(Build dependencies)
7030 dnl ========================================================
7031 dnl = Do not auto generate dependency info
7032 dnl ========================================================
7033 MOZ_AUTO_DEPS=1
7034 MOZ_ARG_DISABLE_BOOL(auto-deps,
7035 [  --disable-auto-deps     Do not automatically generate dependency info],
7036     MOZ_AUTO_DEPS=,
7037     MOZ_AUTO_DEPS=1)
7039 if test -n "$MOZ_AUTO_DEPS"; then
7040 dnl ========================================================
7041 dnl = Use mkdepend instead of $CC -MD for dependency generation
7042 dnl ========================================================
7043 _cpp_md_flag=
7044 MOZ_ARG_DISABLE_BOOL(md,
7045 [  --disable-md            Do not use compiler-based dependencies ],
7046   [_cpp_md_flag=],
7047   [_cpp_md_flag=1],
7048   [dnl Default is to turn on -MD if using GNU-compatible compilers
7049    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7050      _cpp_md_flag=1
7051    fi
7052   dnl Default is to use -xM if using Sun Studio on Solaris
7053    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7054      _cpp_md_flag=1
7055    fi])
7056 if test "$_cpp_md_flag"; then
7057   COMPILER_DEPEND=1
7058   if test "$OS_ARCH" = "OpenVMS"; then
7059     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(*F).pp))'
7060   else
7061     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(*F).pp)'
7062   fi
7063   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7064   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7065     _DEPEND_CFLAGS=
7066   fi
7067 else
7068   COMPILER_DEPEND=
7069   _USE_CPP_INCLUDE_FLAG=
7070   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7071   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7073 fi # MOZ_AUTO_DEPS
7074 MDDEPDIR='.deps'
7075 AC_SUBST(MOZ_AUTO_DEPS)
7076 AC_SUBST(COMPILER_DEPEND)
7077 AC_SUBST(MDDEPDIR)
7080 dnl ========================================================
7081 dnl =
7082 dnl = Static Build Options
7083 dnl =
7084 dnl ========================================================
7085 MOZ_ARG_HEADER(Static build options)
7087 MOZ_ARG_ENABLE_BOOL(static,
7088 [  --enable-static         Enable building of internal static libs],
7089     BUILD_STATIC_LIBS=1,
7090     BUILD_STATIC_LIBS=)
7092 dnl Disable libxul in debug builds, but not for xulrunner.
7093 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7094    MOZ_ENABLE_LIBXUL=
7097 MOZ_ARG_ENABLE_BOOL(libxul,
7098 [  --enable-libxul         Enable building of libxul],
7099     MOZ_ENABLE_LIBXUL=1,
7100     MOZ_ENABLE_LIBXUL=)
7102 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7103         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7106 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
7107         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
7110 if test -n "$MOZ_ENABLE_LIBXUL"; then
7111     XPCOM_LIBS="$LIBXUL_LIBS"
7112     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7113 else
7114     if test -n "$BUILD_STATIC_LIBS"; then
7115         AC_DEFINE(MOZ_STATIC_BUILD)
7116     fi
7117     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7120 dnl ========================================================
7121 dnl = Force JS to be a static lib
7122 dnl ========================================================
7123 MOZ_ARG_ENABLE_BOOL(js-static-build,
7124 [  --enable-js-static-build  Force js to be a static lib],
7125     JS_STATIC_BUILD=1,
7126     JS_STATIC_BUILD= )
7128 AC_SUBST(JS_STATIC_BUILD)
7129         
7130 if test -n "$JS_STATIC_BUILD"; then
7131     AC_DEFINE(EXPORT_JS_API)
7133 if test -z "$BUILD_STATIC_LIBS"; then
7134     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
7139 dnl Disable static mail in debug builds, but not with libxul sdk.
7140 if test -n "$MOZ_DEBUG" -a -z "$LIBXUL_SDK"; then
7141    MOZ_STATIC_MAIL_BUILD=
7143 MOZ_ARG_ENABLE_BOOL(static-mail,
7144 [  --enable-static-mail Enable static mail build support],
7145     MOZ_STATIC_MAIL_BUILD=1,
7146     MOZ_STATIC_MAIL_BUILD= )
7148 if test "$MOZ_STATIC_MAIL_BUILD"; then
7149     AC_DEFINE(MOZ_STATIC_MAIL_BUILD)
7152 AC_SUBST(MOZ_STATIC_MAIL_BUILD)
7154 dnl ========================================================
7155 dnl =
7156 dnl = Standalone module options
7157 dnl = 
7158 dnl ========================================================
7159 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7161 dnl Check for GLib and libIDL.
7162 dnl ========================================================
7163 case "$target_os" in
7164 msvc*|mks*|cygwin*|mingw*|wince*)
7165     SKIP_IDL_CHECK="yes"
7166     ;;
7168     SKIP_IDL_CHECK="no"
7169     ;;
7170 esac
7172 if test -z "$COMPILE_ENVIRONMENT"; then
7173     SKIP_IDL_CHECK="yes"
7176 dnl = Allow users to disable libIDL checking for standalone modules
7177 MOZ_ARG_WITHOUT_BOOL(libIDL,
7178 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7179         SKIP_IDL_CHECK="yes")
7181 if test "$SKIP_IDL_CHECK" = "no"
7182 then
7183     _LIBIDL_FOUND=
7184     if test "$MACOS_SDK_DIR"; then 
7185       dnl xpidl, and therefore libIDL, is only needed on the build host.
7186       dnl Don't build it against the SDK, as that causes problems.
7187       _MACSAVE_CFLAGS="$CFLAGS"
7188       _MACSAVE_LIBS="$LIBS"
7189       _MACSAVE_LDFLAGS="$LDFLAGS"
7190       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7191       changequote(,)
7192       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"`
7193       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7194       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7195       changequote([,])
7196       unset NEXT_ROOT
7197     fi
7199     if test "$MOZ_ENABLE_GTK2"; then
7200         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7201     fi
7202     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7203     dnl to either libIDL1 or libIDL2.
7204     if test -z "$_LIBIDL_FOUND"; then
7205         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7206         if test -z "$_LIBIDL_FOUND"; then
7207             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7208         fi
7209     fi
7210     dnl
7211     dnl If we don't have a libIDL config program & not cross-compiling, 
7212     dnl     look for orbit-config instead.
7213     dnl
7214     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7215         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7216         if test -n "$ORBIT_CONFIG"; then
7217             AC_MSG_CHECKING([for ORBit libIDL usability])
7218                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7219             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7220             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7221             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7222             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7223             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7224             LIBIDL_CONFIG=
7225             _SAVE_CFLAGS="$CFLAGS"
7226             _SAVE_LIBS="$LIBS"
7227             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7228             LIBS="$LIBIDL_LIBS $LIBS"
7229             AC_TRY_RUN([
7230 #include <stdlib.h>
7231 #include <libIDL/IDL.h>
7232 int main() {
7233   char *s;
7234   s=strdup(IDL_get_libver_string());
7235   if(s==NULL) {
7236     exit(1);
7237   }
7238   exit(0);
7240             ], [_LIBIDL_FOUND=1
7241                 result="yes"],
7242                [LIBIDL_CFLAGS=
7243                 LIBIDL_LIBS=
7244                 result="no"],
7245                [_LIBIDL_FOUND=1
7246                 result="maybe"] )
7247             AC_MSG_RESULT($result)
7248             CFLAGS="$_SAVE_CFLAGS"
7249             LIBS="$_SAVE_LIBS"
7250         fi
7251     fi
7252     if test -z "$_LIBIDL_FOUND"; then
7253         AC_MSG_ERROR([libIDL not found.
7254         libIDL $LIBIDL_VERSION or higher is required.])
7255     fi
7256     if test "$MACOS_SDK_DIR"; then
7257       CFLAGS="$_MACSAVE_CFLAGS"
7258       LIBS="$_MACSAVE_LIBS"
7259       LDFLAGS="$_MACSAVE_LDFLAGS"
7260       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7261         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7262       fi
7263     fi
7266 if test -n "$CROSS_COMPILE"; then
7267      if test -z "$HOST_LIBIDL_CONFIG"; then
7268         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7269     fi
7270     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7271         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7272         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7273     else
7274         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7275         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7276     fi
7279 if test -z "$SKIP_PATH_CHECKS"; then
7280 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7281     if test "$MOZ_ENABLE_GTK2"; then
7282         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7283     else
7284         AM_PATH_GLIB(${GLIB_VERSION})
7285     fi
7289 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7290     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7293 AC_SUBST(LIBIDL_CFLAGS)
7294 AC_SUBST(LIBIDL_LIBS)
7295 AC_SUBST(STATIC_LIBIDL)
7296 AC_SUBST(GLIB_CFLAGS)
7297 AC_SUBST(GLIB_LIBS)
7298 AC_SUBST(GLIB_GMODULE_LIBS)
7299 AC_SUBST(HOST_LIBIDL_CONFIG)
7300 AC_SUBST(HOST_LIBIDL_CFLAGS)
7301 AC_SUBST(HOST_LIBIDL_LIBS)
7303 dnl ========================================================
7304 dnl Check for libart
7305 dnl ========================================================
7306 if test "$MOZ_SVG_RENDERER_LIBART"; then
7307   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
7308     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
7309 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
7310   fi
7312   dnl libart's configure hasn't been run yet, but we know what the
7313   dnl answer should be anyway
7314   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
7315   case "$target_os" in
7316   msvc*|mks*|cygwin*|mingw*|wince*)
7317       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
7318       ;;
7319   os2*)
7320       MOZ_LIBART_LIBS='-lmoz_art -lm'
7321       ;;
7322   beos*)
7323       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
7324       ;;
7325   *)
7326       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
7327       ;;
7328   esac
7329   AC_FUNC_ALLOCA
7332 AC_SUBST(MOZ_LIBART_CFLAGS)
7333 AC_SUBST(MOZ_LIBART_LIBS)
7335 dnl ========================================================
7336 dnl Check for cairo
7337 dnl ========================================================
7338 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7340 MOZ_TREE_CAIRO=1
7341 MOZ_ARG_ENABLE_BOOL(system-cairo,
7342 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7343 MOZ_TREE_CAIRO=,
7344 MOZ_TREE_CAIRO=1 )
7346 # Check for headers defining standard int types.
7347 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7349 if test "$MOZ_TREE_CAIRO"; then
7350     AC_DEFINE(MOZ_TREE_CAIRO)
7352     # For now we assume that we will have a uint64_t available through
7353     # one of the above headers or mozstdint.h.
7354     AC_DEFINE(HAVE_UINT64_T)
7356     # Define macros for cairo-features.h
7357     if test "$MOZ_X11"; then
7358         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7359         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7360         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7361         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7362         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7363         MOZ_ENABLE_CAIRO_FT=1
7364         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7365     fi
7366     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7367         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7368         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7369         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7370     fi
7371     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7372         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7373         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7374         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7375     fi
7376     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7377         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7378         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7379         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7380         MOZ_ENABLE_CAIRO_FT=1
7381         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7382         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7383     fi
7384     if test "$MOZ_ENABLE_GLITZ"; then
7385         GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
7386     fi
7387     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7388         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7389         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7390         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7391         MOZ_ENABLE_CAIRO_FT=1
7392     fi
7393     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7394     AC_SUBST(CAIRO_FT_CFLAGS)
7396     if test "$MOZ_DEBUG"; then
7397       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7398     else
7399       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7400     fi
7402     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7404     AC_SUBST(PS_SURFACE_FEATURE)
7405     AC_SUBST(PDF_SURFACE_FEATURE)
7406     AC_SUBST(SVG_SURFACE_FEATURE)
7407     AC_SUBST(XLIB_SURFACE_FEATURE)
7408     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7409     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7410     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7411     AC_SUBST(XCB_SURFACE_FEATURE)
7412     AC_SUBST(WIN32_SURFACE_FEATURE)
7413     AC_SUBST(OS2_SURFACE_FEATURE)
7414     AC_SUBST(BEOS_SURFACE_FEATURE)
7415     AC_SUBST(GLITZ_SURFACE_FEATURE)
7416     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7417     AC_SUBST(FT_FONT_FEATURE)
7418     AC_SUBST(WIN32_FONT_FEATURE)
7419     AC_SUBST(QUARTZ_FONT_FEATURE)
7420     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7422     if test "$_WIN32_MSVC"; then
7423         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7424         if test "$MOZ_ENABLE_GLITZ"; then
7425             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
7426         fi
7427     else
7428         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"
7430         if test "$MOZ_X11"; then
7431             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7432         fi
7434         if test "$MOZ_ENABLE_GLITZ"; then
7435             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
7436             if test "$MOZ_X11"; then
7437                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
7438             fi
7439             if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7440                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
7441             fi
7442         fi
7443     fi
7444 else
7445    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7446    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7447    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7448    if test "$MOZ_X11"; then
7449         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7450         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7451         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7452    fi
7455 AC_SUBST(MOZ_TREE_CAIRO)
7456 AC_SUBST(MOZ_CAIRO_CFLAGS)
7457 AC_SUBST(MOZ_CAIRO_LIBS)
7459 dnl ========================================================
7460 dnl Check for lcms
7461 dnl ========================================================
7463 MOZ_NATIVE_LCMS=
7464 MOZ_ARG_ENABLE_BOOL(system-lcms,
7465 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7466 MOZ_NATIVE_LCMS=1,
7467 MOZ_NATIVE_LCMS= )
7469 if test -z "$MOZ_NATIVE_LCMS"
7470 then
7471     LCMS_CFLAGS=
7472     if test "$_WIN32_MSVC"; then
7473         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7474             LCMS_CFLAGS=-DLCMS_DLL
7475         fi
7476         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7477     else
7478         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7479     fi
7480 else
7481     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7484 AC_SUBST(MOZ_NATIVE_LCMS)
7485 AC_SUBST(LCMS_CFLAGS)
7486 AC_SUBST(LCMS_LIBS)
7488 dnl ========================================================
7489 dnl disable xul
7490 dnl ========================================================
7491 MOZ_ARG_DISABLE_BOOL(xul,
7492 [  --disable-xul           Disable XUL],
7493     MOZ_XUL= )
7494 if test "$MOZ_XUL"; then
7495   AC_DEFINE(MOZ_XUL)
7496 else
7497   dnl remove extensions that require XUL
7498   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7501 AC_SUBST(MOZ_XUL)
7503 dnl ========================================================
7504 dnl Two ways to enable Python support:
7505 dnl   --enable-extensions=python # select all available.
7506 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7507 dnl or:
7508 dnl   --enable-extensions=python/xpcom,... # select individual ones
7510 dnl If either is used, we locate the Python to use.
7511 dnl ========================================================
7513 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7514 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7515     dnl Allow PYTHON to point to the Python interpreter to use
7516     dnl (note that it must be the python executable - which we
7517     dnl run to locate the relevant paths etc)
7518     dnl If not set, we use whatever Python we can find.
7519     MOZ_PYTHON=$PYTHON
7520     dnl Ask Python what its version number is
7521     changequote(,)
7522     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7523     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7524     changequote([,])
7525     dnl Ask for the Python "prefix" (ie, home/source dir)
7526     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7527     dnl Setup the include and library directories.
7528     if test "$OS_ARCH" = "WINNT"; then
7529         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7530         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7531         dnl Binary trees have "include" for .h, and "libs" for .lib
7532         dnl We add 'em both - along with quotes, to handle spaces.
7533         MOZ_PYTHON_DLL_SUFFIX=.pyd
7534         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7535         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7536     else
7537         dnl Non-Windows include and libs
7538         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7539         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7540         dnl Check for dynamic Python lib
7541         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7542         dnl - core, xpcom loader, pydom etc) all need to share Python.
7543         dnl - Python 2.3's std --enable-shared configure option will
7544         dnl   create a libpython2.3.so.1.0. We should first try this
7545         dnl   dotted versioned .so file because this is the one that
7546         dnl   the PyXPCOM build mechanics tries to link to.
7547         dnl   XXX Should find a better way than hardcoding "1.0".
7548         dnl - Python developement tree dir layouts are NOT allowed here
7549         dnl   because the PyXPCOM build just dies on it later anyway.
7550         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7551         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7552             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7553         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7554             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7555         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7556             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7557         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7558             dnl Don't Python development tree directory layout.
7559             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7560             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.])
7561         elif test "$OS_ARCH" = "Darwin"; then
7562             dnl We do Darwin last, so if a custom non-framework build of
7563             dnl python is used on OSX, then it will be picked up first by
7564             dnl the logic above.
7565             MOZ_PYTHON_LIBS="-framework Python"
7566         else
7567             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7568         fi
7569         if test "$OS_ARCH" = "Linux"; then
7570             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7571         fi
7572     fi
7573     dnl Handle "_d" on Windows
7574     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7575         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7576     else
7577         MOZ_PYTHON_DEBUG_SUFFIX=
7578     fi
7579     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7582 dnl If the user asks for the 'python' extension, then we add
7583 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7584 dnl Note the careful regex - it must match 'python' followed by anything
7585 dnl other than a '/', including the end-of-string.
7586 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7587     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7588         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7589     done
7591 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7592 dnl command-line, but not yet
7593 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7594 AC_SUBST(MOZ_PYTHON)
7595 AC_SUBST(MOZ_PYTHON_PREFIX)
7596 AC_SUBST(MOZ_PYTHON_INCLUDES)
7597 AC_SUBST(MOZ_PYTHON_LIBS)
7598 AC_SUBST(MOZ_PYTHON_VER)
7599 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7600 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7601 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7603 dnl ========================================================
7604 dnl disable profile sharing
7605 dnl ========================================================
7606 MOZ_ARG_DISABLE_BOOL(profilesharing,
7607 [  --disable-profilesharing           Disable profile sharing],
7608     MOZ_PROFILESHARING=,
7609     MOZ_PROFILESHARING=1 )
7610 if test "$MOZ_PROFILESHARING"; then
7611   MOZ_IPCD=1
7612   AC_DEFINE(MOZ_PROFILESHARING)
7615 dnl ========================================================
7616 dnl enable ipc/ipcd
7617 dnl ========================================================
7618 MOZ_ARG_ENABLE_BOOL(ipcd,
7619 [  --enable-ipcd                      Enable IPC daemon],
7620     MOZ_IPCD=1,
7621     MOZ_IPCD= )
7623 dnl ========================================================
7624 dnl disable profile locking
7625 dnl   do no use this in applications that can have more than
7626 dnl   one process accessing the profile directory.
7627 dnl ========================================================
7628 MOZ_ARG_DISABLE_BOOL(profilelocking,
7629 [  --disable-profilelocking           Disable profile locking],
7630     MOZ_PROFILELOCKING=,
7631     MOZ_PROFILELOCKING=1 )
7632 if test "$MOZ_PROFILELOCKING"; then
7633   AC_DEFINE(MOZ_PROFILELOCKING)
7636 dnl ========================================================
7637 dnl disable rdf services
7638 dnl ========================================================
7639 MOZ_ARG_DISABLE_BOOL(rdf,
7640 [  --disable-rdf           Disable RDF],
7641     MOZ_RDF= )
7642 if test "$MOZ_RDF"; then
7643   AC_DEFINE(MOZ_RDF)
7646 AC_SUBST(MOZ_RDF)
7648 dnl ========================================================
7649 dnl necko configuration options
7650 dnl ========================================================
7653 dnl option to disable various necko protocols
7655 MOZ_ARG_ENABLE_STRING(necko-protocols,
7656 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7657                           Enable/disable specific protocol handlers],
7658 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7659     if test "$option" = "yes" || test "$option" = "all"; then
7660         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7661     elif test "$option" = "no" || test "$option" = "none"; then
7662         NECKO_PROTOCOLS=""
7663     elif test "$option" = "default"; then
7664         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7665     elif test `echo "$option" | grep -c \^-` != 0; then
7666         option=`echo $option | sed 's/^-//'`
7667         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7668     else
7669         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7670     fi
7671 done],
7672     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7673 dnl Remove dupes
7674 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7675 AC_SUBST(NECKO_PROTOCOLS)
7676 for p in $NECKO_PROTOCOLS; do
7677     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7678 done
7681 dnl option to disable necko's disk cache
7683 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7684 [  --disable-necko-disk-cache
7685                           Disable necko disk cache],
7686     NECKO_DISK_CACHE=,
7687     NECKO_DISK_CACHE=1)
7688 AC_SUBST(NECKO_DISK_CACHE)
7689 if test "$NECKO_DISK_CACHE"; then
7690     AC_DEFINE(NECKO_DISK_CACHE)
7694 dnl option to minimize size of necko's i/o buffers
7696 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7697 [  --enable-necko-small-buffers
7698                           Minimize size of necko's i/o buffers],
7699     NECKO_SMALL_BUFFERS=1,
7700     NECKO_SMALL_BUFFERS=)
7701 AC_SUBST(NECKO_SMALL_BUFFERS)
7702 if test "$NECKO_SMALL_BUFFERS"; then
7703     AC_DEFINE(NECKO_SMALL_BUFFERS)
7704 fi 
7707 dnl option to disable cookies
7709 MOZ_ARG_DISABLE_BOOL(cookies,
7710 [  --disable-cookies       Disable cookie support],
7711     NECKO_COOKIES=,
7712     NECKO_COOKIES=1)
7713 AC_SUBST(NECKO_COOKIES)
7714 if test "$NECKO_COOKIES"; then
7715     AC_DEFINE(NECKO_COOKIES)
7718 dnl NECKO_ configuration options are not global
7719 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7721 dnl ========================================================
7722 dnl string api compatibility
7723 dnl ========================================================
7724 MOZ_ARG_DISABLE_BOOL(v1-string-abi,
7725 [  --disable-v1-string-abi   Disable binary compatibility layer for strings],
7726     MOZ_V1_STRING_ABI=,
7727     MOZ_V1_STRING_ABI=1)
7728 AC_SUBST(MOZ_V1_STRING_ABI)
7729 if test "$MOZ_V1_STRING_ABI"; then
7730     AC_DEFINE(MOZ_V1_STRING_ABI)
7733 dnl Only build Mork if it's required
7734 AC_SUBST(MOZ_MORK)
7735 if test "$MOZ_MORK"; then
7736   AC_DEFINE(MOZ_MORK)
7739 dnl Build the lightweight Mork reader if required
7740 AC_SUBST(MOZ_MORKREADER)
7741 if test "$MOZ_MORKREADER"; then
7742   AC_DEFINE(MOZ_MORKREADER)
7745 dnl ========================================================
7746 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7747     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7750 if test "$MOZ_LDAP_XPCOM"; then
7751     LDAP_CFLAGS='-I${DIST}/public/ldap'
7752     if test "$OS_ARCH" = "WINNT"; then
7753         if test -n "$GNU_CC"; then
7754             LDAP_LIBS='-L$(DIST)/lib -lnsldap32v60 -lnsldappr32v60 -lnsldif32v60'
7755         else
7756             LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)nsldap32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldappr32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldif32v60.${IMPORT_LIB_SUFFIX}'
7757         fi
7758     elif test "$OS_ARCH" = "OS2"; then
7759             LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)ldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)prldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)ldif60.${IMPORT_LIB_SUFFIX}'
7760     else
7761         LDAP_LIBS='-L${DIST}/bin -L${DIST}/lib -lldap60 -lprldap60 -lldif60'
7762     fi
7765 if test "$COMPILE_ENVIRONMENT"; then
7766 if test "$SUNCTL"; then
7767     dnl older versions of glib do not seem to have gmodule which ctl needs
7768     _SAVE_CFLAGS=$CFLAGS
7769     CFLAGS="$CFLAGS $GLIB_CFLAGS"
7770     AC_LANG_SAVE
7771     AC_LANG_C
7772     AC_TRY_COMPILE([#include <gmodule.h>],
7773         [ int x = 1; x++; ],,
7774         [AC_MSG_ERROR([Cannot build ctl without gmodule support in glib.])])
7775     AC_LANG_RESTORE
7776     CFLAGS=$_SAVE_CFLAGS
7777     AC_DEFINE(SUNCTL)
7779 fi # COMPILE_ENVIRONMENT
7781 dnl ========================================================
7782 dnl =
7783 dnl = Maintainer debug option (no --enable equivalent)
7784 dnl =
7785 dnl ========================================================
7787 AC_SUBST(AR)
7788 AC_SUBST(AR_FLAGS)
7789 AC_SUBST(AR_LIST)
7790 AC_SUBST(AR_EXTRACT)
7791 AC_SUBST(AR_DELETE)
7792 AC_SUBST(AS)
7793 AC_SUBST(ASFLAGS)
7794 AC_SUBST(AS_DASH_C_FLAG)
7795 AC_SUBST(LD)
7796 AC_SUBST(RC)
7797 AC_SUBST(RCFLAGS)
7798 AC_SUBST(WINDRES)
7799 AC_SUBST(USE_SHORT_LIBNAME)
7800 AC_SUBST(IMPLIB)
7801 AC_SUBST(FILTER)
7802 AC_SUBST(BIN_FLAGS)
7803 AC_SUBST(NS_USE_NATIVE)
7804 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7805 AC_SUBST(MOZ_GFX_TOOLKIT)
7806 AC_SUBST(MOZ_UPDATE_XTERM)
7807 AC_SUBST(MINIMO)
7808 AC_SUBST(NS_HILDON)
7809 AC_SUBST(NS_OSSO)
7810 AC_SUBST(MOZ_AUTH_EXTENSION)
7811 AC_SUBST(MOZ_MATHML)
7812 AC_SUBST(MOZ_PERMISSIONS)
7813 AC_SUBST(MOZ_XTF)
7814 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7815 AC_SUBST(MOZ_PREF_EXTENSIONS)
7816 AC_SUBST(MOZ_SVG)
7817 AC_SUBST(MOZ_SVG_FOREIGNOBJECT)
7818 AC_SUBST(MOZ_XSLT_STANDALONE)
7819 AC_SUBST(MOZ_JS_LIBS)
7820 AC_SUBST(MOZ_PSM)
7821 AC_SUBST(MOZ_DEBUG)
7822 AC_SUBST(MOZ_DEBUG_MODULES)
7823 AC_SUBST(MOZ_PROFILE_MODULES)
7824 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7825 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7826 AC_SUBST(MOZ_DEBUG_FLAGS)
7827 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7828 AC_SUBST(WARNINGS_AS_ERRORS)
7829 AC_SUBST(MOZ_DBGRINFO_MODULES)
7830 AC_SUBST(MOZ_EXTENSIONS)
7831 AC_SUBST(MOZ_IMG_DECODERS)
7832 AC_SUBST(MOZ_IMG_ENCODERS)
7833 AC_SUBST(MOZ_JSDEBUGGER)
7834 AC_SUBST(MOZ_OJI)
7835 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7836 AC_SUBST(MOZ_PLUGINS)
7837 AC_SUBST(ENABLE_EAZEL_PROFILER)
7838 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7839 AC_SUBST(EAZEL_PROFILER_LIBS)
7840 AC_SUBST(MOZ_PERF_METRICS)
7841 AC_SUBST(GC_LEAK_DETECTOR)
7842 AC_SUBST(MOZ_LOG_REFCNT)
7843 AC_SUBST(MOZ_LEAKY)
7844 AC_SUBST(MOZ_JPROF)
7845 AC_SUBST(MOZ_SHARK)
7846 AC_SUBST(MOZ_CALLGRIND)
7847 AC_SUBST(MOZ_XPCTOOLS)
7848 AC_SUBST(MOZ_JSLOADER)
7849 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7850 AC_SUBST(MOZ_INSURE)
7851 AC_SUBST(MOZ_INSURE_DIRS)
7852 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7853 AC_SUBST(MOZ_QUANTIFY)
7854 AC_SUBST(MOZ_INSURIFYING)
7855 AC_SUBST(MOZ_LDAP_XPCOM)
7856 AC_SUBST(MOZ_LDAP_XPCOM_EXPERIMENTAL)
7857 AC_SUBST(LDAP_CFLAGS)
7858 AC_SUBST(LDAP_LIBS)
7859 AC_SUBST(LIBICONV)
7860 AC_SUBST(MOZ_PLACES)
7861 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7862 AC_SUBST(MOZ_STORAGE)
7863 AC_SUBST(MOZ_FEEDS)
7864 AC_SUBST(NS_PRINTING)
7866 AC_SUBST(MOZ_JAVAXPCOM)
7867 AC_SUBST(JAVA_INCLUDE_PATH)
7868 AC_SUBST(JAVA)
7869 AC_SUBST(JAVAC)
7870 AC_SUBST(JAR)
7872 AC_SUBST(MOZ_PROFILESHARING)
7873 AC_SUBST(MOZ_PROFILELOCKING)
7875 AC_SUBST(MOZ_IPCD)
7877 AC_SUBST(HAVE_XIE)
7878 AC_SUBST(MOZ_XIE_LIBS)
7879 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7881 AC_SUBST(XPCOM_USE_LEA)
7882 AC_SUBST(BUILD_STATIC_LIBS)
7883 AC_SUBST(MOZ_ENABLE_LIBXUL)
7884 AC_SUBST(ENABLE_TESTS)
7885 AC_SUBST(IBMBIDI)
7886 AC_SUBST(SUNCTL)
7887 AC_SUBST(MOZ_UNIVERSALCHARDET)
7888 AC_SUBST(ACCESSIBILITY)
7889 AC_SUBST(MOZ_XPINSTALL)
7890 AC_SUBST(MOZ_VIEW_SOURCE)
7891 AC_SUBST(MOZ_SPELLCHECK)
7892 AC_SUBST(MOZ_XPFE_COMPONENTS)
7893 AC_SUBST(MOZ_USER_DIR)
7894 AC_SUBST(MOZ_CRASHREPORTER)
7895 AC_SUBST(MOZ_MOCHITEST)
7897 AC_SUBST(ENABLE_STRIP)
7898 AC_SUBST(PKG_SKIP_STRIP)
7899 AC_SUBST(USE_ELF_DYNSTR_GC)
7900 AC_SUBST(USE_PREBINDING)
7901 AC_SUBST(INCREMENTAL_LINKER)
7902 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7903 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7904 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7906 AC_SUBST(MOZ_FIX_LINK_PATHS)
7907 AC_SUBST(XPCOM_LIBS)
7908 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7909 AC_SUBST(XPCOM_GLUE_LDOPTS)
7910 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7912 AC_SUBST(USE_DEPENDENT_LIBS)
7914 AC_SUBST(MOZ_BUILD_ROOT)
7915 AC_SUBST(MOZ_OS2_TOOLS)
7916 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7918 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7919 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7920 AC_SUBST(MOZ_TIMELINE)
7921 AC_SUBST(WINCE)
7922 AC_SUBST(TARGET_DEVICE)
7924 AC_SUBST(MOZ_APP_NAME)
7925 AC_SUBST(MOZ_APP_DISPLAYNAME)
7926 AC_SUBST(MOZ_APP_VERSION)
7927 AC_SUBST(FIREFOX_VERSION)
7928 AC_SUBST(THUNDERBIRD_VERSION)
7929 AC_SUBST(SUNBIRD_VERSION)
7930 AC_SUBST(SEAMONKEY_VERSION)
7932 AC_SUBST(MOZ_PKG_SPECIAL)
7934 AC_SUBST(MOZILLA_OFFICIAL)
7935 AC_SUBST(BUILD_OFFICIAL)
7936 AC_SUBST(MOZ_MILESTONE_RELEASE)
7938 dnl win32 options
7939 AC_SUBST(MOZ_PROFILE)
7940 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7941 AC_SUBST(MOZ_MAPINFO)
7942 AC_SUBST(MOZ_BROWSE_INFO)
7943 AC_SUBST(MOZ_TOOLS_DIR)
7944 AC_SUBST(CYGWIN_WRAPPER)
7945 AC_SUBST(AS_PERL)
7946 AC_SUBST(WIN32_REDIST_DIR)
7947 AC_SUBST(PYTHON)
7949 dnl Echo the CFLAGS to remove extra whitespace.
7950 CFLAGS=`echo \
7951         $_WARNINGS_CFLAGS \
7952         $CFLAGS`
7954 CXXFLAGS=`echo \
7955         $_MOZ_RTTI_FLAGS \
7956         $_MOZ_EXCEPTIONS_FLAGS \
7957         $_WARNINGS_CXXFLAGS \
7958         $CXXFLAGS`
7960 COMPILE_CFLAGS=`echo \
7961     $_DEFINES_CFLAGS \
7962         $_DEPEND_CFLAGS \
7963     $COMPILE_CFLAGS`
7965 COMPILE_CXXFLAGS=`echo \
7966     $_DEFINES_CXXFLAGS \
7967         $_DEPEND_CFLAGS \
7968     $COMPILE_CXXFLAGS`
7970 AC_SUBST(SYSTEM_MAKEDEPEND)
7971 AC_SUBST(SYSTEM_JPEG)
7972 AC_SUBST(SYSTEM_PNG)
7973 AC_SUBST(SYSTEM_ZLIB)
7974 AC_SUBST(SYSTEM_BZ2)
7976 AC_SUBST(JPEG_CFLAGS)
7977 AC_SUBST(JPEG_LIBS)
7978 AC_SUBST(ZLIB_CFLAGS)
7979 AC_SUBST(ZLIB_LIBS)
7980 AC_SUBST(BZ2_CFLAGS)
7981 AC_SUBST(BZ2_LIBS)
7982 AC_SUBST(PNG_CFLAGS)
7983 AC_SUBST(PNG_LIBS)
7985 AC_SUBST(MOZ_JPEG_CFLAGS)
7986 AC_SUBST(MOZ_JPEG_LIBS)
7987 AC_SUBST(MOZ_ZLIB_CFLAGS)
7988 AC_SUBST(MOZ_ZLIB_LIBS)
7989 AC_SUBST(MOZ_BZ2_CFLAGS)
7990 AC_SUBST(MOZ_BZ2_LIBS)
7991 AC_SUBST(MOZ_PNG_CFLAGS)
7992 AC_SUBST(MOZ_PNG_LIBS)
7994 AC_SUBST(NSPR_CFLAGS)
7995 AC_SUBST(NSPR_LIBS)
7996 AC_SUBST(MOZ_NATIVE_NSPR)
7998 AC_SUBST(NSS_CFLAGS)
7999 AC_SUBST(NSS_LIBS)
8000 AC_SUBST(NSS_DEP_LIBS)
8001 AC_SUBST(MOZ_NATIVE_NSS)
8003 AC_SUBST(CFLAGS)
8004 AC_SUBST(CXXFLAGS)
8005 AC_SUBST(CPPFLAGS)
8006 AC_SUBST(COMPILE_CFLAGS)
8007 AC_SUBST(COMPILE_CXXFLAGS)
8008 AC_SUBST(LDFLAGS)
8009 AC_SUBST(LIBS)
8010 AC_SUBST(CROSS_COMPILE)
8012 AC_SUBST(HOST_CC)
8013 AC_SUBST(HOST_CXX)
8014 AC_SUBST(HOST_CFLAGS)
8015 AC_SUBST(HOST_CXXFLAGS)
8016 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8017 AC_SUBST(HOST_AR)
8018 AC_SUBST(HOST_AR_FLAGS)
8019 AC_SUBST(HOST_LD)
8020 AC_SUBST(HOST_RANLIB)
8021 AC_SUBST(HOST_NSPR_MDCPUCFG)
8022 AC_SUBST(HOST_BIN_SUFFIX)
8023 AC_SUBST(HOST_OS_ARCH)
8025 AC_SUBST(TARGET_CPU)
8026 AC_SUBST(TARGET_VENDOR)
8027 AC_SUBST(TARGET_OS)
8028 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8029 AC_SUBST(TARGET_MD_ARCH)
8030 AC_SUBST(TARGET_XPCOM_ABI)
8031 AC_SUBST(OS_TARGET)
8032 AC_SUBST(OS_ARCH)
8033 AC_SUBST(OS_RELEASE)
8034 AC_SUBST(OS_TEST)
8036 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8037 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8039 AC_SUBST(WRAP_MALLOC_CFLAGS)
8040 AC_SUBST(WRAP_MALLOC_LIB)
8041 AC_SUBST(MKSHLIB)
8042 AC_SUBST(MKCSHLIB)
8043 AC_SUBST(MKSHLIB_FORCE_ALL)
8044 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8045 AC_SUBST(DSO_CFLAGS)
8046 AC_SUBST(DSO_PIC_CFLAGS)
8047 AC_SUBST(DSO_LDOPTS)
8048 AC_SUBST(LIB_PREFIX)
8049 AC_SUBST(DLL_PREFIX)
8050 AC_SUBST(DLL_SUFFIX)
8051 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8052 AC_SUBST(LIB_SUFFIX)
8053 AC_SUBST(OBJ_SUFFIX)
8054 AC_SUBST(BIN_SUFFIX)
8055 AC_SUBST(ASM_SUFFIX)
8056 AC_SUBST(IMPORT_LIB_SUFFIX)
8057 AC_SUBST(USE_N32)
8058 AC_SUBST(CC_VERSION)
8059 AC_SUBST(CXX_VERSION)
8060 AC_SUBST(MSMANIFEST_TOOL)
8062 if test "$USING_HCC"; then
8063    CC='${topsrcdir}/build/hcc'
8064    CC="$CC '$_OLDCC'"
8065    CXX='${topsrcdir}/build/hcpp'
8066    CXX="$CXX '$_OLDCXX'"
8067    AC_SUBST(CC)
8068    AC_SUBST(CXX)
8071 dnl Check for missing components
8072 if test "$COMPILE_ENVIRONMENT"; then
8073 if test "$MOZ_X11"; then
8074     dnl ====================================================
8075     dnl = Check if X headers exist
8076     dnl ====================================================
8077     _SAVE_CFLAGS=$CFLAGS
8078     CFLAGS="$CFLAGS $XCFLAGS"
8079     AC_TRY_COMPILE([
8080         #include <stdio.h>
8081         #include <stdlib.h>
8082         #include <X11/Xlib.h>
8083         #include <X11/Intrinsic.h>
8084     ],
8085     [
8086         Display *dpy = 0;
8087         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8088             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8089             exit(1);
8090         }
8091     ], [], 
8092     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8093     CFLAGS="$_SAVE_CFLAGS"
8095     if test ! -z "$MISSING_X"; then
8096         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8097     fi
8099 fi # MOZ_X11
8100 fi # COMPILE_ENVIRONMENT
8102 dnl Set various defines and substitutions
8103 dnl ========================================================
8105 if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
8106       LIBS='so32dll.lib tcp32dll.lib'
8107 elif test "$OS_ARCH" = "BeOS"; then
8108   AC_DEFINE(XP_BEOS)
8109   MOZ_MOVEMAIL=1
8110 elif test "$OS_ARCH" = "Darwin"; then
8111   AC_DEFINE(XP_UNIX)
8112   AC_DEFINE(UNIX_ASYNC_DNS)
8113   MOZ_MOVEMAIL=1
8114 elif test "$OS_ARCH" = "OpenVMS"; then
8115   AC_DEFINE(XP_UNIX)
8116 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8117   AC_DEFINE(XP_UNIX)
8118   AC_DEFINE(UNIX_ASYNC_DNS)
8119   MOZ_MOVEMAIL=1
8121 AC_SUBST(MOZ_MOVEMAIL)
8123 AC_DEFINE(JS_THREADSAFE)
8125 if test "$MOZ_DEBUG"; then
8126     AC_DEFINE(MOZ_REFLOW_PERF)
8127     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8130 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8131     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8132     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8133     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8134     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8135     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8136     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8137     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8138     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8141 # Used for LD_LIBRARY_PATH of run_viewer target
8142 LIBS_PATH=
8143 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8144   case $lib_arg in
8145     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8146       * ) ;;
8147   esac
8148 done
8149 AC_SUBST(LIBS_PATH)
8151 dnl ========================================================
8152 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8153 dnl ========================================================
8154 case "$host_os" in
8155 mingw*)
8156     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8157     ;;
8158 cygwin*|msvc*|mks*)
8159     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8160     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8161     CC="\$(CYGWIN_WRAPPER) $CC"
8162     CXX="\$(CYGWIN_WRAPPER) $CXX"
8163     CPP="\$(CYGWIN_WRAPPER) $CPP"
8164     LD="\$(CYGWIN_WRAPPER) $LD"
8165     AS="\$(CYGWIN_WRAPPER) $AS"
8166     RC="\$(CYGWIN_WRAPPER) $RC"
8167     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8168     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8169     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8170     ;;
8171 esac
8173 AC_SUBST(CYGDRIVE_MOUNT)
8174 AC_SUBST(WIN_TOP_SRC)
8176 AC_SUBST(MOZILLA_VERSION)
8178 . ${srcdir}/config/chrome-versions.sh
8179 AC_DEFINE_UNQUOTED(MOZILLA_LOCALE_VERSION,"$MOZILLA_LOCALE_VERSION")
8180 AC_DEFINE_UNQUOTED(MOZILLA_REGION_VERSION,"$MOZILLA_REGION_VERSION")
8181 AC_DEFINE_UNQUOTED(MOZILLA_SKIN_VERSION,"$MOZILLA_SKIN_VERSION")
8183 AC_SUBST(ac_configure_args)
8185 dnl Spit out some output
8186 dnl ========================================================
8188 dnl The following defines are used by xpcom
8189 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8190 CPP_THROW_NEW
8191 HAVE_CPP_2BYTE_WCHAR_T
8192 HAVE_CPP_ACCESS_CHANGING_USING
8193 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8194 HAVE_CPP_BOOL
8195 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8196 HAVE_CPP_EXPLICIT
8197 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8198 HAVE_CPP_NAMESPACE_STD
8199 HAVE_CPP_NEW_CASTS
8200 HAVE_CPP_PARTIAL_SPECIALIZATION
8201 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8202 HAVE_CPP_TYPENAME
8203 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8204 HAVE_STATVFS
8205 NEED_CPP_UNUSED_IMPLEMENTATIONS
8206 NEW_H
8207 HAVE_GETPAGESIZE
8208 HAVE_ICONV
8209 HAVE_ICONV_WITH_CONST_INPUT
8210 HAVE_MBRTOWC
8211 HAVE_SYS_MOUNT_H
8212 HAVE_SYS_VFS_H
8213 HAVE_WCRTOMB
8214 MOZ_V1_STRING_ABI
8217 AC_CONFIG_HEADER(
8218 netwerk/necko-config.h
8219 xpcom/xpcom-config.h
8220 xpcom/xpcom-private.h
8223 # Save the defines header file before autoconf removes it.
8224 # (Do not add AC_DEFINE calls after this line.)
8225   _CONFIG_TMP=confdefs-tmp.h
8226   _CONFIG_DEFS_H=mozilla-config.h
8228   cat > $_CONFIG_TMP <<\EOF
8229 /* List of defines generated by configure. Included with preprocessor flag,
8230  * -include, to avoid long list of -D defines on the compile command-line.
8231  * Do not edit.
8232  */
8234 #ifndef _MOZILLA_CONFIG_H_
8235 #define _MOZILLA_CONFIG_H_
8238 _EGREP_PATTERN='^#define ('
8239 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8240     for f in $_NON_GLOBAL_ACDEFINES; do
8241         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8242     done
8244 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8246   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8248   cat >> $_CONFIG_TMP <<\EOF
8250 #endif /* _MOZILLA_CONFIG_H_ */
8254   # Only write mozilla-config.h when something changes (or it doesn't exist)
8255   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8256     rm $_CONFIG_TMP
8257   else
8258     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8259     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8261     echo ==== $_CONFIG_DEFS_H =================================
8262     cat $_CONFIG_DEFS_H
8263   fi
8265 dnl Probably shouldn't call this manually but we always want the output of DEFS
8266 rm -f confdefs.h.save
8267 mv confdefs.h confdefs.h.save
8268 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8269 AC_OUTPUT_MAKE_DEFS()
8270 MOZ_DEFINES=$DEFS
8271 AC_SUBST(MOZ_DEFINES)
8272 rm -f confdefs.h
8273 mv confdefs.h.save confdefs.h
8275 dnl Load the list of Makefiles to generate.
8276 dnl   To add new Makefiles, edit allmakefiles.sh.
8277 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8278 . ${srcdir}/allmakefiles.sh
8279 dnl 
8280 dnl Run a perl script to quickly create the makefiles.
8281 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8282 dnl   for the files it cannot handle correctly. This way, config.status
8283 dnl   will handle these files.
8284 dnl If it fails, nothing is set and config.status will run as usual.
8286 dnl This does not change the $MAKEFILES variable.
8288 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8290 if test -z "${AS_PERL}"; then
8291 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8292 else
8293 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8295 . ./conftest.sh
8296 rm conftest.sh
8298 echo $MAKEFILES > unallmakefiles
8300 AC_OUTPUT($MAKEFILES)
8302 dnl ========================================================
8303 dnl = Setup a nice relatively clean build environment for
8304 dnl = sub-configures.
8305 dnl ========================================================
8306 CC="$_SUBDIR_CC" 
8307 CXX="$_SUBDIR_CXX" 
8308 CFLAGS="$_SUBDIR_CFLAGS" 
8309 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8310 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8311 LDFLAGS="$_SUBDIR_LDFLAGS"
8312 HOST_CC="$_SUBDIR_HOST_CC" 
8313 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8314 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8317 unset MAKEFILES
8318 unset CONFIG_FILES
8320 if test "$COMPILE_ENVIRONMENT"; then
8321 if test -z "$MOZ_NATIVE_NSPR" || test "$MOZ_LDAP_XPCOM"; then
8322     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8323     if test -z "$MOZ_DEBUG"; then
8324         ac_configure_args="$ac_configure_args --disable-debug"
8325     fi
8326     if test "$MOZ_OPTIMIZE" = "1"; then
8327         ac_configure_args="$ac_configure_args --enable-optimize"
8328     fi
8329     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8330        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8331     fi
8332     if test -n "$HAVE_64BIT_OS"; then
8333         ac_configure_args="$ac_configure_args --enable-64bit"
8334     fi
8335     if test -n "$USE_ARM_KUSER"; then
8336         ac_configure_args="$ac_configure_args --with-arm-kuser"
8337     fi
8338     AC_OUTPUT_SUBDIRS(nsprpub)
8339     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8342 if test -z "$MOZ_NATIVE_NSPR"; then
8343     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8344     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8345     if test ! "$VACPP" && test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8346        _libs=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --libdir=$\(LIBXUL_DIST\)/lib --libs`
8347        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $_libs'" config/autoconf.mk
8348     fi
8349     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE" ; then
8350        _cflags=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --includedir=$\(LIBXUL_DIST\)/include/nspr --cflags`
8351        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $_cflags'" config/autoconf.mk
8352     fi
8353     rm -f config/autoconf.mk.bak
8356 # if we're building the LDAP XPCOM component, we need to build 
8357 # the c-sdk first.  
8359 if test "$MOZ_LDAP_XPCOM"; then
8361     # these subdirs may not yet have been created in the build tree.
8362     # don't use the "-p" switch to mkdir, since not all platforms have it
8363     #
8364     if test ! -d "directory"; then
8365         mkdir "directory"
8366     fi
8367     if test ! -d "directory/c-sdk"; then
8368         mkdir "directory/c-sdk"    
8369     fi
8370     if test ! -d "directory/c-sdk/ldap"; then
8371         mkdir "directory/c-sdk/ldap"    
8372     fi
8374     ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/dist --with-dist-prefix=$MOZ_BUILD_ROOT/dist --without-nss --with-mozilla"
8375     if test -z "$MOZ_DEBUG"; then
8376         ac_configure_args="$ac_configure_args --disable-debug"
8377     fi
8378     if test "$MOZ_OPTIMIZE" = "1"; then
8379         ac_configure_args="$ac_configure_args --enable-optimize"
8380     fi
8381     if test -n "$HAVE_64BIT_OS"; then
8382         ac_configure_args="$ac_configure_args --enable-64bit"
8383     fi
8384     AC_OUTPUT_SUBDIRS(directory/c-sdk)
8385     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8387 fi # COMPILE_ENVIRONMENT