Bug 381843 - Move for-var-in and for-let-in hoisting from the emitter to the parser...
[mozilla-central.git] / configure.in
blob311bfdb2ca489313d57f17aa1d62789704808e9b
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.10.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.5.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])
684 echo PYTHON="$PYTHON"
686 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
687 if test -z "$COMPILE_ENVIRONMENT"; then
688 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
689     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
692 AC_SUBST(NSINSTALL_BIN)
694 AC_PATH_PROG(DOXYGEN, doxygen, :)
695 AC_PATH_PROG(WHOAMI, whoami, :)
696 AC_PATH_PROG(AUTOCONF, autoconf, :)
697 AC_PATH_PROG(UNZIP, unzip, :)
698 AC_PATH_PROGS(ZIP, zip)
699 if test -z "$ZIP" || test "$ZIP" = ":"; then
700     AC_MSG_ERROR([zip not found in \$PATH])
702 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
703 AC_PATH_PROG(XARGS, xargs)
704 if test -z "$XARGS" || test "$XARGS" = ":"; then
705     AC_MSG_ERROR([xargs not found in \$PATH .])
708 if test "$COMPILE_ENVIRONMENT"; then
710 dnl ========================================================
711 dnl = Mac OS X toolchain support
712 dnl ========================================================
714 case "$target_os" in
715 darwin*)
716     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
717     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
718     dnl the environment and includedir purposes (when using an SDK, below),
719     dnl but remember the full version number for the libdir (SDK).
720     changequote(,)
721     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
722     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
723     changequote([,])
724     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
725         dnl Bug 280479, but this keeps popping up in bug 292530 too because
726         dnl 4.0.0/4061 is the default compiler in Tiger.
727         changequote(,)
728         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
729         changequote([,])
730         if test "$GCC_BUILD" = "4061" ; then
731             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
732 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
733 from building Mozilla. Upgrade to Xcode 2.1 or later.])
734         fi
735     fi
737     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
738     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
739     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
740     AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
742     case "$PBBUILD" in
743       *xcodebuild*)
744         changequote(,)
745         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
746         changequote([,])
747         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
748           HAS_XCODE_2_1=1;
749         fi
750       ;;
751     esac
753     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
754     dnl it has moved into /usr/bin.
755     AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
756     ;;
757 esac
759 AC_SUBST(GCC_VERSION)
760 AC_SUBST(XCODEBUILD_VERSION)
761 AC_SUBST(HAS_XCODE_2_1)
763 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
764 dnl that a universal binary is being produced.
765 AC_SUBST(UNIVERSAL_BINARY)
767 dnl ========================================================
768 dnl Check for MacOS deployment target version
769 dnl ========================================================
771 MOZ_ARG_ENABLE_STRING(macos-target,
772                       [  --enable-macos-target=VER (default=10.4)
773                           Set the minimum MacOS version needed at runtime],
774                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
776 case "$target" in
777 *-darwin*)
778     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
779         dnl Use the specified value
780         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
781         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
782     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
783         dnl No value specified on the command line or in the environment,
784         dnl use the lesser of the application's minimum or the architecture's
785         dnl minimum.
786         export MACOSX_DEPLOYMENT_TARGET=10.4
787     fi
788     ;;
789 esac
791 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
793 dnl ========================================================
794 dnl = Mac OS X SDK support
795 dnl ========================================================
796 MACOS_SDK_DIR=
797 NEXT_ROOT=
798 MOZ_ARG_WITH_STRING(macos-sdk,
799 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
800     MACOS_SDK_DIR=$withval)
802 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
803 dnl NEXT_ROOT will be set and exported only if it's needed.
804 AC_SUBST(MACOS_SDK_DIR)
805 AC_SUBST(NEXT_ROOT)
807 if test "$MACOS_SDK_DIR"; then
808   dnl Sync this section with the ones in NSPR and NSS.
809   dnl Changes to the cross environment here need to be accounted for in
810   dnl the libIDL checks (below) and xpidl build.
812   if test ! -d "$MACOS_SDK_DIR"; then
813     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
814 specify a valid SDK.  SDKs are installed when the optional cross-development
815 tools are selected during the Xcode/Developer Tools installation.])
816   fi
818   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
819   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
820     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"
821     if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
822       SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
823     fi
824     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"
826     CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
827     CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
829     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
830     CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
831     CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
833     dnl ld support for -syslibroot is compiler-agnostic, but only available
834     dnl on Tiger.  Although it's possible to switch on the build host's
835     dnl OS release to use ld -syslibroot when available, ld -syslibroot will
836     dnl cause warnings as long as NEXT_ROOT is set.  NEXT_ROOT should be
837     dnl set because both the compiler and linker use it.
838     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"
839     export NEXT_ROOT=$MACOS_SDK_DIR
841     if test -n "$CROSS_COMPILE" ; then
842       dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
843       dnl the build host.  HOST_CXX is presently unused.
844       HOST_CC="NEXT_ROOT= $HOST_CC"
845       HOST_CXX="NEXT_ROOT= $HOST_CXX"
846     fi
847   else
848     dnl gcc >= 4.0 uses different paths than above, but knows how to find
849     dnl them itself.
850     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
851     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
853     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
854     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
855     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
857     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
858       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
859       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
860       dnl be ignored and cause warnings when -syslibroot is specified.
861       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
862       dnl the -isysroot it receives, so this is only needed with 4.0.0.
863       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
864     fi
865   fi
867   AC_LANG_SAVE
868   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
869   AC_LANG_CPLUSPLUS
870   AC_TRY_COMPILE([#include <new>
871                  int main() { return 0; }],
872    result=yes,
873    result=no)
874   AC_LANG_RESTORE
875   AC_MSG_RESULT($result)
877   if test "$result" = "no" ; then
878     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
879   fi
882 fi # COMPILE_ENVIRONMENT
884 dnl Be sure the make we use is GNU make.
885 dnl on win32, gmake.exe is the generally the wrong version
886 case "$host_os" in
887 cygwin*|mingw*|mks*|msvc*)
888     AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
889     ;;
891     AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
892     ;;
893 esac
894 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
895 if test ! "$_make_try"
896 then
897         echo
898         echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
899         echo
900         exit 1
902 dnl Now exit if version if < MAKE_VERSION
903 rm -f dummy.mk
904 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
905 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
906 rm -f dummy.mk
907 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
908 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
909 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
910 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
911 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
912    test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
913         "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
914    AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
916 AC_SUBST(MAKE)
918 if test "$COMPILE_ENVIRONMENT"; then
920 AC_PATH_XTRA
922 dnl Check in X11 include directory too.
923 if test "$no_x" != "yes"; then
924     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
927 XCFLAGS="$X_CFLAGS"
929 fi # COMPILE_ENVIRONMENT
931 dnl ========================================================
932 dnl set the defaults first
933 dnl ========================================================
934 AS_BIN=$AS
935 AR_FLAGS='cr $@'
936 AR_LIST='$(AR) t'
937 AR_EXTRACT='$(AR) x'
938 AR_DELETE='$(AR) d'
939 AS='$(CC)'
940 AS_DASH_C_FLAG='-c'
941 DLL_PREFIX=lib
942 LIB_PREFIX=lib
943 DLL_SUFFIX=.so
944 OBJ_SUFFIX=o
945 LIB_SUFFIX=a
946 ASM_SUFFIX=s
947 IMPORT_LIB_SUFFIX=
948 TARGET_MD_ARCH=unix
949 DIRENT_INO=d_ino
950 CYGWIN_WRAPPER=
951 WIN_TOP_SRC=
952 MOZ_USER_DIR=".mozilla"
953 HOST_AR='$(AR)'
954 HOST_AR_FLAGS='$(AR_FLAGS)'
956 MOZ_JPEG_CFLAGS=
957 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
958 MOZ_ZLIB_CFLAGS=
959 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
960 MOZ_BZ2_CFLAGS=
961 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
962 MOZ_PNG_CFLAGS=
963 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
965 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
966 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
967 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(PREFIX)/lib'
968 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
969 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
970 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
971 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
973 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
974 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
976 USE_DEPENDENT_LIBS=1
978 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
979 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
981 MOZ_ENABLE_POSTSCRIPT=1 
983 if test -n "$CROSS_COMPILE"; then
984     OS_TARGET="${target_os}"
985     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
986     OS_RELEASE=
987     case "${target_os}" in
988         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
989         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
990         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
991         mingw*)       OS_ARCH=WINNT ;;
992         wince*)       OS_ARCH=WINCE ;;
993         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
994     esac
995 else
996     OS_TARGET=`uname -s`
997     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
998     OS_RELEASE=`uname -r`
1001 # Before this used `uname -m` when not cross compiling
1002 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1003 OS_TEST="${target_cpu}"
1005 _COMPILER_PREFIX=
1007 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1009 #######################################################################
1010 # Master "Core Components" macros for getting the OS target           #
1011 #######################################################################
1014 # Note: OS_TARGET should be specified on the command line for gmake.
1015 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
1016 # The difference between the Win95 target and the WinNT target is that
1017 # the WinNT target uses Windows NT specific features not available
1018 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
1019 # at lesser performance (the Win95 target uses threads; the WinNT target
1020 # uses fibers).
1022 # When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target
1023 # is built. See: win16_3.11.mk for lots more about the Win16 target.
1025 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1026 # cross-compilation.
1030 # The following hack allows one to build on a WIN95 machine (as if
1031 # s/he were cross-compiling on a WINNT host for a WIN95 target).
1032 # It also accomodates for MKS's uname.exe.  If you never intend
1033 # to do development on a WIN95 machine, you don't need this hack.
1035 case "$OS_ARCH" in
1036 WIN95)
1037     OS_ARCH=WINNT
1038     OS_TARGET=WIN95
1039     ;;
1040 Windows_95)
1041     OS_ARCH=Windows_NT
1042     OS_TARGET=WIN95
1043     ;;
1044 Windows_98)
1045     OS_ARCH=Windows_NT
1046     OS_TARGET=WIN95
1047     ;;
1048 CYGWIN_9*|CYGWIN_ME*)
1049     OS_ARCH='CYGWIN_NT-4.0'
1050     OS_TARGET=WIN95
1051     ;;
1052 esac
1055 # Define and override various archtecture-specific variables, including
1056 # HOST_OS_ARCH
1057 # OS_ARCH
1058 # OS_TEST
1059 # OS_TARGET
1060 # OS_RELEASE
1061 # OS_MINOR_RELEASE
1064 case "$HOST_OS_ARCH" in
1065 cygwin*|mingw*|mks*|msvc*)
1066     HOST_OS_ARCH=WINNT
1067     ;;
1068 linux*)
1069     HOST_OS_ARCH=Linux
1070     ;;
1071 solaris*)
1072     HOST_OS_ARCH=SunOS
1073     ;;
1074 BSD_386)
1075     HOST_OS_ARCH=BSD
1076     ;;
1077 dgux)
1078     HOST_OS_ARCH=DGUX
1079     ;;
1080 IRIX64)
1081     HOST_OS_ARCH=IRIX
1082     ;;
1083 UNIX_SV)
1084     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1085         HOST_OS_ARCH=NCR
1086     else
1087         HOST_OS_ARCH=UNIXWARE
1088     fi
1089     ;;
1090 ncr)
1091     HOST_OS_ARCH=NCR
1092     ;;
1093 UNIX_SYSTEM_V)
1094     HOST_OS_ARCH=NEC
1095     ;;
1096 OSF1)
1097     ;;
1098 *OpenVMS*)
1099     HOST_OS_ARCH=OpenVMS
1100     ;;
1101 OS_2)
1102     HOST_OS_ARCH=OS2
1103     ;;
1104 QNX)
1105     ;;
1106 SCO_SV)
1107     HOST_OS_ARCH=SCOOS
1108     ;;
1109 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1110     HOST_OS_ARCH=SINIX
1111     ;;
1112 UnixWare)
1113     HOST_OS_ARCH=UNIXWARE
1114     ;;
1115 esac
1117 case "$OS_ARCH" in
1118 WINNT)
1119     OS_TEST=`uname -p`
1120     ;;
1121 Windows_NT)
1123 # If uname -s returns "Windows_NT", we assume that we are using
1124 # the uname.exe in MKS toolkit.
1126 # The -r option of MKS uname only returns the major version number.
1127 # So we need to use its -v option to get the minor version number.
1128 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1130     OS_ARCH=WINNT
1131     OS_TARGET=WINNT
1132     OS_MINOR_RELEASE=`uname -v`
1133     if test "$OS_MINOR_RELEASE" = "00"; then
1134         OS_MINOR_RELEASE=0
1135     fi
1136     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1137     ;;
1138 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1140 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1141 # the uname.exe in the Cygwin tools.
1142 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1143 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1144 # the uname.exe in the GNU-Win32 tools.
1145 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1146 # the uname.exe in the MSYS tools.
1148     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1149     OS_ARCH=WINNT
1150     OS_TARGET=WINNT
1151     ;;
1152 AIX)
1153     OS_RELEASE=`uname -v`.`uname -r`
1154     OS_TEST=`uname -p`
1155     ;;
1156 BSD_386)
1157     OS_ARCH=BSD
1158     ;;
1159 dgux)
1160     OS_ARCH=DGUX
1161     ;;
1162 IRIX64)
1163     OS_ARCH=IRIX
1164     ;;
1165 UNIX_SV)
1166     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1167         OS_ARCH=NCR
1168     else
1169         OS_ARCH=UNIXWARE
1170         OS_RELEASE=`uname -v`
1171     fi
1172     ;;
1173 ncr)
1174     OS_ARCH=NCR
1175     ;;
1176 UNIX_SYSTEM_V)
1177     OS_ARCH=NEC
1178     ;;
1179 OSF1)
1180     case `uname -v` in
1181     148)
1182         OS_RELEASE=V3.2C
1183         ;;
1184     564)
1185         OS_RELEASE=V4.0B
1186         ;;
1187     878)
1188         OS_RELEASE=V4.0D
1189         ;;
1190     esac
1191     ;;
1192 *OpenVMS*)
1193     OS_ARCH=OpenVMS
1194     OS_RELEASE=`uname -v`
1195     OS_TEST=`uname -p`
1196     ;;
1197 OS_2)
1198     OS_ARCH=OS2
1199     OS_TARGET=OS2
1200     OS_RELEASE=`uname -v`
1201     ;;
1202 QNX)
1203     if test "$OS_TARGET" != "NTO"; then
1204         changequote(,)
1205         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1206         changequote([,])
1207     fi
1208     OS_TEST=x86
1209     ;;
1210 SCO_SV)
1211     OS_ARCH=SCOOS
1212     OS_RELEASE=5.0
1213     ;;
1214 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1215     OS_ARCH=SINIX
1216     OS_TEST=`uname -p`
1217     ;;
1218 UnixWare)
1219     OS_ARCH=UNIXWARE
1220     OS_RELEASE=`uname -v`
1221     ;;
1222 WINCE)
1223     OS_ARCH=WINCE
1224     OS_TARGET=WINCE
1225     ;;
1226 Darwin)
1227     case "${target_cpu}" in
1228     powerpc*)
1229         OS_TEST=ppc
1230         ;;
1231     i*86*)
1232         OS_TEST=i386 
1233         ;;
1234     *)
1235         if test -z "$CROSS_COMPILE" ; then
1236             OS_TEST=`uname -p`
1237         fi
1238         ;;
1239     esac
1240     ;;
1241 esac
1243 if test "$OS_ARCH" = "NCR"; then
1244     changequote(,)
1245     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1246     changequote([,])
1249 # Only set CPU_ARCH if we recognize the value of OS_TEST
1251 case "$OS_TEST" in
1252 *86 | i86pc)
1253     CPU_ARCH=x86
1254     ;;
1256 powerpc* | ppc)
1257     CPU_ARCH=ppc
1258     ;;
1260 Alpha | alpha | ALPHA)
1261     CPU_ARCH=Alpha
1262     ;;
1264 hppa* | parisc)
1265     CPU_ARCH=hppa
1266     ;;
1268 sun4u | sparc*)
1269     CPU_ARCH=sparc
1270     ;;
1272 x86_64 | ia64)
1273     CPU_ARCH="$OS_TEST"
1274     ;;
1275 esac
1277 if test -z "$OS_TARGET"; then
1278     OS_TARGET=$OS_ARCH
1280 if test "$OS_TARGET" = "WIN95"; then
1281     OS_RELEASE="4.0"
1283 if test "$OS_TARGET" = "WIN16"; then
1284     OS_RELEASE=
1286 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1288 dnl ========================================================
1289 dnl GNU specific defaults
1290 dnl ========================================================
1291 if test "$GNU_CC"; then
1292     # FIXME: Let us build with strict aliasing. bug 414641.
1293     CFLAGS="$CFLAGS -fno-strict-aliasing"
1294     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1295     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1296     DSO_LDOPTS='-shared'
1297     if test "$GCC_USE_GNU_LD"; then
1298         # Don't allow undefined symbols in libraries
1299         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1300     fi
1301     WARNINGS_AS_ERRORS='-Werror'
1302     DSO_CFLAGS=''
1303     DSO_PIC_CFLAGS='-fPIC'
1304     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1305     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1306     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1307     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1309     # Turn on GNU specific features
1310     # -Wall - turn on all warnings
1311     # -pedantic - make compiler warn about non-ANSI stuff, and
1312     #             be a little bit stricter
1313     # Warnings slamm took out for now (these were giving more noise than help):
1314     # -Wbad-function-cast - warns when casting a function to a new return type
1315     # -Wshadow - removed because it generates more noise than help --pete
1316     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1317     if test -z "$INTEL_CC"; then
1318        # Don't use -Wcast-align with ICC
1319        case "$CPU_ARCH" in
1320            # And don't use it on hppa, ia64, sparc, since it's noisy there
1321            hppa | ia64 | sparc)
1322            ;;
1323            *)
1324         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1325            ;;
1326        esac
1327     fi
1329     dnl Turn pedantic on but disable the warnings for long long
1330     _PEDANTIC=1
1332     if test -z "$INTEL_CC"; then
1333       _IGNORE_LONG_LONG_WARNINGS=1
1334       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1335     else
1336       _IGNORE_LONG_LONG_WARNINGS=
1337     fi
1340     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1341     _USE_CPP_INCLUDE_FLAG=1
1342 else
1343     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1344     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1346     DSO_LDOPTS='-shared'
1347     if test "$GNU_LD"; then
1348         # Don't allow undefined symbols in libraries
1349         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1350     fi
1352     DSO_CFLAGS=''
1353     DSO_PIC_CFLAGS='-KPIC'
1354     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1357 if test "$GNU_CXX"; then
1358     # FIXME: Let us build with strict aliasing. bug 414641.
1359     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1360     # Turn on GNU specific features
1361     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1362     if test -z "$INTEL_CC"; then
1363        # Don't use -Wcast-align with ICC
1364        case "$CPU_ARCH" in
1365            # And don't use it on hppa, ia64, sparc, since it's noisy there
1366            hppa | ia64 | sparc)
1367            ;;
1368            *)
1369         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1370            ;;
1371        esac
1372     fi
1374     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1375     _USE_CPP_INCLUDE_FLAG=1
1377     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1378                    ac_has_wno_invalid_offsetof,
1379         [
1380             AC_LANG_SAVE
1381             AC_LANG_CPLUSPLUS
1382             _SAVE_CXXFLAGS="$CXXFLAGS"
1383             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1384             AC_TRY_COMPILE([],
1385                            [return(0);],
1386                            ac_has_wno_invalid_offsetof="yes",
1387                            ac_has_wno_invalid_offsetof="no")
1388             CXXFLAGS="$_SAVE_CXXFLAGS"
1389             AC_LANG_RESTORE
1390         ])
1391     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1392         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1393     fi
1394 else
1395     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1398 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1399 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1400 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1401 dnl normal behavior.
1402 dnl ========================================================
1403 MKSHLIB_FORCE_ALL=
1404 MKSHLIB_UNFORCE_ALL=
1406 if test "$COMPILE_ENVIRONMENT"; then
1407 if test "$GNU_CC"; then
1408   AC_MSG_CHECKING(whether ld has archive extraction flags)
1409   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1410    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1411     ac_cv_mkshlib_force_and_unforce="no"
1412     exec 3<&0 <<LOOP_INPUT
1413         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1414         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1415         force="-Wl,-all";              unforce="-Wl,-none"
1416 LOOP_INPUT
1417     while read line
1418     do
1419       eval $line
1420       LDFLAGS=$force
1421       LIBS=$unforce
1422       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1423     done
1424     exec 0<&3 3<&-
1425     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1426    ])
1427   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1428     AC_MSG_RESULT(no)
1429   else
1430     AC_MSG_RESULT(yes)
1431     eval $ac_cv_mkshlib_force_and_unforce
1432     MKSHLIB_FORCE_ALL=$force
1433     MKSHLIB_UNFORCE_ALL=$unforce
1434   fi
1435 fi # GNU_CC
1436 fi # COMPILE_ENVIRONMENT
1438 dnl =================================================================
1439 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1440 dnl which is bad when cross compiling.
1441 dnl =================================================================
1442 if test "$COMPILE_ENVIRONMENT"; then
1443 configure_static_assert_macros='
1444 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1445 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1446 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1449 dnl test that the macros actually work:
1450 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1451 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1452  [AC_LANG_SAVE
1453   AC_LANG_C
1454   ac_cv_static_assertion_macros_work="yes"
1455   AC_TRY_COMPILE([$configure_static_assert_macros],
1456                  [CONFIGURE_STATIC_ASSERT(1)],
1457                  ,
1458                  ac_cv_static_assertion_macros_work="no")
1459   AC_TRY_COMPILE([$configure_static_assert_macros],
1460                  [CONFIGURE_STATIC_ASSERT(0)],
1461                  ac_cv_static_assertion_macros_work="no",
1462                  )
1463   AC_LANG_CPLUSPLUS
1464   AC_TRY_COMPILE([$configure_static_assert_macros],
1465                  [CONFIGURE_STATIC_ASSERT(1)],
1466                  ,
1467                  ac_cv_static_assertion_macros_work="no")
1468   AC_TRY_COMPILE([$configure_static_assert_macros],
1469                  [CONFIGURE_STATIC_ASSERT(0)],
1470                  ac_cv_static_assertion_macros_work="no",
1471                  )
1472   AC_LANG_RESTORE
1473  ])
1474 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1475 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1476     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1478 fi # COMPILE_ENVIRONMENT
1480 dnl ========================================================
1481 dnl Checking for 64-bit OS
1482 dnl ========================================================
1483 if test "$COMPILE_ENVIRONMENT"; then
1484 AC_LANG_SAVE
1485 AC_LANG_C
1486 AC_MSG_CHECKING(for 64-bit OS)
1487 AC_TRY_COMPILE([$configure_static_assert_macros],
1488                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1489                result="yes", result="no")
1490 AC_MSG_RESULT("$result")
1491 if test "$result" = "yes"; then
1492     AC_DEFINE(HAVE_64BIT_OS)
1493     HAVE_64BIT_OS=1
1495 AC_SUBST(HAVE_64BIT_OS)
1496 AC_LANG_RESTORE
1497 fi # COMPILE_ENVIRONMENT
1499 dnl ========================================================
1500 dnl Enable high-memory support on OS/2 by default.
1501 dnl ========================================================
1502 MOZ_OS2_HIGH_MEMORY=1
1503 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1504 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1505     MOZ_OS2_HIGH_MEMORY=,
1506     MOZ_OS2_HIGH_MEMORY=1 )
1507 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1509 dnl ========================================================
1510 dnl System overrides of the defaults for host
1511 dnl ========================================================
1512 case "$host" in
1513 *-beos*)
1514     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1515     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1516     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1517     ;;
1519 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1520     if test -n "$_WIN32_MSVC"; then
1521         HOST_AR=lib
1522         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1523         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1524         HOST_RANLIB='echo ranlib'
1525     else
1526         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1527     fi
1528     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1529     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1530     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1531     HOST_BIN_SUFFIX=.exe
1532     case "$host" in
1533     *mingw*)
1534     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1535         ;;
1536     *)
1537         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1538         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1539             _pwd=`pwd`
1540             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1541         fi
1542         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1543             AS_PERL=1
1544             PERL="${CYGWIN_WRAPPER} $PERL"
1545         fi
1547         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1548             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1549         fi
1550         ;;
1551     esac
1552     ;;
1554 *-darwin*)
1555     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1556     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1557     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1558     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1559     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1560     ;;
1562 *-linux*|*-kfreebsd*-gnu)
1563     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1564     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1565     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1566     ;;
1568 *os2*)
1569     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1570     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1571     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1572     HOST_BIN_SUFFIX=.exe
1573     MOZ_FIX_LINK_PATHS=
1574     ;;
1576 *-osf*)
1577     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1578     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1579     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1580     ;;
1583     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1584     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1585     ;;
1586 esac
1588 dnl Get mozilla version from central milestone file
1589 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1591 dnl Get version of various core apps from the version files.
1592 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1594 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1595 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1597 dnl ========================================================
1598 dnl System overrides of the defaults for target
1599 dnl ========================================================
1601 case "$target" in
1602 *-aix*)
1603     AC_DEFINE(AIX)
1604     if test ! "$GNU_CC"; then
1605         if test ! "$HAVE_64BIT_OS"; then
1606             # Compiling with Visual Age C++ object model compat is the
1607             # default. To compile with object model ibm, add 
1608             # AIX_OBJMODEL=ibm to .mozconfig.
1609             if test "$AIX_OBJMODEL" = "ibm"; then
1610                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1611             else
1612                 AIX_OBJMODEL=compat
1613             fi
1614         else
1615             AIX_OBJMODEL=compat
1616         fi
1617         AC_SUBST(AIX_OBJMODEL)
1618         DSO_LDOPTS='-qmkshrobj=1'
1619         DSO_CFLAGS='-qflag=w:w'
1620         DSO_PIC_CFLAGS=
1621         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1622         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1623         MOZ_FIX_LINK_PATHS=
1624         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1625         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1626         if test "$COMPILE_ENVIRONMENT"; then
1627             AC_LANG_SAVE
1628             AC_LANG_CPLUSPLUS
1629             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 5.0.2.0])
1630             AC_TRY_COMPILE([],
1631                 [#if (__IBMCPP__ < 502)
1632                  #error "Bad compiler"
1633                  #endif],
1634                 _BAD_COMPILER=,_BAD_COMPILER=1)
1635             if test -n "$_BAD_COMPILER"; then
1636                 AC_MSG_RESULT([no])    
1637                 AC_MSG_ERROR([VisualAge C++ version 5.0.2.0 or higher is required to build.])
1638             else
1639                 AC_MSG_RESULT([yes])    
1640             fi
1641             AC_LANG_RESTORE
1642             TARGET_COMPILER_ABI="ibmc"
1643             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1644             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1645         fi
1646     fi
1647     case "${target_os}" in
1648     aix4.1*)
1649         DLL_SUFFIX='_shr.a'
1650         ;;
1651     esac
1652     if test "$COMPILE_ENVIRONMENT"; then
1653         AC_CHECK_HEADERS(sys/inttypes.h)
1654     fi
1655     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1656     ;;
1658 *-beos*)
1659     no_x=yes
1660     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1661     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1662     DSO_LDOPTS='-nostart'
1663     TK_LIBS='-lbe -lroot'
1664     LIBS="$LIBS -lbe"
1665     if test "$COMPILE_ENVIRONMENT"; then
1666         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1667         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1668     fi
1669     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1670     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1671     _MOZ_USE_RTTI=1
1672     USE_DEPENDENT_LIBS=
1673     MOZ_USER_DIR="Mozilla"
1674     ;;
1676 *-bsdi*)
1677     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1678     _PEDANTIC=
1679     _IGNORE_LONG_LONG_WARNINGS=
1680     case $OS_RELEASE in
1681         4.*|5.*)
1682             STRIP="$STRIP -d"
1683             ;;
1684         *)
1685             DSO_CFLAGS=''
1686             DSO_LDOPTS='-r'
1687             _WARNINGS_CFLAGS="-Wall"
1688             _WARNINGS_CXXFLAGS="-Wall"
1689             # The test above doesn't work properly, at least on 3.1.
1690             MKSHLIB_FORCE_ALL=''
1691             MKSHLIB_UNFORCE_ALL=''
1692         ;;
1693     esac
1694     ;;
1696 *-darwin*) 
1697     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1698     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1699     MOZ_OPTIMIZE_FLAGS="-O2"
1700     _PEDANTIC=
1701     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1702     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1703     DLL_SUFFIX=".dylib"
1704     DSO_LDOPTS=''
1705     STRIP="$STRIP -x -S"
1706     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1707     MOZ_ENABLE_POSTSCRIPT=
1708     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1709     LDFLAGS="$LDFLAGS -framework Cocoa"
1710     # The ExceptionHandling framework is needed for Objective-C exception
1711     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1712     # builds.
1713     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1714     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1715     MACOSX=1
1717     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1718     dnl ===================================================================
1719     if test "x$enable_dtrace" = "xyes"; then
1720         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1721     else
1722         dnl check for the presence of the -dead_strip linker flag
1723         AC_MSG_CHECKING([for -dead_strip option to ld])
1724         _SAVE_LDFLAGS=$LDFLAGS
1725         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1726         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1727         if test -n "$_HAVE_DEAD_STRIP" ; then
1728             AC_MSG_RESULT([yes])
1729             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1730         else
1731             AC_MSG_RESULT([no])
1732         fi
1733         
1734         LDFLAGS=$_SAVE_LDFLAGS
1735     fi
1736     ;;
1738 *-freebsd*)
1739     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1740         DLL_SUFFIX=".so.1.0"
1741         DSO_LDOPTS="-shared"
1742     fi
1743     if test ! "$GNU_CC"; then
1744         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1745     fi
1746 # Can't have force w/o an unforce.
1747 #    # Hack for FreeBSD 2.2
1748 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1749 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1750 #       MKSHLIB_UNFORCE_ALL=''
1751 #    fi
1752     ;; 
1754 *-hpux*)
1755     DLL_SUFFIX=".sl"
1756     if test ! "$GNU_CC"; then
1757         DSO_LDOPTS='-b -Wl,+s'
1758         DSO_CFLAGS=""
1759         DSO_PIC_CFLAGS="+Z"
1760         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1761         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1762         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1763     else
1764         DSO_LDOPTS='-b -E +s'
1765         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1766         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1767     fi
1768     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1769     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1770     ;;
1772 *-irix5*)
1773     AC_DEFINE(IRIX)
1774     DSO_LDOPTS='-elf -shared'
1776     if test "$GNU_CC"; then
1777        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1778        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1779        MKSHLIB_FORCE_ALL='-Wl,-all'
1780        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1781        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1782     else
1783        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1784        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1785        MKSHLIB_FORCE_ALL='-all'
1786        MKSHLIB_UNFORCE_ALL='-none'
1787     fi
1788     ;;
1790 *-irix6*)
1791     AC_DEFINE(IRIX)
1792     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1793     dnl compile and link using -n32
1794     USE_N32=1
1795     TARGET_COMPILER_ABI=n32
1796     DSO_LDOPTS='-elf -shared'
1797     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1798     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1799     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1800     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1801     if test "$GNU_CC"; then
1802        MKSHLIB_FORCE_ALL='-Wl,-all'
1803        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1804        _WARNINGS_CFLAGS="-Wall"
1805        _WARNINGS_CXXFLAGS="-Wall"
1806        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1807     else
1808        MKSHLIB_FORCE_ALL='-all'
1809        MKSHLIB_UNFORCE_ALL='-none'
1810            AR_LIST="$AR t"
1811            AR_EXTRACT="$AR x"
1812            AR_DELETE="$AR d"
1813            AR='$(CXX) -ar'
1814            AR_FLAGS='-o $@'
1815        CFLAGS="$CFLAGS -woff 3262 -G 4"
1816        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1817        if test -n "$USE_N32"; then
1818            ASFLAGS="$ASFLAGS -n32"
1819            CFLAGS="$CFLAGS -n32"
1820            CXXFLAGS="$CXXFLAGS -n32"
1821            LDFLAGS="$LDFLAGS -n32"
1822        fi
1823        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1824        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1825        MOZ_FIX_LINK_PATHS=
1826     fi
1827     if test -z "$GNU_CXX"; then
1828       MIPSPRO_CXX=1
1829     fi
1830     ;;
1832 *-*linux*)
1833     if test "$GNU_CC"; then
1834         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1835         case $GCC_VERSION in
1836         4.1.*|4.2.*)
1837             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1838             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1839         esac
1840     fi
1842     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1843     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1844     MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1845                                       # and that combo is not yet good at
1846                                       # debugging inlined functions (even
1847                                       # when using DWARF2 as the debugging
1848                                       # format)    
1850     MOZ_MEMORY=1
1852     case "${target_cpu}" in
1853     alpha*)
1854         CFLAGS="$CFLAGS -mieee"
1855         CXXFLAGS="$CXXFLAGS -mieee"
1856     ;;
1857     i*86)
1858         USE_ELF_DYNSTR_GC=1
1859         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1860     ;;
1861     mips*)
1862         CFLAGS="$CFLAGS -Wa,-xgot"
1863         CXXFLAGS="$CXXFLAGS -Wa,-xgot"
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\$(PDBFILE)"
1903     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(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:$(PDBFILE) $(DSO_LDOPTS)'
2005         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
2006         MKSHLIB_FORCE_ALL=
2007         MKSHLIB_UNFORCE_ALL=
2008         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2009         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
2010         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(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(XP_OS2)
2298     USE_SHORT_LIBNAME=1
2299     DLL_PREFIX=
2300     LIB_PREFIX=
2301     LIB_SUFFIX=lib
2302     BIN_SUFFIX=".exe"
2303     DLL_SUFFIX=".dll"
2304     IMPORT_LIB_SUFFIX=lib
2305     DSO_PIC_CFLAGS=
2306     TARGET_MD_ARCH=os2
2307     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2308     MOZ_ENABLE_POSTSCRIPT=
2309     RC=rc.exe
2310     RCFLAGS='-n'
2311     MOZ_USER_DIR="Mozilla"
2313     if test "$MOZTOOLS"; then
2314         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2315     else
2316         AC_MSG_ERROR([MOZTOOLS is not set])
2317     fi
2319     # EMX/GCC build
2320     if test -n "$GNU_CC"; then
2321         AC_DEFINE(OS2)
2322         AC_DEFINE(XP_OS2_EMX)
2323         AC_DEFINE(OS2EMX_PLAIN_CHAR)
2324         AC_DEFINE(TCPV40HDRS)
2325         AR=emxomfar
2326         AR_FLAGS='r $@'
2327         CFLAGS="$CFLAGS -Zomf"
2328         CXXFLAGS="$CXXFLAGS -Zomf"
2329         DSO_LDOPTS='-Zdll'
2330         BIN_FLAGS='-Zlinker /ST:0x100000'
2331         IMPLIB='emximp -o'
2332         FILTER='emxexp -o'
2333         LDFLAGS='-Zmap'
2334         WARNINGS_AS_ERRORS='-Werror'
2335         MOZ_DEBUG_FLAGS="-g -fno-inline"
2336         MOZ_OPTIMIZE_FLAGS="-O2"
2337         MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2338         MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2339         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2340         LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2341         if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2342           DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2343           LDFLAGS="$LDFLAGS -Zhigh-mem"
2344           MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2345           AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2346         fi
2348         # GCC for OS/2 currently predefines these, but we don't want them
2349         _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2350         _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2352         AC_CACHE_CHECK(for __declspec(dllexport),
2353            ac_os2_declspec,
2354            [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2355                            [return 0;],
2356                            ac_os2_declspec="yes",
2357                            ac_os2_declspec="no")])
2358         if test "$ac_os2_declspec" = "yes"; then
2359            FILTER='true'
2360            MOZ_OS2_USE_DECLSPEC='1'
2361         fi
2362         
2363     # Visual Age C++ build
2364     elif test "$VACPP" = "yes"; then
2365         MOZ_BUILD_ROOT=`pwd -D`
2366         OBJ_SUFFIX=obj
2367         AR=-ilib
2368         AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
2369         AR_LIST='/L'
2370         AR_EXTRACT='-*'
2371         AR_DELETE='-'
2372         AS=alp
2373         ASFLAGS='-Mb'
2374         AS_DASH_C_FLAG=''
2375         ASM_SUFFIX=asm
2376         LD='-ilink'
2377         CFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9"
2378         CXXFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9 /Gx+"
2379         MOZ_DEBUG_FLAGS="/Ti+"
2380         WARNINGS_AS_ERRORS='-WX'
2381         MOZ_OPTIMIZE_FLAGS="/O+ /Gl+ /G5 /qarch=pentium"
2382         LDFLAGS="/NOL /M"
2383         MOZ_DEBUG_LDFLAGS="/DE"
2384         MOZ_OPTIMIZE_LDFLAGS="/OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
2385         DSO_LDOPTS=''
2386         DSO_PIC_CFLAGS=
2387         IMPLIB='implib /NOL /NOI'
2388         FILTER='cppfilt -q -B -P'
2389         AC_DEFINE(NO_ANSI_KEYWORDS)
2390         AC_DEFINE(OS2,4)
2391         AC_DEFINE(_X86_)
2392         AC_DEFINE(XP_OS2_VACPP)
2393         AC_DEFINE(TCPV40HDRS)
2394         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2395         AC_DEFINE(STDC_HEADERS)
2396         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2397         MKSHLIB='$(LD) $(DSO_LDOPTS)'
2398         MKCSHLIB='$(LD) $(DSO_LDOPTS)'
2399         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2400         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcomct.lib'
2401         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2402         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2403     fi
2404     ;;
2406 alpha*-*-osf*)
2407     if test "$GNU_CC"; then
2408       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2409       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2411     else
2412         MOZ_DEBUG_FLAGS='-g'
2413         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2414         CFLAGS="$CFLAGS -ieee"
2415         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2416         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2417         DSO_CFLAGS=
2418         DSO_PIC_CFLAGS=
2419         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2420         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2421         MKSHLIB_FORCE_ALL='-all'
2422         MKSHLIB_UNFORCE_ALL='-none'
2423         dnl Might fix the libxpcom.so breakage on this platform as well....
2424         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2425         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2426     fi
2427     if test -z "$GNU_CXX"; then
2428       COMPAQ_CXX=1
2429     fi
2430     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2431     ;;
2433 *-qnx*) 
2434     DIRENT_INO=d_stat.st_ino
2435     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2436     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2437     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2438     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2439     AC_DEFINE(STDC_HEADERS)
2440     if test "$no_x" = "yes"; then
2441             _PLATFORM_DEFAULT_TOOLKIT='photon'
2442             TK_CFLAGS='-I/usr/nto/include/photon'
2443             TK_LIBS='-lphoton -lphrender'
2444     fi
2445     ;;
2447 *-sco*) 
2448     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2449     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2450     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2451     if test ! "$GNU_CC"; then
2452        DSO_LDOPTS='-G'
2453     fi
2454     ;;
2456 dnl the qsort routine under solaris is faulty
2457 *-solaris*) 
2458     AC_DEFINE(SOLARIS)
2459     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2460     SYSTEM_MAKEDEPEND=
2461     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2462     # libraries one level up (e.g. libnspr4.so)
2463     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2464     LIBS="-lCrun -lCstd $LIBS"
2465     MOZ_MEMORY=1
2466     if test -z "$GNU_CC"; then
2467        NS_USE_NATIVE=1
2468        MOZ_FIX_LINK_PATHS=
2469        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2471        if test "$CPU_ARCH" != "sparc"; then
2472           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2473           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2474        else
2475           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2476           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2477           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2478        fi
2480        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2481        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2482            _SAVE_LDFLAGS=$LDFLAGS
2483            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2484            AC_TRY_LINK([#include <stdio.h>],
2485                        [printf("Hello World\n");],
2486                        ,
2487                        [LDFLAGS=$_SAVE_LDFLAGS])
2488        fi
2489        WARNINGS_AS_ERRORS='-Werror'
2490        MOZ_OPTIMIZE_FLAGS="-xO4"
2491        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2492        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2493        MKSHLIB_FORCE_ALL='-z allextract'
2494        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2495        DSO_LDOPTS='-G -z muldefs'
2496        AR_LIST="$AR t"
2497        AR_EXTRACT="$AR x"
2498        AR_DELETE="$AR d"
2499        AR='$(CXX) -xar'
2500        AR_FLAGS='-o $@'
2501        AS='/usr/ccs/bin/as'
2502        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2503        AS_DASH_C_FLAG=''
2504        TARGET_COMPILER_ABI="sunc"
2505         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2506         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2507        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2508        AC_LANG_SAVE
2509        AC_LANG_CPLUSPLUS
2510        AC_TRY_COMPILE([],
2511            [#if (__SUNPRO_CC < 0x530)
2512            #error "Denied"
2513            #endif],
2514            _BAD_COMPILER=,_BAD_COMPILER=1)
2515         if test -n "$_BAD_COMPILER"; then
2516             _res="no"
2517             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2518         else
2519             _res="yes"
2520         fi
2521         AC_MSG_RESULT([$_res])
2522         AC_LANG_RESTORE
2523     else
2524        ASFLAGS="$ASFLAGS -fPIC"
2525        DSO_LDOPTS='-G'
2526        _WARNINGS_CFLAGS=''
2527        _WARNINGS_CXXFLAGS=''
2528        if test "$OS_RELEASE" = "5.3"; then
2529           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2530        fi
2531     fi
2532     if test "$OS_RELEASE" = "5.5.1"; then
2533        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2534     fi
2535     ;;
2537 *-sunos*) 
2538     DSO_LDOPTS='-Bdynamic'
2539     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2540     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2541     AC_DEFINE(SUNOS4)
2542     AC_DEFINE(SPRINTF_RETURNS_STRING)
2543     case "$(target_os)" in
2544     sunos4.1*)
2545         DLL_SUFFIX='.so.1.0'
2546         ;;
2547     esac
2548     ;;
2550 *-sysv4.2uw7*) 
2551         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2552     ;;
2554 *-os2*)
2555     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2556     ;;
2558 esac
2560 dnl Only one oddball right now (QNX), but this gives us flexibility
2561 dnl if any other platforms need to override this in the future.
2562 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2564 dnl ========================================================
2565 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2566 dnl by now will not have any way to link most binaries (tests
2567 dnl as well as viewer, apprunner, etc.), because some symbols
2568 dnl will be left out of the "composite" .so's by ld as unneeded.
2569 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2570 dnl they can link in the static libs that provide the missing
2571 dnl symbols.
2572 dnl ========================================================
2573 NO_LD_ARCHIVE_FLAGS=
2574 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2575     NO_LD_ARCHIVE_FLAGS=1
2577 case "$target" in
2578 *-os2*)
2579     NO_LD_ARCHIVE_FLAGS=
2580     ;;
2581 *-aix4.3*|*-aix5*)
2582     NO_LD_ARCHIVE_FLAGS=
2583     ;;
2584 *-openvms*)
2585     NO_LD_ARCHIVE_FLAGS=
2586     ;;
2587 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2588     if test -z "$GNU_CC"; then
2589         NO_LD_ARCHIVE_FLAGS=
2590     fi
2591     ;;
2592 esac
2593 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2596 dnl Indicate that platform requires special thread safe 
2597 dnl locking when starting up the OJI JVM 
2598 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2599 dnl ========================================================
2600 case "$target" in
2601     *-hpux*)      
2602         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2603         ;;
2604 esac
2606 dnl ========================================================
2607 dnl = Flags to strip unused symbols from .so components
2608 dnl ========================================================
2609 case "$target" in
2610     *-linux*|*-kfreebsd*-gnu)
2611         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2612         ;;
2613     *-solaris*)
2614         if test -z "$GNU_CC"; then
2615          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2616         else
2617          if test -z "$GCC_USE_GNU_LD"; then
2618           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2619          else
2620           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2621          fi
2622         fi
2623         ;;
2624     *-nto*) 
2625         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2626         ;;
2627     *-darwin*)
2628         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2629         ;;
2630     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2631         if test -n "$GNU_CC"; then
2632            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2633         fi
2634         ;;
2635 esac
2637 if test -z "$COMPILE_ENVIRONMENT"; then
2638     SKIP_COMPILER_CHECKS=1
2639     SKIP_LIBRARY_CHECKS=1
2642 if test -z "$SKIP_COMPILER_CHECKS"; then
2643 dnl Checks for typedefs, structures, and compiler characteristics.
2644 dnl ========================================================
2645 AC_LANG_C
2646 AC_HEADER_STDC
2647 AC_C_CONST
2648 AC_TYPE_MODE_T
2649 AC_TYPE_OFF_T
2650 AC_TYPE_PID_T
2651 AC_TYPE_SIZE_T
2652 AC_STRUCT_ST_BLKSIZE
2653 AC_MSG_CHECKING(for siginfo_t)
2654 AC_CACHE_VAL(ac_cv_siginfo_t,
2655  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2656                   #include <signal.h>],
2657                  [siginfo_t* info;],
2658                  [ac_cv_siginfo_t=true],
2659                  [ac_cv_siginfo_t=false])])
2660 if test "$ac_cv_siginfo_t" = true ; then
2661   AC_DEFINE(HAVE_SIGINFO_T)
2662   AC_MSG_RESULT(yes)
2663 else
2664   AC_MSG_RESULT(no)
2667 dnl Visual Age for os/2 also defines size_t and off_t in certain 
2668 dnl  header files.  These defines make Visual Age use the mozilla
2669 dnl  defines types.
2670 if test "$VACPP" = "yes"; then
2671    AC_DEFINE(__size_t)
2672    AC_DEFINE(__off_t)
2675 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2676 dnl ========================================================
2677 AC_MSG_CHECKING(for int16_t)
2678 AC_CACHE_VAL(ac_cv_int16_t,
2679  [AC_TRY_COMPILE([#include <stdio.h>
2680                   #include <sys/types.h>],
2681                  [int16_t foo = 0;],
2682                  [ac_cv_int16_t=true],
2683                  [ac_cv_int16_t=false])])
2684 if test "$ac_cv_int16_t" = true ; then
2685   AC_DEFINE(HAVE_INT16_T)
2686   AC_MSG_RESULT(yes)
2687 else
2688   AC_MSG_RESULT(no)
2690 AC_MSG_CHECKING(for int32_t)
2691 AC_CACHE_VAL(ac_cv_int32_t,
2692  [AC_TRY_COMPILE([#include <stdio.h>
2693                   #include <sys/types.h>],
2694                  [int32_t foo = 0;],
2695                  [ac_cv_int32_t=true],
2696                  [ac_cv_int32_t=false])])
2697 if test "$ac_cv_int32_t" = true ; then
2698   AC_DEFINE(HAVE_INT32_T)
2699   AC_MSG_RESULT(yes)
2700 else
2701   AC_MSG_RESULT(no)
2703 AC_MSG_CHECKING(for int64_t)
2704 AC_CACHE_VAL(ac_cv_int64_t,
2705  [AC_TRY_COMPILE([#include <stdio.h>
2706                   #include <sys/types.h>],
2707                  [int64_t foo = 0;],
2708                  [ac_cv_int64_t=true],
2709                  [ac_cv_int64_t=false])])
2710 if test "$ac_cv_int64_t" = true ; then
2711   AC_DEFINE(HAVE_INT64_T)
2712   AC_MSG_RESULT(yes)
2713 else
2714   AC_MSG_RESULT(no)
2716 AC_MSG_CHECKING(for int64)
2717 AC_CACHE_VAL(ac_cv_int64,
2718  [AC_TRY_COMPILE([#include <stdio.h>
2719                   #include <sys/types.h>],
2720                  [int64 foo = 0;],
2721                  [ac_cv_int64=true],
2722                  [ac_cv_int64=false])])
2723 if test "$ac_cv_int64" = true ; then
2724   AC_DEFINE(HAVE_INT64)
2725   AC_MSG_RESULT(yes)
2726 else
2727   AC_MSG_RESULT(no)
2729 AC_MSG_CHECKING(for uint)
2730 AC_CACHE_VAL(ac_cv_uint,
2731  [AC_TRY_COMPILE([#include <stdio.h>
2732                   #include <sys/types.h>],
2733                  [uint foo = 0;],
2734                  [ac_cv_uint=true],
2735                  [ac_cv_uint=false])])
2736 if test "$ac_cv_uint" = true ; then
2737   AC_DEFINE(HAVE_UINT)
2738   AC_MSG_RESULT(yes)
2739 else
2740   AC_MSG_RESULT(no)
2742 AC_MSG_CHECKING(for uint_t)
2743 AC_CACHE_VAL(ac_cv_uint_t,
2744  [AC_TRY_COMPILE([#include <stdio.h>
2745                   #include <sys/types.h>],
2746                  [uint_t foo = 0;],
2747                  [ac_cv_uint_t=true],
2748                  [ac_cv_uint_t=false])])
2749 if test "$ac_cv_uint_t" = true ; then
2750   AC_DEFINE(HAVE_UINT_T)
2751   AC_MSG_RESULT(yes)
2752 else
2753   AC_MSG_RESULT(no)
2755 AC_MSG_CHECKING(for uint16_t)
2756 AC_CACHE_VAL(ac_cv_uint16_t,
2757  [AC_TRY_COMPILE([#include <stdio.h>
2758                   #include <sys/types.h>],
2759                  [uint16_t foo = 0;],
2760                  [ac_cv_uint16_t=true],
2761                  [ac_cv_uint16_t=false])])
2762 if test "$ac_cv_uint16_t" = true ; then
2763   AC_DEFINE(HAVE_UINT16_T)
2764   AC_MSG_RESULT(yes)
2765 else
2766   AC_MSG_RESULT(no)
2769 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2770 dnl are defined when compiling C++ but not C.  Since the result of this
2771 dnl test is used only in C++, do it in C++.
2772 AC_LANG_CPLUSPLUS
2774 AC_MSG_CHECKING(for uname.domainname)
2775 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2776     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2777         [ struct utsname *res; char *domain; 
2778             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2779         [ac_cv_have_uname_domainname_field=true],
2780         [ac_cv_have_uname_domainname_field=false])])
2782 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2783     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2784     AC_MSG_RESULT(yes)
2785 else
2786     AC_MSG_RESULT(no)
2789 AC_MSG_CHECKING(for uname.__domainname)
2790 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2791     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2792         [ struct utsname *res; char *domain; 
2793             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2794         [ac_cv_have_uname_us_domainname_field=true],
2795         [ac_cv_have_uname_us_domainname_field=false])])
2797 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2798     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2799     AC_MSG_RESULT(yes)
2800 else
2801     AC_MSG_RESULT(no)
2804 AC_LANG_C
2806 dnl Check for usable wchar_t (2 bytes, unsigned)
2807 dnl (we really don't need the unsignedness check anymore)
2808 dnl ========================================================
2810 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2811     ac_cv_have_usable_wchar_v2,
2812     [AC_TRY_COMPILE([#include <stddef.h>
2813                      $configure_static_assert_macros],
2814                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2815                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2816                     ac_cv_have_usable_wchar_v2="yes",
2817                     ac_cv_have_usable_wchar_v2="no")])
2818 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2819     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2820     HAVE_CPP_2BYTE_WCHAR_T=1
2821 else
2822 dnl This is really gcc-only
2823 dnl Do this test using CXX only since some versions of gcc
2824 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2825 dnl only have short-wchar support for c++.
2826 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2828     AC_LANG_SAVE
2829     AC_LANG_CPLUSPLUS
2830     _SAVE_CXXFLAGS=$CXXFLAGS
2831     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2833     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2834         ac_cv_have_usable_wchar_option_v2,
2835         [AC_TRY_LINK([#include <stddef.h>
2836                       $configure_static_assert_macros],
2837                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2838                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2839                      ac_cv_have_usable_wchar_option_v2="yes",
2840                      ac_cv_have_usable_wchar_option_v2="no")])
2842     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2843         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2844         HAVE_CPP_2BYTE_WCHAR_T=1
2845     else    
2846         CXXFLAGS=$_SAVE_CXXFLAGS
2847     fi
2848     AC_LANG_RESTORE
2851 dnl Check for .hidden assembler directive and visibility attribute.
2852 dnl Borrowed from glibc configure.in
2853 dnl ===============================================================
2854 if test "$GNU_CC"; then
2855   AC_CACHE_CHECK(for visibility(hidden) attribute,
2856                  ac_cv_visibility_hidden,
2857                  [cat > conftest.c <<EOF
2858                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2860                   ac_cv_visibility_hidden=no
2861                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2862                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2863                       ac_cv_visibility_hidden=yes
2864                     fi
2865                   fi
2866                   rm -f conftest.[cs]
2867                  ])
2868   if test "$ac_cv_visibility_hidden" = "yes"; then
2869     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2871     AC_CACHE_CHECK(for visibility(default) attribute,
2872                    ac_cv_visibility_default,
2873                    [cat > conftest.c <<EOF
2874                     int foo __attribute__ ((visibility ("default"))) = 1;
2876                     ac_cv_visibility_default=no
2877                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2878                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2879                         ac_cv_visibility_default=yes
2880                       fi
2881                     fi
2882                     rm -f conftest.[cs]
2883                    ])
2884     if test "$ac_cv_visibility_default" = "yes"; then
2885       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2887       AC_CACHE_CHECK(for visibility pragma support,
2888                      ac_cv_visibility_pragma,
2889                      [cat > conftest.c <<EOF
2890 #pragma GCC visibility push(hidden)
2891                       int foo_hidden = 1;
2892 #pragma GCC visibility push(default)
2893                       int foo_default = 1;
2895                       ac_cv_visibility_pragma=no
2896                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2897                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2898                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2899                             ac_cv_visibility_pragma=yes
2900                           fi
2901                         fi
2902                       fi
2903                       rm -f conftest.[cs]
2904                     ])
2905       if test "$ac_cv_visibility_pragma" = "yes"; then
2906         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2907                        ac_cv_have_visibility_class_bug,
2908                        [cat > conftest.c <<EOF
2909 #pragma GCC visibility push(hidden)
2910 struct __attribute__ ((visibility ("default"))) TestStruct {
2911   static void Init();
2913 __attribute__ ((visibility ("default"))) void TestFunc() {
2914   TestStruct::Init();
2917                        ac_cv_have_visibility_class_bug=no
2918                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2919                          ac_cv_have_visibility_class_bug=yes
2920                        else
2921                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2922                            ac_cv_have_visibility_class_bug=yes
2923                          fi
2924                        fi
2925                        rm -rf conftest.{c,S}
2926                        ])
2928         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2929                        ac_cv_have_visibility_builtin_bug,
2930                        [cat > conftest.c <<EOF
2931 #pragma GCC visibility push(hidden)
2932 #pragma GCC visibility push(default)
2933 #include <string.h>
2934 #pragma GCC visibility pop
2936 __attribute__ ((visibility ("default"))) void Func() {
2937   char c[[100]];
2938   memset(c, 0, sizeof(c));
2941                        ac_cv_have_visibility_builtin_bug=no
2942                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2943                          ac_cv_have_visibility_builtin_bug=yes
2944                        else
2945                          if test `grep -c "@PLT" conftest.S` = 0; then
2946                            ac_cv_visibility_builtin_bug=yes
2947                          fi
2948                        fi
2949                        rm -f conftest.{c,S}
2950                        ])
2951         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2952                 "$ac_cv_have_visibility_class_bug" = "no"; then
2953           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2954           WRAP_SYSTEM_INCLUDES=1
2955         else
2956           VISIBILITY_FLAGS='-fvisibility=hidden'
2957         fi # have visibility pragma bug
2958       fi   # have visibility pragma
2959     fi     # have visibility(default) attribute
2960   fi       # have visibility(hidden) attribute
2961 fi         # GNU_CC
2963 # visibility hidden flag for Sun Studio on Solaris
2964 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
2965 VISIBILITY_FLAGS='-xldscope=hidden'
2966 fi         # Sun Studio on Solaris
2968 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2969 AC_SUBST(VISIBILITY_FLAGS)
2971 dnl Checks for header files.
2972 dnl ========================================================
2973 AC_HEADER_DIRENT
2974 case "$target_os" in
2975 freebsd*)
2976 # for stuff like -lXshm
2977     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2978     ;;
2979 esac
2980 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2981 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2982 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2983 AC_CHECK_HEADERS(malloc.h)
2984 AC_CHECK_HEADERS(X11/XKBlib.h)
2986 dnl These are all the places some variant of statfs can be hiding.
2987 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2989 dnl Try for MMX support
2990 dnl NB - later gcc versions require -mmmx for this header to be successfully
2991 dnl included (or another option which implies it, such as -march=pentium-mmx)
2992 AC_CHECK_HEADERS(mmintrin.h)
2994 AC_MSG_CHECKING(for ARM SIMD support)
2995 AC_TRY_COMPILE([],
2996                [asm("uqadd8 r1, r1, r2");],
2997                result="yes", result="no")
2998 AC_MSG_RESULT("$result")
2999 if test "$result" = "yes"; then
3000     AC_DEFINE(HAVE_ARM_SIMD)
3001     HAVE_ARM_SIMD=1
3003 AC_SUBST(HAVE_ARM_SIMD)
3005 dnl Check whether the compiler supports the new-style C++ standard
3006 dnl library headers (i.e. <new>) or needs the old "new.h"
3007 AC_LANG_CPLUSPLUS
3008 NEW_H=new.h
3009 AC_CHECK_HEADER(new, [NEW_H=new])
3010 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3011 AC_LANG_C
3013 AC_ARG_ENABLE(dtrace,
3014               [  --enable-dtrace         build with dtrace support if available (default=no)],
3015               [enable_dtrace="yes"],)
3016 if test "x$enable_dtrace" = "xyes"; then
3017   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3018   if test -n "$HAVE_DTRACE"; then
3019       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3020   else
3021       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3022   fi
3024 AC_SUBST(HAVE_DTRACE)
3026 case $target in
3027 *-aix4.3*|*-aix5*)
3028         ;;
3030         AC_CHECK_HEADERS(sys/cdefs.h)
3031         ;;
3032 esac
3034 dnl Checks for libraries.
3035 dnl ========================================================
3036 case $target in
3037 *-hpux11.*)
3038         ;;
3040         AC_CHECK_LIB(c_r, gethostbyname_r)
3041         ;;
3042 esac
3044 dnl We don't want to link with libdl even if it's present on OS X, since
3045 dnl it's not used and not part of the default installation.
3046 dnl The same goes for BeOS.
3047 dnl We don't want to link against libm or libpthread on Darwin since
3048 dnl they both are just symlinks to libSystem and explicitly linking
3049 dnl against libSystem causes issues when debugging (see bug 299601).
3050 case $target in
3051 *-darwin*)
3052     ;;
3053 *-beos*)
3054     ;;
3056     AC_CHECK_LIB(m, atan)
3057     AC_CHECK_LIB(dl, dlopen,
3058     AC_CHECK_HEADER(dlfcn.h, 
3059         LIBS="-ldl $LIBS"
3060         AC_DEFINE(HAVE_LIBDL)))
3061     ;;
3062 esac
3064 _SAVE_CFLAGS="$CFLAGS"
3065 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3066 AC_CHECK_FUNCS(dladdr)
3067 CFLAGS="$_SAVE_CFLAGS"
3069 if test ! "$GNU_CXX"; then
3071     case $target in
3072     *-aix*)
3073         AC_CHECK_LIB(C_r, demangle)
3074         ;;
3075      *)
3076         AC_CHECK_LIB(C, demangle)
3077         ;;
3078      esac
3080 AC_CHECK_LIB(socket, socket)
3082 XLDFLAGS="$X_LIBS"
3083 XLIBS="$X_EXTRA_LIBS"
3085 dnl ========================================================
3086 dnl Checks for X libraries.
3087 dnl Ordering is important.
3088 dnl Xt is dependent upon SM as of X11R6
3089 dnl ========================================================
3090 if test "$no_x" = "yes"; then
3091     AC_DEFINE(NO_X11)
3092 else
3093     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3094         XLIBS="-lX11 $XLIBS"
3095         _SAVE_LDFLAGS="$LDFLAGS"
3096         LDFLAGS="$XLDFLAGS $LDFLAGS"
3097         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3098                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3099         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3100                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3101    
3102      
3103         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3104         unset ac_cv_lib_Xt_XtFree
3105             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3106             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3107         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3108                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3109         ])
3111     # AIX needs the motif library linked before libXt to prevent
3112     # crashes in plugins linked against Motif - Bug #98892
3113     case "${target_os}" in
3114     aix*)
3115         XT_LIBS="-lXm $XT_LIBS"
3116         ;;
3117     esac
3119     dnl ========================================================
3120     dnl = Check for XShm
3121     dnl ========================================================
3122     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3123         $XLIBS $XEXT_LIBS)
3124     AC_CHECK_HEADER(X11/extensions/XShm.h)
3125     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3126         test -n "$_HAVE_XSHM_XEXT"; then
3127         AC_DEFINE(HAVE_XSHM)
3128     fi
3130     dnl ========================================================
3131     dnl = Check for XIE
3132     dnl ========================================================
3133     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3134         $XLIBS $XEXT_LIBS)
3135     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3137     if test "$MOZ_XIE_LIBS"; then
3138         dnl ====================================================
3139         dnl = If XIE is present and is desired, turn it on
3140         dnl ====================================================
3141         case $target in
3142             *-hpux*)
3143                 ;;
3144             *)
3145                 HAVE_XIE=1
3146                 ;;
3147         esac
3148     fi
3150         LDFLAGS="$_SAVE_LDFLAGS"
3152     dnl ========================================================
3153     dnl = Check for freetype2 and its functionality
3154     dnl ========================================================
3155     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3157     if test "$_HAVE_FREETYPE2"; then
3158         _SAVE_LIBS="$LIBS"
3159         _SAVE_CFLAGS="$CFLAGS"
3160         LIBS="$LIBS $FT2_LIBS"
3161         CFLAGS="$CFLAGS $FT2_CFLAGS"
3163         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3164             ac_cv_member_FT_Bitmap_Size_y_ppem,
3165             [AC_TRY_COMPILE([#include <ft2build.h>
3166                              #include FT_FREETYPE_H],
3167                             [FT_Bitmap_Size s;
3168                              if (sizeof s.y_ppem) return 0;
3169                              return 1],
3170                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3171                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3172         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3173             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3174         else
3175             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3176         fi
3177         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3178                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3179                            [FT_Bitmap_Size structure includes y_ppem field])
3181         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3183         LIBS="$_SAVE_LIBS"
3184         CFLAGS="$_SAVE_CFLAGS"
3185     fi
3187 fi # $no_x
3189 AC_SUBST(XCFLAGS)
3190 AC_SUBST(XLDFLAGS)
3191 AC_SUBST(XLIBS)
3192 AC_SUBST(XT_LIBS)
3194 dnl ========================================================
3195 dnl = pthread support
3196 dnl = Start by checking whether the system support pthreads
3197 dnl ========================================================
3198 case "$target_os" in
3199 darwin*)
3200     USE_PTHREADS=1
3201     ;;
3203     MOZ_CHECK_PTHREADS(pthreads,
3204         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3205         MOZ_CHECK_PTHREADS(pthread,
3206             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3207             MOZ_CHECK_PTHREADS(c_r,
3208                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3209                 MOZ_CHECK_PTHREADS(c,
3210                     USE_PTHREADS=1
3211                 )
3212             )
3213         )
3214     )
3215     ;;
3216 esac
3218 dnl ========================================================
3219 dnl Check the command line for --with-pthreads 
3220 dnl ========================================================
3221 MOZ_ARG_WITH_BOOL(pthreads,
3222 [  --with-pthreads         Force use of system pthread library with NSPR ],
3223 [ if test "$USE_PTHREADS"x = x; then
3224     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3225 fi],
3226     USE_PTHREADS=
3227     _PTHREAD_LDFLAGS=
3230 dnl ========================================================
3231 dnl Do the platform specific pthread hackery
3232 dnl ========================================================
3233 if test "$USE_PTHREADS"x != x
3234 then
3235         dnl
3236         dnl See if -pthread is supported.
3237         dnl
3238         rm -f conftest*
3239         ac_cv_have_dash_pthread=no
3240         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3241         echo 'int main() { return 0; }' | cat > conftest.c
3242         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3243         if test $? -eq 0; then
3244                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3245                         ac_cv_have_dash_pthread=yes
3246                 case "$target_os" in
3247                 freebsd*)
3248 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3249                 ;;
3250                 *)
3251                             CFLAGS="$CFLAGS -pthread"
3252                             CXXFLAGS="$CXXFLAGS -pthread"
3253                 ;;
3254                 esac
3255                 fi
3256         fi
3257         rm -f conftest*
3258     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3260         dnl
3261         dnl See if -pthreads is supported.
3262         dnl
3263     ac_cv_have_dash_pthreads=no
3264     if test "$ac_cv_have_dash_pthread" = "no"; then
3265             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3266         echo 'int main() { return 0; }' | cat > conftest.c
3267             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3268         if test $? -eq 0; then
3269                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3270                             ac_cv_have_dash_pthreads=yes
3271                             CFLAGS="$CFLAGS -pthreads"
3272                             CXXFLAGS="$CXXFLAGS -pthreads"
3273                     fi
3274             fi
3275             rm -f conftest*
3276         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3277     fi
3279         case "$target" in
3280             *-*-freebsd*)
3281                         AC_DEFINE(_REENTRANT)
3282                         AC_DEFINE(_THREAD_SAFE)
3283                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3284                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3285                                 _PTHREAD_LDFLAGS="-pthread"
3286                         else
3287                                 _PTHREAD_LDFLAGS="-lc_r"
3288                         fi
3289                         ;;
3291             *-*-openbsd*|*-*-bsdi*)
3292                         AC_DEFINE(_REENTRANT)
3293                         AC_DEFINE(_THREAD_SAFE)
3294                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3295                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3296                 _PTHREAD_LDFLAGS="-pthread"
3297                         fi
3298                         ;;
3300             *-*-linux*|*-*-kfreebsd*-gnu)
3301                         AC_DEFINE(_REENTRANT) 
3302                         ;;
3304             *-*-nto*) 
3305                         AC_DEFINE(_REENTRANT) 
3306                         ;;
3308             *-aix4.3*|*-aix5*)
3309                         AC_DEFINE(_REENTRANT) 
3310                         ;;
3312             *-hpux11.*)
3313                         AC_DEFINE(_REENTRANT) 
3314                         ;;
3316             alpha*-*-osf*)
3317                         AC_DEFINE(_REENTRANT)
3318                         ;;
3320             *-*-solaris*) 
3321                         AC_DEFINE(_REENTRANT) 
3322                         if test ! "$GNU_CC"; then
3323                                 CFLAGS="$CFLAGS -mt" 
3324                                 CXXFLAGS="$CXXFLAGS -mt" 
3325                         fi
3326                         ;;
3327         esac
3328     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3331 dnl ========================================================
3332 dnl See if mmap sees writes
3333 dnl For cross compiling, just define it as no, which is a safe default
3334 dnl ========================================================
3335 AC_MSG_CHECKING(whether mmap() sees write()s)
3337 changequote(,)
3338 mmap_test_prog='
3339     #include <stdlib.h>
3340     #include <unistd.h>
3341     #include <sys/mman.h>
3342     #include <sys/types.h>
3343     #include <sys/stat.h>
3344     #include <fcntl.h>
3346     char fname[] = "conftest.file";
3347     char zbuff[1024]; /* Fractional page is probably worst case */
3349     int main() {
3350         char *map;
3351         int fd;
3352         int i;
3353         unlink(fname);
3354         fd = open(fname, O_RDWR | O_CREAT, 0660);
3355         if(fd<0) return 1;
3356         unlink(fname);
3357         write(fd, zbuff, sizeof(zbuff));
3358         lseek(fd, 0, SEEK_SET);
3359         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3360         if(map==(char*)-1) return 2;
3361         for(i=0; fname[i]; i++) {
3362             int rc = write(fd, &fname[i], 1);
3363             if(map[i]!=fname[i]) return 4;
3364         }
3365         return 0;
3366     }
3368 changequote([,])
3370 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3372 AC_MSG_RESULT("$result")
3374 if test "$result" = "no"; then
3375     AC_DEFINE(MMAP_MISSES_WRITES)
3379 dnl Checks for library functions.
3380 dnl ========================================================
3381 AC_PROG_GCC_TRADITIONAL
3382 AC_FUNC_MEMCMP
3383 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3384 AC_CHECK_FUNCS(flockfile getpagesize)
3386 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3387 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3388   AC_CHECK_FUNCS(localtime_r strtok_r)
3391 dnl check for wcrtomb/mbrtowc
3392 dnl =======================================================================
3393 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3394 AC_LANG_SAVE
3395 AC_LANG_CPLUSPLUS
3396 AC_CACHE_CHECK(for wcrtomb,
3397     ac_cv_have_wcrtomb,
3398     [AC_TRY_LINK([#include <wchar.h>],
3399                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3400                  ac_cv_have_wcrtomb="yes",
3401                  ac_cv_have_wcrtomb="no")])
3402 if test "$ac_cv_have_wcrtomb" = "yes"; then
3403     AC_DEFINE(HAVE_WCRTOMB)
3405 AC_CACHE_CHECK(for mbrtowc,
3406     ac_cv_have_mbrtowc,
3407     [AC_TRY_LINK([#include <wchar.h>],
3408                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3409                  ac_cv_have_mbrtowc="yes",
3410                  ac_cv_have_mbrtowc="no")])
3411 if test "$ac_cv_have_mbrtowc" = "yes"; then
3412     AC_DEFINE(HAVE_MBRTOWC)
3414 AC_LANG_RESTORE
3417 AC_CACHE_CHECK(
3418     [for res_ninit()],
3419     ac_cv_func_res_ninit,
3420     [AC_TRY_LINK([
3421         #ifdef linux
3422         #define _BSD_SOURCE 1
3423         #endif
3424         #include <resolv.h>
3425         ],
3426         [int foo = res_ninit(&_res);],
3427         [ac_cv_func_res_ninit=yes],
3428         [ac_cv_func_res_ninit=no])
3429     ])
3431 if test "$ac_cv_func_res_ninit" = "yes"; then
3432     AC_DEFINE(HAVE_RES_NINIT)
3433 dnl must add the link line we do something as foolish as this... dougt
3434 dnl else
3435 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3436 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3439 AC_LANG_CPLUSPLUS
3440 AC_CACHE_CHECK(
3441     [for gnu_get_libc_version()],
3442     ac_cv_func_gnu_get_libc_version,
3443     [AC_TRY_LINK([
3444         #ifdef HAVE_GNU_LIBC_VERSION_H
3445         #include <gnu/libc-version.h>
3446         #endif
3447         ],
3448         [const char *glibc_version = gnu_get_libc_version();],
3449         [ac_cv_func_gnu_get_libc_version=yes],
3450         [ac_cv_func_gnu_get_libc_version=no] 
3451         )]
3452     )
3454 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3455     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3458 case $target_os in
3459     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3460         ;;
3461     *)
3462     
3463 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3464     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3465         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3466 _SAVE_LIBS=$LIBS
3467 LIBS="$LIBS $_ICONV_LIBS"
3468 AC_CACHE_CHECK(
3469     [for iconv()],
3470     ac_cv_func_iconv,
3471     [AC_TRY_LINK([
3472         #include <stdlib.h>
3473         #include <iconv.h>
3474         ],
3475         [
3476             iconv_t h = iconv_open("", "");
3477             iconv(h, NULL, NULL, NULL, NULL);
3478             iconv_close(h);
3479         ],
3480         [ac_cv_func_iconv=yes],
3481         [ac_cv_func_iconv=no] 
3482         )]
3483     )
3484 if test "$ac_cv_func_iconv" = "yes"; then
3485     AC_DEFINE(HAVE_ICONV)
3486     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3487     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3488     LIBICONV="$_ICONV_LIBS"
3489     AC_CACHE_CHECK(
3490         [for iconv() with const input],
3491         ac_cv_func_const_iconv,
3492         [AC_TRY_COMPILE([
3493             #include <stdlib.h>
3494             #include <iconv.h>
3495             ],
3496             [
3497                 const char *input = "testing";
3498                 iconv_t h = iconv_open("", "");
3499                 iconv(h, &input, NULL, NULL, NULL);
3500                 iconv_close(h);
3501             ],
3502             [ac_cv_func_const_iconv=yes],
3503             [ac_cv_func_const_iconv=no] 
3504             )]
3505         )
3506     if test "$ac_cv_func_const_iconv" = "yes"; then
3507         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3508     fi
3510 LIBS=$_SAVE_LIBS
3512     ;;
3513 esac
3515 AM_LANGINFO_CODESET
3517 AC_LANG_C
3519 dnl **********************
3520 dnl *** va_copy checks ***
3521 dnl **********************
3522 dnl we currently check for all three va_copy possibilities, so we get
3523 dnl all results in config.log for bug reports.
3524 AC_MSG_CHECKING(for an implementation of va_copy())
3525 AC_CACHE_VAL(ac_cv_va_copy,[
3526     AC_TRY_RUN([
3527         #include <stdarg.h>
3528         void f (int i, ...) {
3529             va_list args1, args2;
3530             va_start (args1, i);
3531             va_copy (args2, args1);
3532             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3533                 exit (1);
3534             va_end (args1); va_end (args2);
3535         }
3536         int main() { f (0, 42); return 0; }],
3537         ac_cv_va_copy=yes,
3538         ac_cv_va_copy=no,
3539         ac_cv_va_copy=no
3540     )
3542 AC_MSG_RESULT($ac_cv_va_copy)
3543 AC_MSG_CHECKING(for an implementation of __va_copy())
3544 AC_CACHE_VAL(ac_cv___va_copy,[
3545     AC_TRY_RUN([
3546         #include <stdarg.h>
3547         void f (int i, ...) {
3548             va_list args1, args2;
3549             va_start (args1, i);
3550             __va_copy (args2, args1);
3551             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3552                 exit (1);
3553             va_end (args1); va_end (args2);
3554         }
3555         int main() { f (0, 42); return 0; }],
3556         ac_cv___va_copy=yes,
3557         ac_cv___va_copy=no,
3558         ac_cv___va_copy=no
3559     )
3561 AC_MSG_RESULT($ac_cv___va_copy)
3562 AC_MSG_CHECKING(whether va_lists can be copied by value)
3563 AC_CACHE_VAL(ac_cv_va_val_copy,[
3564     AC_TRY_RUN([
3565         #include <stdarg.h>
3566         void f (int i, ...) {
3567             va_list args1, args2;
3568             va_start (args1, i);
3569             args2 = args1;
3570             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3571                 exit (1);
3572             va_end (args1); va_end (args2);
3573         }
3574         int main() { f (0, 42); return 0; }],
3575         ac_cv_va_val_copy=yes,
3576         ac_cv_va_val_copy=no,
3577         ac_cv_va_val_copy=yes
3578     )
3580 if test "x$ac_cv_va_copy" = "xyes"; then
3581     AC_DEFINE(VA_COPY, va_copy)
3582     AC_DEFINE(HAVE_VA_COPY)
3583 elif test "x$ac_cv___va_copy" = "xyes"; then
3584     AC_DEFINE(VA_COPY, __va_copy)
3585     AC_DEFINE(HAVE_VA_COPY)
3588 if test "x$ac_cv_va_val_copy" = "xno"; then
3589    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3591 AC_MSG_RESULT($ac_cv_va_val_copy)
3593 dnl Check for dll-challenged libc's.
3594 dnl This check is apparently only needed for Linux.
3595 case "$target" in
3596         *-linux*)
3597             dnl ===================================================================
3598             _curdir=`pwd`
3599             export _curdir
3600             rm -rf conftest* _conftest
3601             mkdir _conftest
3602             cat >> conftest.C <<\EOF
3603 #include <stdio.h>
3604 #include <link.h>
3605 #include <dlfcn.h>
3606 #ifdef _dl_loaded
3607 void __dump_link_map(void) {
3608   struct link_map *map = _dl_loaded;
3609   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3611 int main() {
3612   dlopen("./conftest1.so",RTLD_LAZY);
3613   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3614   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3615   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3616   __dump_link_map();
3618 #else
3619 /* _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).*/
3620 int main() { printf("./conftest1.so\n"); }
3621 #endif
3624             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3626             cat >> conftest1.C <<\EOF
3627 #include <stdio.h>
3628 void foo(void) {printf("foo in dll called\n");}
3630             ${CXX-g++} -fPIC -c -g conftest1.C
3631             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3632             ${CXX-g++} -g conftest.C -o conftest -ldl
3633             cp -f conftest1.so conftest _conftest
3634             cd _conftest
3635             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3636             then
3637                 echo
3638                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3639                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3640                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3641                 echo "*** will be excessive memory usage at runtime."
3642                 echo
3643             fi
3644             cd ${_curdir}
3645             rm -rf conftest* _conftest
3646             dnl ===================================================================
3647             ;;
3648 esac
3650 dnl ===================================================================
3651 dnl ========================================================
3652 dnl By default, turn rtti and exceptions off on g++/egcs
3653 dnl ========================================================
3654 if test "$GNU_CXX"; then
3656   AC_MSG_CHECKING(for C++ exceptions flag)
3658   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3659   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3660   [echo "int main() { return 0; }" | cat > conftest.C
3662   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3664   if egrep "warning.*renamed" conftest.out >/dev/null; then
3665     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3666   else
3667     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3668   fi
3670   rm -f conftest*])
3672   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3673   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3674   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3677 dnl ========================================================
3678 dnl Put your C++ language/feature checks below
3679 dnl ========================================================
3680 AC_LANG_CPLUSPLUS
3682 HAVE_GCC3_ABI=
3683 if test "$GNU_CC"; then
3684   AC_CACHE_CHECK(for gcc 3.0 ABI,
3685       ac_cv_gcc_three_abi,
3686       [AC_TRY_COMPILE([],
3687                       [
3688 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3689   return 0;
3690 #else
3691 #error Not gcc3.
3692 #endif
3693                       ],
3694                       ac_cv_gcc_three_abi="yes",
3695                       ac_cv_gcc_three_abi="no")])
3696   if test "$ac_cv_gcc_three_abi" = "yes"; then
3697       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3698       HAVE_GCC3_ABI=1
3699   else
3700       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3701   fi
3703 AC_SUBST(HAVE_GCC3_ABI)
3706 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3707                ac_cv_cpp_explicit,
3708                [AC_TRY_COMPILE(class X {
3709                                public: explicit X(int i) : i_(i) {}
3710                                private: int i_;
3711                                };,
3712                                X x(3);,
3713                                ac_cv_cpp_explicit=yes,
3714                                ac_cv_cpp_explicit=no)])
3715 if test "$ac_cv_cpp_explicit" = yes ; then
3716    AC_DEFINE(HAVE_CPP_EXPLICIT)
3719 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3720                ac_cv_cpp_typename,
3721                [AC_TRY_COMPILE(class param {
3722                                public:
3723                                    typedef unsigned long num_type;
3724                                };
3726                                template <class T> class tplt {
3727                                public:
3728                                    typedef typename T::num_type t_num_type;
3729                                    t_num_type foo(typename T::num_type num) {
3730                                        return num;
3731                                    }
3732                                };,
3733                                tplt<param> A;
3734                                A.foo(0);,
3735                                ac_cv_cpp_typename=yes,
3736                                ac_cv_cpp_typename=no)])
3737 if test "$ac_cv_cpp_typename" = yes ; then
3738    AC_DEFINE(HAVE_CPP_TYPENAME)
3741 dnl Check for support of modern template specialization syntax
3742 dnl Test code and requirement from scc@netscape.com.
3743 dnl Autoconf cut-and-paste job by waterson@netscape.com
3744 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3745                ac_cv_cpp_modern_specialize_template_syntax,
3746                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3747                                class Y {};
3748                                template <> struct X<Y> { double a; };,
3749                                X<int> int_x;
3750                                X<Y> y_x;,
3751                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3752                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3753 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3754   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3758 dnl Some compilers support only full specialization, and some don't.
3759 AC_CACHE_CHECK(whether partial template specialization works,
3760                ac_cv_cpp_partial_specialization,
3761                [AC_TRY_COMPILE(template <class T> class Foo {};
3762                                template <class T> class Foo<T*> {};,
3763                                return 0;,
3764                                ac_cv_cpp_partial_specialization=yes,
3765                                ac_cv_cpp_partial_specialization=no)])
3766 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3767   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3770 dnl Some compilers have limited support for operators with templates;
3771 dnl specifically, it is necessary to define derived operators when a base
3772 dnl class's operator declaration should suffice.
3773 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3774                ac_cv_need_derived_template_operators,
3775                [AC_TRY_COMPILE([template <class T> class Base { };
3776                                 template <class T>
3777                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3778                                 template <class T> class Derived : public Base<T> { };],
3779                                [Derived<char> a, b;
3780                                 Base<char> c = a + b;
3781                                 return 0;],
3782                                ac_cv_need_derived_template_operators=no,
3783                                ac_cv_need_derived_template_operators=yes)])
3784 if test "$ac_cv_need_derived_template_operators" = yes ; then
3785   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3789 dnl Some compilers have trouble detecting that a template class
3790 dnl that derives from another template is actually an instance
3791 dnl of the base class. This test checks for that.
3792 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3793                ac_cv_need_cpp_template_cast_to_base,
3794                [AC_TRY_COMPILE([template <class T> class Base { };
3795                                 template <class T> class Derived : public Base<T> { };
3796                                 template <class T> int foo(const Base<T>&) { return 0; }],
3797                                [Derived<char> bar; return foo(bar);],
3798                                ac_cv_need_cpp_template_cast_to_base=no,
3799                                ac_cv_need_cpp_template_cast_to_base=yes)])
3800 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3801   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3804 dnl Some compilers have trouble resolving the ambiguity between two
3805 dnl functions whose arguments differ only by cv-qualifications.
3806 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3807                ac_cv_can_resolve_const_ambiguity,
3808                [AC_TRY_COMPILE([
3809                                 template <class T> class ptrClass {
3810                                   public: T* ptr;
3811                                 };
3813                                 template <class T> T* a(ptrClass<T> *arg) {
3814                                   return arg->ptr;
3815                                 }
3817                                 template <class T>
3818                                 const T* a(const ptrClass<T> *arg) {
3819                                   return arg->ptr;
3820                                 }
3821                                ],
3822                                [ ptrClass<int> i;
3823                                  a(&i); ],
3824                                ac_cv_can_resolve_const_ambiguity=yes,
3825                                ac_cv_can_resolve_const_ambiguity=no)])
3826 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3827   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3831 dnl We don't do exceptions on unix.  The only reason this used to be here
3832 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3833 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3834 dnl So im commenting this out until someone writes some artificial 
3835 dnl intelligence to detect not only if the compiler has exceptions, but if 
3836 dnl they are enabled as well.
3837 dnl 
3838 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3839 dnl                ac_cv_cpp_exceptions,
3840 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3841 dnl                                static void F() { throw X(); },
3842 dnl                                try { F(); } catch(X & e) { },
3843 dnl                                ac_cv_cpp_exceptions=yes,
3844 dnl                                ac_cv_cpp_exceptions=no)])
3845 dnl if test $ac_cv_cpp_exceptions = yes ; then
3846 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3847 dnl fi
3849 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3850 dnl supports it well enough to allow us to use it to change access, but not
3851 dnl to resolve ambiguity. The next two tests determine how well the |using|
3852 dnl keyword is supported.
3854 dnl Check to see if we can change access with |using|.  Test both a
3855 dnl legal and an illegal example.
3856 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3857                ac_cv_cpp_access_changing_using2,
3858                [AC_TRY_COMPILE(
3859                    class A { protected: int foo() { return 0; } };
3860                    class B : public A { public: using A::foo; };,
3861                    B b; return b.foo();,
3862                    [AC_TRY_COMPILE(
3863                        class A { public: int foo() { return 1; } };
3864                        class B : public A { private: using A::foo; };,
3865                        B b; return b.foo();,
3866                        ac_cv_cpp_access_changing_using2=no,
3867                        ac_cv_cpp_access_changing_using2=yes)],
3868                    ac_cv_cpp_access_changing_using2=no)])
3869 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3870    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3873 dnl Check to see if we can resolve ambiguity with |using|.
3874 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3875                ac_cv_cpp_ambiguity_resolving_using,
3876                [AC_TRY_COMPILE(class X { 
3877                                  public: int go(const X&) {return 3;}
3878                                          int jo(const X&) {return 3;}
3879                                };
3880                                class Y : public X {
3881                                  public:  int go(int) {return 2;}
3882                                           int jo(int) {return 2;}
3883                                           using X::jo;
3884                                  private: using X::go;
3885                                };,
3886                                X x; Y y; y.jo(x);,
3887                                ac_cv_cpp_ambiguity_resolving_using=yes,
3888                                ac_cv_cpp_ambiguity_resolving_using=no)])
3889 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3890    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3893 dnl Check to see if the |std| namespace is supported. If so, we'll want
3894 dnl to qualify any standard library calls with "std::" to ensure that
3895 dnl those functions can be resolved.
3896 AC_CACHE_CHECK(for \"std::\" namespace,
3897                ac_cv_cpp_namespace_std,
3898                [AC_TRY_COMPILE([#include <algorithm>],
3899                                [return std::min(0, 1);],
3900                                ac_cv_cpp_namespace_std=yes,
3901                                ac_cv_cpp_namespace_std=no)])
3902 if test "$ac_cv_cpp_namespace_std" = yes ; then
3903    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3906 dnl Older compilers are overly ambitious with respect to using the standard
3907 dnl template library's |operator!=()| when |operator==()| is defined. In
3908 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3909 dnl ambiguity at compile-time. This test checks for that case.
3910 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3911                ac_cv_cpp_unambiguous_std_notequal,
3912                [AC_TRY_COMPILE([#include <algorithm>
3913                                 struct T1 {};
3914                                 int operator==(const T1&, const T1&) { return 0; }
3915                                 int operator!=(const T1&, const T1&) { return 0; }],
3916                                [T1 a,b; return a != b;],
3917                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3918                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3919 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3920   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3924 AC_CACHE_CHECK(for C++ reinterpret_cast,
3925                ac_cv_cpp_reinterpret_cast,
3926                [AC_TRY_COMPILE(struct X { int i; };
3927                                struct Y { int i; };,
3928                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3929                                ac_cv_cpp_reinterpret_cast=yes,
3930                                ac_cv_cpp_reinterpret_cast=no)])
3931 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3932    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3935 dnl See if a dynamic_cast to void* gives the most derived object.
3936 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3937                ac_cv_cpp_dynamic_cast_void_ptr,
3938                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3939                             class Y { int j; public: virtual ~Y() { } };
3940                             class Z : public X, public Y { int k; };
3942                             int main() {
3943                                  Z mdo;
3944                                  X *subx = (X*)&mdo;
3945                                  Y *suby = (Y*)&mdo;
3946                                  return !((((void*)&mdo != (void*)subx) &&
3947                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3948                                           (((void*)&mdo != (void*)suby) &&
3949                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3950                             }],
3951                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3952                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3953                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3954 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3955    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3959 dnl note that this one is reversed - if the test fails, then
3960 dnl we require implementations of unused virtual methods. Which
3961 dnl really blows because it means we'll have useless vtable
3962 dnl bloat.
3963 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3964                ac_cv_cpp_unused_required,
3965                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3966                                X x;,
3967                                ac_cv_cpp_unused_required=no,
3968                                ac_cv_cpp_unused_required=yes)])
3969 if test "$ac_cv_cpp_unused_required" = yes ; then
3970    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3974 dnl Some compilers have trouble comparing a constant reference to a templatized
3975 dnl class to zero, and require an explicit operator==() to be defined that takes
3976 dnl an int. This test separates the strong from the weak.
3978 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3979                ac_cv_trouble_comparing_to_zero,
3980                [AC_TRY_COMPILE([#include <algorithm>
3981                                 template <class T> class Foo {};
3982                                 class T2;
3983                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3984                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3985                                [Foo<int> f; return (0 != f);],
3986                                ac_cv_trouble_comparing_to_zero=no,
3987                                ac_cv_trouble_comparing_to_zero=yes)])
3988 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3989   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3994 dnl End of C++ language/feature checks
3995 AC_LANG_C
3997 dnl ========================================================
3998 dnl =  Internationalization checks
3999 dnl ========================================================
4001 dnl Internationalization and Locale support is different
4002 dnl on various UNIX platforms.  Checks for specific i18n
4003 dnl features go here.
4005 dnl check for LC_MESSAGES
4006 AC_CACHE_CHECK(for LC_MESSAGES,
4007                 ac_cv_i18n_lc_messages,
4008                 [AC_TRY_COMPILE([#include <locale.h>],
4009                                 [int category = LC_MESSAGES;],
4010                                 ac_cv_i18n_lc_messages=yes,
4011                                 ac_cv_i18n_lc_messages=no)])
4012 if test "$ac_cv_i18n_lc_messages" = yes; then
4013    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4014 fi      
4016 fi # SKIP_COMPILER_CHECKS
4018 TARGET_XPCOM_ABI=
4019 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4020     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4023 dnl Mozilla specific options
4024 dnl ========================================================
4025 dnl The macros used for command line options
4026 dnl are defined in build/autoconf/altoptions.m4.
4029 dnl ========================================================
4030 dnl =
4031 dnl = Check for external package dependencies
4032 dnl =
4033 dnl ========================================================
4034 MOZ_ARG_HEADER(External Packages)
4036 MOZ_ENABLE_LIBXUL=
4038 MOZ_ARG_WITH_STRING(libxul-sdk,
4039 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4040   LIBXUL_SDK_DIR=$withval)
4042 if test "$LIBXUL_SDK_DIR" = "yes"; then
4043     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4044 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4045     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4047     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
4048         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
4049     fi
4051     MOZ_ENABLE_LIBXUL=1
4053 AC_SUBST(LIBXUL_SDK)
4055 if test -n "$LIBXUL_SDK"; then
4056     LIBXUL_DIST="$LIBXUL_SDK"
4057 else
4058     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4060 AC_SUBST(LIBXUL_DIST)
4062 dnl ========================================================
4063 dnl = If NSPR was not detected in the system, 
4064 dnl = use the one in the source tree (mozilla/nsprpub)
4065 dnl ========================================================
4066 MOZ_ARG_WITH_BOOL(system-nspr,
4067 [  --with-system-nspr      Use system installed NSPR],
4068     _USE_SYSTEM_NSPR=1 )
4070 if test -n "$_USE_SYSTEM_NSPR"; then
4071     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4074 if test -n "$MOZ_NATIVE_NSPR"; then
4075     _SAVE_CFLAGS=$CFLAGS
4076     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4077     AC_TRY_COMPILE([#include "prlog.h"],
4078                 [#ifndef PR_STATIC_ASSERT
4079                  #error PR_STATIC_ASSERT not defined
4080                  #endif],
4081                 [MOZ_NATIVE_NSPR=1],
4082                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4083     CFLAGS=$_SAVE_CFLAGS
4084 else
4085     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4086     # explicitly set libs for Visual Age C++ for OS/2
4087     if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
4088         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib ${_PTHREAD_LDFLAGS}"
4089     elif test "$OS_ARCH" = "WINCE"; then
4090         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4091         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4092     elif test "$OS_ARCH" = "WINNT"; then
4093         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4094         if test -n "$GNU_CC"; then
4095             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4096         else
4097             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4098         fi
4099     else
4100         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4101     fi
4104 dnl ========================================================
4105 dnl = If NSS was not detected in the system, 
4106 dnl = use the one in the source tree (mozilla/security/nss)
4107 dnl ========================================================
4109 MOZ_ARG_WITH_BOOL(system-nss,
4110 [  --with-system-nss      Use system installed NSS],
4111     _USE_SYSTEM_NSS=1 )
4113 if test -n "$_USE_SYSTEM_NSS"; then
4114     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4117 if test -n "$MOZ_NATIVE_NSS"; then
4118    NSS_LIBS="$NSS_LIBS -lcrmf"
4119 else
4120    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4121    NSS_DEP_LIBS="\
4122         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4123         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4124         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4125         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4126         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4127         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4129    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4130        NSS_LIBS="\
4131         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4132         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4133         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4134         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4135         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4136         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4137    else
4138        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4139    fi
4142 if test -z "$SKIP_LIBRARY_CHECKS"; then
4143 dnl system JPEG support
4144 dnl ========================================================
4145 MOZ_ARG_WITH_STRING(system-jpeg,
4146 [  --with-system-jpeg[=PFX]
4147                           Use system libjpeg [installed at prefix PFX]],
4148     JPEG_DIR=$withval)
4150 _SAVE_CFLAGS=$CFLAGS
4151 _SAVE_LDFLAGS=$LDFLAGS
4152 _SAVE_LIBS=$LIBS
4153 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4154     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4155     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4157 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4158     SYSTEM_JPEG=
4159 else
4160     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4163 if test "$SYSTEM_JPEG" = 1; then
4164     LIBS="$JPEG_LIBS $LIBS"
4165     AC_TRY_COMPILE([ #include <stdio.h>
4166                      #include <sys/types.h>
4167                      #include <jpeglib.h> ],
4168                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4169                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4170                      #endif ],
4171                    SYSTEM_JPEG=1,
4172                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4173 fi 
4174 CFLAGS=$_SAVE_CFLAGS
4175 LDFLAGS=$_SAVE_LDFLAGS
4176 LIBS=$_SAVE_LIBS
4178 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4179     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4180     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4183 dnl system ZLIB support
4184 dnl ========================================================
4185 MOZ_ARG_WITH_STRING(system-zlib,
4186 [  --with-system-zlib[=PFX]
4187                           Use system libz [installed at prefix PFX]],
4188     ZLIB_DIR=$withval)
4190 _SAVE_CFLAGS=$CFLAGS
4191 _SAVE_LDFLAGS=$LDFLAGS
4192 _SAVE_LIBS=$LIBS
4193 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4194     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4195     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4197 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4198     SYSTEM_ZLIB=
4199 else
4200     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4201         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4203 if test "$SYSTEM_ZLIB" = 1; then
4204     LIBS="$ZLIB_LIBS $LIBS"
4205     AC_TRY_COMPILE([ #include <stdio.h>
4206                      #include <string.h>
4207                      #include <zlib.h> ],
4208                    [ #if ZLIB_VERNUM < $MOZZLIB 
4209                      #error "Insufficient zlib version ($MOZZLIB required)."
4210                      #endif ],
4211                    SYSTEM_ZLIB=1,
4212                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4214 CFLAGS=$_SAVE_CFLAGS
4215 LDFLAGS=$_SAVE_LDFLAGS
4216 LIBS=$_SAVE_LIBS
4218 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4219     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4220     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4223 dnl system BZIP2 Support
4224 dnl ========================================================
4225 MOZ_ARG_WITH_STRING(system-bz2,
4226 [  --with-system-bz2[=PFX]
4227                           Use system libbz2 [installed at prefix PFX]],
4228     BZ2_DIR=$withval)
4230 _SAVE_CFLAGS=$CFLAGS
4231 _SAVE_LDFLAGS=$LDFLAGS
4232 _SAVE_LIBS=$LIBS
4233 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4234     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4235     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4237 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4238     SYSTEM_BZ2=
4239 else
4240     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4241         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4243 CFLAGS=$_SAVE_CFLAGS
4244 LDFLAGS=$_SAVE_LDFLAGS
4245 LIBS=$_SAVE_LIBS
4247 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4248     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4249     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4252 dnl system PNG Support
4253 dnl ========================================================
4254 MOZ_ARG_WITH_STRING(system-png, 
4255 [  --with-system-png[=PFX]
4256                           Use system libpng [installed at prefix PFX]],
4257     PNG_DIR=$withval)
4259 _SAVE_CFLAGS=$CFLAGS
4260 _SAVE_LDFLAGS=$LDFLAGS
4261 _SAVE_LIBS=$LIBS
4262 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4263 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4264 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4265     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4266     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4268 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4269     SYSTEM_PNG=
4270 else
4271     _SAVE_PNG_LIBS=$PNG_LIBS
4272     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4273                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4274                  $PNG_LIBS)
4275     AC_CHECK_LIB(png, png_get_acTL, ,
4276                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4277                  $_SAVE_PNG_LIBS)
4279 if test "$SYSTEM_PNG" = 1; then
4280     LIBS="$PNG_LIBS $LIBS"
4281     AC_TRY_COMPILE([ #include <stdio.h>
4282                      #include <sys/types.h>
4283                      #include <png.h> ],
4284                    [ #if PNG_LIBPNG_VER < $MOZPNG
4285                      #error "Insufficient libpng version ($MOZPNG required)."
4286                      #endif
4287                      #ifndef PNG_UINT_31_MAX
4288                      #error "Insufficient libpng version."
4289                      #endif ],
4290                    SYSTEM_PNG=1,
4291                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4293 CFLAGS=$_SAVE_CFLAGS
4294 LDFLAGS=$_SAVE_LDFLAGS
4295 LIBS=$_SAVE_LIBS
4297 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4298     PNG_CFLAGS="-I${PNG_DIR}/include"
4299     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4302 fi # SKIP_LIBRARY_CHECKS
4304 dnl system HunSpell Support
4305 dnl ========================================================
4306 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4307 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4308     SYSTEM_HUNSPELL=1 )
4310 if test -n "$SYSTEM_HUNSPELL"; then
4311     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4314 AC_SUBST(SYSTEM_HUNSPELL)
4316 dnl ========================================================
4317 dnl Java SDK support
4318 dnl ========================================================
4319 JAVA_INCLUDE_PATH=
4320 MOZ_ARG_WITH_STRING(java-include-path,
4321 [  --with-java-include-path=dir   Location of Java SDK headers],
4322     JAVA_INCLUDE_PATH=$withval)
4324 JAVA_BIN_PATH=
4325 MOZ_ARG_WITH_STRING(java-bin-path,
4326 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4327     JAVA_BIN_PATH=$withval)
4329 dnl ========================================================
4330 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4331 dnl their usage and use them in spidermonkey.
4332 dnl ========================================================
4333 MOZ_ARG_WITH_BOOL(arm-kuser,
4334 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4335     USE_ARM_KUSER=1,
4336     USE_ARM_KUSER=)
4337 if test -n "$USE_ARM_KUSER"; then
4338    AC_DEFINE(USE_ARM_KUSER)
4341 dnl ========================================================
4342 dnl =
4343 dnl = Application
4344 dnl =
4345 dnl ========================================================
4347 MOZ_ARG_HEADER(Application)
4349 BUILD_STATIC_LIBS=
4350 ENABLE_TESTS=1
4351 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4352 MOZ_BRANDING_DIRECTORY=
4353 MOZ_DBGRINFO_MODULES=
4354 MOZ_ENABLE_CANVAS=1
4355 MOZ_EXTENSIONS_ALL=" wallet p3p venkman inspector irc typeaheadfind gnomevfs sroaming datetime finger cview layout-debug tasks sql xforms schema-validation reporter"
4356 MOZ_FEEDS=1
4357 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4358 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4359 MOZ_IPCD=
4360 MOZ_JAVAXPCOM=
4361 MOZ_JSDEBUGGER=1
4362 MOZ_JSLOADER=1
4363 MOZ_LIBART_CFLAGS=
4364 MOZ_LIBART_LIBS=
4365 MOZ_MATHML=1
4366 MOZ_MORK=1
4367 MOZ_MORKREADER=
4368 MOZ_AUTH_EXTENSION=1
4369 MOZ_NO_ACTIVEX_SUPPORT=1
4370 MOZ_NO_INSPECTOR_APIS=
4371 MOZ_NO_XPCOM_OBSOLETE=
4372 MOZ_NO_FAST_LOAD=
4373 MOZ_OGG=1
4374 MOZ_MEDIA=
4375 MOZ_OJI=1
4376 MOZ_PERMISSIONS=1
4377 MOZ_PLACES=
4378 MOZ_PLAINTEXT_EDITOR_ONLY=
4379 MOZ_PLUGINS=1
4380 MOZ_PREF_EXTENSIONS=1
4381 MOZ_PROFILELOCKING=1
4382 MOZ_PROFILESHARING=1
4383 MOZ_PSM=1
4384 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4385 MOZ_PYTHON=
4386 MOZ_PYTHON_DEBUG_SUFFIX=
4387 MOZ_PYTHON_DLL_SUFFIX=
4388 MOZ_PYTHON_INCLUDES=
4389 MOZ_PYTHON_LIBS=
4390 MOZ_PYTHON_PREFIX=
4391 MOZ_PYTHON_VER=
4392 MOZ_PYTHON_VER_DOTTED=
4393 MOZ_RDF=1
4394 MOZ_REFLOW_PERF=
4395 MOZ_SAFE_BROWSING=
4396 MOZ_HELP_VIEWER=
4397 MOZ_SPELLCHECK=1
4398 MOZ_STATIC_MAIL_BUILD=
4399 MOZ_STORAGE=1
4400 MOZ_SVG=1
4401 MOZ_TIMELINE=
4402 MOZ_UI_LOCALE=en-US
4403 MOZ_UNIVERSALCHARDET=1
4404 MOZ_URL_CLASSIFIER=
4405 MOZ_USE_NATIVE_UCONV=
4406 MOZ_VIEW_SOURCE=1
4407 MOZ_XPFE_COMPONENTS=1
4408 MOZ_XPINSTALL=1
4409 MOZ_XSLT_STANDALONE=
4410 MOZ_XTF=1
4411 MOZ_XUL=1
4412 MOZ_XUL_APP=1
4413 MOZ_ZIPWRITER=1
4414 NS_PRINTING=1
4415 NECKO_COOKIES=1
4416 NECKO_DISK_CACHE=1
4417 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4418 NECKO_SMALL_BUFFERS=
4419 JS_STATIC_BUILD=
4420 XPC_IDISPATCH_SUPPORT=
4423 case "$target_os" in
4424 darwin*)
4425     ACCESSIBILITY=
4426     ;;
4428     ACCESSIBILITY=1
4429     ;;
4430 esac
4432 case "$target_os" in
4433     msvc*|mks*|cygwin*|mingw*)
4434         if test -z "$GNU_CC"; then 
4435             XPC_IDISPATCH_SUPPORT=1
4436             MOZ_NO_ACTIVEX_SUPPORT=
4437             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4438         fi
4439         ;;
4440 esac
4442 MOZ_ARG_ENABLE_STRING(application,
4443 [  --enable-application=APP
4444                           Options include:
4445                             browser (Firefox)
4446                             xulrunner
4447                             content/xslt (Standalone Transformiix XSLT)
4448                             netwerk (Standalone Necko)
4449                             tools/update-packaging (AUS-related packaging tools)
4450                             standalone (use this for standalone
4451                               xpcom/xpconnect or to manually drive a build)],
4452 [ MOZ_BUILD_APP=$enableval ] )
4454 MOZ_EMBEDDING_PROFILE=default
4455 MOZ_ARG_WITH_STRING(embedding-profile,
4456 [  --with-embedding-profile=default|basic|minimal
4457                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4458 [ MOZ_EMBEDDING_PROFILE=$withval ])
4460 case "$MOZ_EMBEDDING_PROFILE" in
4461 default)
4462   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4463   MOZ_EMBEDDING_LEVEL_BASIC=1
4464   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4465   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4466   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4467   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4468   ;;
4470 basic)
4471   MOZ_EMBEDDING_LEVEL_DEFAULT=
4472   MOZ_EMBEDDING_LEVEL_BASIC=1
4473   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4474   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4475   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4476   ENABLE_TESTS=
4477   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4478   MOZ_ENABLE_CANVAS=
4479   MOZ_ENABLE_POSTSCRIPT=
4480   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4481   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4482   MOZ_IMG_ENCODERS_DEFAULT=
4483   MOZ_IMG_ENCODERS=
4484   MOZ_INSTALLER=
4485   MOZ_JSDEBUGGER=
4486   MOZ_MATHML=
4487   MOZ_AUTH_EXTENSION=
4488   MOZ_NO_ACTIVEX_SUPPORT=1
4489   MOZ_NO_INSPECTOR_APIS=1
4490   MOZ_NO_XPCOM_OBSOLETE=1
4491   MOZ_NO_FAST_LOAD=1
4492   MOZ_OJI=
4493   MOZ_PLAINTEXT_EDITOR_ONLY=1
4494 #  MOZ_PLUGINS=
4495   MOZ_PREF_EXTENSIONS=
4496   MOZ_PROFILELOCKING=
4497   MOZ_PROFILESHARING=
4498   MOZ_SPELLCHECK=
4499   MOZ_SVG=
4500   MOZ_UNIVERSALCHARDET=
4501   MOZ_UPDATER=
4502   MOZ_USE_NATIVE_UCONV=
4503   MOZ_VIEW_SOURCE=
4504   MOZ_XPFE_COMPONENTS=
4505   MOZ_XPINSTALL=
4506   MOZ_XTF=
4507   MOZ_ZIPWRITER=
4508   NECKO_DISK_CACHE=
4509   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4510   NECKO_SMALL_BUFFERS=1
4511   NS_DISABLE_LOGGING=1
4512   NS_PRINTING=
4513   JS_STATIC_BUILD=1
4514   ;;
4516 minimal)
4517   MOZ_EMBEDDING_LEVEL_DEFAULT=
4518   MOZ_EMBEDDING_LEVEL_BASIC=
4519   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4520   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4521   ENABLE_TESTS=
4522   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4523   MOZ_ENABLE_CANVAS=
4524   MOZ_ENABLE_POSTSCRIPT=
4525   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4526   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4527   MOZ_IMG_ENCODERS_DEFAULT=
4528   MOZ_IMG_ENCODERS=
4529   MOZ_INSTALLER=
4530   MOZ_JSDEBUGGER=
4531   MOZ_MATHML=
4532   MOZ_AUTH_EXTENSION=
4533   MOZ_NO_ACTIVEX_SUPPORT=1
4534   MOZ_NO_INSPECTOR_APIS=1
4535   MOZ_NO_XPCOM_OBSOLETE=1
4536   MOZ_NO_FAST_LOAD=1
4537   MOZ_OJI=
4538   MOZ_PLAINTEXT_EDITOR_ONLY=1
4539   MOZ_PLUGINS=
4540   MOZ_PREF_EXTENSIONS=
4541   MOZ_PROFILELOCKING=
4542   MOZ_PROFILESHARING=
4543   MOZ_SPELLCHECK=
4544   MOZ_STORAGE=1
4545   MOZ_PLACES=
4546   MOZ_SVG=
4547   MOZ_UNIVERSALCHARDET=
4548   MOZ_UPDATER=
4549   MOZ_USE_NATIVE_UCONV=1
4550   MOZ_VIEW_SOURCE=
4551   MOZ_XPFE_COMPONENTS=
4552   MOZ_XPINSTALL=
4553   MOZ_XTF=
4554   MOZ_XUL=
4555   MOZ_ZIPWRITER=
4556   MOZ_RDF=
4557   NECKO_DISK_CACHE=
4558   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4559   NECKO_SMALL_BUFFERS=1
4560   NS_DISABLE_LOGGING=1
4561   NS_PRINTING=
4562   JS_STATIC_BUILD=1
4563   ;;
4566   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4567   ;;
4568 esac
4570 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4571 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4572 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4574 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4575 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4576   XULRUNNER_STUB_NAME=$withval)
4578 if test -z "$XULRUNNER_STUB_NAME"; then
4579   case "$target_os" in
4580   darwin*)
4581     XULRUNNER_STUB_NAME=xulrunner
4582     ;;
4583   *)
4584     XULRUNNER_STUB_NAME=xulrunner-stub
4585   esac
4587 AC_SUBST(XULRUNNER_STUB_NAME)
4589 if test -z "$MOZ_BUILD_APP"; then
4590   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4591 else
4592   # We have a valid application only if it has a build.mk file in its top
4593   # directory.
4594   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4595     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4596   fi
4599 # Allow the application to influence configure with a confvars.sh script.
4601 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4602 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4603   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4604   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4605 else
4606   AC_MSG_RESULT([no])
4609 # Now is a good time to test for logic errors, define mismatches, etc.
4610 case "$MOZ_BUILD_APP" in
4611 xulrunner)
4612   if test "$LIBXUL_SDK"; then
4613     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4614   fi
4615   ;;
4617   # Fix this case for folks who forget. Warn them.
4618   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4619     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4620     MOZ_XUL_APP=1
4621   fi
4622   ;;
4623 esac
4625 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4626 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4627 # MOZ_BUILD_APP.
4628 case "$MOZ_BUILD_APP" in
4629 browser)
4630   AC_DEFINE(MOZ_PHOENIX)
4631   ;;
4633 xulrunner)
4634   AC_DEFINE(MOZ_XULRUNNER)
4635   ;;
4637 content/xslt)
4638   AC_DEFINE(TX_EXE)
4639   ;;
4641 standalone) 
4642   MOZ_APP_NAME=mozilla
4643   MOZ_APP_DISPLAYNAME=Mozilla
4644   MOZ_APP_VERSION=$MOZILLA_VERSION
4645   ;;
4647 esac
4649 if test -z "$MOZ_XUL_APP"; then
4650         AC_MSG_ERROR([builds with unsetting MOZ_XUL_APP in confvars.sh are not supported.])
4653 AC_SUBST(MOZ_BUILD_APP)
4654 AC_SUBST(MOZ_XUL_APP)
4655 AC_SUBST(MOZ_PHOENIX)
4656 AC_SUBST(MOZ_XULRUNNER)
4658 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4660 if test "$MOZ_XUL_APP"; then
4661   MOZ_PROFILESHARING=
4662   AC_DEFINE(MOZ_XUL_APP)
4665 dnl ========================================================
4666 dnl = 
4667 dnl = Toolkit Options
4668 dnl = 
4669 dnl ========================================================
4670 MOZ_ARG_HEADER(Toolkit Options)
4672     dnl ========================================================
4673     dnl = Select the default toolkit
4674     dnl ========================================================
4675         MOZ_ARG_ENABLE_STRING(default-toolkit,
4676         [  --enable-default-toolkit=TK
4677                           Select default toolkit
4678                           Platform specific defaults:
4679                             BeOS - cairo-beos
4680                             Mac OS X - cairo-cocoa
4681                             Neutrino/QNX - photon
4682                             OS/2 - cairo-os2
4683                             Win32 - cairo-windows
4684                             WinCE - windows
4685                             Gtk2 with DirectFB - cairo-gtk2-dfb
4686                             * - cairo-gtk2
4687                             * - cairo-qt],
4688     [ _DEFAULT_TOOLKIT=$enableval ],
4689     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4691     if test "$_DEFAULT_TOOLKIT" = "photon" \
4692         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4693         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4694         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4695         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4696         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4697         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4698         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4699         -o "$_DEFAULT_TOOLKIT" = "cairo-mac" \
4700         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4701     then
4702         dnl nglayout only supports building with one toolkit,
4703         dnl so ignore everything after the first comma (",").
4704         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4705     else
4706         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4707     fi
4709 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4711 dnl ========================================================
4712 dnl = Enable the toolkit as needed                         =
4713 dnl ========================================================
4715 case "$MOZ_WIDGET_TOOLKIT" in
4716 photon)
4717         MOZ_ENABLE_PHOTON=1
4718         AC_DEFINE(MOZ_WIDGET_PHOTON)
4719     ;;
4721 cairo-windows)
4722     MOZ_WIDGET_TOOLKIT=windows
4723     MOZ_GFX_TOOLKIT=cairo
4724     ;;
4726 cairo-gtk2|cairo-gtk2-x11)
4727     MOZ_WIDGET_TOOLKIT=gtk2
4728     MOZ_GFX_TOOLKIT=cairo
4729     MOZ_ENABLE_GTK2=1
4730     MOZ_ENABLE_XREMOTE=1
4732     AC_DEFINE(MOZ_X11)
4733     MOZ_X11=1
4735     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4736     TK_LIBS='$(MOZ_GTK2_LIBS)'
4737     AC_DEFINE(MOZ_WIDGET_GTK2)
4738     ;;
4740 cairo-gtk2-dfb)
4741     MOZ_WIDGET_TOOLKIT=gtk2
4742     MOZ_GFX_TOOLKIT=cairo
4743     MOZ_ENABLE_GTK2=1
4745     AC_DEFINE(MOZ_DFB)
4746     MOZ_DFB=1
4748     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4749     TK_LIBS='$(MOZ_GTK2_LIBS)'
4750     AC_DEFINE(MOZ_WIDGET_GTK2)
4751     if test "$no_x" != "yes"; then
4752         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4753         no_x=yes
4754     fi
4755     ;;
4757 cairo-qt)
4758     MOZ_WIDGET_TOOLKIT=qt
4759     MOZ_GFX_TOOLKIT=cairo
4760     MOZ_ENABLE_QT=1
4761     MOZ_ENABLE_XREMOTE=1
4762     USE_ELF_DYNSTR_GC=
4764     AC_DEFINE(MOZ_X11)
4765     MOZ_X11=1
4767     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4768     TK_LIBS='$(MOZ_QT_LIBS)'
4769     AC_DEFINE(MOZ_WIDGET_QT)
4770     ;;
4772 cairo-beos)
4773     MOZ_WIDGET_TOOLKIT=beos
4774     MOZ_GFX_TOOLKIT=cairo
4775     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4776     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4777     ;;
4779 cairo-os2)
4780     MOZ_WIDGET_TOOLKIT=os2
4781     MOZ_GFX_TOOLKIT=cairo
4782     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4783     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4784     ;;
4786 cairo-mac|cairo-cocoa)
4787     if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
4788         MOZ_WIDGET_TOOLKIT=cocoa
4789         AC_DEFINE(MOZ_WIDGET_COCOA)
4790         MOZ_ENABLE_COCOA=1
4791     else
4792         MOZ_WIDGET_TOOLKIT=mac
4793     fi
4794     MOZ_GFX_TOOLKIT=cairo
4795     MOZ_USER_DIR="Mozilla"
4796     AC_DEFINE(XP_MACOSX)
4797     AC_DEFINE(TARGET_CARBON)
4798     AC_DEFINE(TARGET_API_MAC_CARBON)
4799     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4800     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4801     CFLAGS="$CFLAGS $TK_CFLAGS"
4802     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4803     ;;
4804 esac
4806 if test "$MOZ_ENABLE_XREMOTE"; then
4807     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4810 if test "$COMPILE_ENVIRONMENT"; then
4811   if test "$MOZ_ENABLE_GTK2"; then
4812     if test "$MOZ_X11"; then
4813       GDK_PACKAGES=gdk-x11-2.0
4814     elif test "$MOZ_DFB"; then
4815       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4816       GDK_PACKAGES=directfb
4817     fi
4819     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4820   fi
4822 fi # COMPILE_ENVIRONMENT
4824 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4826 dnl ========================================================
4827 dnl = startup-notification support module
4828 dnl ========================================================
4830 if test "$MOZ_ENABLE_GTK2"
4831 then
4832     MOZ_ENABLE_STARTUP_NOTIFICATION=
4834     MOZ_ARG_ENABLE_BOOL(startup-notification,
4835     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4836         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4837         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4838     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4839     then
4840         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4841                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4842         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4843             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4844             then
4845                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4846             fi
4847             MOZ_ENABLE_STARTUP_NOTIFICATION=
4848         ])
4849     fi
4851     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4852         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4853     fi
4855     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4857 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4858 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4859 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4861 dnl ========================================================
4862 dnl = QT support
4863 dnl ========================================================
4864 if test "$MOZ_ENABLE_QT"
4865 then
4866     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4867     AC_SUBST(MOZ_QT_CFLAGS)
4868     AC_SUBST(MOZ_QT_LIBS)
4870     MOZ_ARG_WITH_STRING(qtdir,
4871     [  --with-qtdir=\$dir       Specify Qt directory ],
4872     [ QTDIR=$withval])
4874     if test -z "$QTDIR"; then
4875       QTDIR="/usr"
4876     fi
4877     QTINCDIR="/include/qt"
4878     if test ! -d "$QTDIR$QTINCDIR"; then
4879        QTINCDIR="/include/X11/qt"
4880     fi
4881     if test ! -d "$QTDIR$QTINCDIR"; then
4882        QTINCDIR="/include"
4883     fi
4885     if test -x "$QTDIR/bin/moc-qt4"; then
4886       HOST_MOC="$QTDIR/bin/moc-qt4"
4887     else
4888       if test -x "$QTDIR/bin/moc"; then
4889         HOST_MOC="$QTDIR/bin/moc"
4890       else
4891         AC_CHECK_PROGS(HOST_MOC, moc, "")
4892       fi
4893     fi
4894     if test -z "$HOST_MOC"; then
4895       AC_MSG_ERROR([no acceptable moc preprocessor found])
4896     fi
4897     MOC=$HOST_MOC
4900 AC_SUBST(GTK_CONFIG)
4901 AC_SUBST(TK_CFLAGS)
4902 AC_SUBST(TK_LIBS)
4904 AC_SUBST(MOZ_ENABLE_GTK2)
4905 AC_SUBST(MOZ_ENABLE_PHOTON)
4906 AC_SUBST(MOZ_ENABLE_COCOA)
4907 AC_SUBST(MOZ_ENABLE_QT)
4908 AC_SUBST(MOZ_ENABLE_XREMOTE)
4909 AC_SUBST(MOZ_GTK2_CFLAGS)
4910 AC_SUBST(MOZ_GTK2_LIBS)
4911 AC_SUBST(MOZ_QT_CFLAGS)
4912 AC_SUBST(MOZ_QT_LIBS)
4914 AC_SUBST(MOC)
4916 AC_SUBST(MOZ_DFB)
4917 AC_SUBST(MOZ_X11)
4919 dnl ========================================================
4920 dnl =
4921 dnl = Components & Features
4922 dnl = 
4923 dnl ========================================================
4924 MOZ_ARG_HEADER(Components and Features)
4926 dnl ========================================================
4927 dnl = Localization
4928 dnl ========================================================
4929 MOZ_ARG_ENABLE_STRING(ui-locale,
4930 [  --enable-ui-locale=ab-CD
4931                           Select the user interface locale (default: en-US)],
4932     MOZ_UI_LOCALE=$enableval )
4933 AC_SUBST(MOZ_UI_LOCALE)
4935 dnl ========================================================
4936 dnl = Trademarked Branding 
4937 dnl ========================================================
4938 MOZ_ARG_ENABLE_BOOL(official-branding,
4939 [  --enable-official-branding Enable Official mozilla.org Branding
4940                           Do not distribute builds with
4941                           --enable-official-branding unless you have
4942                           permission to use trademarks per
4943                           http://www.mozilla.org/foundation/trademarks/ .],
4944 [case "$MOZ_BUILD_APP" in
4945 browser)
4946     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4947     MOZ_APP_DISPLAYNAME=Firefox
4948     ;;
4951     AC_MSG_ERROR([Official branding is only available for Firefox.])
4952 esac
4955 MOZ_ARG_WITH_STRING(branding,
4956 [  --with-branding=dir    Use branding from the specified directory.],
4957     MOZ_BRANDING_DIRECTORY=$withval)
4959 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4960 if test -z "$REAL_BRANDING_DIRECTORY"; then
4961   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4964 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4965   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4968 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4970 dnl ========================================================
4971 dnl = Distribution ID
4972 dnl ========================================================
4973 MOZ_ARG_WITH_STRING(distribution-id,
4974 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4975 [ val=`echo $withval`
4976     MOZ_DISTRIBUTION_ID="$val"])
4978 if test -z "$MOZ_DISTRIBUTION_ID"; then
4979    MOZ_DISTRIBUTION_ID="org.mozilla"
4982 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4983 AC_SUBST(MOZ_DISTRIBUTION_ID)
4986 dnl ========================================================
4987 dnl complex text support off by default
4988 dnl ========================================================
4989 MOZ_PANGO=1
4990 MOZ_ARG_DISABLE_BOOL(pango,
4991 [  --disable-pango Disable usage of Pango ],
4992     MOZ_PANGO=,
4993     MOZ_PANGO=1)
4996 dnl ========================================================
4997 dnl = Pango
4998 dnl ========================================================
4999 if test "$MOZ_ENABLE_GTK2"
5000 then
5001     AC_SUBST(MOZ_PANGO)
5003     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5005     if test "$MOZ_PANGO"
5006     then
5007         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5008         AC_SUBST(MOZ_PANGO_CFLAGS)
5009         AC_SUBST(MOZ_PANGO_LIBS)
5010         AC_DEFINE(MOZ_PANGO)
5011     else
5012         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5013         AC_SUBST(MOZ_PANGO_CFLAGS)
5014         AC_SUBST(MOZ_PANGO_LIBS)
5016         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5017         AC_SUBST(FT2_CFLAGS)
5018         AC_SUBST(FT2_LIBS)
5019     fi
5022 dnl ========================================================
5023 dnl = PostScript print module
5024 dnl ========================================================
5025 MOZ_ARG_DISABLE_BOOL(postscript,
5026 [  --disable-postscript    Disable PostScript printing support ],
5027     MOZ_ENABLE_POSTSCRIPT=,
5028     MOZ_ENABLE_POSTSCRIPT=1 )
5030 dnl ========================================================
5031 dnl = GnomeVFS support module
5032 dnl ========================================================
5034 if test "$MOZ_X11"
5035 then
5036     dnl build the gnomevfs extension by default only when the
5037     dnl GTK2 toolkit is in use.
5038     if test "$MOZ_ENABLE_GTK2"
5039     then
5040         MOZ_ENABLE_GNOMEVFS=1
5041         MOZ_ENABLE_GCONF=1
5042         MOZ_ENABLE_LIBGNOME=1
5043     fi
5045     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5046     [  --disable-gnomevfs      Disable GnomeVFS support ],
5047         MOZ_ENABLE_GNOMEVFS=,
5048         MOZ_ENABLE_GNOMEVFS=force)
5050     if test "$MOZ_ENABLE_GNOMEVFS"
5051     then
5052         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5053             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5054             MOZ_ENABLE_GNOMEVFS=1
5055         ],[
5056             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5057             then
5058                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5059             fi
5060             MOZ_ENABLE_GNOMEVFS=
5061         ])
5062     fi
5064     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5065     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5067     if test "$MOZ_ENABLE_GCONF"
5068     then
5069         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5070             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5071             MOZ_ENABLE_GCONF=1
5072         ],[
5073             MOZ_ENABLE_GCONF=
5074         ])
5075     fi
5077     if test "$MOZ_ENABLE_GCONF"; then
5078         AC_DEFINE(MOZ_ENABLE_GCONF)
5079     fi
5081     AC_SUBST(MOZ_ENABLE_GCONF)
5082     AC_SUBST(MOZ_GCONF_CFLAGS)
5083     AC_SUBST(MOZ_GCONF_LIBS)
5085     if test "$MOZ_ENABLE_LIBGNOME"
5086     then
5087         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5088             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5089             MOZ_ENABLE_LIBGNOME=1
5090         ],[
5091             MOZ_ENABLE_LIBGNOME=
5092         ])
5093     fi
5095     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5096     AC_SUBST(MOZ_LIBGNOME_LIBS)
5098     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5099     # are all available.
5101     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5102             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5103       MOZ_ENABLE_GNOME_COMPONENT=1
5104     else
5105       MOZ_ENABLE_GNOME_COMPONENT=
5106     fi
5108     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5111 dnl ========================================================
5112 dnl = libgnomeui support module
5113 dnl ========================================================
5115 if test "$MOZ_ENABLE_GTK2"
5116 then
5117     MOZ_ENABLE_GNOMEUI=1
5119     MOZ_ARG_DISABLE_BOOL(gnomeui,
5120     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5121         MOZ_ENABLE_GNOMEUI=,
5122         MOZ_ENABLE_GNOMEUI=force)
5124     if test "$MOZ_ENABLE_GNOMEUI"
5125     then
5126         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5127         [
5128             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5129             MOZ_ENABLE_GNOMEUI=1
5130         ],[
5131             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5132             then
5133                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5134             fi
5135             MOZ_ENABLE_GNOMEUI=
5136         ])
5137     fi
5139     if test "$MOZ_ENABLE_GNOMEUI"; then
5140         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5141     fi
5143 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5144 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5145 AC_SUBST(MOZ_GNOMEUI_LIBS)
5147 dnl ========================================================
5148 dnl = dbus support
5149 dnl ========================================================
5151 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5152 then
5153     MOZ_ENABLE_DBUS=1
5155     MOZ_ARG_DISABLE_BOOL(dbus,
5156     [  --disable-dbus       Disable dbus support ],
5157         MOZ_ENABLE_DBUS=,
5158         MOZ_ENABLE_DBUS=1)
5160     if test "$MOZ_ENABLE_DBUS"
5161     then
5162         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5163         AC_DEFINE(MOZ_ENABLE_DBUS)
5164     fi
5166 AC_SUBST(MOZ_ENABLE_DBUS)
5167 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5168 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5170 dnl ========================================================
5171 dnl = Build Personal Security Manager
5172 dnl ========================================================
5173 MOZ_ARG_DISABLE_BOOL(crypto,
5174 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5175     MOZ_PSM=,
5176     MOZ_PSM=1 )
5178 dnl ========================================================
5179 dnl = JS Debugger XPCOM component (js/jsd)
5180 dnl ========================================================
5181 MOZ_ARG_DISABLE_BOOL(jsd,
5182 [  --disable-jsd           Disable JavaScript debug library],
5183     MOZ_JSDEBUGGER=,
5184     MOZ_JSDEBUGGER=1)
5187 dnl ========================================================
5188 dnl = Disable plugin support
5189 dnl ========================================================
5190 MOZ_ARG_DISABLE_BOOL(plugins,
5191 [  --disable-plugins       Disable plugins support],
5192     MOZ_PLUGINS=,
5193     MOZ_PLUGINS=1)
5195 dnl ========================================================
5196 dnl = Open JVM Interface (OJI) support
5197 dnl ========================================================
5198 MOZ_ARG_DISABLE_BOOL(oji,
5199 [  --disable-oji           Disable Open JVM Integration support],
5200     MOZ_OJI=,
5201     MOZ_OJI=1)
5202 if test -n "$MOZ_OJI"; then
5203     AC_DEFINE(OJI)
5206 dnl bi-directional support always on
5207 IBMBIDI=1
5208 AC_DEFINE(IBMBIDI)
5210 dnl ========================================================
5211 dnl view source support on by default
5212 dnl ========================================================
5213 MOZ_ARG_DISABLE_BOOL(view-source,
5214 [  --disable-view-source     Disable view source support],
5215     MOZ_VIEW_SOURCE=,
5216     MOZ_VIEW_SOURCE=1 )
5217 if test "$MOZ_VIEW_SOURCE"; then
5218     AC_DEFINE(MOZ_VIEW_SOURCE)
5222 dnl ========================================================
5223 dnl accessibility support on by default on all platforms 
5224 dnl except OS X.
5225 dnl ========================================================
5226 MOZ_ARG_DISABLE_BOOL(accessibility,
5227 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5228     ACCESSIBILITY=,
5229     ACCESSIBILITY=1 )
5230 if test "$ACCESSIBILITY"; then
5231     AC_DEFINE(ACCESSIBILITY)
5234 if test -n "$ACCESSIBILITY"; then
5235 case "$target" in
5236 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5237     if test "$ac_cv_header_atlbase_h" = "no"; then
5238         AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
5239     fi
5240     if test "$ac_cv_header_oleacc_idl" = "no"; then
5241         AC_MSG_ERROR([System header oleacc.idl is not available. See http://developer.mozilla.org/en/docs/oleacc.idl for details on fixing this problem.])
5242     fi
5243     ;;
5244 esac
5247 dnl ========================================================
5248 dnl xpfe/components on by default
5249 dnl ========================================================
5250 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5251 [  --disable-xpfe-components
5252                           Disable xpfe components],
5253     MOZ_XPFE_COMPONENTS=,
5254     MOZ_XPFE_COMPONENTS=1 )
5256 dnl ========================================================
5257 dnl xpinstall support on by default
5258 dnl ========================================================
5259 MOZ_ARG_DISABLE_BOOL(xpinstall,
5260 [  --disable-xpinstall     Disable xpinstall support],
5261     MOZ_XPINSTALL=,
5262     MOZ_XPINSTALL=1 )
5263 if test "$MOZ_XPINSTALL"; then
5264     AC_DEFINE(MOZ_XPINSTALL)
5267 dnl ========================================================
5268 dnl xpcom js loader support on by default
5269 dnl ========================================================
5270 MOZ_ARG_DISABLE_BOOL(jsloader,
5271 [  --disable-jsloader      Disable xpcom js loader support],
5272     MOZ_JSLOADER=,
5273     MOZ_JSLOADER=1 )
5274 if test "$MOZ_JSLOADER"; then
5275     AC_DEFINE(MOZ_JSLOADER)
5278 dnl ========================================================
5279 dnl Disable printing
5280 dnl ========================================================
5281 MOZ_ARG_DISABLE_BOOL(printing,
5282 [  --disable-printing  Disable printing support],
5283     NS_PRINTING=,
5284     NS_PRINTING=1 )
5286 if test "$NS_PRINTING"; then
5287     AC_DEFINE(NS_PRINTING)
5288     AC_DEFINE(NS_PRINT_PREVIEW)
5291 dnl ========================================================
5292 dnl use native unicode converters
5293 dnl ========================================================
5294 MOZ_ARG_ENABLE_BOOL(native-uconv,
5295 [  --enable-native-uconv   Enable iconv support],
5296     MOZ_USE_NATIVE_UCONV=1,
5297     MOZ_USE_NATIVE_UCONV= )
5298 if test "$MOZ_USE_NATIVE_UCONV"; then
5299     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5301 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5302     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5306 dnl ========================================================
5307 dnl Libeditor can be build as plaintext-only,
5308 dnl or as a full html and text editing component.
5309 dnl We build both by default.
5310 dnl ========================================================
5311 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5312 [  --enable-plaintext-editor-only
5313                           Allow only plaintext editing],
5314     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5315     MOZ_PLAINTEXT_EDITOR_ONLY= )
5316 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5317 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5319 dnl ========================================================
5320 dnl = Drop XPCOM Obsolete library
5321 dnl ========================================================
5322 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5323 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5324     MOZ_NO_XPCOM_OBSOLETE=1,
5325     MOZ_NO_XPCOM_OBSOLETE=)
5327 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5328     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5331 dnl ========================================================
5332 dnl = Disable Fast Load
5333 dnl ========================================================
5334 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5335 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5336     MOZ_NO_FAST_LOAD=1,
5337     MOZ_NO_FAST_LOAD=)
5339 AC_SUBST(MOZ_NO_FAST_LOAD)
5341 if test -n "$MOZ_NO_FAST_LOAD"; then
5342     AC_DEFINE(MOZ_NO_FAST_LOAD)
5345 dnl ========================================================
5346 dnl = Enable Ogg Codecs
5347 dnl ========================================================
5348 MOZ_ARG_DISABLE_BOOL(ogg,
5349 [  --disable-ogg           Disable Ogg Codec support],
5350     MOZ_OGG=,
5351     MOZ_OGG=1)
5353 AC_SUBST(MOZ_OGG)
5355 if test -n "$MOZ_OGG"; then
5356     AC_DEFINE(MOZ_OGG)
5357     MOZ_MEDIA=1
5360 AC_SUBST(MOZ_MEDIA)
5362 if test -n "$MOZ_MEDIA"; then
5363     AC_DEFINE(MOZ_MEDIA)
5366 dnl If using Ogg with Linux, ensure that the alsa library is available
5367 if test -n "$MOZ_OGG"; then
5368    case "$target_os" in
5369 linux*)
5370       AC_CHECK_LIB(asound, snd_pcm_open,,AC_MSG_ERROR([Ogg support on Linux requires the alsa library]))
5371       ;;
5372    esac
5375 dnl ========================================================
5376 dnl Permissions System
5377 dnl ========================================================
5378 MOZ_ARG_DISABLE_BOOL(permissions,
5379 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5380     MOZ_PERMISSIONS=,
5381     MOZ_PERMISSIONS=1
5384 dnl ========================================================
5385 dnl NegotiateAuth
5386 dnl ========================================================
5387 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5388 [  --disable-negotiateauth Disable GSS-API negotiation ],
5389     MOZ_AUTH_EXTENSION=,
5390     MOZ_AUTH_EXTENSION=1 )
5392 dnl ========================================================
5393 dnl XTF
5394 dnl ========================================================
5395 MOZ_ARG_DISABLE_BOOL(xtf,
5396 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5397     MOZ_XTF=,
5398     MOZ_XTF=1 )
5399 if test "$MOZ_XTF"; then
5400   AC_DEFINE(MOZ_XTF)
5403 dnl ========================================================
5404 dnl Inspector APIs
5405 dnl ========================================================
5406 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5407 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5408     MOZ_NO_INSPECTOR_APIS=1,
5409     MOZ_NO_INSPECTOR_APIS= )
5411 dnl ========================================================
5412 dnl Pref extensions (autoconfig and system-pref)
5413 dnl ========================================================
5414 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5415 [  --disable-pref-extensions
5416                           Disable pref extensions such as autoconfig and
5417                           system-pref],
5418   MOZ_PREF_EXTENSIONS=,
5419   MOZ_PREF_EXTENSIONS=1 )
5421 dnl ========================================================
5422 dnl = Universalchardet
5423 dnl ========================================================
5424 MOZ_ARG_DISABLE_BOOL(universalchardet,
5425 [  --disable-universalchardet
5426                           Disable universal encoding detection],
5427   MOZ_UNIVERSALCHARDET=,
5428   MOZ_UNIVERSALCHARDET=1 )
5430 dnl ========================================================
5431 dnl JavaXPCOM
5432 dnl ========================================================
5433 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5434 [  --enable-javaxpcom
5435                           Enable Java-XPCOM bridge],
5436     MOZ_JAVAXPCOM=1,
5437     MOZ_JAVAXPCOM= )
5439 if test -n "${MOZ_JAVAXPCOM}"; then
5440   case "$host_os" in
5441     cygwin*|msvc*|mks*)
5442       if test -n "$JAVA_HOME"; then
5443         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5444       fi
5445       ;;
5446     *mingw*)
5447       if test -n "$JAVA_HOME"; then
5448         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5449       fi
5450       ;;
5451   esac
5453   if test -n "${JAVA_INCLUDE_PATH}"; then
5454     dnl Make sure jni.h exists in the given include path.
5455     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5456       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5457     fi
5458   else
5459     case "$target_os" in
5460       darwin*)
5461         dnl Default to java system location
5462         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5463         ;;
5464       *)
5465         dnl Try $JAVA_HOME
5466         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5467         ;;
5468     esac
5469     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5470       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.])
5471     fi
5472   fi
5474   if test -n "${JAVA_BIN_PATH}"; then
5475     dnl Look for javac and jar in the specified path.
5476     JAVA_PATH="$JAVA_BIN_PATH"
5477   else
5478     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5479     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5480   fi
5482   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5483   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5484   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5485   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5486     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.])
5487   fi
5490 dnl ========================================================
5491 dnl = Breakpad crash reporting (on by default on supported platforms)
5492 dnl ========================================================
5494 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5495     || test "$OS_ARCH" = "Darwin" \
5496     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5497     || test "$OS_ARCH" = "SunOS") \
5498    && test -z "$HAVE_64BIT_OS"; then
5499    MOZ_CRASHREPORTER=1
5502 MOZ_ARG_DISABLE_BOOL(crashreporter,
5503 [  --disable-crashreporter          Disable breakpad crash reporting],
5504     MOZ_CRASHREPORTER=,
5505     MOZ_CRASHREPORTER=1)
5507 if test -n "$MOZ_CRASHREPORTER"; then
5508    AC_DEFINE(MOZ_CRASHREPORTER)
5510   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5511     test -z "$SKIP_LIBRARY_CHECKS"; then
5512     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5513     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5514     AC_SUBST(MOZ_GTHREAD_LIBS)
5516     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.])])
5517   fi
5520 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5521 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5522 [ val=`echo $withval | sed 's/[^0-9]//g'`
5523     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5525 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5526    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5528 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5530 dnl ========================================================
5531 dnl = Enable compilation of specific extension modules
5532 dnl ========================================================
5534 MOZ_ARG_ENABLE_STRING(extensions,
5535 [  --enable-extensions     Enable extensions],
5536 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5537     if test "$option" = "yes" || test "$option" = "all"; then
5538         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
5539     elif test "$option" = "no" || test "$option" = "none"; then
5540         MOZ_EXTENSIONS=""
5541     elif test "$option" = "default"; then
5542         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5543     elif test `echo "$option" | grep -c \^-` != 0; then
5544         option=`echo $option | sed 's/^-//'`
5545         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5546     else
5547         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5548     fi
5549 done],
5550     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5552 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5553     # Suppress warning on non-X11 platforms
5554     if test -n "$MOZ_X11"; then
5555         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5556     fi
5557     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5560 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5561     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5562     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5565 dnl This might be temporary: build tridentprofile only on Windows
5566 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5567     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5568     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5571 dnl cookie must be built before tridentprofile. put it at list's end.
5572 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5573   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5574   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5577 dnl xforms requires xtf and schema-validation
5578 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5579     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5580     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5582 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5583     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5584     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5587 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5588     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5589     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5592 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5593     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5594     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5597 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5598     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5599     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5602 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5603     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5604     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5607 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5608     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5609     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5612 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5613     AC_MSG_WARN([spellcheck is no longer an extension.])
5614     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5617 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5618     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5619     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5622 dnl Remove dupes
5623 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5625 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5626 dnl when trying to build a non-existent extension.
5627 for extension in $MOZ_EXTENSIONS; do
5628     if test ! -d "${srcdir}/extensions/${extension}"; then
5629         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5630     fi
5631 done
5634 dnl ========================================================
5635 dnl Image decoders
5636 dnl ========================================================
5637 case "$MOZ_WIDGET_TOOLKIT" in
5638 beos|windows|os2|mac|cocoa)
5639     ;;
5641     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
5642        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
5643     fi
5644     ;;
5645 esac
5647 MOZ_ARG_ENABLE_STRING(image-decoders,
5648 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5649                           Enable specific image decoders],
5650 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5651     if test "$option" = "yes" || test "$option" = "all"; then
5652         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5653     elif test "$option" = "no" || test "$option" = "none"; then
5654         MOZ_IMG_DECODERS=""
5655     elif test "$option" = "default"; then
5656         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5657     elif test `echo "$option" | grep -c \^-` != 0; then
5658         option=`echo $option | sed 's/^-//'`
5659         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5660     else
5661         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5662     fi
5663 done],
5664     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5666 dnl Dupes are removed in the encoder section because it will also add decoders
5668 dnl ========================================================
5669 dnl Image encoders
5670 dnl ========================================================
5671 MOZ_ARG_ENABLE_STRING(image-encoders,
5672 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5673                           Enable specific image encoders],
5674 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5675     if test "$option" = "yes" || test "$option" = "all"; then
5676         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5677     elif test "$option" = "no" || test "$option" = "none"; then
5678         MOZ_IMG_ENCODERS=""
5679         addencoder=""
5680     elif test "$option" = "default"; then
5681         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5682     elif test `echo "$option" | grep -c \^-` != 0; then
5683         option=`echo $option | sed 's/^-//'`
5684         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5685     else
5686         addencoder="$option"
5687     fi
5688     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5689 done],
5690     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5692 dnl Remove dupes
5693 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5694 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5696 dnl ========================================================
5697 dnl MathML on by default
5698 dnl ========================================================
5699 MOZ_ARG_DISABLE_BOOL(mathml,
5700 [  --disable-mathml        Disable MathML support],
5701     MOZ_MATHML=,
5702     MOZ_MATHML=1 )
5703 if test "$MOZ_MATHML"; then
5704   AC_DEFINE(MOZ_MATHML)
5707 dnl ========================================================
5708 dnl Canvas
5709 dnl ========================================================
5710 MOZ_ARG_DISABLE_BOOL(canvas,
5711 [  --disable-canvas          Disable html:canvas feature],
5712     MOZ_ENABLE_CANVAS=,
5713     MOZ_ENABLE_CANVAS=1 )
5714 if test -n "$MOZ_ENABLE_CANVAS"; then
5715     AC_DEFINE(MOZ_ENABLE_CANVAS)
5717 AC_SUBST(MOZ_ENABLE_CANVAS)
5719 dnl ========================================================
5720 dnl SVG
5721 dnl ========================================================
5722 MOZ_ARG_DISABLE_BOOL(svg,
5723 [  --disable-svg            Disable SVG support],
5724     MOZ_SVG=,
5725     MOZ_SVG=1 )
5726 if test -n "$MOZ_SVG"; then
5727   AC_DEFINE(MOZ_SVG)
5730 dnl ========================================================
5731 dnl Installer
5732 dnl ========================================================
5733 case "$target_os" in
5734     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5735         MOZ_INSTALLER=1
5736         ;;
5737 esac
5739 MOZ_ARG_DISABLE_BOOL(installer,
5740 [  --disable-installer     Disable building of installer],
5741     MOZ_INSTALLER=,
5742     MOZ_INSTALLER=1 )
5743 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5744     # Disable installer for Windows builds that use the new toolkit if NSIS
5745     # isn't in the path.
5746     AC_PATH_PROGS(MAKENSIS, makensis)
5747     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5748         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5749     fi
5750     # The Windows build for NSIS requires the iconv command line utility to
5751     # convert the charset of the locale files.
5752     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5753     if test -z "$HOST_ICONV"; then
5754         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5755     fi
5758 # Automatically disable installer if xpinstall isn't built
5759 if test -z "$MOZ_XPINSTALL"; then
5760     MOZ_INSTALLER=
5762 AC_SUBST(MOZ_INSTALLER)
5764 AC_MSG_CHECKING([for tar archiver])
5765 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5766 if test -z "$TAR"; then
5767     AC_MSG_ERROR([no tar archiver found in \$PATH])
5769 AC_MSG_RESULT([$TAR])
5770 AC_SUBST(TAR)
5772 AC_MSG_CHECKING([for wget])
5773 AC_CHECK_PROGS(WGET, wget, "")
5774 AC_MSG_RESULT([$WGET])
5775 AC_SUBST(WGET)
5777 dnl ========================================================
5778 dnl Updater
5779 dnl ========================================================
5781 MOZ_ARG_DISABLE_BOOL(updater,
5782 [  --disable-updater       Disable building of updater],
5783     MOZ_UPDATER=,
5784     MOZ_UPDATER=1 )
5785 # The Windows build requires the iconv command line utility
5786 # in order to build the updater.
5787 case "$target_os" in
5788     msvc*|mks*|cygwin*|mingw*|wince*)
5789         if test -n "$MOZ_UPDATER"; then
5790             AC_MSG_CHECKING([for iconv])
5791             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5792             if test -z "$HOST_ICONV"; then
5793                 AC_MSG_ERROR([iconv not found in \$PATH])
5794             fi
5795         fi
5796         ;;
5797 esac
5798 AC_SUBST(MOZ_UPDATER)
5800 # app update channel is 'default' when not supplied.
5801 MOZ_ARG_ENABLE_STRING([update-channel],
5802 [  --enable-update-channel=CHANNEL
5803                            Select application update channel (default=default)],
5804     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5806 if test -z "$MOZ_UPDATE_CHANNEL"; then
5807     MOZ_UPDATE_CHANNEL=default
5809 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5811 # tools/update-packaging is not checked out by default.
5812 MOZ_ARG_ENABLE_BOOL(update-packaging,
5813 [  --enable-update-packaging
5814                            Enable tools/update-packaging],
5815     MOZ_UPDATE_PACKAGING=1,
5816     MOZ_UPDATE_PACKAGING= )
5817 AC_SUBST(MOZ_UPDATE_PACKAGING)
5819 dnl ========================================================
5820 dnl ActiveX
5821 dnl ========================================================
5823 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5824 [  --disable-xpconnect-idispatch
5825                           Disable building of xpconnect support for IDispatch
5826                           (win32 only)],
5827     XPC_IDISPATCH_SUPPORT=,
5828     XPC_IDISPATCH_SUPPORT=1)
5829 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5831 MOZ_ARG_DISABLE_BOOL(activex,
5832 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5833     MOZ_NO_ACTIVEX_SUPPORT=1,
5834     MOZ_NO_ACTIVEX_SUPPORT= )
5835 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5837 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5838 [  --disable-activex-scripting
5839                           Disable building of ActiveX scripting support (win32)],
5840     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5841     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5842 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5844 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5845 then
5846     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5849 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5850 case "$target" in
5851 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5852     if test "$ac_cv_header_atlbase_h" = "no"; then
5853         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.])
5854     fi
5855     ;;
5856 esac
5859 dnl ========================================================
5860 dnl leaky
5861 dnl ========================================================
5862 MOZ_ARG_ENABLE_BOOL(leaky,
5863 [  --enable-leaky          Build leaky memory tool],
5864     MOZ_LEAKY=1,
5865     MOZ_LEAKY=)
5868 dnl ========================================================
5869 dnl xpctools
5870 dnl ========================================================
5871 MOZ_ARG_ENABLE_BOOL(xpctools,
5872 [  --enable-xpctools       Build JS profiling tool],
5873     MOZ_XPCTOOLS=1,
5874     MOZ_XPCTOOLS= )
5877 dnl ========================================================
5878 dnl build the tests by default
5879 dnl ========================================================
5880 MOZ_ARG_DISABLE_BOOL(tests,
5881 [  --disable-tests         Do not build test libraries & programs],
5882     ENABLE_TESTS=,
5883     ENABLE_TESTS=1 )
5885 dnl ========================================================
5886 dnl parental controls (for Windows Vista)
5887 dnl ========================================================
5888 MOZ_ARG_DISABLE_BOOL(parental-controls,
5889 [  --disable-parental-controls
5890                            Do not build parental controls],
5891    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5892    MOZ_DISABLE_PARENTAL_CONTROLS=)
5893 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5894     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5897 dnl ========================================================
5898 dnl Vista SDK specific api
5899 dnl ========================================================
5900 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
5901 [  --disable-vista-sdk-requirements
5902                            Do not build Vista SDK specific code],
5903    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
5904    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
5905 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
5906     AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
5907     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5908     if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5909         AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5910     fi
5911     MOZ_DISABLE_PARENTAL_CONTROLS=1
5912 else
5913 case "$target" in
5914 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5915     if test "$ac_cv_header_wpcapi_h" = "no"; then
5916         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.])
5917     fi
5918     ;;
5919 esac
5921 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5922 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5924 dnl ========================================================
5925 dnl =
5926 dnl = Module specific options
5927 dnl =
5928 dnl ========================================================
5929 MOZ_ARG_HEADER(Individual module options)
5931 dnl ========================================================
5932 dnl = Enable Lea malloc in xpcom. OFF by default.
5933 dnl ========================================================
5934 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
5935 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
5936     XPCOM_USE_LEA=1,
5937     XPCOM_USE_LEA= )
5938 if test -n "$XPCOM_USE_LEA"; then
5939     AC_DEFINE(XPCOM_USE_LEA)
5942 dnl ========================================================
5943 dnl = Enable places (new history/bookmarks)
5944 dnl ========================================================
5945 MOZ_ARG_ENABLE_BOOL(places,
5946 [  --enable-places        Enable 'places' bookmark/history implementation],
5947     MOZ_PLACES=1,
5948     MOZ_PLACES= )
5949 if test -n "$MOZ_PLACES"; then
5950     AC_DEFINE(MOZ_PLACES)
5951     if test -z "$MOZ_MAIL_NEWS"; then
5952       MOZ_MORK=
5953     fi
5954     MOZ_MORKREADER=1
5955 else
5956   if test "$MOZ_BUILD_APP" = "browser"; then
5957     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5958   fi
5961 dnl ========================================================
5962 dnl = Disable feed handling components
5963 dnl ========================================================
5964 MOZ_ARG_DISABLE_BOOL(feeds,
5965 [  --disable-feeds        Disable feed handling and processing components],
5966     MOZ_FEEDS=,
5967     MOZ_FEEDS=1 )
5968 if test -n "$MOZ_FEEDS"; then
5969     AC_DEFINE(MOZ_FEEDS)
5970 else
5971     if test "$MOZ_BUILD_APP" = "browser"; then
5972         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
5973     fi
5976 dnl ========================================================
5977 dnl = Enable mozStorage
5978 dnl ========================================================
5979 dnl Implicitly enabled by default if building calendar or places
5980 MOZ_ARG_ENABLE_BOOL(storage,
5981 [  --enable-storage        Enable mozStorage module and related components],
5982     MOZ_STORAGE=1,
5983     MOZ_STORAGE= )
5984 if test -n "$MOZ_STORAGE"; then
5985     AC_DEFINE(MOZ_STORAGE)
5988 dnl ========================================================
5989 dnl Check for sqlite
5990 dnl ========================================================
5992 MOZ_NATIVE_SQLITE=
5993 MOZ_ARG_ENABLE_BOOL(system-sqlite,
5994 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
5995 MOZ_NATIVE_SQLITE=1,
5996 MOZ_NATIVE_SQLITE= )
5998 if test -z "$MOZ_NATIVE_SQLITE"
5999 then
6000     SQLITE_CFLAGS=
6001     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6002 else
6003     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6006 AC_SUBST(MOZ_NATIVE_SQLITE)
6008 dnl ========================================================
6009 dnl = Enable help viewer (off by default)
6010 dnl ========================================================
6011 MOZ_ARG_ENABLE_BOOL(help-viewer,
6012 [  --enable-help-viewer        Enable help viewer],
6013     MOZ_HELP_VIEWER=1,
6014     MOZ_HELP_VIEWER= )
6015 if test -n "$MOZ_HELP_VIEWER"; then
6016      AC_DEFINE(MOZ_HELP_VIEWER)
6018 AC_SUBST(MOZ_HELP_VIEWER)
6019 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6020     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6023 dnl ========================================================
6024 dnl = Enable safe browsing (anti-phishing)
6025 dnl ========================================================
6026 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6027 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6028     MOZ_SAFE_BROWSING=1,
6029     MOZ_SAFE_BROWSING= )
6030 if test -n "$MOZ_SAFE_BROWSING"; then
6031     AC_DEFINE(MOZ_SAFE_BROWSING)
6033 AC_SUBST(MOZ_SAFE_BROWSING)
6035 dnl ========================================================
6036 dnl = Enable url-classifier
6037 dnl ========================================================
6038 dnl Implicitly enabled by default if building with safe-browsing
6039 if test -n "$MOZ_SAFE_BROWSING"; then
6040     MOZ_URL_CLASSIFIER=1
6042 MOZ_ARG_ENABLE_BOOL(url-classifier,
6043 [  --enable-url-classifier        Enable url classifier module],
6044     MOZ_URL_CLASSIFIER=1,
6045     MOZ_URL_CLASSIFIER= )
6046 if test -n "$MOZ_URL_CLASSIFIER"; then
6047     AC_DEFINE(MOZ_URL_CLASSIFIER)
6049 AC_SUBST(MOZ_URL_CLASSIFIER)
6051 dnl ========================================================
6052 dnl = Disable zipwriter
6053 dnl ========================================================
6054 MOZ_ARG_DISABLE_BOOL(zipwriter,
6055 [  --disable-zipwriter             Disable zipwriter component],
6056     MOZ_ZIPWRITER=,
6057     MOZ_ZIPWRITER=1 )
6058 AC_SUBST(MOZ_ZIPWRITER)
6060 dnl ========================================================
6061 dnl = Enable Ultrasparc specific optimizations for JS
6062 dnl ========================================================
6063 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6064 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6065     JS_ULTRASPARC_OPTS=1,
6066     JS_ULTRASPARC_OPTS= )
6068 dnl only enable option for ultrasparcs
6069 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6070     "$OS_TEST" != "sun4u"; then
6071     JS_ULTRASPARC_OPTS=
6073 AC_SUBST(JS_ULTRASPARC_OPTS)
6075 dnl ========================================================
6076 dnl = Hildon and OSSO checks
6077 dnl ========================================================
6078 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
6079                   MOZ_PLATFORM_HILDON=1,
6080                   MOZ_PLATFORM_HILDON=)
6081 if test $MOZ_PLATFORM_HILDON; then
6082    AC_DEFINE(MOZ_PLATFORM_HILDON)
6084 AC_SUBST(LIBHILDONMIME_CFLAGS)
6085 AC_SUBST(LIBHILDONMIME_LIBS)
6087 PKG_CHECK_MODULES(LIBOSSO,libosso,
6088                   NS_OSSO=1,
6089                   NS_OSSO=)
6091 if test $NS_OSSO; then
6092     if test -z "$MOZ_ENABLE_DBUS"; then
6093         AC_MSG_ERROR([DBus is required when building for OSSO])
6094     fi
6095     AC_DEFINE(NS_OSSO)     
6097 AC_SUBST(LIBOSSO_CFLAGS)
6098 AC_SUBST(LIBOSSO_LIBS)
6100 PKG_CHECK_MODULES(MOZ_LOCATION, [liblocation gpsbt],
6101                   NS_MAEMO_LOCATION=1,
6102                   NS_MAEMO_LOCATION=)
6104 if test $NS_MAEMO_LOCATION; then
6105   AC_DEFINE(NS_MAEMO_LOCATION)
6108 AC_SUBST(MOZ_LOCATION_CFLAGS)
6109 AC_SUBST(MOZ_LOCATION_LIBS)
6111 dnl ========================================================
6112 dnl =
6113 dnl = Feature options that require extra sources to be pulled
6114 dnl =
6115 dnl ========================================================
6116 dnl MOZ_ARG_HEADER(Features that require extra sources)
6118 dnl ========================================================
6119 dnl =
6120 dnl = Debugging Options
6121 dnl = 
6122 dnl ========================================================
6123 MOZ_ARG_HEADER(Debugging and Optimizations)
6125 dnl ========================================================
6126 dnl = Disable building with debug info.
6127 dnl = Debugging is OFF by default
6128 dnl ========================================================
6129 if test -z "$MOZ_DEBUG_FLAGS"
6130 then
6131     case "$target" in
6132     *-irix*)
6133         if test "$GNU_CC"; then
6134             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6135             case "$GCC_VERSION" in
6136             2.95.*)
6137                 MOZ_DEBUG_FLAGS=""
6138                 ;;
6139             *)
6140                 MOZ_DEBUG_FLAGS="-g"
6141                 ;;
6142             esac
6143         else
6144             MOZ_DEBUG_FLAGS="-g"
6145         fi
6146         ;;
6147     *)
6148         MOZ_DEBUG_FLAGS="-g"
6149         ;;
6150     esac
6153 MOZ_ARG_ENABLE_STRING(debug,
6154 [  --enable-debug[=DBG]    Enable building with developer debug info
6155                           (Using compiler flags DBG)],
6156 [ if test "$enableval" != "no"; then
6157     MOZ_DEBUG=1
6158     if test -n "$enableval" && test "$enableval" != "yes"; then
6159         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6160     fi
6161   else
6162     MOZ_DEBUG=
6163   fi ],
6164   MOZ_DEBUG=)
6166 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6167  case "${target_os}" in
6168     beos*)
6169         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6170         ;;
6171     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6172         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6173         ;;
6174     *) 
6175         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6176         ;;
6177   esac
6178 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6180 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6182 if test -n "$MOZ_DEBUG"; then
6183     AC_MSG_CHECKING([for valid debug flags])
6184     _SAVE_CFLAGS=$CFLAGS
6185     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6186     AC_TRY_COMPILE([#include <stdio.h>], 
6187         [printf("Hello World\n");],
6188         _results=yes,
6189         _results=no)
6190     AC_MSG_RESULT([$_results])
6191     if test "$_results" = "no"; then
6192         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6193     fi
6194     CFLAGS=$_SAVE_CFLAGS
6197 dnl ========================================================
6198 dnl = Enable code optimization. ON by default.
6199 dnl ========================================================
6200 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6201         MOZ_OPTIMIZE_FLAGS="-O"
6204 MOZ_ARG_ENABLE_STRING(optimize,
6205 [  --disable-optimize      Disable compiler optimization
6206   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6207 [ if test "$enableval" != "no"; then
6208     MOZ_OPTIMIZE=1
6209     if test -n "$enableval" && test "$enableval" != "yes"; then
6210         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6211         MOZ_OPTIMIZE=2
6212     fi
6213 else
6214     MOZ_OPTIMIZE=
6215 fi ], MOZ_OPTIMIZE=1)
6217 if test "$COMPILE_ENVIRONMENT"; then
6218 if test -n "$MOZ_OPTIMIZE"; then
6219     AC_MSG_CHECKING([for valid optimization flags])
6220     _SAVE_CFLAGS=$CFLAGS
6221     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6222     AC_TRY_COMPILE([#include <stdio.h>], 
6223         [printf("Hello World\n");],
6224         _results=yes,
6225         _results=no)
6226     AC_MSG_RESULT([$_results])
6227     if test "$_results" = "no"; then
6228         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6229     fi
6230     CFLAGS=$_SAVE_CFLAGS
6232 fi # COMPILE_ENVIRONMENT
6234 AC_SUBST(MOZ_OPTIMIZE)
6235 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6236 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6237 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6239 dnl ========================================================
6240 dnl = Enable/disable debug for specific modules only
6241 dnl =   module names beginning with ^ will be disabled 
6242 dnl ========================================================
6243 MOZ_ARG_ENABLE_STRING(debug-modules,
6244 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6245 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6247 dnl ========================================================
6248 dnl = Enable/disable generation of debugger info for specific modules only
6249 dnl =    the special module name ALL_MODULES can be used to denote all modules
6250 dnl =    module names beginning with ^ will be disabled
6251 dnl ========================================================
6252 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6253 [  --enable-debugger-info-modules
6254                           Enable/disable debugger info for specific modules],
6255 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6256       dnl note that the list of module names is reversed as it is copied
6257       dnl this is important, as it will allow config.mk to interpret stuff like
6258       dnl "^ALL_MODULES xpcom" properly
6259       if test "$i" = "no"; then
6260         i="^ALL_MODULES"
6261       fi
6262       if test "$i" = "yes"; then
6263         i="ALL_MODULES"
6264       fi
6265       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6266     done ])
6268 dnl ========================================================
6269 dnl Enable garbage collector
6270 dnl ========================================================
6271 MOZ_ARG_ENABLE_BOOL(boehm,
6272 [  --enable-boehm          Enable the Boehm Garbage Collector],
6273     GC_LEAK_DETECTOR=1,
6274     GC_LEAK_DETECTOR= )
6275 if test -n "$GC_LEAK_DETECTOR"; then
6276     AC_DEFINE(GC_LEAK_DETECTOR)
6279 dnl ========================================================
6280 dnl Disable runtime logging checks
6281 dnl ========================================================
6282 MOZ_ARG_DISABLE_BOOL(logging,
6283 [  --disable-logging       Disable logging facilities],
6284     NS_DISABLE_LOGGING=1,
6285     NS_DISABLE_LOGGING= )
6286 if test "$NS_DISABLE_LOGGING"; then
6287     AC_DEFINE(NS_DISABLE_LOGGING)
6288 else
6289     AC_DEFINE(MOZ_LOGGING)
6292 dnl ========================================================
6293 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6294 dnl ========================================================
6295 _ENABLE_LOGREFCNT=42
6296 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6297 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6298     _ENABLE_LOGREFCNT=1,
6299     _ENABLE_LOGREFCNT= )
6300 if test "$_ENABLE_LOGREFCNT" = "1"; then
6301     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6302 elif test -z "$_ENABLE_LOGREFCNT"; then
6303     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6306 dnl ========================================================
6307 dnl = Enable trace malloc
6308 dnl ========================================================
6309 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6310 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6311 [  --enable-trace-malloc   Enable malloc tracing],
6312     NS_TRACE_MALLOC=1,
6313     NS_TRACE_MALLOC= )
6314 if test "$NS_TRACE_MALLOC"; then
6315   # Please, Mr. Linker Man, don't take away our symbol names
6316   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6317   USE_ELF_DYNSTR_GC=
6318   AC_DEFINE(NS_TRACE_MALLOC)
6320 AC_SUBST(NS_TRACE_MALLOC)
6322 dnl ========================================================
6323 dnl = Enable jemalloc
6324 dnl ========================================================
6325 MOZ_ARG_ENABLE_BOOL(jemalloc,
6326 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6327     MOZ_MEMORY=1,
6328     MOZ_MEMORY=)
6330 if test "$NS_TRACE_MALLOC"; then
6331     MOZ_MEMORY=
6334 if test "$MOZ_MEMORY"; then
6336   dnl Don't try to run compiler tests on Windows  
6337   if test "$OS_ARCH" = "WINNT"; then
6338     if test -z "$HAVE_64BIT_OS"; then
6339       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6340     else
6341       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6342     fi
6343   else
6344     AC_CHECK_SIZEOF([int *], [4])
6345     case "${ac_cv_sizeof_int_p}" in
6346     4)
6347       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6348       ;;
6349     8)
6350       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6351       ;;
6352     *)
6353       AC_MSG_ERROR([Unexpected pointer size])
6354       ;;
6355     esac
6356   fi
6358   AC_DEFINE(MOZ_MEMORY)
6359   if test "x$MOZ_DEBUG" = "x1"; then
6360     AC_DEFINE(MOZ_MEMORY_DEBUG)
6361   fi
6362   dnl The generic feature tests that determine how to compute ncpus are long and
6363   dnl complicated.  Therefore, simply define special cpp variables for the
6364   dnl platforms we have special knowledge of.
6365   case "${target_os}" in
6366   darwin*)
6367     AC_DEFINE(MOZ_MEMORY_DARWIN)
6368     ;;
6369   *-freebsd*)
6370     AC_DEFINE(MOZ_MEMORY_BSD)
6371     ;;
6372   *linux*)
6373     AC_DEFINE(MOZ_MEMORY_LINUX)
6374     ;;
6375   netbsd*)
6376     AC_DEFINE(MOZ_MEMORY_BSD)
6377     ;;
6378   solaris*)
6379     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6380     ;;
6381   msvc*|mks*|cygwin*|mingw*)
6382     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6383     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6384     dnl will fail miserably
6385     if test "$_CC_SUITE" -lt "8"; then
6386         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6387     fi
6388     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6389       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6390         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.])
6391       else
6392         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6393       fi
6394     fi
6395     if test -z "$WIN32_CRT_SRC_DIR"; then
6396       # pre-built dll
6397       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6398       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6399     else
6400       # CRT source directory
6401       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6402       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6403       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6404     fi
6405     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6406     dnl are to avoid m4
6407     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6408     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6409     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6410     dnl This needs to be unix style.
6411     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6412     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6413     AC_DEFINE(_STATIC_CPPLIB)
6414     dnl Don't generate a manifest, since we're linking to a custom CRT.
6415     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6416     dnl Also pass this to NSPR/NSS
6417     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6418     export DLLFLAGS
6419     ;;
6420   *)
6421     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6422     ;;
6423   esac
6425   AC_ARG_WITH([valgrind],
6426     [  --with-valgrind         Enable valgrind integration hooks],
6427     [enable_valgrind="yes"], [enable_valgrind="no"])
6428   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6429   if test "x$enable_valgrind" = "xyes" ; then
6430     AC_DEFINE(MOZ_VALGRIND)
6431   fi
6433 AC_SUBST(MOZ_MEMORY)
6434 AC_SUBST(WIN32_CRT_SRC_DIR)
6435 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6436 AC_SUBST(MOZ_LIB)
6437 AC_SUBST(MOZ_PATH)
6438 dnl Need to set this for make because NSS doesn't have configure
6439 AC_SUBST(DLLFLAGS)
6441 dnl ========================================================
6442 dnl = Use malloc wrapper lib
6443 dnl ========================================================
6444 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6445 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6446     _WRAP_MALLOC=1,
6447     _WRAP_MALLOC= )
6449 if test -n "$_WRAP_MALLOC"; then
6450     if test "$GNU_CC"; then
6451     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"
6452     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6453     fi
6456 dnl ========================================================
6457 dnl = Location of malloc wrapper lib
6458 dnl ========================================================
6459 MOZ_ARG_WITH_STRING(wrap-malloc,
6460 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6461     WRAP_MALLOC_LIB=$withval)
6463 dnl ========================================================
6464 dnl = Use Electric Fence
6465 dnl ========================================================
6466 MOZ_ARG_ENABLE_BOOL(efence,
6467 [  --enable-efence         Link with Electric Fence],
6468     _ENABLE_EFENCE=1,
6469     _ENABLE_EFENCE= )
6470 if test -n "$_ENABLE_EFENCE"; then
6471     AC_CHECK_LIB(efence,malloc)
6474 dnl ========================================================
6475 dnl jprof
6476 dnl ========================================================
6477 MOZ_ARG_ENABLE_BOOL(jprof,
6478 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6479     MOZ_JPROF=1,
6480     MOZ_JPROF= )
6481 if test -n "$MOZ_JPROF"; then
6482     AC_DEFINE(MOZ_JPROF)
6485 dnl ========================================================
6486 dnl shark
6487 dnl ========================================================
6488 MOZ_ARG_ENABLE_BOOL(shark,
6489 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6490     MOZ_SHARK=1,
6491     MOZ_SHARK= )
6492 if test -n "$MOZ_SHARK"; then
6493     AC_DEFINE(MOZ_SHARK)
6496 dnl ========================================================
6497 dnl callgrind
6498 dnl ========================================================
6499 MOZ_ARG_ENABLE_BOOL(callgrind,
6500 [  --enable-callgrind      Enable callgrind profiling],
6501     MOZ_CALLGRIND=1,
6502     MOZ_CALLGRIND= )
6503 if test -n "$MOZ_CALLGRIND"; then
6504     AC_DEFINE(MOZ_CALLGRIND)
6507 dnl ========================================================
6508 dnl vtune
6509 dnl ========================================================
6510 MOZ_ARG_ENABLE_BOOL(vtune,
6511 [  --enable-vtune          Enable vtune profiling],
6512     MOZ_VTUNE=1,
6513     MOZ_VTUNE= )
6514 if test -n "$MOZ_VTUNE"; then
6515     AC_DEFINE(MOZ_VTUNE)
6518 dnl ========================================================
6519 dnl = Enable static checking using gcc-dehydra
6520 dnl ========================================================
6522 MOZ_ARG_WITH_STRING(static-checking,
6523 [  --with-static-checking=path/to/gcc_dehydra.so
6524                             Enable static checking of code using GCC-dehydra],
6525     DEHYDRA_PATH=$withval,
6526     DEHYDRA_PATH= )
6528 if test -n "$DEHYDRA_PATH"; then
6529     if ! test -f "$DEHYDRA_PATH"; then
6530         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6531     fi
6532     AC_DEFINE(NS_STATIC_CHECKING)
6534 AC_SUBST(DEHYDRA_PATH)
6536 dnl ========================================================
6537 dnl = Enable stripping of libs & executables
6538 dnl ========================================================
6539 MOZ_ARG_ENABLE_BOOL(strip,
6540 [  --enable-strip          Enable stripping of libs & executables ],
6541     ENABLE_STRIP=1,
6542     ENABLE_STRIP= )
6544 dnl ========================================================
6545 dnl = Enable stripping of libs & executables when packaging
6546 dnl ========================================================
6547 MOZ_ARG_ENABLE_BOOL(install-strip,
6548 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6549     PKG_SKIP_STRIP= ,
6550     PKG_SKIP_STRIP=1)
6552 dnl ========================================================
6553 dnl = --enable-elf-dynstr-gc
6554 dnl ========================================================
6555 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6556 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6557     USE_ELF_DYNSTR_GC=1,
6558     USE_ELF_DYNSTR_GC= )
6560 dnl ========================================================
6561 dnl = --enable-old-abi-compat-wrappers
6562 dnl ========================================================
6563 dnl on x86 linux, the current builds of some popular plugins (notably
6564 dnl flashplayer and real) expect a few builtin symbols from libgcc
6565 dnl which were available in some older versions of gcc.  However,
6566 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6567 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6568 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6569 dnl to true on x86 linux, and false everywhere else.
6572 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6573 [  --enable-old-abi-compat-wrappers
6574                           Support old GCC ABI symbols to ease the pain 
6575                           of the linux compiler change],
6576     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6577     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6578 if test "$COMPILE_ENVIRONMENT"; then
6579 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6580     AC_LANG_SAVE
6581     AC_LANG_CPLUSPLUS
6582     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6583     AC_LANG_RESTORE
6584     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6586 fi # COMPILE_ENVIRONMENT
6588 dnl ========================================================
6589 dnl = --enable-prebinding
6590 dnl ========================================================
6591 MOZ_ARG_ENABLE_BOOL(prebinding,
6592 [  --enable-prebinding     Enable prebinding (Mac OS X only)],
6593     USE_PREBINDING=1,
6594     USE_PREBINDING= )
6596 dnl ========================================================
6597 dnl = 
6598 dnl = Profiling and Instrumenting
6599 dnl = 
6600 dnl ========================================================
6601 MOZ_ARG_HEADER(Profiling and Instrumenting)
6603 dnl ========================================================
6604 dnl = Enable timeline service, which provides lightweight
6605 dnl = instrumentation of mozilla for performance measurement.
6606 dnl = Timeline is off by default.
6607 dnl ========================================================
6608 MOZ_ARG_ENABLE_BOOL(timeline,
6609 [  --enable-timeline       Enable timeline services ],
6610     MOZ_TIMELINE=1,
6611     MOZ_TIMELINE= )
6612 if test -n "$MOZ_TIMELINE"; then
6613     AC_DEFINE(MOZ_TIMELINE)
6616 dnl ========================================================
6617 dnl Turn on reflow counting
6618 dnl ========================================================
6619 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6620 [  --enable-reflow-perf    Enable reflow performance tracing],
6621     MOZ_REFLOW_PERF=1,
6622     MOZ_REFLOW_PERF= )
6623 if test -n "$MOZ_REFLOW_PREF"; then
6624     AC_DEFINE(MOZ_REFLOW_PREF)
6626 AC_SUBST(MOZ_REFLOW_PERF)
6628 dnl ========================================================
6629 dnl Enable performance metrics.
6630 dnl ========================================================
6631 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6632 [  --enable-perf-metrics   Enable performance metrics],
6633     MOZ_PERF_METRICS=1,
6634     MOZ_PERF_METRICS= )
6635 if test -n "$MOZ_PERF_METRICS"; then
6636     AC_DEFINE(MOZ_PERF_METRICS)
6639 dnl ========================================================
6640 dnl Enable code size metrics.
6641 dnl ========================================================
6642 MOZ_ARG_ENABLE_BOOL(codesighs,
6643 [  --enable-codesighs      Enable code size analysis tools],
6644     _ENABLE_CODESIGHS=1,
6645     _ENABLE_CODESIGHS= )
6646 if test -n "$_ENABLE_CODESIGHS"; then
6647     if test -d $srcdir/tools/codesighs; then 
6648         MOZ_MAPINFO=1
6649     else
6650         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6651     fi
6654 dnl ========================================================
6655 dnl = Add support for Eazel profiler
6656 dnl ========================================================
6657 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6658 [  --enable-eazel-profiler-support
6659                           Enable Corel/Eazel profiler support],
6660     ENABLE_EAZEL_PROFILER=1,
6661     ENABLE_EAZEL_PROFILER= )
6662 if test -n "$ENABLE_EAZEL_PROFILER"; then
6663     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6664     USE_ELF_DYNSTR_GC=
6665     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6666     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6667     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6670 MOZ_ARG_ENABLE_STRING(profile-modules,
6671 [  --enable-profile-modules
6672                           Enable/disable profiling for specific modules],
6673 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6675 MOZ_ARG_ENABLE_BOOL(insure,
6676 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6677     _ENABLE_INSURE=1,
6678     _ENABLE_INSURE= )
6679 if test -n "$_ENABLE_INSURE"; then
6680     MOZ_INSURE="insure"
6681     MOZ_INSURIFYING=1
6682     MOZ_INSURE_DIRS="."
6683     MOZ_INSURE_EXCLUDE_DIRS="config"
6686 MOZ_ARG_WITH_STRING(insure-dirs,
6687 [  --with-insure-dirs=DIRS
6688                           Dirs to instrument with insure ],
6689     MOZ_INSURE_DIRS=$withval )
6691 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6692 [  --with-insure-exclude-dirs=DIRS
6693                           Dirs to not instrument with insure ],
6694     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6696 dnl ========================================================
6697 dnl = Support for Quantify (Windows)
6698 dnl ========================================================
6699 MOZ_ARG_ENABLE_BOOL(quantify,
6700 [  --enable-quantify      Enable Quantify support (Windows only) ],
6701     MOZ_QUANTIFY=1,
6702     MOZ_QUANTIFY= )
6704 dnl ========================================================
6705 dnl = Support for demangling undefined symbols
6706 dnl ========================================================
6707 if test -z "$SKIP_LIBRARY_CHECKS"; then
6708     AC_LANG_SAVE
6709     AC_LANG_CPLUSPLUS
6710     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6711     AC_LANG_RESTORE
6714 # Demangle only for debug or trace-malloc builds
6715 MOZ_DEMANGLE_SYMBOLS=
6716 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6717     MOZ_DEMANGLE_SYMBOLS=1
6718     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6720 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6722 dnl ========================================================
6723 dnl = Support for gcc stack unwinding (from gcc 3.3)
6724 dnl ========================================================
6725 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6726     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6729 dnl ========================================================
6730 dnl =
6731 dnl = Misc. Options
6732 dnl = 
6733 dnl ========================================================
6734 MOZ_ARG_HEADER(Misc. Options)
6736 dnl ========================================================
6737 dnl update xterm title
6738 dnl ========================================================
6739 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6740 [  --enable-xterm-updates  Update XTERM titles with current command.],
6741     MOZ_UPDATE_XTERM=1,
6742     MOZ_UPDATE_XTERM= )
6744 dnl =========================================================
6745 dnl = Chrome format
6746 dnl =========================================================
6747 MOZ_ARG_ENABLE_STRING([chrome-format],
6748 [  --enable-chrome-format=jar|flat|both|symlink
6749                           Select FORMAT of chrome files (default=jar)],
6750     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6752 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6753     MOZ_CHROME_FILE_FORMAT=jar
6756 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6757     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6758     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6759     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6760     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6763 dnl ========================================================
6764 dnl = Define default location for MOZILLA_FIVE_HOME
6765 dnl ========================================================
6766 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6767 [  --with-default-mozilla-five-home
6768                           Set the default value for MOZILLA_FIVE_HOME],
6769 [ val=`echo $withval`
6770   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6772 dnl ========================================================
6773 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6774 dnl ========================================================
6775 MOZ_ARG_WITH_STRING(user-appdir,
6776 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6777 [ val=`echo $withval`
6778 if echo "$val" | grep "\/" >/dev/null; then
6779     AC_MSG_ERROR("Homedir must be single relative path.")
6780 else 
6781     MOZ_USER_DIR="$val"
6782 fi])
6784 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6786 dnl ========================================================
6787 dnl = Doxygen configuration
6788 dnl ========================================================
6789 dnl Use commas to specify multiple dirs to this arg
6790 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6791 MOZ_ARG_WITH_STRING(doc-input-dirs,
6792 [  --with-doc-input-dirs=DIRS
6793                           Header/idl dirs to create docs from],
6794 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6795 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6797 dnl Use commas to specify multiple dirs to this arg
6798 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6799 MOZ_ARG_WITH_STRING(doc-include-dirs,
6800 [  --with-doc-include-dirs=DIRS  
6801                           Include dirs to preprocess doc headers],
6802 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6803 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6805 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6806 MOZ_ARG_WITH_STRING(doc-output-dir,
6807 [  --with-doc-output-dir=DIR
6808                           Dir to generate docs into],
6809 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6810 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6812 if test -z "$SKIP_COMPILER_CHECKS"; then
6813 dnl ========================================================
6814 dnl =
6815 dnl = Compiler Options
6816 dnl = 
6817 dnl ========================================================
6818 MOZ_ARG_HEADER(Compiler Options)
6820 dnl ========================================================
6821 dnl Check for gcc -pipe support
6822 dnl ========================================================
6823 AC_MSG_CHECKING([for gcc -pipe support])
6824 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6825     echo '#include <stdio.h>' > dummy-hello.c
6826     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6827     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6828     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6829     if test $? = 0; then
6830         _res_as_stdin="yes"
6831     else
6832         _res_as_stdin="no"
6833     fi
6834     if test "$_res_as_stdin" = "yes"; then
6835         _SAVE_CFLAGS=$CFLAGS
6836         CFLAGS="$CFLAGS -pipe"
6837         AC_TRY_COMPILE( [ #include <stdio.h> ],
6838             [printf("Hello World\n");],
6839             [_res_gcc_pipe="yes"],
6840             [_res_gcc_pipe="no"] )
6841         CFLAGS=$_SAVE_CFLAGS
6842     fi
6843     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6844         _res="yes";
6845         CFLAGS="$CFLAGS -pipe"
6846         CXXFLAGS="$CXXFLAGS -pipe"
6847     else
6848         _res="no"
6849     fi
6850     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6851     AC_MSG_RESULT([$_res])
6852 else
6853     AC_MSG_RESULT([no])
6856 dnl pass -Wno-long-long to the compiler
6857 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6858 [  --enable-long-long-warning 
6859                           Warn about use of non-ANSI long long type],
6860     _IGNORE_LONG_LONG_WARNINGS=,
6861     _IGNORE_LONG_LONG_WARNINGS=1)
6863 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6864      _SAVE_CFLAGS="$CFLAGS"
6865      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6866      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6867      AC_TRY_COMPILE([], [return(0);], 
6868         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6869           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6870           result="yes" ], result="no")
6871      AC_MSG_RESULT([$result])
6872      CFLAGS="$_SAVE_CFLAGS"
6875 dnl ========================================================
6876 dnl Profile guided optimization
6877 dnl ========================================================
6878 dnl Test for profiling options
6879 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6880 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6882 dnl Provide a switch to disable PGO even when called via profiledbuild.
6883 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6884 [  --disable-profile-guided-optimization
6885                            Don't build with PGO even if called via make profiledbuild],
6886 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6887 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6889 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6891 _SAVE_CFLAGS="$CFLAGS"
6892 CFLAGS="$CFLAGS -fprofile-generate"
6894 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6895 AC_TRY_COMPILE([], [return 0;],
6896                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6897                  result="yes" ], result="no")
6898 AC_MSG_RESULT([$result])
6900 if test $result = "yes"; then
6901   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6902   PROFILE_USE_CFLAGS="-fprofile-use"
6903   PROFILE_USE_LDFLAGS="-fprofile-use"
6904 else
6905   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6906   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6907   AC_TRY_COMPILE([], [return 0;],
6908                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6909                    result="yes" ], result="no")
6910   AC_MSG_RESULT([$result])
6911   if test $result = "yes"; then
6912     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6913   fi
6914   # don't really care, this is an old GCC
6915   PROFILE_GEN_LDFLAGS=
6916   PROFILE_USE_LDFLAGS=
6919 CFLAGS="$_SAVE_CFLAGS"
6921 if test -n "$INTEL_CC"; then
6922   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6923   PROFILE_GEN_LDFLAGS=
6924   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6925   PROFILE_USE_LDFLAGS=
6928 dnl Sun Studio on Solaris
6929 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6930   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6931   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6932   if test "$CPU_ARCH" != "sparc"; then
6933     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6934     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6935   else
6936     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6937     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6938   fi
6941 AC_SUBST(PROFILE_GEN_CFLAGS)
6942 AC_SUBST(PROFILE_GEN_LDFLAGS)
6943 AC_SUBST(PROFILE_USE_CFLAGS)
6944 AC_SUBST(PROFILE_USE_LDFLAGS)
6946 AC_LANG_CPLUSPLUS
6948 dnl ========================================================
6949 dnl Test for -pedantic bustage
6950 dnl ========================================================
6951 MOZ_ARG_DISABLE_BOOL(pedantic,
6952 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6953 _PEDANTIC= )
6954 if test "$_PEDANTIC"; then
6955     _SAVE_CXXFLAGS=$CXXFLAGS
6956     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6957     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6958     AC_TRY_COMPILE([$configure_static_assert_macros],
6959                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6960                    result="no", result="yes" )
6961     AC_MSG_RESULT([$result])
6962     CXXFLAGS="$_SAVE_CXXFLAGS"
6964     case "$result" in
6965     no)
6966         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6967         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6968         ;;
6969     yes)
6970         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
6971         ;;
6972     esac
6975 dnl ========================================================
6976 dnl Test for correct temporary object destruction order
6977 dnl ========================================================
6978 dnl We want to make sure the compiler follows the C++ spec here as 
6979 dnl xpcom and the string classes depend on it (bug 235381).
6980 AC_MSG_CHECKING([for correct temporary object destruction order])
6981 AC_TRY_RUN([ class A {
6982              public:  A(int& x) : mValue(x) {}
6983                       ~A() { mValue--; }
6984                       operator char**() { return 0; }
6985              private:  int& mValue;
6986              };
6987              void func(char **arg) {}
6988              int m=2;
6989              void test() {
6990                   func(A(m));
6991                   if (m==1) m = 0;
6992              }
6993              int main() {
6994                  test();
6995                  return(m);
6996              }
6997              ],
6998      result="yes", result="no", result="maybe")
6999 AC_MSG_RESULT([$result])
7001 if test "$result" = "no"; then
7002     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7005 dnl ========================================================
7006 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7007 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7008 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7009 dnl ========================================================
7010 _SAVE_CXXFLAGS=$CXXFLAGS
7011 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7012 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7013     ac_nscap_nonconst_opeq_bug,
7014     [AC_TRY_COMPILE([
7015                       template <class T>
7016                       class Pointer
7017                         {
7018                         public:
7019                           T* myPtr;
7020                         };
7021                       
7022                       template <class T, class U>
7023                       int operator==(const Pointer<T>& rhs, U* lhs)
7024                         {
7025                           return rhs.myPtr == lhs;
7026                         }
7027                       
7028                       template <class T, class U>
7029                       int operator==(const Pointer<T>& rhs, const U* lhs)
7030                         {
7031                           return rhs.myPtr == lhs;
7032                         }
7033                     ],
7034                     [
7035                       Pointer<int> foo;
7036                       const int* bar;
7037                       return foo == bar;
7038                     ],
7039                     ac_nscap_nonconst_opeq_bug="no",
7040                     ac_nscap_nonconst_opeq_bug="yes")])
7041 CXXFLAGS="$_SAVE_CXXFLAGS"
7043 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7044     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7046 fi # SKIP_COMPILER_CHECKS
7048 dnl ========================================================
7049 dnl C++ rtti
7050 dnl Should be smarter and check that the compiler does indeed have rtti
7051 dnl ========================================================
7052 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7053 [  --enable-cpp-rtti       Enable C++ RTTI ],
7054 [ _MOZ_USE_RTTI=1 ],
7055 [ _MOZ_USE_RTTI= ])
7057 if test "$_MOZ_USE_RTTI"; then
7058    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7059 else
7060    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7063 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7065 dnl ========================================================
7066 dnl C++ exceptions (g++/egcs only - for now)
7067 dnl Should be smarter and check that the compiler does indeed have exceptions
7068 dnl ========================================================
7069 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7070 [  --enable-cpp-exceptions Enable C++ exceptions ],
7071 [ _MOZ_CPP_EXCEPTIONS=1 ],
7072 [ _MOZ_CPP_EXCEPTIONS= ])
7074 if test "$_MOZ_CPP_EXCEPTIONS"; then
7075     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7076 else
7077     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7080 # Irix & OSF native compilers do not like exception declarations 
7081 # when exceptions are disabled
7082 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7083     AC_DEFINE(CPP_THROW_NEW, [])
7084 else
7085     AC_DEFINE(CPP_THROW_NEW, [throw()])
7087 AC_LANG_C
7089 dnl ========================================================
7090 dnl =
7091 dnl = Build depencency options
7092 dnl =
7093 dnl ========================================================
7094 MOZ_ARG_HEADER(Build dependencies)
7096 dnl ========================================================
7097 dnl = Do not auto generate dependency info
7098 dnl ========================================================
7099 MOZ_AUTO_DEPS=1
7100 MOZ_ARG_DISABLE_BOOL(auto-deps,
7101 [  --disable-auto-deps     Do not automatically generate dependency info],
7102     MOZ_AUTO_DEPS=,
7103     MOZ_AUTO_DEPS=1)
7105 if test -n "$MOZ_AUTO_DEPS"; then
7106 dnl ========================================================
7107 dnl = Use mkdepend instead of $CC -MD for dependency generation
7108 dnl ========================================================
7109 _cpp_md_flag=
7110 MOZ_ARG_DISABLE_BOOL(md,
7111 [  --disable-md            Do not use compiler-based dependencies ],
7112   [_cpp_md_flag=],
7113   [_cpp_md_flag=1],
7114   [dnl Default is to turn on -MD if using GNU-compatible compilers
7115    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7116      _cpp_md_flag=1
7117    fi
7118   dnl Default is to use -xM if using Sun Studio on Solaris
7119    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7120      _cpp_md_flag=1
7121    fi])
7122 if test "$_cpp_md_flag"; then
7123   COMPILER_DEPEND=1
7124   if test "$OS_ARCH" = "OpenVMS"; then
7125     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7126   else
7127     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7128   fi
7129   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7130   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7131     _DEPEND_CFLAGS=
7132   fi
7133 else
7134   COMPILER_DEPEND=
7135   _USE_CPP_INCLUDE_FLAG=
7136   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7137   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7139 fi # MOZ_AUTO_DEPS
7140 MDDEPDIR='.deps'
7141 AC_SUBST(MOZ_AUTO_DEPS)
7142 AC_SUBST(COMPILER_DEPEND)
7143 AC_SUBST(MDDEPDIR)
7146 dnl ========================================================
7147 dnl =
7148 dnl = Static Build Options
7149 dnl =
7150 dnl ========================================================
7151 MOZ_ARG_HEADER(Static build options)
7153 MOZ_ARG_ENABLE_BOOL(static,
7154 [  --enable-static         Enable building of internal static libs],
7155     BUILD_STATIC_LIBS=1,
7156     BUILD_STATIC_LIBS=)
7158 dnl Disable libxul in debug builds, but not for xulrunner.
7159 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7160    MOZ_ENABLE_LIBXUL=
7163 MOZ_ARG_ENABLE_BOOL(libxul,
7164 [  --enable-libxul         Enable building of libxul],
7165     MOZ_ENABLE_LIBXUL=1,
7166     MOZ_ENABLE_LIBXUL=)
7168 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7169         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7172 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7173         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7176 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
7177         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
7180 if test -n "$MOZ_ENABLE_LIBXUL"; then
7181     XPCOM_LIBS="$LIBXUL_LIBS"
7182     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7183 else
7184     if test -n "$BUILD_STATIC_LIBS"; then
7185         AC_DEFINE(MOZ_STATIC_BUILD)
7186     fi
7187     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7190 dnl ========================================================
7191 dnl = Force JS to be a static lib
7192 dnl ========================================================
7193 MOZ_ARG_ENABLE_BOOL(js-static-build,
7194 [  --enable-js-static-build  Force js to be a static lib],
7195     JS_STATIC_BUILD=1,
7196     JS_STATIC_BUILD= )
7198 AC_SUBST(JS_STATIC_BUILD)
7199         
7200 if test -n "$JS_STATIC_BUILD"; then
7201     AC_DEFINE(EXPORT_JS_API)
7203 if test -z "$BUILD_STATIC_LIBS"; then
7204     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
7209 dnl ========================================================
7210 dnl =
7211 dnl = Standalone module options
7212 dnl = 
7213 dnl ========================================================
7214 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7216 dnl Check for GLib and libIDL.
7217 dnl ========================================================
7218 case "$target_os" in
7219 msvc*|mks*|cygwin*|mingw*|wince*)
7220     SKIP_IDL_CHECK="yes"
7221     ;;
7223     SKIP_IDL_CHECK="no"
7224     ;;
7225 esac
7227 if test -z "$COMPILE_ENVIRONMENT"; then
7228     SKIP_IDL_CHECK="yes"
7231 dnl = Allow users to disable libIDL checking for standalone modules
7232 MOZ_ARG_WITHOUT_BOOL(libIDL,
7233 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7234         SKIP_IDL_CHECK="yes")
7236 if test "$SKIP_IDL_CHECK" = "no"
7237 then
7238     _LIBIDL_FOUND=
7239     if test "$MACOS_SDK_DIR"; then 
7240       dnl xpidl, and therefore libIDL, is only needed on the build host.
7241       dnl Don't build it against the SDK, as that causes problems.
7242       _MACSAVE_CFLAGS="$CFLAGS"
7243       _MACSAVE_LIBS="$LIBS"
7244       _MACSAVE_LDFLAGS="$LDFLAGS"
7245       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7246       changequote(,)
7247       CFLAGS=`echo $CFLAGS|sed -E -e "s%((-I|-isystem )${MACOS_SDK_DIR}/usr/(include|lib/gcc)[^ ]*)|-F${MACOS_SDK_DIR}(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot ${MACOS_SDK_DIR}%%g"`
7248       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7249       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7250       changequote([,])
7251       unset NEXT_ROOT
7252     fi
7254     if test "$MOZ_ENABLE_GTK2"; then
7255         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7256     fi
7257     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7258     dnl to either libIDL1 or libIDL2.
7259     if test -z "$_LIBIDL_FOUND"; then
7260         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7261         if test -z "$_LIBIDL_FOUND"; then
7262             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7263         fi
7264     fi
7265     dnl
7266     dnl If we don't have a libIDL config program & not cross-compiling, 
7267     dnl     look for orbit-config instead.
7268     dnl
7269     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7270         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7271         if test -n "$ORBIT_CONFIG"; then
7272             AC_MSG_CHECKING([for ORBit libIDL usability])
7273                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7274             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7275             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7276             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7277             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7278             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7279             LIBIDL_CONFIG=
7280             _SAVE_CFLAGS="$CFLAGS"
7281             _SAVE_LIBS="$LIBS"
7282             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7283             LIBS="$LIBIDL_LIBS $LIBS"
7284             AC_TRY_RUN([
7285 #include <stdlib.h>
7286 #include <libIDL/IDL.h>
7287 int main() {
7288   char *s;
7289   s=strdup(IDL_get_libver_string());
7290   if(s==NULL) {
7291     exit(1);
7292   }
7293   exit(0);
7295             ], [_LIBIDL_FOUND=1
7296                 result="yes"],
7297                [LIBIDL_CFLAGS=
7298                 LIBIDL_LIBS=
7299                 result="no"],
7300                [_LIBIDL_FOUND=1
7301                 result="maybe"] )
7302             AC_MSG_RESULT($result)
7303             CFLAGS="$_SAVE_CFLAGS"
7304             LIBS="$_SAVE_LIBS"
7305         fi
7306     fi
7307     if test -z "$_LIBIDL_FOUND"; then
7308         AC_MSG_ERROR([libIDL not found.
7309         libIDL $LIBIDL_VERSION or higher is required.])
7310     fi
7311     if test "$MACOS_SDK_DIR"; then
7312       CFLAGS="$_MACSAVE_CFLAGS"
7313       LIBS="$_MACSAVE_LIBS"
7314       LDFLAGS="$_MACSAVE_LDFLAGS"
7315       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7316         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7317       fi
7318     fi
7321 if test -n "$CROSS_COMPILE"; then
7322      if test -z "$HOST_LIBIDL_CONFIG"; then
7323         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7324     fi
7325     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7326         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7327         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7328     else
7329         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7330         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7331     fi
7334 if test -z "$SKIP_PATH_CHECKS"; then
7335 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7336     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7337         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7338     else
7339         AM_PATH_GLIB(${GLIB_VERSION})
7340     fi
7344 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7345     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7348 AC_SUBST(LIBIDL_CFLAGS)
7349 AC_SUBST(LIBIDL_LIBS)
7350 AC_SUBST(STATIC_LIBIDL)
7351 AC_SUBST(GLIB_CFLAGS)
7352 AC_SUBST(GLIB_LIBS)
7353 AC_SUBST(GLIB_GMODULE_LIBS)
7354 AC_SUBST(HOST_LIBIDL_CONFIG)
7355 AC_SUBST(HOST_LIBIDL_CFLAGS)
7356 AC_SUBST(HOST_LIBIDL_LIBS)
7358 dnl ========================================================
7359 dnl Check for libart
7360 dnl ========================================================
7361 if test "$MOZ_SVG_RENDERER_LIBART"; then
7362   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
7363     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
7364 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
7365   fi
7367   dnl libart's configure hasn't been run yet, but we know what the
7368   dnl answer should be anyway
7369   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
7370   case "$target_os" in
7371   msvc*|mks*|cygwin*|mingw*|wince*)
7372       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
7373       ;;
7374   os2*)
7375       MOZ_LIBART_LIBS='-lmoz_art -lm'
7376       ;;
7377   beos*)
7378       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
7379       ;;
7380   *)
7381       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
7382       ;;
7383   esac
7384   AC_FUNC_ALLOCA
7387 AC_SUBST(MOZ_LIBART_CFLAGS)
7388 AC_SUBST(MOZ_LIBART_LIBS)
7390 dnl ========================================================
7391 dnl Check for cairo
7392 dnl ========================================================
7393 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7395 MOZ_TREE_CAIRO=1
7396 MOZ_ARG_ENABLE_BOOL(system-cairo,
7397 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7398 MOZ_TREE_CAIRO=,
7399 MOZ_TREE_CAIRO=1 )
7401 # Check for headers defining standard int types.
7402 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7404 if test "$MOZ_TREE_CAIRO"; then
7405     AC_DEFINE(MOZ_TREE_CAIRO)
7407     # For now we assume that we will have a uint64_t available through
7408     # one of the above headers or mozstdint.h.
7409     AC_DEFINE(HAVE_UINT64_T)
7411     # Define macros for cairo-features.h
7412     if test "$MOZ_X11"; then
7413         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7414         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7415         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7416         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7417         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7418         MOZ_ENABLE_CAIRO_FT=1
7419         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7420     fi
7421     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7422         QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7423     fi
7424     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7425         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7426         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7427         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7428     fi
7429     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7430         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7431         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7432         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7433     fi
7434     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7435         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7436         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7437         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7438         MOZ_ENABLE_CAIRO_FT=1
7439         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7440         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7441     fi
7442     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7443         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7444         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7445         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7446         MOZ_ENABLE_CAIRO_FT=1
7447     fi
7448     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7449     AC_SUBST(CAIRO_FT_CFLAGS)
7451     if test "$MOZ_DEBUG"; then
7452       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7453     else
7454       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7455     fi
7457     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7459     AC_SUBST(PS_SURFACE_FEATURE)
7460     AC_SUBST(PDF_SURFACE_FEATURE)
7461     AC_SUBST(SVG_SURFACE_FEATURE)
7462     AC_SUBST(XLIB_SURFACE_FEATURE)
7463     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7464     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7465     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7466     AC_SUBST(XCB_SURFACE_FEATURE)
7467     AC_SUBST(WIN32_SURFACE_FEATURE)
7468     AC_SUBST(OS2_SURFACE_FEATURE)
7469     AC_SUBST(BEOS_SURFACE_FEATURE)
7470     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7471     AC_SUBST(FT_FONT_FEATURE)
7472     AC_SUBST(WIN32_FONT_FEATURE)
7473     AC_SUBST(QUARTZ_FONT_FEATURE)
7474     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7475     AC_SUBST(QPAINTER_SURFACE_FEATURE)
7477     if test "$_WIN32_MSVC"; then
7478         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7479     else
7480         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
7482         if test "$MOZ_X11"; then
7483             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7484         fi
7485     fi
7487     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7488     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7490 else
7491    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7492    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7493    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7494    if test "$MOZ_X11"; then
7495         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7496         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7497         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7498    fi
7501 AC_SUBST(MOZ_TREE_CAIRO)
7502 AC_SUBST(MOZ_CAIRO_CFLAGS)
7503 AC_SUBST(MOZ_CAIRO_LIBS)
7505 dnl ========================================================
7506 dnl Check for lcms
7507 dnl ========================================================
7509 MOZ_NATIVE_LCMS=
7510 MOZ_ARG_ENABLE_BOOL(system-lcms,
7511 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7512 MOZ_NATIVE_LCMS=1,
7513 MOZ_NATIVE_LCMS= )
7515 if test -z "$MOZ_NATIVE_LCMS"
7516 then
7517     LCMS_CFLAGS=
7518     if test "$_WIN32_MSVC"; then
7519         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7520             LCMS_CFLAGS=-DLCMS_DLL
7521         fi
7522         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7523     else
7524         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7525     fi
7526 else
7527     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7530 AC_SUBST(MOZ_NATIVE_LCMS)
7531 AC_SUBST(LCMS_CFLAGS)
7532 AC_SUBST(LCMS_LIBS)
7534 dnl ========================================================
7535 dnl disable xul
7536 dnl ========================================================
7537 MOZ_ARG_DISABLE_BOOL(xul,
7538 [  --disable-xul           Disable XUL],
7539     MOZ_XUL= )
7540 if test "$MOZ_XUL"; then
7541   AC_DEFINE(MOZ_XUL)
7542 else
7543   dnl remove extensions that require XUL
7544   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7547 AC_SUBST(MOZ_XUL)
7549 dnl ========================================================
7550 dnl Two ways to enable Python support:
7551 dnl   --enable-extensions=python # select all available.
7552 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7553 dnl or:
7554 dnl   --enable-extensions=python/xpcom,... # select individual ones
7556 dnl If either is used, we locate the Python to use.
7557 dnl ========================================================
7559 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7560 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7561     dnl Allow PYTHON to point to the Python interpreter to use
7562     dnl (note that it must be the python executable - which we
7563     dnl run to locate the relevant paths etc)
7564     dnl If not set, we use whatever Python we can find.
7565     MOZ_PYTHON=$PYTHON
7566     dnl Ask Python what its version number is
7567     changequote(,)
7568     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7569     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7570     changequote([,])
7571     dnl Ask for the Python "prefix" (ie, home/source dir)
7572     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7573     dnl Setup the include and library directories.
7574     if test "$OS_ARCH" = "WINNT"; then
7575         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7576         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7577         dnl Binary trees have "include" for .h, and "libs" for .lib
7578         dnl We add 'em both - along with quotes, to handle spaces.
7579         MOZ_PYTHON_DLL_SUFFIX=.pyd
7580         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7581         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7582     else
7583         dnl Non-Windows include and libs
7584         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7585         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7586         dnl Check for dynamic Python lib
7587         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7588         dnl - core, xpcom loader, pydom etc) all need to share Python.
7589         dnl - Python 2.3's std --enable-shared configure option will
7590         dnl   create a libpython2.3.so.1.0. We should first try this
7591         dnl   dotted versioned .so file because this is the one that
7592         dnl   the PyXPCOM build mechanics tries to link to.
7593         dnl   XXX Should find a better way than hardcoding "1.0".
7594         dnl - Python developement tree dir layouts are NOT allowed here
7595         dnl   because the PyXPCOM build just dies on it later anyway.
7596         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7597         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7598             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7599         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7600             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7601         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7602             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7603         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7604             dnl Don't Python development tree directory layout.
7605             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7606             AC_MSG_ERROR([The Python at $MOZ_PYTHON_PREFIX looks like a dev tree. The PyXPCOM build cannot handle this yet. You must 'make install' Python and use the installed tree.])
7607         elif test "$OS_ARCH" = "Darwin"; then
7608             dnl We do Darwin last, so if a custom non-framework build of
7609             dnl python is used on OSX, then it will be picked up first by
7610             dnl the logic above.
7611             MOZ_PYTHON_LIBS="-framework Python"
7612         else
7613             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7614         fi
7615         if test "$OS_ARCH" = "Linux"; then
7616             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7617         fi
7618     fi
7619     dnl Handle "_d" on Windows
7620     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7621         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7622     else
7623         MOZ_PYTHON_DEBUG_SUFFIX=
7624     fi
7625     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7628 dnl If the user asks for the 'python' extension, then we add
7629 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7630 dnl Note the careful regex - it must match 'python' followed by anything
7631 dnl other than a '/', including the end-of-string.
7632 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7633     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7634         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7635     done
7637 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7638 dnl command-line, but not yet
7639 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7640 AC_SUBST(MOZ_PYTHON)
7641 AC_SUBST(MOZ_PYTHON_PREFIX)
7642 AC_SUBST(MOZ_PYTHON_INCLUDES)
7643 AC_SUBST(MOZ_PYTHON_LIBS)
7644 AC_SUBST(MOZ_PYTHON_VER)
7645 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7646 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7647 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7649 dnl ========================================================
7650 dnl disable profile sharing
7651 dnl ========================================================
7652 MOZ_ARG_DISABLE_BOOL(profilesharing,
7653 [  --disable-profilesharing           Disable profile sharing],
7654     MOZ_PROFILESHARING=,
7655     MOZ_PROFILESHARING=1 )
7656 if test "$MOZ_PROFILESHARING"; then
7657   MOZ_IPCD=1
7658   AC_DEFINE(MOZ_PROFILESHARING)
7661 dnl ========================================================
7662 dnl enable ipc/ipcd
7663 dnl ========================================================
7664 MOZ_ARG_ENABLE_BOOL(ipcd,
7665 [  --enable-ipcd                      Enable IPC daemon],
7666     MOZ_IPCD=1,
7667     MOZ_IPCD= )
7669 dnl ========================================================
7670 dnl disable profile locking
7671 dnl   do no use this in applications that can have more than
7672 dnl   one process accessing the profile directory.
7673 dnl ========================================================
7674 MOZ_ARG_DISABLE_BOOL(profilelocking,
7675 [  --disable-profilelocking           Disable profile locking],
7676     MOZ_PROFILELOCKING=,
7677     MOZ_PROFILELOCKING=1 )
7678 if test "$MOZ_PROFILELOCKING"; then
7679   AC_DEFINE(MOZ_PROFILELOCKING)
7682 dnl ========================================================
7683 dnl disable rdf services
7684 dnl ========================================================
7685 MOZ_ARG_DISABLE_BOOL(rdf,
7686 [  --disable-rdf           Disable RDF],
7687     MOZ_RDF= )
7688 if test "$MOZ_RDF"; then
7689   AC_DEFINE(MOZ_RDF)
7692 AC_SUBST(MOZ_RDF)
7694 dnl ========================================================
7695 dnl necko configuration options
7696 dnl ========================================================
7699 dnl option to disable various necko protocols
7701 MOZ_ARG_ENABLE_STRING(necko-protocols,
7702 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7703                           Enable/disable specific protocol handlers],
7704 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7705     if test "$option" = "yes" || test "$option" = "all"; then
7706         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7707     elif test "$option" = "no" || test "$option" = "none"; then
7708         NECKO_PROTOCOLS=""
7709     elif test "$option" = "default"; then
7710         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7711     elif test `echo "$option" | grep -c \^-` != 0; then
7712         option=`echo $option | sed 's/^-//'`
7713         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7714     else
7715         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7716     fi
7717 done],
7718     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7719 dnl Remove dupes
7720 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7721 AC_SUBST(NECKO_PROTOCOLS)
7722 for p in $NECKO_PROTOCOLS; do
7723     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7724 done
7727 dnl option to disable necko's disk cache
7729 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7730 [  --disable-necko-disk-cache
7731                           Disable necko disk cache],
7732     NECKO_DISK_CACHE=,
7733     NECKO_DISK_CACHE=1)
7734 AC_SUBST(NECKO_DISK_CACHE)
7735 if test "$NECKO_DISK_CACHE"; then
7736     AC_DEFINE(NECKO_DISK_CACHE)
7740 dnl option to minimize size of necko's i/o buffers
7742 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7743 [  --enable-necko-small-buffers
7744                           Minimize size of necko's i/o buffers],
7745     NECKO_SMALL_BUFFERS=1,
7746     NECKO_SMALL_BUFFERS=)
7747 AC_SUBST(NECKO_SMALL_BUFFERS)
7748 if test "$NECKO_SMALL_BUFFERS"; then
7749     AC_DEFINE(NECKO_SMALL_BUFFERS)
7750 fi 
7753 dnl option to disable cookies
7755 MOZ_ARG_DISABLE_BOOL(cookies,
7756 [  --disable-cookies       Disable cookie support],
7757     NECKO_COOKIES=,
7758     NECKO_COOKIES=1)
7759 AC_SUBST(NECKO_COOKIES)
7760 if test "$NECKO_COOKIES"; then
7761     AC_DEFINE(NECKO_COOKIES)
7764 dnl NECKO_ configuration options are not global
7765 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7767 dnl Only build Mork if it's required
7768 AC_SUBST(MOZ_MORK)
7769 if test "$MOZ_MORK"; then
7770   AC_DEFINE(MOZ_MORK)
7773 dnl Build the lightweight Mork reader if required
7774 AC_SUBST(MOZ_MORKREADER)
7775 if test "$MOZ_MORKREADER"; then
7776   AC_DEFINE(MOZ_MORKREADER)
7779 dnl ========================================================
7780 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7781     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7784 dnl ========================================================
7785 dnl =
7786 dnl = Maintainer debug option (no --enable equivalent)
7787 dnl =
7788 dnl ========================================================
7790 AC_SUBST(AR)
7791 AC_SUBST(AR_FLAGS)
7792 AC_SUBST(AR_LIST)
7793 AC_SUBST(AR_EXTRACT)
7794 AC_SUBST(AR_DELETE)
7795 AC_SUBST(AS)
7796 AC_SUBST(ASFLAGS)
7797 AC_SUBST(AS_DASH_C_FLAG)
7798 AC_SUBST(LD)
7799 AC_SUBST(RC)
7800 AC_SUBST(RCFLAGS)
7801 AC_SUBST(WINDRES)
7802 AC_SUBST(USE_SHORT_LIBNAME)
7803 AC_SUBST(IMPLIB)
7804 AC_SUBST(FILTER)
7805 AC_SUBST(BIN_FLAGS)
7806 AC_SUBST(NS_USE_NATIVE)
7807 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7808 AC_SUBST(MOZ_GFX_TOOLKIT)
7809 AC_SUBST(MOZ_UPDATE_XTERM)
7810 AC_SUBST(MINIMO)
7811 AC_SUBST(MOZ_PLATFORM_HILDON)
7812 AC_SUBST(NS_OSSO)
7813 AC_SUBST(NS_MAEMO_LOCATION)
7814 AC_SUBST(MOZ_AUTH_EXTENSION)
7815 AC_SUBST(MOZ_MATHML)
7816 AC_SUBST(MOZ_PERMISSIONS)
7817 AC_SUBST(MOZ_XTF)
7818 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7819 AC_SUBST(MOZ_PREF_EXTENSIONS)
7820 AC_SUBST(MOZ_SVG)
7821 AC_SUBST(MOZ_XSLT_STANDALONE)
7822 AC_SUBST(MOZ_JS_LIBS)
7823 AC_SUBST(MOZ_PSM)
7824 AC_SUBST(MOZ_DEBUG)
7825 AC_SUBST(MOZ_DEBUG_MODULES)
7826 AC_SUBST(MOZ_PROFILE_MODULES)
7827 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7828 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7829 AC_SUBST(MOZ_DEBUG_FLAGS)
7830 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7831 AC_SUBST(WARNINGS_AS_ERRORS)
7832 AC_SUBST(MOZ_DBGRINFO_MODULES)
7833 AC_SUBST(MOZ_EXTENSIONS)
7834 AC_SUBST(MOZ_IMG_DECODERS)
7835 AC_SUBST(MOZ_IMG_ENCODERS)
7836 AC_SUBST(MOZ_JSDEBUGGER)
7837 AC_SUBST(MOZ_OJI)
7838 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7839 AC_SUBST(MOZ_PLUGINS)
7840 AC_SUBST(ENABLE_EAZEL_PROFILER)
7841 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7842 AC_SUBST(EAZEL_PROFILER_LIBS)
7843 AC_SUBST(MOZ_PERF_METRICS)
7844 AC_SUBST(GC_LEAK_DETECTOR)
7845 AC_SUBST(MOZ_LOG_REFCNT)
7846 AC_SUBST(MOZ_LEAKY)
7847 AC_SUBST(MOZ_JPROF)
7848 AC_SUBST(MOZ_SHARK)
7849 AC_SUBST(MOZ_CALLGRIND)
7850 AC_SUBST(MOZ_VTUNE)
7851 AC_SUBST(MOZ_XPCTOOLS)
7852 AC_SUBST(MOZ_JSLOADER)
7853 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7854 AC_SUBST(MOZ_INSURE)
7855 AC_SUBST(MOZ_INSURE_DIRS)
7856 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7857 AC_SUBST(MOZ_QUANTIFY)
7858 AC_SUBST(MOZ_INSURIFYING)
7859 AC_SUBST(LIBICONV)
7860 AC_SUBST(MOZ_PLACES)
7861 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7862 AC_SUBST(MOZ_STORAGE)
7863 AC_SUBST(MOZ_FEEDS)
7864 AC_SUBST(NS_PRINTING)
7866 AC_SUBST(MOZ_JAVAXPCOM)
7867 AC_SUBST(JAVA_INCLUDE_PATH)
7868 AC_SUBST(JAVA)
7869 AC_SUBST(JAVAC)
7870 AC_SUBST(JAR)
7872 AC_SUBST(MOZ_PROFILESHARING)
7873 AC_SUBST(MOZ_PROFILELOCKING)
7875 AC_SUBST(MOZ_IPCD)
7877 AC_SUBST(HAVE_XIE)
7878 AC_SUBST(MOZ_XIE_LIBS)
7879 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7881 AC_SUBST(XPCOM_USE_LEA)
7882 AC_SUBST(BUILD_STATIC_LIBS)
7883 AC_SUBST(MOZ_ENABLE_LIBXUL)
7884 AC_SUBST(ENABLE_TESTS)
7885 AC_SUBST(IBMBIDI)
7886 AC_SUBST(MOZ_UNIVERSALCHARDET)
7887 AC_SUBST(ACCESSIBILITY)
7888 AC_SUBST(MOZ_XPINSTALL)
7889 AC_SUBST(MOZ_VIEW_SOURCE)
7890 AC_SUBST(MOZ_SPELLCHECK)
7891 AC_SUBST(MOZ_XPFE_COMPONENTS)
7892 AC_SUBST(MOZ_USER_DIR)
7893 AC_SUBST(MOZ_CRASHREPORTER)
7895 AC_SUBST(ENABLE_STRIP)
7896 AC_SUBST(PKG_SKIP_STRIP)
7897 AC_SUBST(USE_ELF_DYNSTR_GC)
7898 AC_SUBST(USE_PREBINDING)
7899 AC_SUBST(INCREMENTAL_LINKER)
7900 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7901 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7902 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7904 AC_SUBST(MOZ_FIX_LINK_PATHS)
7905 AC_SUBST(XPCOM_LIBS)
7906 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7907 AC_SUBST(XPCOM_GLUE_LDOPTS)
7908 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7910 AC_SUBST(USE_DEPENDENT_LIBS)
7912 AC_SUBST(MOZ_BUILD_ROOT)
7913 AC_SUBST(MOZ_OS2_TOOLS)
7914 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7916 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7917 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7918 AC_SUBST(MOZ_TIMELINE)
7919 AC_SUBST(WINCE)
7920 AC_SUBST(TARGET_DEVICE)
7922 AC_SUBST(MOZ_APP_NAME)
7923 AC_SUBST(MOZ_APP_DISPLAYNAME)
7924 AC_SUBST(MOZ_APP_VERSION)
7925 AC_SUBST(FIREFOX_VERSION)
7927 AC_SUBST(MOZ_PKG_SPECIAL)
7929 AC_SUBST(MOZILLA_OFFICIAL)
7930 AC_SUBST(BUILD_OFFICIAL)
7931 AC_SUBST(MOZ_MILESTONE_RELEASE)
7933 dnl win32 options
7934 AC_SUBST(MOZ_PROFILE)
7935 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7936 AC_SUBST(MOZ_MAPINFO)
7937 AC_SUBST(MOZ_BROWSE_INFO)
7938 AC_SUBST(MOZ_TOOLS_DIR)
7939 AC_SUBST(CYGWIN_WRAPPER)
7940 AC_SUBST(AS_PERL)
7941 AC_SUBST(WIN32_REDIST_DIR)
7942 AC_SUBST(PYTHON)
7944 dnl Echo the CFLAGS to remove extra whitespace.
7945 CFLAGS=`echo \
7946         $_WARNINGS_CFLAGS \
7947         $CFLAGS`
7949 CXXFLAGS=`echo \
7950         $_MOZ_RTTI_FLAGS \
7951         $_MOZ_EXCEPTIONS_FLAGS \
7952         $_WARNINGS_CXXFLAGS \
7953         $CXXFLAGS`
7955 COMPILE_CFLAGS=`echo \
7956     $_DEFINES_CFLAGS \
7957         $_DEPEND_CFLAGS \
7958     $COMPILE_CFLAGS`
7960 COMPILE_CXXFLAGS=`echo \
7961     $_DEFINES_CXXFLAGS \
7962         $_DEPEND_CFLAGS \
7963     $COMPILE_CXXFLAGS`
7965 AC_SUBST(SYSTEM_MAKEDEPEND)
7966 AC_SUBST(SYSTEM_JPEG)
7967 AC_SUBST(SYSTEM_PNG)
7968 AC_SUBST(SYSTEM_ZLIB)
7969 AC_SUBST(SYSTEM_BZ2)
7971 AC_SUBST(JPEG_CFLAGS)
7972 AC_SUBST(JPEG_LIBS)
7973 AC_SUBST(ZLIB_CFLAGS)
7974 AC_SUBST(ZLIB_LIBS)
7975 AC_SUBST(BZ2_CFLAGS)
7976 AC_SUBST(BZ2_LIBS)
7977 AC_SUBST(PNG_CFLAGS)
7978 AC_SUBST(PNG_LIBS)
7980 AC_SUBST(MOZ_JPEG_CFLAGS)
7981 AC_SUBST(MOZ_JPEG_LIBS)
7982 AC_SUBST(MOZ_ZLIB_CFLAGS)
7983 AC_SUBST(MOZ_ZLIB_LIBS)
7984 AC_SUBST(MOZ_BZ2_CFLAGS)
7985 AC_SUBST(MOZ_BZ2_LIBS)
7986 AC_SUBST(MOZ_PNG_CFLAGS)
7987 AC_SUBST(MOZ_PNG_LIBS)
7989 AC_SUBST(NSPR_CFLAGS)
7990 AC_SUBST(NSPR_LIBS)
7991 AC_SUBST(MOZ_NATIVE_NSPR)
7993 AC_SUBST(NSS_CFLAGS)
7994 AC_SUBST(NSS_LIBS)
7995 AC_SUBST(NSS_DEP_LIBS)
7996 AC_SUBST(MOZ_NATIVE_NSS)
7998 AC_SUBST(CFLAGS)
7999 AC_SUBST(CXXFLAGS)
8000 AC_SUBST(CPPFLAGS)
8001 AC_SUBST(COMPILE_CFLAGS)
8002 AC_SUBST(COMPILE_CXXFLAGS)
8003 AC_SUBST(LDFLAGS)
8004 AC_SUBST(LIBS)
8005 AC_SUBST(CROSS_COMPILE)
8007 AC_SUBST(HOST_CC)
8008 AC_SUBST(HOST_CXX)
8009 AC_SUBST(HOST_CFLAGS)
8010 AC_SUBST(HOST_CXXFLAGS)
8011 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8012 AC_SUBST(HOST_AR)
8013 AC_SUBST(HOST_AR_FLAGS)
8014 AC_SUBST(HOST_LD)
8015 AC_SUBST(HOST_RANLIB)
8016 AC_SUBST(HOST_NSPR_MDCPUCFG)
8017 AC_SUBST(HOST_BIN_SUFFIX)
8018 AC_SUBST(HOST_OS_ARCH)
8020 AC_SUBST(TARGET_CPU)
8021 AC_SUBST(TARGET_VENDOR)
8022 AC_SUBST(TARGET_OS)
8023 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8024 AC_SUBST(TARGET_MD_ARCH)
8025 AC_SUBST(TARGET_XPCOM_ABI)
8026 AC_SUBST(OS_TARGET)
8027 AC_SUBST(OS_ARCH)
8028 AC_SUBST(OS_RELEASE)
8029 AC_SUBST(OS_TEST)
8031 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8032 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8034 AC_SUBST(WRAP_MALLOC_CFLAGS)
8035 AC_SUBST(WRAP_MALLOC_LIB)
8036 AC_SUBST(MKSHLIB)
8037 AC_SUBST(MKCSHLIB)
8038 AC_SUBST(MKSHLIB_FORCE_ALL)
8039 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8040 AC_SUBST(DSO_CFLAGS)
8041 AC_SUBST(DSO_PIC_CFLAGS)
8042 AC_SUBST(DSO_LDOPTS)
8043 AC_SUBST(LIB_PREFIX)
8044 AC_SUBST(DLL_PREFIX)
8045 AC_SUBST(DLL_SUFFIX)
8046 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8047 AC_SUBST(LIB_SUFFIX)
8048 AC_SUBST(OBJ_SUFFIX)
8049 AC_SUBST(BIN_SUFFIX)
8050 AC_SUBST(ASM_SUFFIX)
8051 AC_SUBST(IMPORT_LIB_SUFFIX)
8052 AC_SUBST(USE_N32)
8053 AC_SUBST(CC_VERSION)
8054 AC_SUBST(CXX_VERSION)
8055 AC_SUBST(MSMANIFEST_TOOL)
8057 if test "$USING_HCC"; then
8058    CC='${topsrcdir}/build/hcc'
8059    CC="$CC '$_OLDCC'"
8060    CXX='${topsrcdir}/build/hcpp'
8061    CXX="$CXX '$_OLDCXX'"
8062    AC_SUBST(CC)
8063    AC_SUBST(CXX)
8066 dnl Check for missing components
8067 if test "$COMPILE_ENVIRONMENT"; then
8068 if test "$MOZ_X11"; then
8069     dnl ====================================================
8070     dnl = Check if X headers exist
8071     dnl ====================================================
8072     _SAVE_CFLAGS=$CFLAGS
8073     CFLAGS="$CFLAGS $XCFLAGS"
8074     AC_TRY_COMPILE([
8075         #include <stdio.h>
8076         #include <stdlib.h>
8077         #include <X11/Xlib.h>
8078         #include <X11/Intrinsic.h>
8079     ],
8080     [
8081         Display *dpy = 0;
8082         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8083             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8084             exit(1);
8085         }
8086     ], [], 
8087     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8088     CFLAGS="$_SAVE_CFLAGS"
8090     if test ! -z "$MISSING_X"; then
8091         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8092     fi
8094 fi # MOZ_X11
8095 fi # COMPILE_ENVIRONMENT
8097 dnl Set various defines and substitutions
8098 dnl ========================================================
8100 if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
8101       LIBS='so32dll.lib tcp32dll.lib'
8102 elif test "$OS_ARCH" = "BeOS"; then
8103   AC_DEFINE(XP_BEOS)
8104   MOZ_MOVEMAIL=1
8105 elif test "$OS_ARCH" = "Darwin"; then
8106   AC_DEFINE(XP_UNIX)
8107   AC_DEFINE(UNIX_ASYNC_DNS)
8108   MOZ_MOVEMAIL=1
8109 elif test "$OS_ARCH" = "OpenVMS"; then
8110   AC_DEFINE(XP_UNIX)
8111 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8112   AC_DEFINE(XP_UNIX)
8113   AC_DEFINE(UNIX_ASYNC_DNS)
8114   MOZ_MOVEMAIL=1
8116 AC_SUBST(MOZ_MOVEMAIL)
8118 AC_DEFINE(JS_THREADSAFE)
8120 if test "$MOZ_DEBUG"; then
8121     AC_DEFINE(MOZ_REFLOW_PERF)
8122     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8125 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8126     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8127     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8128     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8129     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8130     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8131     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8132     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8133     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8136 # Used for LD_LIBRARY_PATH of run_viewer target
8137 LIBS_PATH=
8138 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8139   case $lib_arg in
8140     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8141       * ) ;;
8142   esac
8143 done
8144 AC_SUBST(LIBS_PATH)
8146 dnl ========================================================
8147 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8148 dnl ========================================================
8149 case "$host_os" in
8150 mingw*)
8151     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8152     ;;
8153 cygwin*|msvc*|mks*)
8154     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8155     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8156     CC="\$(CYGWIN_WRAPPER) $CC"
8157     CXX="\$(CYGWIN_WRAPPER) $CXX"
8158     CPP="\$(CYGWIN_WRAPPER) $CPP"
8159     LD="\$(CYGWIN_WRAPPER) $LD"
8160     AS="\$(CYGWIN_WRAPPER) $AS"
8161     RC="\$(CYGWIN_WRAPPER) $RC"
8162     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8163     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8164     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8165     ;;
8166 esac
8168 AC_SUBST(CYGDRIVE_MOUNT)
8169 AC_SUBST(WIN_TOP_SRC)
8171 AC_SUBST(MOZILLA_VERSION)
8173 AC_SUBST(ac_configure_args)
8175 dnl Spit out some output
8176 dnl ========================================================
8178 dnl The following defines are used by xpcom
8179 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8180 CPP_THROW_NEW
8181 HAVE_CPP_2BYTE_WCHAR_T
8182 HAVE_CPP_ACCESS_CHANGING_USING
8183 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8184 HAVE_CPP_BOOL
8185 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8186 HAVE_CPP_EXPLICIT
8187 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8188 HAVE_CPP_NAMESPACE_STD
8189 HAVE_CPP_NEW_CASTS
8190 HAVE_CPP_PARTIAL_SPECIALIZATION
8191 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8192 HAVE_CPP_TYPENAME
8193 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8194 HAVE_STATVFS
8195 NEED_CPP_UNUSED_IMPLEMENTATIONS
8196 NEW_H
8197 HAVE_GETPAGESIZE
8198 HAVE_ICONV
8199 HAVE_ICONV_WITH_CONST_INPUT
8200 HAVE_MBRTOWC
8201 HAVE_SYS_MOUNT_H
8202 HAVE_SYS_VFS_H
8203 HAVE_WCRTOMB
8206 AC_CONFIG_HEADER(
8207 netwerk/necko-config.h
8208 xpcom/xpcom-config.h
8209 xpcom/xpcom-private.h
8212 # Save the defines header file before autoconf removes it.
8213 # (Do not add AC_DEFINE calls after this line.)
8214   _CONFIG_TMP=confdefs-tmp.h
8215   _CONFIG_DEFS_H=mozilla-config.h
8217   cat > $_CONFIG_TMP <<\EOF
8218 /* List of defines generated by configure. Included with preprocessor flag,
8219  * -include, to avoid long list of -D defines on the compile command-line.
8220  * Do not edit.
8221  */
8223 #ifndef _MOZILLA_CONFIG_H_
8224 #define _MOZILLA_CONFIG_H_
8227 _EGREP_PATTERN='^#define ('
8228 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8229     for f in $_NON_GLOBAL_ACDEFINES; do
8230         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8231     done
8233 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8235   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8237   cat >> $_CONFIG_TMP <<\EOF
8239 #endif /* _MOZILLA_CONFIG_H_ */
8243   # Only write mozilla-config.h when something changes (or it doesn't exist)
8244   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8245     rm $_CONFIG_TMP
8246   else
8247     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8248     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8250     echo ==== $_CONFIG_DEFS_H =================================
8251     cat $_CONFIG_DEFS_H
8252   fi
8254 dnl Probably shouldn't call this manually but we always want the output of DEFS
8255 rm -f confdefs.h.save
8256 mv confdefs.h confdefs.h.save
8257 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8258 AC_OUTPUT_MAKE_DEFS()
8259 MOZ_DEFINES=$DEFS
8260 AC_SUBST(MOZ_DEFINES)
8261 rm -f confdefs.h
8262 mv confdefs.h.save confdefs.h
8264 dnl Load the list of Makefiles to generate.
8265 dnl   To add new Makefiles, edit allmakefiles.sh.
8266 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8267 . ${srcdir}/allmakefiles.sh
8268 dnl 
8269 dnl Run a perl script to quickly create the makefiles.
8270 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8271 dnl   for the files it cannot handle correctly. This way, config.status
8272 dnl   will handle these files.
8273 dnl If it fails, nothing is set and config.status will run as usual.
8275 dnl This does not change the $MAKEFILES variable.
8277 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8279 if test -z "${AS_PERL}"; then
8280 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8281 else
8282 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8284 . ./conftest.sh
8285 rm conftest.sh
8287 echo $MAKEFILES > unallmakefiles
8289 AC_OUTPUT($MAKEFILES)
8291 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8292 if test "$CAIRO_FEATURES_H"; then
8293   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8294     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8295   else
8296     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8297   fi
8300 dnl ========================================================
8301 dnl = Setup a nice relatively clean build environment for
8302 dnl = sub-configures.
8303 dnl ========================================================
8304 CC="$_SUBDIR_CC" 
8305 CXX="$_SUBDIR_CXX" 
8306 CFLAGS="$_SUBDIR_CFLAGS" 
8307 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8308 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8309 LDFLAGS="$_SUBDIR_LDFLAGS"
8310 HOST_CC="$_SUBDIR_HOST_CC" 
8311 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8312 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8315 unset MAKEFILES
8316 unset CONFIG_FILES
8318 if test "$COMPILE_ENVIRONMENT"; then
8319 if test -z "$MOZ_NATIVE_NSPR"; then
8320     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8321     if test -z "$MOZ_DEBUG"; then
8322         ac_configure_args="$ac_configure_args --disable-debug"
8323     fi
8324     if test "$MOZ_OPTIMIZE" = "1"; then
8325         ac_configure_args="$ac_configure_args --enable-optimize"
8326     fi
8327     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8328        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8329     fi
8330     if test -n "$HAVE_64BIT_OS"; then
8331         ac_configure_args="$ac_configure_args --enable-64bit"
8332     fi
8333     if test -n "$USE_ARM_KUSER"; then
8334         ac_configure_args="$ac_configure_args --with-arm-kuser"
8335     fi
8336     AC_OUTPUT_SUBDIRS(nsprpub)
8337     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8340 if test -z "$MOZ_NATIVE_NSPR"; then
8341     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8342     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8343     if test ! "$VACPP" && test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8344        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8345        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8346     fi
8347     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE" ; then
8348        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8349        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8350     fi
8351     rm -f config/autoconf.mk.bak
8354 fi # COMPILE_ENVIRONMENT