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