Another followup, deferred nit-pick for 547314.
[mozilla-central.git] / configure.in
blob18cfccee5e3530646afb7faa77c73c5fd37a5de4
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   Windows x64 support
46 dnl   Makoto Kato <m_kato@ga2.so-net.ne.jp>
47 dnl
48 dnl Alternatively, the contents of this file may be used under the terms of
49 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
50 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
51 dnl in which case the provisions of the GPL or the LGPL are applicable instead
52 dnl of those above. If you wish to allow use of your version of this file only
53 dnl under the terms of either the GPL or the LGPL, and not to allow others to
54 dnl use your version of this file under the terms of the MPL, indicate your
55 dnl decision by deleting the provisions above and replace them with the notice
56 dnl and other provisions required by the GPL or the LGPL. If you do not delete
57 dnl the provisions above, a recipient may use your version of this file under
58 dnl the terms of any one of the MPL, the GPL or the LGPL.
59 dnl
60 dnl ***** END LICENSE BLOCK *****
62 dnl Process this file with autoconf to produce a configure script.
63 dnl ========================================================
65 AC_PREREQ(2.13)
66 AC_INIT(config/config.mk)
67 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
68 AC_CANONICAL_SYSTEM
69 TARGET_CPU="${target_cpu}"
70 TARGET_VENDOR="${target_vendor}"
71 TARGET_OS="${target_os}"
74 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1` 
75 AC_SUBST(MOZ_DEB_TIMESTAMP)
78 dnl ========================================================
79 dnl =
80 dnl = Don't change the following two lines.  Doing so breaks:
81 dnl =
82 dnl = CFLAGS="-foo" ./configure
83 dnl =
84 dnl ========================================================
85 CFLAGS="${CFLAGS=}"
86 CPPFLAGS="${CPPFLAGS=}"
87 CXXFLAGS="${CXXFLAGS=}"
88 LDFLAGS="${LDFLAGS=}"
89 HOST_CFLAGS="${HOST_CFLAGS=}"
90 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
91 HOST_LDFLAGS="${HOST_LDFLAGS=}"
93 dnl ========================================================
94 dnl = Preserve certain environment flags passed to configure
95 dnl = We want sub projects to receive the same flags
96 dnl = untainted by this configure script
97 dnl ========================================================
98 _SUBDIR_CC="$CC"
99 _SUBDIR_CXX="$CXX"
100 _SUBDIR_CFLAGS="$CFLAGS"
101 _SUBDIR_CPPFLAGS="$CPPFLAGS"
102 _SUBDIR_CXXFLAGS="$CXXFLAGS"
103 _SUBDIR_LDFLAGS="$LDFLAGS"
104 _SUBDIR_HOST_CC="$HOST_CC"
105 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
106 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
107 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
108 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
110 dnl Set the version number of the libs included with mozilla
111 dnl ========================================================
112 MOZJPEG=62
113 MOZPNG=10400
114 MOZZLIB=0x1230
115 NSPR_VERSION=4
116 NSS_VERSION=3
118 dnl Set the minimum version of toolkit libs used by mozilla
119 dnl ========================================================
120 GLIB_VERSION=1.2.0
121 LIBIDL_VERSION=0.6.3
122 PERL_VERSION=5.006
123 PYTHON_VERSION=2.4
124 CAIRO_VERSION=1.8.8
125 PANGO_VERSION=1.14.0
126 GTK2_VERSION=2.10.0
127 WINDRES_VERSION=2.14.90
128 W32API_VERSION=3.8
129 GNOMEVFS_VERSION=2.0
130 GNOMEUI_VERSION=2.2.0
131 GCONF_VERSION=1.2.1
132 LIBGNOME_VERSION=2.0
133 GIO_VERSION=2.0
134 STARTUP_NOTIFICATION_VERSION=0.8
135 DBUS_VERSION=0.60
136 SQLITE_VERSION=3.6.22
137 LIBNOTIFY_VERSION=0.4
139 MSMANIFEST_TOOL=
141 dnl Set various checks
142 dnl ========================================================
143 MISSING_X=
144 AC_PROG_AWK
146 dnl Initialize the Pthread test variables early so they can be
147 dnl  overridden by each platform.
148 dnl ========================================================
149 USE_PTHREADS=
150 _PTHREAD_LDFLAGS=""
152 dnl Do not allow a separate objdir build if a srcdir build exists.
153 dnl ==============================================================
154 _topsrcdir=`cd \`dirname $0\`; pwd`
155 _objdir=`pwd`
157 if test "$_topsrcdir" != "$_objdir"
158 then
159   # Check for a couple representative files in the source tree
160   _conflict_files=
161   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
162     if test -f $file; then
163       _conflict_files="$_conflict_files $file"
164     fi
165   done
166   if test "$_conflict_files"; then
167     echo "***"
168     echo "*   Your source tree contains these files:"
169     for file in $_conflict_files; do
170       echo "*         $file"
171     done
172     cat 1>&2 <<-EOF
173         *   This indicates that you previously built in the source tree.
174         *   A source tree build can confuse the separate objdir build.
175         *
176         *   To clean up the source tree:
177         *     1. cd $_topsrcdir
178         *     2. gmake distclean
179         ***
180         EOF
181     exit 1
182     break
183   fi
185 MOZ_BUILD_ROOT=`pwd`
187 dnl Default to MSVC for win32 and gcc-4.2 for darwin
188 dnl ==============================================================
189 if test -z "$CROSS_COMPILE"; then
190 case "$target" in
191 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
192     if test -z "$CC"; then CC=cl; fi
193     if test -z "$CXX"; then CXX=cl; fi
194     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
195     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
196     if test -z "$LD"; then LD=link; fi
197     if test -z "$AS"; then
198         case "${target_cpu}" in
199         i*86)
200             AS=ml;
201             ;;
202         x86_64)
203             AS=ml64;
204             ;;
205         esac
206     fi
207     if test -z "$MIDL"; then MIDL=midl; fi
208     ;;
209 *-darwin*)
210     if test -z "$CC"; then CC=gcc-4.2; fi
211     if test -z "$CXX"; then CXX=g++-4.2; fi
212     ;;
213 esac
216 COMPILE_ENVIRONMENT=1
217 MOZ_ARG_ENABLE_BOOL(compile-environment,
218 [  --disable-compile-environment
219                            Disable compiler/library checks.],
220     COMPILE_ENVIRONMENT=1,
221     COMPILE_ENVIRONMENT= )
222 AC_SUBST(COMPILE_ENVIRONMENT)
224 MOZ_ARG_WITH_STRING(l10n-base,
225 [  --with-l10n-base=DIR     path to l10n repositories],
226     L10NBASEDIR=$withval)
227 if test ! -z "$L10NBASEDIR"; then
228     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
229         AC_MSG_ERROR([--with-l10n-base must specify a path])
230     elif test -d "$L10NBASEDIR"; then
231         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
232     else
233         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
234     fi
236 AC_SUBST(L10NBASEDIR)
238 dnl Check for Perl first -- needed for win32 SDK checks
239 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
240 if test -z "$PERL" || test "$PERL" = ":"; then
241     AC_MSG_ERROR([perl not found in \$PATH])
244 dnl ========================================================
245 dnl Checks for compilers.
246 dnl ========================================================
247 dnl Set CROSS_COMPILE in the environment when running configure
248 dnl to use the cross-compile setup for now
249 dnl ========================================================
251 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
252 AR_FLAGS='cr $@'
254 if test "$COMPILE_ENVIRONMENT"; then
256 dnl Do some special WinCE toolchain stuff
257 case "$target" in
258 *wince|*winmo)
260     MOZ_ARG_WITH_STRING(wince-sdk,
261     [  --with-wince-sdk=WINCE_SDK_DIR
262                         The path to the Windows CE SDK],
263     WINCE_SDK_DIR=$withval)
265     MOZ_ARG_WITH_STRING(ogles-sdk,
266     [  --with-ogles-sdk=OGLES_SDK_DIR
267                         The path to the OGLES SDK],
268     OGLES_SDK_DIR=$withval)
270     AC_DEFINE(WINCE)
271     
272     export WINCE=1
274     echo -----------------------------------------------------------------------------
275     echo Building Windows CE Shunt Library and Tool Chain
276     echo Using SDK in:
277     echo $WINCE_SDK_DIR
279     ac_exeext=.exe
281     _pwd=`pwd -W`
282     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
283     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
284     TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
285     -C $srcdir/build/wince/tools
287     CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
288     CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
289     CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
290     CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
291     LD="$_pwd/dist/sdk/bin/$target-link.exe"
292     AR="$_pwd/dist/sdk/bin/$target-lib.exe"
293     AS="$_pwd/dist/sdk/bin/$target-as.exe"
294     RC="$_pwd/dist/sdk/bin/$target-res.exe"
297     echo -----------------------------------------------------------------------------
299     ;;
300 esac
302 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
303     echo "cross compiling from $host to $target"
304     cross_compiling=yes
306     _SAVE_CC="$CC"
307     _SAVE_CFLAGS="$CFLAGS"
308     _SAVE_LDFLAGS="$LDFLAGS"
310     AC_MSG_CHECKING([for host c compiler])
311     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
312     if test -z "$HOST_CC"; then
313         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
314     fi
315     AC_MSG_RESULT([$HOST_CC])
316     AC_MSG_CHECKING([for host c++ compiler])
317     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
318     if test -z "$HOST_CXX"; then
319         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
320     fi
321     AC_MSG_RESULT([$HOST_CXX])
323     if test -z "$HOST_CFLAGS"; then
324         HOST_CFLAGS="$CFLAGS"
325     fi
326     if test -z "$HOST_CXXFLAGS"; then
327         HOST_CXXFLAGS="$CXXFLAGS"
328     fi
329     if test -z "$HOST_LDFLAGS"; then
330         HOST_LDFLAGS="$LDFLAGS"
331     fi
332     if test -z "$HOST_AR_FLAGS"; then
333         HOST_AR_FLAGS="$AR_FLAGS"
334     fi
335     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
336     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
337     CC="$HOST_CC"
338     CFLAGS="$HOST_CFLAGS"
339     LDFLAGS="$HOST_LDFLAGS"
341     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
342     AC_TRY_COMPILE([], [return(0);], 
343         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
344         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
346     CC="$HOST_CXX"
347     CFLAGS="$HOST_CXXFLAGS"
349     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
350     AC_TRY_COMPILE([], [return(0);], 
351         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
352         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
353     
354     CC=$_SAVE_CC
355     CFLAGS=$_SAVE_CFLAGS
356     LDFLAGS=$_SAVE_LDFLAGS
358     case "$build:$target" in
359       powerpc-apple-darwin8*:i?86-apple-darwin*)
360         dnl The Darwin cross compiler doesn't necessarily point itself at a
361         dnl root that has libraries for the proper architecture, it defaults
362         dnl to the system root.  The libraries in the system root on current
363         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
364         dnl checks will fail.  Fake a working SDK in that case.
365         _SAVE_CFLAGS=$CFLAGS
366         _SAVE_CXXFLAGS=$CXXLAGS
367         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
368         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
369         ;;
370     esac
372     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
373     unset ac_cv_prog_CC
374     AC_PROG_CC
375     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
376     unset ac_cv_prog_CXX
377     AC_PROG_CXX
379     case "$build:$target" in
380       powerpc-apple-darwin8*:i?86-apple-darwin*)
381         dnl Revert the changes made above.  From this point on, the target
382         dnl compiler will never be used without applying the SDK to CFLAGS
383         dnl (see --with-macos-sdk below).
384         CFLAGS=$_SAVE_CFLAGS
385         CXXFLAGS=$_SAVE_CXXFLAGS
386         ;;
387     esac
389     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
390     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
391     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
392     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
393     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
394     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
395     AC_DEFINE(CROSS_COMPILE)
396 else
397     AC_PROG_CC
398     AC_PROG_CXX
399     AC_PROG_RANLIB
400     MOZ_PATH_PROGS(AS, $AS as, $CC)
401     AC_CHECK_PROGS(AR, ar, :)
402     AC_CHECK_PROGS(LD, ld, :)
403     AC_CHECK_PROGS(STRIP, strip, :)
404     AC_CHECK_PROGS(WINDRES, windres, :)
405     if test -z "$HOST_CC"; then
406         HOST_CC='$(CC)'
407     fi
408     if test -z "$HOST_CFLAGS"; then
409         HOST_CFLAGS='$(CFLAGS)'
410     fi
411     if test -z "$HOST_CXX"; then
412         HOST_CXX='$(CXX)'
413     fi
414     if test -z "$HOST_CXXFLAGS"; then
415         HOST_CXXFLAGS='$(CXXFLAGS)'
416     fi
417     if test -z "$HOST_LDFLAGS"; then
418         HOST_LDFLAGS='$(LDFLAGS)'
419     fi
420     if test -z "$HOST_RANLIB"; then
421         HOST_RANLIB='$(RANLIB)'
422     fi
423     if test -z "$HOST_AR"; then
424         HOST_AR='$(AR)'
425     fi
426     if test -z "$HOST_AR_FLAGS"; then
427         HOST_AR_FLAGS='$(AR_FLAGS)'
428     fi
431 GNU_AS=
432 GNU_LD=
433 GNU_CC=
434 GNU_CXX=
435 CC_VERSION='N/A'
436 CXX_VERSION='N/A'
437 if test "$GCC" = "yes"; then
438     GNU_CC=1
439     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
441 if test "$GXX" = "yes"; then
442     GNU_CXX=1
443     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
445 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
446     GNU_AS=1
448 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
449     GNU_LD=1
451 if test "$GNU_CC"; then
452     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
453         GCC_USE_GNU_LD=1
454     fi
457 INTEL_CC=
458 INTEL_CXX=
459 if test "$GCC" = yes; then
460    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
461      INTEL_CC=1
462    fi
465 if test "$GXX" = yes; then
466    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
467      INTEL_CXX=1
468    fi
471 dnl Special win32 checks
472 dnl ========================================================
473 case "$target" in
474 *-wince|*-winmo)
475     WINVER=500
476     ;;
478     WINVER=502
479     ;;
480 esac
482 dnl Target the Windows 7 SDK by default
483 WINSDK_TARGETVER=601
485 MOZ_ARG_WITH_STRING(windows-version,
486 [  --with-windows-version=WINSDK_TARGETVER
487                           Highest Windows version to target using this SDK
488                               502: Windows Server 2003
489                               600: Windows Vista
490                               601: Windows 7],
491   WINSDK_TARGETVER=$withval)
493 case "$WINSDK_TARGETVER" in
494 502|600|601)
495     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
496     ;;
499     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
500     ;;
502 esac
504 dnl Vista SDK specific api (deprecated)
505 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
506 [  --disable-vista-sdk-requirements
507                            Do not build Vista SDK specific code],
508    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
509    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=$_PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
510 if test -n "$COMPILE_ENVIRONMENT"; then
511 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
512     AC_MSG_WARN([--disable-vista-sdk-requirements is deprecated, use --with-windows-version=502 instead])
513     MOZ_WINSDK_TARGETVER=05020000
516 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
517     MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
518     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
519     # We can't build parental controls either
520     MOZ_DISABLE_PARENTAL_CONTROLS=1
524 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
526 case "$target" in
527 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
528     if test "$GCC" != "yes"; then
529         # Check to see if we are really running in a msvc environemnt
530         _WIN32_MSVC=1
531         AC_CHECK_PROGS(MIDL, midl)
533         # Make sure compilers are valid
534         CFLAGS="$CFLAGS -TC -nologo"
535         CXXFLAGS="$CXXFLAGS -TP -nologo"
536         AC_LANG_SAVE
537         AC_LANG_C
538         AC_TRY_COMPILE([#include <stdio.h>],
539             [ printf("Hello World\n"); ],,
540             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
542         AC_LANG_CPLUSPLUS
543         AC_TRY_COMPILE([#include <new.h>],
544             [ unsigned *test = new unsigned(42); ],,
545             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
546         AC_LANG_RESTORE
547         
548         changequote(,)
549         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
550         changequote([,])
551         
552         # Determine compiler version
553         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
554         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
555         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
556         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
557         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
558         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
560         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
561         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
563         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
564             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
565         fi
566         if test "$_CC_MAJOR_VERSION" = "13"; then
567             _CC_SUITE=7
568         elif test "$_CC_MAJOR_VERSION" = "14"; then
569             _CC_SUITE=8
570             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
571             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
572             dnl so be very specific here!
573             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
574             if test $_CC_RELEASE -gt 50727; then
575                _USE_DYNAMICBASE=1
576             elif test $_CC_BUILD -ge 762; then
577                _USE_DYNAMICBASE=1
578             fi
579             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
580             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
581         elif test "$_CC_MAJOR_VERSION" = "15"; then
582             _CC_SUITE=9
583             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
584             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
585             _USE_DYNAMICBASE=1
586             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
587             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
588         elif test "$_CC_MAJOR_VERSION" = "16"; then
589             _CC_SUITE=10
590             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
591             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
592             _USE_DYNAMICBASE=1
593             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
594             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
595         else
596             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
597         fi
599         _MOZ_RTTI_FLAGS_ON='-GR'
600         _MOZ_RTTI_FLAGS_OFF='-GR-'
601         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
602         _MOZ_EXCEPTIONS_FLAGS_OFF=''
604         if test -n "$WIN32_REDIST_DIR"; then
605             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
606         fi
607         
608         # bug #249782
609         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
610         if test "$_CC_SUITE" -ge "8"; then
611                 changequote(,)
612                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
613                 changequote([,])
615                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
616                 if test -n "$MSMT_TOOL"; then
617                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
618                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
619                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
620                         fi
621                         MSMANIFEST_TOOL=1
622                         unset MSMT_TOOL
623                 else
624                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
625                 fi
626         fi
628         # Check linker version
629         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
630         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
631         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
632             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
633         fi
634         INCREMENTAL_LINKER=1
636         # Check midl version
637         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
638         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
639         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
640         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
641         # Add flags if necessary
642         AC_MSG_CHECKING([for midl flags])
643         case "$target" in
644         i*86-*)
645             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
646                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
647                 # MIDL version 7.00.0500 or later has no problem.
648                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
649                 AC_MSG_RESULT([need -env win32])
650             else
651                 AC_MSG_RESULT([none needed])
652             fi
653             ;;
654         x86_64-*)
655             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
656             ;;
657         *)
658             AC_MSG_RESULT([none needed])
659             ;;
660         esac
662         # Identify which version of the SDK we're building with
663         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
664         # from there
665         AC_CHECK_HEADERS([winsdkver.h])
666         if test "$ac_cv_header_winsdkver_h" = "yes"; then
667             # Get the highest _WIN32_WINNT and NTDDI versions supported
668             # Take the higher of the two
669             # This is done because the Windows 7 beta SDK reports its
670             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
671             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
672                            ac_cv_winsdk_maxver,
673                            [cat > conftest.h <<EOF
674 #include <winsdkver.h>
675 #include <sdkddkver.h>
677 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
678 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
679 #else
680 #define WINSDK_MAXVER NTDDI_MAXVER
681 #endif
683 WINSDK_MAXVER
685                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
686                             rm -f conftest.h
687                            ])
688             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
689         else
690             # The Vista SDK is the only one to have sdkddkver.h but not
691             # WinSDKVer.h
692             AC_CHECK_HEADERS([sdkddkver.h])
693             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
694                 MOZ_WINSDK_MAXVER=0x06000000
695             else
696                 # Assume the Server 2003 Platform SDK
697                 MOZ_WINSDK_MAXVER=0x05020000
698             fi
699         fi
701         unset _MSVC_VER_FILTER
703     else
704         # Check w32api version
705         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
706         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
707         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
708         AC_TRY_COMPILE([#include <w32api.h>],
709             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
710                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
711                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
712                 #error "test failed."
713             #endif
714             , [ res=yes ], [ res=no ])
715         AC_MSG_RESULT([$res])
716         if test "$res" != "yes"; then
717             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
718         fi
719         # Check windres version
720         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
721         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
722         AC_MSG_RESULT([$_WINDRES_VERSION])
723         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
724         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
725         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
726         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
727         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
728         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
729         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
730                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
731                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
732                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
733                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
734                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
735         then
736             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
737         fi
739         # Server 2003 is the highest version supported
740         MOZ_WINSDK_MAXVER=0x05020000
741     fi # !GNU_CC
743     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
744     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
745     # Require OS features provided by IE 5.0
746     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
748     # If the maximum version supported by this SDK is lower than the target
749     # version, error out
750     AC_MSG_CHECKING([for Windows SDK being recent enough])
751     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
752         AC_MSG_RESULT("yes")
753     else
754         AC_MSG_RESULT("no")
755         AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
756     fi
758     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
759     # Definitions matching sdkddkver.h
760     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
761     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
762     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
763     ;;
764 esac
766 dnl Test breaks icc on OS/2 && MSVC
767 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
768     AC_PROG_CC_C_O
769     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
770         USING_HCC=1
771         _OLDCC=$CC
772         _OLDCXX=$CXX
773         CC="${srcdir}/build/hcc '$CC'"
774         CXX="${srcdir}/build/hcpp '$CXX'"
775     fi
778 AC_PROG_CPP
779 AC_PROG_CXXCPP
781 if test -n "$_WIN32_MSVC"; then
782     SKIP_PATH_CHECKS=1
783     SKIP_COMPILER_CHECKS=1
784     SKIP_LIBRARY_CHECKS=1
786     # Since we're skipping compiler and library checks, hard-code
787     # some facts here.
788     case "$target" in
789     *-wince|*-winmo)
790         ;;
791     *)
792         AC_DEFINE(HAVE_IO_H)
793         AC_DEFINE(HAVE_SETBUF)
794         AC_DEFINE(HAVE_ISATTY)
795         ;;
796     esac
799 fi # COMPILE_ENVIRONMENT
801 AC_SUBST(MIDL_FLAGS)
802 AC_SUBST(_MSC_VER)
804 AC_SUBST(GNU_AS)
805 AC_SUBST(GNU_LD)
806 AC_SUBST(GNU_CC)
807 AC_SUBST(GNU_CXX)
808 AC_SUBST(INTEL_CC)
809 AC_SUBST(INTEL_CXX)
811 dnl ========================================================
812 dnl Checks for programs.
813 dnl ========================================================
814 AC_PROG_INSTALL
815 AC_PROG_LN_S
817 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
818 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
819 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
820 _perl_res=$?
821 AC_MSG_RESULT([$_perl_version])
823 if test "$_perl_res" != 0; then
824     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
828 AC_MSG_CHECKING([for full perl installation])
829 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
830 _perl_res=$?
831 if test "$_perl_res" != 0; then
832     AC_MSG_RESULT([no])
833     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
834 else
835     AC_MSG_RESULT([yes])    
838 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.5 python2.4 python)
839 if test -z "$PYTHON"; then
840     AC_MSG_ERROR([python was not found in \$PATH])
843 if test -z "$COMPILE_ENVIRONMENT"; then
844     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
846 AC_SUBST(NSINSTALL_BIN)
848 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
849 MOZ_PATH_PROG(WHOAMI, whoami, :)
850 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
851 MOZ_PATH_PROG(UNZIP, unzip, :)
852 MOZ_PATH_PROGS(ZIP, zip)
853 if test -z "$ZIP" || test "$ZIP" = ":"; then
854     AC_MSG_ERROR([zip not found in \$PATH])
856 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
857 MOZ_PATH_PROG(XARGS, xargs)
858 if test -z "$XARGS" || test "$XARGS" = ":"; then
859     AC_MSG_ERROR([xargs not found in \$PATH .])
862 if test "$COMPILE_ENVIRONMENT"; then
864 dnl ========================================================
865 dnl = Mac OS X toolchain support
866 dnl ========================================================
868 case "$target_os" in
869 darwin*)
870     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
871     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
872     dnl the environment and includedir purposes (when using an SDK, below),
873     dnl but remember the full version number for the libdir (SDK).
874     changequote(,)
875     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
876     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
877     changequote([,])
878     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
879         dnl Bug 280479, but this keeps popping up in bug 292530 too because
880         dnl 4.0.0/4061 is the default compiler in Tiger.
881         changequote(,)
882         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
883         changequote([,])
884         if test "$GCC_BUILD" = "4061" ; then
885             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
886 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
887 from building Mozilla. Upgrade to Xcode 2.1 or later.])
888         fi
889     fi
891     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
892     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
893     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
894     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
896     case "$PBBUILD" in
897       *xcodebuild*)
898         changequote(,)
899         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
900         changequote([,])
901         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
902           HAS_XCODE_2_1=1;
903         fi
904       ;;
905     esac
907     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
908     dnl it has moved into /usr/bin.
909     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
910     ;;
911 esac
913 AC_SUBST(GCC_VERSION)
914 AC_SUBST(XCODEBUILD_VERSION)
915 AC_SUBST(HAS_XCODE_2_1)
917 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
918 dnl that a universal binary is being produced.
919 AC_SUBST(UNIVERSAL_BINARY)
921 dnl ========================================================
922 dnl Check for MacOS deployment target version
923 dnl ========================================================
925 MOZ_ARG_ENABLE_STRING(macos-target,
926                       [  --enable-macos-target=VER (default=10.5)
927                           Set the minimum MacOS version needed at runtime],
928                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
930 case "$target" in
931 *-darwin*)
932     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
933         dnl Use the specified value
934         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
935         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
936     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
937         dnl No value specified on the command line or in the environment,
938         dnl use architecture minimum.
939         export MACOSX_DEPLOYMENT_TARGET=10.5
940     fi
941     ;;
942 esac
944 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
946 dnl ========================================================
947 dnl = Mac OS X SDK support
948 dnl ========================================================
949 MACOS_SDK_DIR=
950 NEXT_ROOT=
951 MOZ_ARG_WITH_STRING(macos-sdk,
952 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
953     MACOS_SDK_DIR=$withval)
955 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
956 dnl NEXT_ROOT will be set and exported only if it's needed.
957 AC_SUBST(MACOS_SDK_DIR)
958 AC_SUBST(NEXT_ROOT)
960 if test "$MACOS_SDK_DIR"; then
961   dnl Sync this section with the ones in NSPR and NSS.
962   dnl Changes to the cross environment here need to be accounted for in
963   dnl the libIDL checks (below) and xpidl build.
965   if test ! -d "$MACOS_SDK_DIR"; then
966     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
967 specify a valid SDK.  SDKs are installed when the optional cross-development
968 tools are selected during the Xcode/Developer Tools installation.])
969   fi
971   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
972   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
973     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
974   else
975     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
976     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
978     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
979     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
980     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
982     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
983       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
984       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
985       dnl be ignored and cause warnings when -syslibroot is specified.
986       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
987       dnl the -isysroot it receives, so this is only needed with 4.0.0.
988       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
989     fi
990   fi
992   AC_LANG_SAVE
993   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
994   AC_LANG_CPLUSPLUS
995   AC_TRY_COMPILE([#include <new>
996                  int main() { return 0; }],
997    result=yes,
998    result=no)
999   AC_LANG_RESTORE
1000   AC_MSG_RESULT($result)
1002   if test "$result" = "no" ; then
1003     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1004   fi
1007 fi # COMPILE_ENVIRONMENT
1009 dnl Be sure the make we use is GNU make.
1010 dnl on win32, gmake.exe is the generally the wrong version
1011 if test -n "$MAKE"; then
1012   if test `echo $MAKE | grep -c make.py` != 1; then
1013      NOT_PYMAKE=$MAKE
1014   fi
1017 case "$host_os" in
1018 cygwin*|mingw*|mks*|msvc*)
1019     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1020     ;;
1022     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1023     ;;
1024 esac
1025 if test "$GMAKE" = ":"; then
1026    AC_MSG_ERROR([GNU make not found])
1028 AC_SUBST(GMAKE)
1030 if test "$COMPILE_ENVIRONMENT"; then
1032 AC_PATH_XTRA
1034 XCFLAGS="$X_CFLAGS"
1036 fi # COMPILE_ENVIRONMENT
1038 dnl ========================================================
1039 dnl set the defaults first
1040 dnl ========================================================
1041 AS_BIN=$AS
1042 AR_LIST='$(AR) t'
1043 AR_EXTRACT='$(AR) x'
1044 AR_DELETE='$(AR) d'
1045 AS='$(CC)'
1046 AS_DASH_C_FLAG='-c'
1047 DLL_PREFIX=lib
1048 LIB_PREFIX=lib
1049 DLL_SUFFIX=.so
1050 OBJ_SUFFIX=o
1051 LIB_SUFFIX=a
1052 ASM_SUFFIX=s
1053 IMPORT_LIB_SUFFIX=
1054 TARGET_MD_ARCH=unix
1055 DIRENT_INO=d_ino
1056 CYGWIN_WRAPPER=
1057 WIN_TOP_SRC=
1058 MOZ_USER_DIR=".mozilla"
1060 MOZ_JPEG_CFLAGS=
1061 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1062 MOZ_ZLIB_CFLAGS=
1063 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1064 MOZ_BZ2_CFLAGS=
1065 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1066 MOZ_PNG_CFLAGS=
1067 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1069 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1070 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
1071 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1072 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
1073 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1074 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1075 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1077 MOZ_FS_LAYOUT=unix
1079 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1081 USE_DEPENDENT_LIBS=1
1083 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1085 MOZ_ENABLE_POSTSCRIPT=1 
1087 if test -n "$CROSS_COMPILE"; then
1088     OS_TARGET="${target_os}"
1089     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1090     OS_RELEASE=
1091     case "${target_os}" in
1092         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1093         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1094         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1095         mingw*)       OS_ARCH=WINNT ;;
1096         wince*)       OS_ARCH=WINCE ;;
1097         winmo*)       OS_ARCH=WINCE ;;
1098         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1099     esac
1100 else
1101     OS_TARGET=`uname -s`
1102     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1103     OS_RELEASE=`uname -r`
1106 # Before this used `uname -m` when not cross compiling
1107 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1108 OS_TEST="${target_cpu}"
1110 _COMPILER_PREFIX=
1112 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1114 #######################################################################
1115 # Master "Core Components" macros for getting the OS target           #
1116 #######################################################################
1119 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1120 # cross-compilation.
1124 # Define and override various archtecture-specific variables, including
1125 # HOST_OS_ARCH
1126 # OS_ARCH
1127 # OS_TEST
1128 # OS_TARGET
1129 # OS_RELEASE
1130 # OS_MINOR_RELEASE
1133 case "$HOST_OS_ARCH" in
1134 cygwin*|mingw*|mks*|msvc*)
1135     HOST_OS_ARCH=WINNT
1136     ;;
1137 linux*)
1138     HOST_OS_ARCH=Linux
1139     ;;
1140 solaris*)
1141     HOST_OS_ARCH=SunOS
1142     SOLARIS_SUNPRO_CC=
1143     SOLARIS_SUNPRO_CXX=
1144     if test -z "$GNU_CC"; then
1145         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1146             SOLARIS_SUNPRO_CC=1
1147        fi
1148     fi
1150     if test -z "$GNU_CXX"; then
1151        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1152            SOLARIS_SUNPRO_CXX=1
1153        fi
1154     fi
1155     AC_SUBST(SOLARIS_SUNPRO_CC)
1156     AC_SUBST(SOLARIS_SUNPRO_CXX)
1157     ;;
1158 BSD_386)
1159     HOST_OS_ARCH=BSD
1160     ;;
1161 dgux)
1162     HOST_OS_ARCH=DGUX
1163     ;;
1164 IRIX64)
1165     HOST_OS_ARCH=IRIX
1166     ;;
1167 UNIX_SV)
1168     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1169         HOST_OS_ARCH=NCR
1170     else
1171         HOST_OS_ARCH=UNIXWARE
1172     fi
1173     ;;
1174 ncr)
1175     HOST_OS_ARCH=NCR
1176     ;;
1177 UNIX_SYSTEM_V)
1178     HOST_OS_ARCH=NEC
1179     ;;
1180 OSF1)
1181     ;;
1182 *OpenVMS*)
1183     HOST_OS_ARCH=OpenVMS
1184     ;;
1185 OS_2)
1186     HOST_OS_ARCH=OS2
1187     ;;
1188 QNX)
1189     ;;
1190 SCO_SV)
1191     HOST_OS_ARCH=SCOOS
1192     ;;
1193 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1194     HOST_OS_ARCH=SINIX
1195     ;;
1196 UnixWare)
1197     HOST_OS_ARCH=UNIXWARE
1198     ;;
1199 esac
1201 case "$OS_ARCH" in
1202 WINNT)
1203     if test -z "$CROSS_COMPILE" ; then
1204         OS_TEST=`uname -p`
1205     fi
1206     ;;
1207 Windows_NT)
1209 # If uname -s returns "Windows_NT", we assume that we are using
1210 # the uname.exe in MKS toolkit.
1212 # The -r option of MKS uname only returns the major version number.
1213 # So we need to use its -v option to get the minor version number.
1214 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1216     OS_ARCH=WINNT
1217     OS_TARGET=WINNT
1218     OS_MINOR_RELEASE=`uname -v`
1219     if test "$OS_MINOR_RELEASE" = "00"; then
1220         OS_MINOR_RELEASE=0
1221     fi
1222     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1223     ;;
1224 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1226 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1227 # the uname.exe in the Cygwin tools.
1228 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1229 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1230 # the uname.exe in the GNU-Win32 tools.
1231 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1232 # the uname.exe in the MSYS tools.
1234     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1235     OS_ARCH=WINNT
1236     OS_TARGET=WINNT
1237     ;;
1238 AIX)
1239     OS_RELEASE=`uname -v`.`uname -r`
1240     OS_TEST=${target_cpu}
1241     ;;
1242 BSD_386)
1243     OS_ARCH=BSD
1244     ;;
1245 dgux)
1246     OS_ARCH=DGUX
1247     ;;
1248 IRIX64)
1249     OS_ARCH=IRIX
1250     ;;
1251 UNIX_SV)
1252     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1253         OS_ARCH=NCR
1254     else
1255         OS_ARCH=UNIXWARE
1256         OS_RELEASE=`uname -v`
1257     fi
1258     ;;
1259 ncr)
1260     OS_ARCH=NCR
1261     ;;
1262 UNIX_SYSTEM_V)
1263     OS_ARCH=NEC
1264     ;;
1265 OSF1)
1266     case `uname -v` in
1267     148)
1268         OS_RELEASE=V3.2C
1269         ;;
1270     564)
1271         OS_RELEASE=V4.0B
1272         ;;
1273     878)
1274         OS_RELEASE=V4.0D
1275         ;;
1276     esac
1277     ;;
1278 *OpenVMS*)
1279     OS_ARCH=OpenVMS
1280     OS_RELEASE=`uname -v`
1281     OS_TEST=`uname -p`
1282     ;;
1283 OS_2)
1284     OS_ARCH=OS2
1285     OS_TARGET=OS2
1286     OS_RELEASE=`uname -v`
1287     ;;
1288 QNX)
1289     if test "$OS_TARGET" != "NTO"; then
1290         changequote(,)
1291         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1292         changequote([,])
1293     fi
1294     OS_TEST=x86
1295     ;;
1296 SCO_SV)
1297     OS_ARCH=SCOOS
1298     OS_RELEASE=5.0
1299     ;;
1300 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1301     OS_ARCH=SINIX
1302     OS_TEST=`uname -p`
1303     ;;
1304 UnixWare)
1305     OS_ARCH=UNIXWARE
1306     OS_RELEASE=`uname -v`
1307     ;;
1308 WINCE)
1309     OS_ARCH=WINCE
1310     case "${target_os}" in
1311     *winmo)
1312         OS_TARGET=WINMO
1313         WINCE_WINDOWS_MOBILE=1
1314         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1315         ;;
1316     *)
1317         OS_TARGET=WINCE
1318         ;;
1319     esac
1320     ;;
1321 Darwin)
1322     case "${target_cpu}" in
1323     powerpc*)
1324         OS_TEST=ppc
1325         ;;
1326     i*86*)
1327         OS_TEST=i386 
1328         ;;
1329     x86_64)
1330         OS_TEST=x86_64
1331         ;;
1332     *)
1333         if test -z "$CROSS_COMPILE" ; then
1334             OS_TEST=`uname -p`
1335         fi
1336         ;;
1337     esac
1338     ;;
1339 esac
1341 if test "$OS_ARCH" = "NCR"; then
1342     changequote(,)
1343     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1344     changequote([,])
1347 # Only set CPU_ARCH if we recognize the value of OS_TEST
1349 case "$OS_TEST" in
1350 *86 | i86pc)
1351     CPU_ARCH=x86
1352     ;;
1354 powerpc64 | ppc64)
1355     CPU_ARCH=ppc64
1356     ;;
1358 powerpc | ppc | rs6000)
1359     CPU_ARCH=ppc
1360     ;;
1362 Alpha | alpha | ALPHA)
1363     CPU_ARCH=Alpha
1364     ;;
1366 s390)
1367     CPU_ARCH=s390
1368     ;;
1370 s390x)
1371     CPU_ARCH=s390x
1372     ;;
1374 hppa* | parisc)
1375     CPU_ARCH=hppa
1376     ;;
1378 sun4u | sparc*)
1379     CPU_ARCH=sparc
1380     ;;
1382 x86_64 | ia64)
1383     CPU_ARCH="$OS_TEST"
1384     ;;
1386 arm)
1387     if test "$OS_TARGET" = "WINCE"; then
1388         CPU_ARCH="$OS_TEST"
1389     fi
1390     ;;
1391 esac
1393 if test -z "$OS_TARGET"; then
1394     OS_TARGET=$OS_ARCH
1396 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1398 dnl ========================================================
1399 dnl GNU specific defaults
1400 dnl ========================================================
1401 if test "$GNU_CC"; then
1402     # FIXME: Let us build with strict aliasing. bug 414641.
1403     CFLAGS="$CFLAGS -fno-strict-aliasing"
1404     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1405     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1406     DSO_LDOPTS='-shared'
1407     if test "$GCC_USE_GNU_LD"; then
1408         # Don't allow undefined symbols in libraries
1409         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1410     fi
1411     WARNINGS_AS_ERRORS='-Werror'
1412     DSO_CFLAGS=''
1413     DSO_PIC_CFLAGS='-fPIC'
1414     ASFLAGS="$ASFLAGS -fPIC"
1415     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1416     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1417     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1418     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1420     # Turn on GNU specific features
1421     # -Wall - turn on all warnings
1422     # -pedantic - make compiler warn about non-ANSI stuff, and
1423     #             be a little bit stricter
1424     # Warnings slamm took out for now (these were giving more noise than help):
1425     # -Wbad-function-cast - warns when casting a function to a new return type
1426     # -Wshadow - removed because it generates more noise than help --pete
1427     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1428     if test -z "$INTEL_CC"; then
1429        # Don't use -Wcast-align with ICC
1430        case "$CPU_ARCH" in
1431            # And don't use it on hppa, ia64, sparc, since it's noisy there
1432            hppa | ia64 | sparc)
1433            ;;
1434            *)
1435         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1436            ;;
1437        esac
1438     fi
1440     dnl Turn pedantic on but disable the warnings for long long
1441     _PEDANTIC=1
1443     if test -z "$INTEL_CC"; then
1444       _IGNORE_LONG_LONG_WARNINGS=1
1445       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1446     else
1447       _IGNORE_LONG_LONG_WARNINGS=
1448     fi
1451     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1452     _USE_CPP_INCLUDE_FLAG=1
1453 elif test "$SOLARIS_SUNPRO_CC"; then
1454     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1455     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1457     DSO_LDOPTS='-shared'
1458     if test "$GNU_LD"; then
1459         # Don't allow undefined symbols in libraries
1460         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1461     fi
1463     DSO_CFLAGS=''
1464     if test "$CPU_ARCH" = "sparc"; then
1465         # for Sun Studio on Solaris/SPARC
1466         DSO_PIC_CFLAGS='-xcode=pic32'
1467     else
1468         DSO_PIC_CFLAGS='-KPIC'
1469     fi
1470     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1471 else
1472     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1473     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1475     DSO_LDOPTS='-shared'
1476     if test "$GNU_LD"; then
1477         # Don't allow undefined symbols in libraries
1478         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1479     fi
1481     DSO_CFLAGS=''
1482     DSO_PIC_CFLAGS='-KPIC'
1483     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1486 if test "$GNU_CXX"; then
1487     # FIXME: Let us build with strict aliasing. bug 414641.
1488     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1489     # Turn on GNU specific features
1490     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1491     if test -z "$INTEL_CC"; then
1492        # Don't use -Wcast-align with ICC
1493        case "$CPU_ARCH" in
1494            # And don't use it on hppa, ia64, sparc, since it's noisy there
1495            hppa | ia64 | sparc)
1496            ;;
1497            *)
1498         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1499            ;;
1500        esac
1501     fi
1503     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1504     _USE_CPP_INCLUDE_FLAG=1
1506     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1507                    ac_has_wno_invalid_offsetof,
1508         [
1509             AC_LANG_SAVE
1510             AC_LANG_CPLUSPLUS
1511             _SAVE_CXXFLAGS="$CXXFLAGS"
1512             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1513             AC_TRY_COMPILE([],
1514                            [return(0);],
1515                            ac_has_wno_invalid_offsetof="yes",
1516                            ac_has_wno_invalid_offsetof="no")
1517             CXXFLAGS="$_SAVE_CXXFLAGS"
1518             AC_LANG_RESTORE
1519         ])
1520     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1521         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1522     fi
1524     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1525                    ac_has_wno_variadic_macros,
1526         [
1527             AC_LANG_SAVE
1528             AC_LANG_CPLUSPLUS
1529             _SAVE_CXXFLAGS="$CXXFLAGS"
1530             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1531             AC_TRY_COMPILE([],
1532                            [return(0);],
1533                            ac_has_wno_variadic_macros="yes",
1534                            ac_has_wno_variadic_macros="no")
1535             CXXFLAGS="$_SAVE_CXXFLAGS"
1536             AC_LANG_RESTORE
1537         ])
1538     if test "$ac_has_wno_variadic_macros" = "yes"; then
1539         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1540     fi
1542     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1543                    ac_has_werror_return_type,
1544         [
1545             AC_LANG_SAVE
1546             AC_LANG_CPLUSPLUS
1547             _SAVE_CXXFLAGS="$CXXFLAGS"
1548             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1549             AC_TRY_COMPILE([],
1550                            [return(0);],
1551                            ac_has_werror_return_type="yes",
1552                            ac_has_werror_return_type="no")
1553             CXXFLAGS="$_SAVE_CXXFLAGS"
1554             AC_LANG_RESTORE
1555         ])
1556     if test "$ac_has_werror_return_type" = "yes"; then
1557         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1558     fi
1560 else
1561     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1564 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1565 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1566 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1567 dnl normal behavior.
1568 dnl ========================================================
1569 MKSHLIB_FORCE_ALL=
1570 MKSHLIB_UNFORCE_ALL=
1572 if test "$COMPILE_ENVIRONMENT"; then
1573 if test "$GNU_CC"; then
1574   AC_MSG_CHECKING(whether ld has archive extraction flags)
1575   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1576    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1577     ac_cv_mkshlib_force_and_unforce="no"
1578     exec 3<&0 <<LOOP_INPUT
1579         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1580         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1581         force="-Wl,-all";              unforce="-Wl,-none"
1582 LOOP_INPUT
1583     while read line
1584     do
1585       eval $line
1586       LDFLAGS=$force
1587       LIBS=$unforce
1588       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1589     done
1590     exec 0<&3 3<&-
1591     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1592    ])
1593   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1594     AC_MSG_RESULT(no)
1595   else
1596     AC_MSG_RESULT(yes)
1597     eval $ac_cv_mkshlib_force_and_unforce
1598     MKSHLIB_FORCE_ALL=$force
1599     MKSHLIB_UNFORCE_ALL=$unforce
1600   fi
1601 fi # GNU_CC
1602 fi # COMPILE_ENVIRONMENT
1604 dnl =================================================================
1605 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1606 dnl which is bad when cross compiling.
1607 dnl =================================================================
1608 if test "$COMPILE_ENVIRONMENT"; then
1609 configure_static_assert_macros='
1610 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1611 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1612 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1615 dnl test that the macros actually work:
1616 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1617 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1618  [AC_LANG_SAVE
1619   AC_LANG_C
1620   ac_cv_static_assertion_macros_work="yes"
1621   AC_TRY_COMPILE([$configure_static_assert_macros],
1622                  [CONFIGURE_STATIC_ASSERT(1)],
1623                  ,
1624                  ac_cv_static_assertion_macros_work="no")
1625   AC_TRY_COMPILE([$configure_static_assert_macros],
1626                  [CONFIGURE_STATIC_ASSERT(0)],
1627                  ac_cv_static_assertion_macros_work="no",
1628                  )
1629   AC_LANG_CPLUSPLUS
1630   AC_TRY_COMPILE([$configure_static_assert_macros],
1631                  [CONFIGURE_STATIC_ASSERT(1)],
1632                  ,
1633                  ac_cv_static_assertion_macros_work="no")
1634   AC_TRY_COMPILE([$configure_static_assert_macros],
1635                  [CONFIGURE_STATIC_ASSERT(0)],
1636                  ac_cv_static_assertion_macros_work="no",
1637                  )
1638   AC_LANG_RESTORE
1639  ])
1640 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1641 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1642     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1644 fi # COMPILE_ENVIRONMENT
1646 dnl ========================================================
1647 dnl Checking for 64-bit OS
1648 dnl ========================================================
1649 if test "$COMPILE_ENVIRONMENT"; then
1650 AC_LANG_SAVE
1651 AC_LANG_C
1652 AC_MSG_CHECKING(for 64-bit OS)
1653 AC_TRY_COMPILE([$configure_static_assert_macros],
1654                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1655                result="yes", result="no")
1656 AC_MSG_RESULT("$result")
1657 if test "$result" = "yes"; then
1658     AC_DEFINE(HAVE_64BIT_OS)
1659     HAVE_64BIT_OS=1
1661 AC_SUBST(HAVE_64BIT_OS)
1662 AC_LANG_RESTORE
1663 fi # COMPILE_ENVIRONMENT
1665 dnl ========================================================
1666 dnl Enable high-memory support on OS/2 by default.
1667 dnl ========================================================
1668 MOZ_OS2_HIGH_MEMORY=1
1669 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1670 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1671     MOZ_OS2_HIGH_MEMORY=,
1672     MOZ_OS2_HIGH_MEMORY=1 )
1673 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1675 dnl ========================================================
1676 dnl System overrides of the defaults for host
1677 dnl ========================================================
1678 case "$host" in
1679 *-beos*)
1680     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1681     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1682     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1683     ;;
1685 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1686     # we need Python 2.5 on Windows
1687     PYTHON_VERSION=2.5
1688     if test -n "$_WIN32_MSVC"; then
1689         HOST_AR=lib
1690         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1691         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1692         HOST_RANLIB='echo ranlib'
1693     else
1694         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1695     fi
1696     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1697     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1698     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1699     HOST_BIN_SUFFIX=.exe
1700     case "$host" in
1701     *mingw*)
1702     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1703         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1704         ;;
1705     *)
1706         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1707         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1708             _pwd=`pwd`
1709             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1710         fi
1711         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1712             AS_PERL=1
1713             PERL="${CYGWIN_WRAPPER} $PERL"
1714         fi
1716         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1717             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1718         fi
1719         ;;
1720     esac
1722     case "${host_cpu}" in
1723     x86_64)
1724         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1725         ;;
1726     esac
1727     ;;
1729 *-darwin*)
1730     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1731     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1732     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1733     ;;
1735 *-linux*|*-kfreebsd*-gnu)
1736     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1737     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1738     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1739     ;;
1741 *os2*)
1742     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1743     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1744     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1745     HOST_BIN_SUFFIX=.exe
1746     MOZ_FIX_LINK_PATHS=
1747     ;;
1749 *-osf*)
1750     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1751     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1752     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1753     ;;
1756     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1757     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1758     ;;
1759 esac
1761 dnl We require version 2.4 or newer of Python to build,
1762 dnl and 2.5 or newer on Windows.
1763 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1764 changequote(,)
1765 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1766 _python_res=$?
1767 changequote([,])
1768 if test "$_python_res" != 0; then
1769     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1771 AC_MSG_RESULT([yes])
1773 dnl Get mozilla version from central milestone file
1774 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1776 dnl Get version of various core apps from the version files.
1777 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1779 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1780 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1782 dnl ========================================================
1783 dnl System overrides of the defaults for target
1784 dnl ========================================================
1786 case "$target" in
1787 *-aix*)
1788     AC_DEFINE(AIX)
1789     if test ! "$GNU_CC"; then
1790         if test ! "$HAVE_64BIT_OS"; then
1791             # Compiling with Visual Age C++ object model compat is the
1792             # default. To compile with object model ibm, add 
1793             # AIX_OBJMODEL=ibm to .mozconfig.
1794             if test "$AIX_OBJMODEL" = "ibm"; then
1795                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1796             else
1797                 AIX_OBJMODEL=compat
1798             fi
1799         else
1800             AIX_OBJMODEL=compat
1801         fi
1802         AC_SUBST(AIX_OBJMODEL)
1803         DSO_LDOPTS='-qmkshrobj=1'
1804         DSO_CFLAGS='-qflag=w:w'
1805         DSO_PIC_CFLAGS=
1806         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1807         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1808         MOZ_FIX_LINK_PATHS=
1809         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1810         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1811         if test "$COMPILE_ENVIRONMENT"; then
1812             AC_LANG_SAVE
1813             AC_LANG_CPLUSPLUS
1814             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1815             AC_TRY_COMPILE([],
1816                 [#if (__IBMCPP__ < 600)
1817                  #error "Bad compiler"
1818                  #endif],
1819                 _BAD_COMPILER=,_BAD_COMPILER=1)
1820             if test -n "$_BAD_COMPILER"; then
1821                 AC_MSG_RESULT([no])    
1822                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1823             else
1824                 AC_MSG_RESULT([yes])    
1825             fi
1826             AC_LANG_RESTORE
1827             TARGET_COMPILER_ABI="ibmc"
1828             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1829             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1830         fi
1831     fi
1832     case "${target_os}" in
1833     aix4.1*)
1834         DLL_SUFFIX='_shr.a'
1835         ;;
1836     esac
1837     if test "$COMPILE_ENVIRONMENT"; then
1838         AC_CHECK_HEADERS(sys/inttypes.h)
1839     fi
1840     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1841     ;;
1843 *-beos*)
1844     no_x=yes
1845     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1846     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1847     DSO_LDOPTS='-nostart'
1848     TK_LIBS='-lbe -lroot'
1849     LIBS="$LIBS -lbe"
1850     if test "$COMPILE_ENVIRONMENT"; then
1851         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1852         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1853     fi
1854     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1855     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1856     _MOZ_USE_RTTI=1
1857     USE_DEPENDENT_LIBS=
1858     MOZ_USER_DIR="Mozilla"
1859     ;;
1861 *-bsdi*)
1862     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1863     _PEDANTIC=
1864     _IGNORE_LONG_LONG_WARNINGS=
1865     case $OS_RELEASE in
1866         4.*|5.*)
1867             STRIP="$STRIP -d"
1868             ;;
1869         *)
1870             DSO_CFLAGS=''
1871             DSO_LDOPTS='-r'
1872             _WARNINGS_CFLAGS="-Wall"
1873             _WARNINGS_CXXFLAGS="-Wall"
1874             # The test above doesn't work properly, at least on 3.1.
1875             MKSHLIB_FORCE_ALL=''
1876             MKSHLIB_UNFORCE_ALL=''
1877         ;;
1878     esac
1879     ;;
1881 *-darwin*) 
1882     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1883     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1884     MOZ_OPTIMIZE_FLAGS="-O3"
1885     _PEDANTIC=
1886     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1887     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1888     DLL_SUFFIX=".dylib"
1889     DSO_LDOPTS=''
1890     STRIP="$STRIP -x -S"
1891     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1892     MOZ_ENABLE_POSTSCRIPT=
1893     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1894     # The ExceptionHandling framework is needed for Objective-C exception
1895     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1896     # builds.
1897     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1899     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1900     dnl ===================================================================
1901     if test "x$enable_dtrace" = "xyes"; then
1902         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1903     else
1904         dnl check for the presence of the -dead_strip linker flag
1905         AC_MSG_CHECKING([for -dead_strip option to ld])
1906         _SAVE_LDFLAGS=$LDFLAGS
1907         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1908         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1909         if test -n "$_HAVE_DEAD_STRIP" ; then
1910             AC_MSG_RESULT([yes])
1911             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1912         else
1913             AC_MSG_RESULT([no])
1914         fi
1915         
1916         LDFLAGS=$_SAVE_LDFLAGS
1917     fi
1918     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1919     ;;
1921 *-freebsd*)
1922     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1923         DLL_SUFFIX=".so.1.0"
1924         DSO_LDOPTS="-shared"
1925     fi
1926     if test ! "$GNU_CC"; then
1927         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1928     fi
1929 # Can't have force w/o an unforce.
1930 #    # Hack for FreeBSD 2.2
1931 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1932 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1933 #       MKSHLIB_UNFORCE_ALL=''
1934 #    fi
1935     ;; 
1937 *-hpux*)
1938     DLL_SUFFIX=".sl"
1939     if test ! "$GNU_CC"; then
1940         DSO_LDOPTS='-b -Wl,+s'
1941         DSO_CFLAGS=""
1942         DSO_PIC_CFLAGS="+Z"
1943         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1944         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1945         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1946     else
1947         DSO_LDOPTS='-b -E +s'
1948         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1949         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1950     fi
1951     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1952     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1953     ;;
1955 *-irix5*)
1956     AC_DEFINE(IRIX)
1957     DSO_LDOPTS='-elf -shared'
1959     if test "$GNU_CC"; then
1960        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1961        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1962        MKSHLIB_FORCE_ALL='-Wl,-all'
1963        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1964        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1965     else
1966        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1967        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1968        MKSHLIB_FORCE_ALL='-all'
1969        MKSHLIB_UNFORCE_ALL='-none'
1970     fi
1971     ;;
1973 *-irix6*)
1974     AC_DEFINE(IRIX)
1975     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1976     dnl compile and link using -n32
1977     USE_N32=1
1978     TARGET_COMPILER_ABI=n32
1979     DSO_LDOPTS='-elf -shared'
1980     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1981     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1982     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1983     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1984     if test "$GNU_CC"; then
1985        MKSHLIB_FORCE_ALL='-Wl,-all'
1986        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1987        _WARNINGS_CFLAGS="-Wall"
1988        _WARNINGS_CXXFLAGS="-Wall"
1989        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1990     else
1991        MKSHLIB_FORCE_ALL='-all'
1992        MKSHLIB_UNFORCE_ALL='-none'
1993            AR_LIST="$AR t"
1994            AR_EXTRACT="$AR x"
1995            AR_DELETE="$AR d"
1996            AR='$(CXX) -ar'
1997            AR_FLAGS='-o $@'
1998        CFLAGS="$CFLAGS -woff 3262 -G 4"
1999        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2000        if test -n "$USE_N32"; then
2001            ASFLAGS="$ASFLAGS -n32"
2002            CFLAGS="$CFLAGS -n32"
2003            CXXFLAGS="$CXXFLAGS -n32"
2004            LDFLAGS="$LDFLAGS -n32"
2005        fi
2006        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2007        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2008        MOZ_FIX_LINK_PATHS=
2009     fi
2010     if test -z "$GNU_CXX"; then
2011       MIPSPRO_CXX=1
2012     fi
2013     ;;
2015 *-*linux*)
2016     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2017     # Similarly for GNU_CXX and INTEL_CXX.
2018     if test "$INTEL_CC" || test "$INTEL_CXX"; then
2019         # -Os has been broken on Intel's C/C++ compilers for quite a
2020         # while; Intel recommends against using it.
2021         MOZ_OPTIMIZE_FLAGS="-O2"
2022         MOZ_DEBUG_FLAGS="-g -fno-inline"
2023     elif test "$GNU_CC" || test "$GNU_CXX"; then
2024         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2025         case $GCC_VERSION in
2026         4.1.*|4.2.*)
2027             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
2028             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2029         esac
2030         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
2031         MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
2032                                           # and that combo is not yet good at
2033                                           # debugging inlined functions (even
2034                                           # when using DWARF2 as the debugging
2035                                           # format)
2036     fi
2038     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2040     MOZ_MEMORY=1
2042     case "${target_cpu}" in
2043     alpha*)
2044         CFLAGS="$CFLAGS -mieee"
2045         CXXFLAGS="$CXXFLAGS -mieee"
2046     ;;
2047     i*86)
2048         USE_ELF_DYNSTR_GC=1
2049     ;;
2050     mips*)
2051         MOZ_DEBUG_FLAGS="-g" # We want inlining
2052     ;;
2053     esac
2054     ;;
2056 *-wince*|*-winmo*)
2057     TARGET_COMPILER_ABI=msvc
2058     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2059     _PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
2060     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2061     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2062     AR_LIST="$AR -list"
2063     AR_EXTRACT="$AR -extract"
2064     AR_DELETE="$AR d"
2065     AR_FLAGS='-OUT:"$@"'
2067     if test "$AS_BIN"; then
2068         AS="$AS_BIN"
2069     fi
2070     DSO_CFLAGS=
2071     DSO_PIC_CFLAGS=
2072     DLL_SUFFIX=.dll
2073     BIN_SUFFIX='.exe'
2074     if test -z "$RC"; then 
2075         RC=rc.exe  
2076     fi
2077     # certain versions of cygwin's makedepend barf on the 
2078     # #include <string> vs -I./dist/include/string issue so don't use it
2079     SYSTEM_MAKEDEPEND=
2081     HOST_CC=cl
2082     HOST_CXX=cl
2083     HOST_LD=link
2084     HOST_AR='lib -OUT:$@'
2085     HOST_RANLIB='echo ranlib'
2086     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2087         
2088         
2089     WARNINGS_AS_ERRORS='-WX'
2090     MOZ_OPTIMIZE_FLAGS='-Ox'
2091     AR_FLAGS='-NOLOGO -OUT:"$@"'
2092     ASM_SUFFIX=asm
2093     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2094     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2095     DLL_PREFIX=
2096     DOXYGEN=:
2097     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2098     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2099     GARBAGE=
2100     IMPORT_LIB_SUFFIX=lib
2101     LIBS="$LIBS"
2102     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2103     LIB_PREFIX=
2104     LIB_SUFFIX=lib 
2105     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2106     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2107     MKSHLIB_FORCE_ALL=
2108     MKSHLIB_UNFORCE_ALL=
2109     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2110     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2111     MOZ_DEBUG_FLAGS='-Zi'
2112     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2113     MOZ_FIX_LINK_PATHS=
2114     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2115     OBJ_SUFFIX=obj
2116     RANLIB='echo not_ranlib'
2117     STRIP='echo not_strip'
2118     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2119     UNZIP=unzip
2120     XARGS=xargs
2121     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2122     ZIP=zip
2123     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2124     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2125     STATIC_LIBIDL=1
2126     MOZ_TREE_FREETYPE=1
2128     AC_DEFINE(HAVE_SNPRINTF)
2129     AC_DEFINE(_WINDOWS)
2130     AC_DEFINE(WIN32)
2131     AC_DEFINE(XP_WIN)
2132     AC_DEFINE(XP_WIN32)
2133     AC_DEFINE(HW_THREADS)
2134     AC_DEFINE(STDC_HEADERS)
2135     AC_DEFINE(NEW_H, <new>)
2136     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2137     AC_DEFINE(HAVE_LOCALTIME_R)
2139     TARGET_MD_ARCH=win32
2140     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2141     BIN_SUFFIX='.exe'
2142     MOZ_ENABLE_POSTSCRIPT=
2143     MOZ_USER_DIR="Mozilla"
2145     MOZ_GFX_OPTIMIZE_MOBILE=1
2147     # Sanity check for WINCE_WINDOWS_MOBILE
2148     # XXX disabled until we can fix the mobile tinderbox
2149     ##if test "$WINCE_WINDOWS_MOBILE"; then
2150     ##   AC_CHECK_HEADER(tpcshell.h, [],
2151     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2152     ##fi
2156 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2157     DSO_CFLAGS=
2158     DSO_PIC_CFLAGS=
2159     DLL_SUFFIX=.dll
2160     RC=rc.exe
2161     # certain versions of cygwin's makedepend barf on the 
2162     # #include <string> vs -I./dist/include/string issue so don't use it
2163     SYSTEM_MAKEDEPEND=
2164     if test -n "$GNU_CC"; then
2165         CC="$CC -mno-cygwin"
2166         CXX="$CXX -mno-cygwin"
2167         CPP="$CPP -mno-cygwin"
2168         CFLAGS="$CFLAGS -mms-bitfields"
2169         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2170         DSO_LDOPTS='-shared'
2171         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2172         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2173         RC='$(WINDRES)'
2174         # Use temp file for windres (bug 213281)
2175         RCFLAGS='-O coff --use-temp-file'
2176         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2177         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2178         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2179         MOZ_FIX_LINK_PATHS=
2180         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
2181         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
2182         DLL_PREFIX=
2183         IMPORT_LIB_SUFFIX=dll.a
2184     else
2185         TARGET_COMPILER_ABI=msvc
2186         HOST_CC='$(CC)'
2187         HOST_CXX='$(CXX)'
2188         HOST_LD='$(LD)'
2189         if test "$AS_BIN"; then
2190             AS="$(basename "$AS_BIN")"
2191         fi
2192         AR='lib -NOLOGO -OUT:"$@"'
2193         AR_FLAGS=
2194         RANLIB='echo not_ranlib'
2195         STRIP='echo not_strip'
2196         XARGS=xargs
2197         ZIP=zip
2198         UNZIP=unzip
2199         DOXYGEN=:
2200         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2201         ASM_SUFFIX=asm
2202         OBJ_SUFFIX=obj
2203         LIB_SUFFIX=lib
2204         DLL_PREFIX=
2205         LIB_PREFIX=
2206         IMPORT_LIB_SUFFIX=lib
2207         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2208         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2209         MKSHLIB_FORCE_ALL=
2210         MKSHLIB_UNFORCE_ALL=
2211         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2212         _USE_CPP_INCLUDE_FLAG=1
2213         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2214         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2215         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2216         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2217         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2218         MOZ_DEBUG_FLAGS='-Zi'
2219         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2220         WARNINGS_AS_ERRORS='-WX'
2221         MOZ_OPTIMIZE_FLAGS='-O1'
2222         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2223         MOZ_FIX_LINK_PATHS=
2224         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2225         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2226         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2227         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2228         if test $_MSC_VER -ge 1400; then
2229             LDFLAGS="$LDFLAGS -NXCOMPAT"
2230             dnl For profile-guided optimization
2231             PROFILE_GEN_CFLAGS="-GL"
2232             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2233             dnl XXX: PGO builds can fail with warnings treated as errors,
2234             dnl specifically "no profile data available" appears to be
2235             dnl treated as an error sometimes. This might be a consequence
2236             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2237             dnl with the linker doing most of the work in the whole-program
2238             dnl optimization/PGO case. I think it's probably a compiler bug,
2239             dnl but we work around it here.
2240             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2241             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2242             dnl Probably also a compiler bug, but what can you do?
2243             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2244             if test -n "$_USE_DYNAMICBASE"; then
2245                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2246             fi
2247         fi
2248     fi
2249     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2250     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2251     AC_DEFINE(HAVE_SNPRINTF)
2252     AC_DEFINE(_WINDOWS)
2253     AC_DEFINE(WIN32)
2254     AC_DEFINE(XP_WIN)
2255     AC_DEFINE(XP_WIN32)
2256     AC_DEFINE(HW_THREADS)
2257     AC_DEFINE(STDC_HEADERS)
2258     AC_DEFINE(NEW_H, <new>)
2259     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2260     TARGET_MD_ARCH=win32
2261     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2262     BIN_SUFFIX='.exe'
2263     MOZ_ENABLE_POSTSCRIPT=
2264     MOZ_USER_DIR="Mozilla"
2266     dnl Hardcode to win95 for now - cls
2267     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2269     dnl set NO_X11 defines here as the general check is skipped on win32
2270     no_x=yes
2271     AC_DEFINE(NO_X11)
2273     dnl MinGW/MSYS doesn't provide or need cygpath
2274     case "$host" in
2275     *-mingw*)
2276         CYGPATH_W=echo
2277         CYGPATH_S=cat
2278         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2279         ;;
2280     *-cygwin*|*-msvc*|*-mks*)
2281         CYGPATH_W="cygpath -a -w"
2282         CYGPATH_S="sed -e s|\\\\|/|g"
2283         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2284         ;;
2285     esac
2286     case "$host" in
2287     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2289     if test -z "$MOZ_TOOLS"; then
2290         AC_MSG_ERROR([MOZ_TOOLS is not set])
2291     fi
2293     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2294     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2295         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2296     fi
2297     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2298     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2299         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2300     fi
2301     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2303     if test -n "$GLIB_PREFIX"; then
2304         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2305         if test "$?" = "0"; then
2306             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2307                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2308             fi
2309             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2310         else
2311             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2312         fi
2313     else
2314         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2315     fi
2316     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2317         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2318     fi
2319     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2320     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2321         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2322     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2323         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2324     else
2325         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2326     fi
2328     if test -n "$LIBIDL_PREFIX"; then
2329         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2330         if test "$?" = "0"; then
2331             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2332                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2333             fi
2334             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2335         else
2336             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2337         fi
2338     else
2339         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2340     fi        
2341     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2342         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2343     fi
2344     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2345     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2346         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2347         STATIC_LIBIDL=1
2348     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2349         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2350     else
2351         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2352     fi
2353     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2354     ;;
2356     *) # else cross-compiling
2357         if test -n "$GLIB_PREFIX"; then
2358             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2359             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2360                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2361             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2362                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2363             else
2364                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2365             fi
2366         fi
2367         if test -n "$LIBIDL_PREFIX"; then
2368             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2369             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2370                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2371                 STATIC_LIBIDL=1
2372             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2373                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2374             else
2375                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2376             fi
2377         fi
2378         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2379         ;;
2380     esac 
2383     case "$host_os" in
2384     cygwin*|msvc*|mks*)
2385         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])
2386         ;;
2388     *)
2389         AC_CHECK_HEADERS(oleacc.idl)
2391         AC_LANG_SAVE
2392         AC_LANG_CPLUSPLUS
2393         AC_CHECK_HEADERS(atlbase.h)
2394         AC_LANG_RESTORE
2395         ;;
2396     esac
2398     case "$target" in
2399     i*86-*)
2400         if test "$HAVE_64BIT_OS"; then
2401             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2402         fi
2404         if test $_MSC_VER -ge 1400; then
2405             LDFLAGS="$LDFLAGS -SAFESEH"
2406         fi
2407         AC_CHECK_HEADERS(mmintrin.h)
2408         AC_DEFINE(_X86_)
2409         ;;
2410     alpha-*)
2411         AC_DEFINE(_ALPHA_)
2412         ;;
2413     mips-*)
2414         AC_DEFINE(_MIPS_)
2415         ;;
2416     x86_64-*)
2417         AC_DEFINE(_AMD64_)
2418         ;;
2419     *)
2420         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2421         ;;
2422     esac
2424     if test "$HAVE_64BIT_OS"; then
2425         AC_DEFINE(_WIN64)
2426     fi
2427     ;;
2429 *-netbsd*)
2430     DSO_CFLAGS=''
2431     CFLAGS="$CFLAGS -Dunix"
2432     CXXFLAGS="$CXXFLAGS -Dunix"
2433     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2434         DLL_SUFFIX=".so"
2435         DSO_PIC_CFLAGS='-fPIC -DPIC'
2436         DSO_LDOPTS='-shared'
2437         BIN_FLAGS='-Wl,--export-dynamic'
2438     else
2439         DSO_PIC_CFLAGS='-fPIC -DPIC'
2440         DLL_SUFFIX=".so.1.0"
2441         DSO_LDOPTS='-shared'
2442     fi
2443     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2444     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2445     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2446     if test "$LIBRUNPATH"; then
2447         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2448     fi
2449     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2450     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2451     ;;
2453 *-nto*) 
2454         AC_DEFINE(NTO)  
2455         AC_DEFINE(_QNX_SOURCE)
2456         AC_DEFINE(_i386)
2457         OS_TARGET=NTO
2458         WARNINGS_AS_ERRORS=''
2459         MOZ_OPTIMIZE_FLAGS="-O"
2460         MOZ_DEBUG_FLAGS="-gstabs"
2461         USE_PTHREADS=1
2462         _PEDANTIC=
2463         LIBS="$LIBS -lsocket -lstdc++"
2464         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2465         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2466         if test "$with_x" != "yes"
2467         then
2468                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2469             TK_CFLAGS='-I/usr/include/photon'
2470                 TK_LIBS='-lph'
2471         fi
2472         case "${target_cpu}" in
2473         ppc*)
2474         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2475         ;;
2476         esac
2477         case "${host_cpu}" in
2478         i*86)
2479         USE_ELF_DYNSTR_GC=1
2480         ;;
2481         esac
2482         ;;
2484 *-openbsd*)
2485     DLL_SUFFIX=".so.1.0"
2486     DSO_CFLAGS=''
2487     DSO_PIC_CFLAGS='-fPIC'
2488     DSO_LDOPTS='-shared -fPIC'
2489     if test "$LIBRUNPATH"; then
2490         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2491     fi
2492     ;;
2494 *-openvms*) 
2495     AC_DEFINE(NO_PW_GECOS)
2496     AC_DEFINE(NO_UDSOCK)
2497     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2498     USE_PTHREADS=1
2499     MKSHLIB_FORCE_ALL='-all'
2500     MKSHLIB_UNFORCE_ALL='-none'
2501     AS='as'
2502     AS_DASH_C_FLAG='-Wc/names=as_is'
2503     AR_FLAGS='c $@'
2504     DSO_LDOPTS='-shared -auto_symvec'
2505     DSO_PIC_CFLAGS=
2506     MOZ_DEBUG_LDFLAGS='-g'
2507     COMPAQ_CXX=1
2508     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2509     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2510     ;;
2513 *-os2*)
2514     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2515     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2516     AC_DEFINE(OS2)
2517     AC_DEFINE(XP_OS2)
2518     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2519     AC_DEFINE(TCPV40HDRS)
2520     DLL_PREFIX=
2521     LIB_PREFIX=
2522     LIB_SUFFIX=lib
2523     BIN_SUFFIX=".exe"
2524     DLL_SUFFIX=".dll"
2525     IMPORT_LIB_SUFFIX=lib
2526     DSO_PIC_CFLAGS=
2527     AR=emxomfar
2528     AR_FLAGS='r $@'
2529     CFLAGS="$CFLAGS -Zomf"
2530     CXXFLAGS="$CXXFLAGS -Zomf"
2531     DSO_LDOPTS='-Zdll'
2532     BIN_FLAGS='-Zlinker /ST:0x100000'
2533     IMPLIB='emximp -o'
2534     FILTER='emxexp -o'
2535     LDFLAGS='-Zmap'
2536     WARNINGS_AS_ERRORS='-Werror'
2537     MOZ_DEBUG_FLAGS="-g -fno-inline"
2538     MOZ_OPTIMIZE_FLAGS="-O2"
2539     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2540     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2541     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2542     TARGET_MD_ARCH=os2
2543     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2544     MOZ_ENABLE_POSTSCRIPT=
2545     RC=rc.exe
2546     RCFLAGS='-n'
2547     MOZ_USER_DIR="Mozilla"
2549     if test "$MOZTOOLS"; then
2550         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2551     else
2552         AC_MSG_ERROR([MOZTOOLS is not set])
2553     fi
2554     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2555         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2556         LDFLAGS="$LDFLAGS -Zhigh-mem"
2557         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2558         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2559     fi
2561     # GCC for OS/2 currently predefines these, but we don't want them
2562     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2563     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2565     AC_CACHE_CHECK(for __declspec(dllexport),
2566         ac_os2_declspec,
2567         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2568                         [return 0;],
2569                         ac_os2_declspec="yes",
2570                         ac_os2_declspec="no")])
2571     if test "$ac_os2_declspec" = "yes"; then
2572         FILTER='true'
2573         MOZ_OS2_USE_DECLSPEC='1'
2574     fi
2575     ;;
2577 alpha*-*-osf*)
2578     if test "$GNU_CC"; then
2579       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2580       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2582     else
2583         MOZ_DEBUG_FLAGS='-g'
2584         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2585         CFLAGS="$CFLAGS -ieee"
2586         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2587         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2588         DSO_CFLAGS=
2589         DSO_PIC_CFLAGS=
2590         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2591         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2592         MKSHLIB_FORCE_ALL='-all'
2593         MKSHLIB_UNFORCE_ALL='-none'
2594         dnl Might fix the libxpcom.so breakage on this platform as well....
2595         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2596         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2597     fi
2598     if test -z "$GNU_CXX"; then
2599       COMPAQ_CXX=1
2600     fi
2601     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2602     ;;
2604 *-qnx*) 
2605     DIRENT_INO=d_stat.st_ino
2606     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2607     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2608     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2609     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2610     AC_DEFINE(STDC_HEADERS)
2611     if test "$no_x" = "yes"; then
2612             _PLATFORM_DEFAULT_TOOLKIT='photon'
2613             TK_CFLAGS='-I/usr/nto/include/photon'
2614             TK_LIBS='-lphoton -lphrender'
2615     fi
2616     ;;
2618 *-sco*) 
2619     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2620     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2621     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2622     if test ! "$GNU_CC"; then
2623        DSO_LDOPTS='-G'
2624     fi
2625     ;;
2627 *-solaris*) 
2628     AC_DEFINE(SOLARIS)
2629     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2630     SYSTEM_MAKEDEPEND=
2631     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2632     # libraries one level up (e.g. libnspr4.so)
2633     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2634     MOZ_MEMORY=1
2635     if test "$SOLARIS_SUNPRO_CC"; then
2636        LIBS="-lCrun -lCstd $LIBS"
2637        NS_USE_NATIVE=1
2638        MOZ_FIX_LINK_PATHS=
2639        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2640        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2641        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2642        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2643        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2644            _SAVE_LDFLAGS=$LDFLAGS
2645            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2646            AC_TRY_LINK([#include <stdio.h>],
2647                        [printf("Hello World\n");],
2648                        ,
2649                        [LDFLAGS=$_SAVE_LDFLAGS])
2650        fi
2651        WARNINGS_AS_ERRORS='-Werror'
2652        MOZ_OPTIMIZE_FLAGS="-xO4"
2653        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2654        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2655        MKSHLIB_FORCE_ALL='-z allextract'
2656        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2657        DSO_LDOPTS='-G -z muldefs'
2658        AR_LIST="$AR t"
2659        AR_EXTRACT="$AR x"
2660        AR_DELETE="$AR d"
2661        AR='$(CXX) -xar'
2662        AR_FLAGS='-o $@'
2663        AS='/usr/ccs/bin/as'
2664        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2665        AS_DASH_C_FLAG=''
2666        TARGET_COMPILER_ABI="sunc"
2667        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2668        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2669        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2670        AC_LANG_SAVE
2671        AC_LANG_CPLUSPLUS
2672        AC_TRY_COMPILE([],
2673            [#if (__SUNPRO_CC < 0x590)
2674            #error "Denied"
2675            #endif],
2676            _BAD_COMPILER=,_BAD_COMPILER=1)
2677         if test -n "$_BAD_COMPILER"; then
2678             _res="no"
2679             AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2680         else
2681             _res="yes"
2682         fi
2683         AC_MSG_RESULT([$_res])
2684         AC_LANG_RESTORE
2685     else
2686        ASFLAGS="$ASFLAGS -fPIC"
2687        DSO_LDOPTS='-G'
2688        _WARNINGS_CFLAGS=''
2689        _WARNINGS_CXXFLAGS=''
2690        if test "$OS_RELEASE" = "5.3"; then
2691           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2692        fi
2693     fi
2694     if test "$OS_RELEASE" = "5.5.1"; then
2695        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2696     fi
2697     ;;
2699 *-sunos*) 
2700     DSO_LDOPTS='-Bdynamic'
2701     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2702     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2703     AC_DEFINE(SUNOS4)
2704     AC_DEFINE(SPRINTF_RETURNS_STRING)
2705     case "$(target_os)" in
2706     sunos4.1*)
2707         DLL_SUFFIX='.so.1.0'
2708         ;;
2709     esac
2710     ;;
2712 *-sysv4.2uw7*) 
2713         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2714     ;;
2716 *-os2*)
2717     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2718     ;;
2720 esac
2722 dnl Only one oddball right now (QNX), but this gives us flexibility
2723 dnl if any other platforms need to override this in the future.
2724 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2726 dnl ========================================================
2727 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2728 dnl by now will not have any way to link most binaries (tests
2729 dnl as well as viewer, apprunner, etc.), because some symbols
2730 dnl will be left out of the "composite" .so's by ld as unneeded.
2731 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2732 dnl they can link in the static libs that provide the missing
2733 dnl symbols.
2734 dnl ========================================================
2735 NO_LD_ARCHIVE_FLAGS=
2736 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2737     NO_LD_ARCHIVE_FLAGS=1
2739 case "$target" in
2740 *-os2*)
2741     NO_LD_ARCHIVE_FLAGS=
2742     ;;
2743 *-aix4.3*|*-aix5*)
2744     NO_LD_ARCHIVE_FLAGS=
2745     ;;
2746 *-openvms*)
2747     NO_LD_ARCHIVE_FLAGS=
2748     ;;
2749 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2750     if test -z "$GNU_CC"; then
2751         NO_LD_ARCHIVE_FLAGS=
2752     fi
2753     ;;
2754 esac
2755 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2757 dnl ========================================================
2758 dnl = Flags to strip unused symbols from .so components
2759 dnl ========================================================
2760 case "$target" in
2761     *-linux*|*-kfreebsd*-gnu)
2762         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2763         ;;
2764     *-solaris*)
2765         if test -z "$GNU_CC"; then
2766          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2767         else
2768          if test -z "$GCC_USE_GNU_LD"; then
2769           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2770          else
2771           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2772          fi
2773         fi
2774         ;;
2775     *-nto*) 
2776         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2777         ;;
2778     *-darwin*)
2779         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2780         ;;
2781     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2782         if test -n "$GNU_CC"; then
2783            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2784         fi
2785         ;;
2786 esac
2788 if test -z "$COMPILE_ENVIRONMENT"; then
2789     SKIP_COMPILER_CHECKS=1
2790     SKIP_LIBRARY_CHECKS=1
2793 if test -z "$SKIP_COMPILER_CHECKS"; then
2794 dnl Checks for typedefs, structures, and compiler characteristics.
2795 dnl ========================================================
2796 AC_LANG_C
2797 AC_HEADER_STDC
2798 AC_C_CONST
2799 AC_TYPE_MODE_T
2800 AC_TYPE_OFF_T
2801 AC_TYPE_PID_T
2802 AC_TYPE_SIZE_T
2803 AC_STRUCT_ST_BLKSIZE
2804 AC_MSG_CHECKING(for siginfo_t)
2805 AC_CACHE_VAL(ac_cv_siginfo_t,
2806  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2807                   #include <signal.h>],
2808                  [siginfo_t* info;],
2809                  [ac_cv_siginfo_t=true],
2810                  [ac_cv_siginfo_t=false])])
2811 if test "$ac_cv_siginfo_t" = true ; then
2812   AC_DEFINE(HAVE_SIGINFO_T)
2813   AC_MSG_RESULT(yes)
2814 else
2815   AC_MSG_RESULT(no)
2818 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2819 dnl ========================================================
2820 AC_MSG_CHECKING(for int16_t)
2821 AC_CACHE_VAL(ac_cv_int16_t,
2822  [AC_TRY_COMPILE([#include <stdio.h>
2823                   #include <sys/types.h>],
2824                  [int16_t foo = 0;],
2825                  [ac_cv_int16_t=true],
2826                  [ac_cv_int16_t=false])])
2827 if test "$ac_cv_int16_t" = true ; then
2828   AC_DEFINE(HAVE_INT16_T)
2829   AC_MSG_RESULT(yes)
2830 else
2831   AC_MSG_RESULT(no)
2833 AC_MSG_CHECKING(for int32_t)
2834 AC_CACHE_VAL(ac_cv_int32_t,
2835  [AC_TRY_COMPILE([#include <stdio.h>
2836                   #include <sys/types.h>],
2837                  [int32_t foo = 0;],
2838                  [ac_cv_int32_t=true],
2839                  [ac_cv_int32_t=false])])
2840 if test "$ac_cv_int32_t" = true ; then
2841   AC_DEFINE(HAVE_INT32_T)
2842   AC_MSG_RESULT(yes)
2843 else
2844   AC_MSG_RESULT(no)
2846 AC_MSG_CHECKING(for int64_t)
2847 AC_CACHE_VAL(ac_cv_int64_t,
2848  [AC_TRY_COMPILE([#include <stdio.h>
2849                   #include <sys/types.h>],
2850                  [int64_t foo = 0;],
2851                  [ac_cv_int64_t=true],
2852                  [ac_cv_int64_t=false])])
2853 if test "$ac_cv_int64_t" = true ; then
2854   AC_DEFINE(HAVE_INT64_T)
2855   AC_MSG_RESULT(yes)
2856 else
2857   AC_MSG_RESULT(no)
2859 AC_MSG_CHECKING(for int64)
2860 AC_CACHE_VAL(ac_cv_int64,
2861  [AC_TRY_COMPILE([#include <stdio.h>
2862                   #include <sys/types.h>],
2863                  [int64 foo = 0;],
2864                  [ac_cv_int64=true],
2865                  [ac_cv_int64=false])])
2866 if test "$ac_cv_int64" = true ; then
2867   AC_DEFINE(HAVE_INT64)
2868   AC_MSG_RESULT(yes)
2869 else
2870   AC_MSG_RESULT(no)
2872 AC_MSG_CHECKING(for uint)
2873 AC_CACHE_VAL(ac_cv_uint,
2874  [AC_TRY_COMPILE([#include <stdio.h>
2875                   #include <sys/types.h>],
2876                  [uint foo = 0;],
2877                  [ac_cv_uint=true],
2878                  [ac_cv_uint=false])])
2879 if test "$ac_cv_uint" = true ; then
2880   AC_DEFINE(HAVE_UINT)
2881   AC_MSG_RESULT(yes)
2882 else
2883   AC_MSG_RESULT(no)
2885 AC_MSG_CHECKING(for uint_t)
2886 AC_CACHE_VAL(ac_cv_uint_t,
2887  [AC_TRY_COMPILE([#include <stdio.h>
2888                   #include <sys/types.h>],
2889                  [uint_t foo = 0;],
2890                  [ac_cv_uint_t=true],
2891                  [ac_cv_uint_t=false])])
2892 if test "$ac_cv_uint_t" = true ; then
2893   AC_DEFINE(HAVE_UINT_T)
2894   AC_MSG_RESULT(yes)
2895 else
2896   AC_MSG_RESULT(no)
2898 AC_MSG_CHECKING(for uint16_t)
2899 AC_CACHE_VAL(ac_cv_uint16_t,
2900  [AC_TRY_COMPILE([#include <stdio.h>
2901                   #include <sys/types.h>],
2902                  [uint16_t foo = 0;],
2903                  [ac_cv_uint16_t=true],
2904                  [ac_cv_uint16_t=false])])
2905 if test "$ac_cv_uint16_t" = true ; then
2906   AC_DEFINE(HAVE_UINT16_T)
2907   AC_MSG_RESULT(yes)
2908 else
2909   AC_MSG_RESULT(no)
2912 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2913 dnl are defined when compiling C++ but not C.  Since the result of this
2914 dnl test is used only in C++, do it in C++.
2915 AC_LANG_CPLUSPLUS
2917 AC_MSG_CHECKING(for uname.domainname)
2918 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2919     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2920         [ struct utsname *res; char *domain; 
2921             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2922         [ac_cv_have_uname_domainname_field=true],
2923         [ac_cv_have_uname_domainname_field=false])])
2925 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2926     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2927     AC_MSG_RESULT(yes)
2928 else
2929     AC_MSG_RESULT(no)
2932 AC_MSG_CHECKING(for uname.__domainname)
2933 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2934     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2935         [ struct utsname *res; char *domain; 
2936             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2937         [ac_cv_have_uname_us_domainname_field=true],
2938         [ac_cv_have_uname_us_domainname_field=false])])
2940 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2941     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2942     AC_MSG_RESULT(yes)
2943 else
2944     AC_MSG_RESULT(no)
2947 AC_LANG_CPLUSPLUS
2949 dnl Check for usable char16_t (2 bytes, unsigned)
2950 dnl (we might not need the unsignedness check anymore)
2951 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2952     ac_cv_have_usable_char16_t,
2953     [AC_TRY_COMPILE([$configure_static_assert_macros],
2954                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2955                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2956                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2957                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2958                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2959                     ac_cv_have_usable_char16_t="yes",
2960                     ac_cv_have_usable_char16_t="no")])
2961 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2962     AC_DEFINE(HAVE_CPP_CHAR16_T)
2963     HAVE_CPP_CHAR16_T=1
2966 dnl Check for usable wchar_t (2 bytes, unsigned)
2967 dnl (we really don't need the unsignedness check anymore)
2968 dnl ========================================================
2970 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2971     ac_cv_have_usable_wchar_v2,
2972     [AC_TRY_COMPILE([#include <stddef.h>
2973                      $configure_static_assert_macros],
2974                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2975                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2976                     ac_cv_have_usable_wchar_v2="yes",
2977                     ac_cv_have_usable_wchar_v2="no")])
2978 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2979     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2980     HAVE_CPP_2BYTE_WCHAR_T=1
2981 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2982 dnl This is really gcc-only
2983 dnl Do this test using CXX only since some versions of gcc
2984 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2985 dnl only have short-wchar support for c++.
2986 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2988     _SAVE_CXXFLAGS=$CXXFLAGS
2989     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2991     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2992         ac_cv_have_usable_wchar_option_v2,
2993         [AC_TRY_LINK([#include <stddef.h>
2994                       $configure_static_assert_macros],
2995                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2996                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2997                      ac_cv_have_usable_wchar_option_v2="yes",
2998                      ac_cv_have_usable_wchar_option_v2="no")])
3000     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3001         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3002         HAVE_CPP_2BYTE_WCHAR_T=1
3003         WCHAR_CFLAGS="-fshort-wchar"
3004     else    
3005         CXXFLAGS=$_SAVE_CXXFLAGS
3006     fi
3009 AC_LANG_C
3011 dnl Check for .hidden assembler directive and visibility attribute.
3012 dnl Borrowed from glibc configure.in
3013 dnl ===============================================================
3014 if test "$GNU_CC"; then
3015   AC_CACHE_CHECK(for visibility(hidden) attribute,
3016                  ac_cv_visibility_hidden,
3017                  [cat > conftest.c <<EOF
3018                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3020                   ac_cv_visibility_hidden=no
3021                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3022                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3023                       ac_cv_visibility_hidden=yes
3024                     fi
3025                   fi
3026                   rm -f conftest.[cs]
3027                  ])
3028   if test "$ac_cv_visibility_hidden" = "yes"; then
3029     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3031     AC_CACHE_CHECK(for visibility(default) attribute,
3032                    ac_cv_visibility_default,
3033                    [cat > conftest.c <<EOF
3034                     int foo __attribute__ ((visibility ("default"))) = 1;
3036                     ac_cv_visibility_default=no
3037                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3038                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3039                         ac_cv_visibility_default=yes
3040                       fi
3041                     fi
3042                     rm -f conftest.[cs]
3043                    ])
3044     if test "$ac_cv_visibility_default" = "yes"; then
3045       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3047       AC_CACHE_CHECK(for visibility pragma support,
3048                      ac_cv_visibility_pragma,
3049                      [cat > conftest.c <<EOF
3050 #pragma GCC visibility push(hidden)
3051                       int foo_hidden = 1;
3052 #pragma GCC visibility push(default)
3053                       int foo_default = 1;
3055                       ac_cv_visibility_pragma=no
3056                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3057                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3058                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3059                             ac_cv_visibility_pragma=yes
3060                           fi
3061                         fi
3062                       fi
3063                       rm -f conftest.[cs]
3064                     ])
3065       if test "$ac_cv_visibility_pragma" = "yes"; then
3066         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3067                        ac_cv_have_visibility_class_bug,
3068                        [cat > conftest.c <<EOF
3069 #pragma GCC visibility push(hidden)
3070 struct __attribute__ ((visibility ("default"))) TestStruct {
3071   static void Init();
3073 __attribute__ ((visibility ("default"))) void TestFunc() {
3074   TestStruct::Init();
3077                        ac_cv_have_visibility_class_bug=no
3078                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3079                          ac_cv_have_visibility_class_bug=yes
3080                        else
3081                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3082                            ac_cv_have_visibility_class_bug=yes
3083                          fi
3084                        fi
3085                        rm -rf conftest.{c,S}
3086                        ])
3088         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3089                        ac_cv_have_visibility_builtin_bug,
3090                        [cat > conftest.c <<EOF
3091 #pragma GCC visibility push(hidden)
3092 #pragma GCC visibility push(default)
3093 #include <string.h>
3094 #pragma GCC visibility pop
3096 __attribute__ ((visibility ("default"))) void Func() {
3097   char c[[100]];
3098   memset(c, 0, sizeof(c));
3101                        ac_cv_have_visibility_builtin_bug=no
3102                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3103                          ac_cv_have_visibility_builtin_bug=yes
3104                        else
3105                          if test `grep -c "@PLT" conftest.S` = 0; then
3106                            ac_cv_visibility_builtin_bug=yes
3107                          fi
3108                        fi
3109                        rm -f conftest.{c,S}
3110                        ])
3111         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3112                 "$ac_cv_have_visibility_class_bug" = "no"; then
3113           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3114           WRAP_SYSTEM_INCLUDES=1
3115         else
3116           VISIBILITY_FLAGS='-fvisibility=hidden'
3117         fi # have visibility pragma bug
3118       fi   # have visibility pragma
3119     fi     # have visibility(default) attribute
3120   fi       # have visibility(hidden) attribute
3121 fi         # GNU_CC
3123 # visibility hidden flag for Sun Studio on Solaris
3124 if test "$SOLARIS_SUNPRO_CC"; then
3125 VISIBILITY_FLAGS='-xldscope=hidden'
3126 fi         # Sun Studio on Solaris
3128 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3129 AC_SUBST(VISIBILITY_FLAGS)
3131 dnl Checks for header files.
3132 dnl ========================================================
3133 AC_HEADER_DIRENT
3134 case "$target_os" in
3135 freebsd*)
3136 # for stuff like -lXshm
3137     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3138     ;;
3139 esac
3140 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3141 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3142 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3143 AC_CHECK_HEADERS(malloc.h)
3144 AC_CHECK_HEADERS(X11/XKBlib.h)
3145 AC_CHECK_HEADERS(io.h)
3147 dnl These are all the places some variant of statfs can be hiding.
3148 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3150 dnl Quota support
3151 AC_CHECK_HEADERS(sys/quota.h)
3153 dnl Try for MMX support
3154 dnl NB - later gcc versions require -mmmx for this header to be successfully
3155 dnl included (or another option which implies it, such as -march=pentium-mmx)
3156 AC_CHECK_HEADERS(mmintrin.h)
3158 dnl Check whether the compiler supports the new-style C++ standard
3159 dnl library headers (i.e. <new>) or needs the old "new.h"
3160 AC_LANG_CPLUSPLUS
3161 NEW_H=new.h
3162 AC_CHECK_HEADER(new, [NEW_H=new])
3163 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3164 AC_LANG_C
3166 AC_ARG_ENABLE(dtrace,
3167               [  --enable-dtrace         build with dtrace support if available (default=no)],
3168               [enable_dtrace="yes"],)
3169 if test "x$enable_dtrace" = "xyes"; then
3170   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3171   if test -n "$HAVE_DTRACE"; then
3172       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3173   else
3174       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3175   fi
3177 AC_SUBST(HAVE_DTRACE)
3179 case $target in
3180 *-aix4.3*|*-aix5*)
3181         ;;
3183         AC_CHECK_HEADERS(sys/cdefs.h)
3184         ;;
3185 esac
3187 dnl Checks for libraries.
3188 dnl ========================================================
3189 case $target in
3190 *-hpux11.*)
3191         ;;
3193         AC_CHECK_LIB(c_r, gethostbyname_r)
3194         ;;
3195 esac
3197 dnl We don't want to link with libdl even if it's present on OS X, since
3198 dnl it's not used and not part of the default installation.
3199 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3200 dnl We don't want to link against libm or libpthread on Darwin since
3201 dnl they both are just symlinks to libSystem and explicitly linking
3202 dnl against libSystem causes issues when debugging (see bug 299601).
3203 case $target in
3204 *-darwin*)
3205     ;;
3206 *-beos*)
3207     ;;
3208 *-os2*)
3209     ;;
3211     AC_CHECK_LIB(m, atan)
3212     AC_CHECK_LIB(dl, dlopen,
3213     AC_CHECK_HEADER(dlfcn.h, 
3214         LIBS="-ldl $LIBS"
3215         AC_DEFINE(HAVE_LIBDL)))
3216     ;;
3217 esac
3219 _SAVE_CFLAGS="$CFLAGS"
3220 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3221 AC_CHECK_FUNCS(dladdr)
3222 CFLAGS="$_SAVE_CFLAGS"
3224 if test ! "$GNU_CXX"; then
3226     case $target in
3227     *-aix*)
3228         AC_CHECK_LIB(C_r, demangle)
3229         ;;
3230      *)
3231         AC_CHECK_LIB(C, demangle)
3232         ;;
3233      esac
3236 dnl OS/2 has socket in libc.
3237 case $target in
3238 *-os2*)
3239     ;;
3241     AC_CHECK_LIB(socket, socket)
3242 esac
3244 dnl ========================================================
3245 dnl Check whether we can compile code for Core Text
3246 dnl (Mac OS X 10.5 or later)
3247 dnl ========================================================
3248 case "$target" in
3249 *-darwin*)
3250   AC_MSG_CHECKING([for Core Text])
3251   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3252                  [CTLineRef lineRef;],
3253                   ac_cv_have_core_text="yes",
3254                   ac_cv_have_core_text="no")
3255   AC_MSG_RESULT([$ac_cv_have_core_text])
3257   MOZ_CORETEXT=1
3259   MOZ_ARG_DISABLE_BOOL(coretext,
3260 [  --disable-coretext      Use ATSUI instead of Core Text for text rendering],
3261     MOZ_CORETEXT=,
3262     MOZ_CORETEXT=1)
3264   if test -n "$MOZ_CORETEXT"; then
3265     if test "$ac_cv_have_core_text" = "no"; then
3266       AC_MSG_ERROR([--enable-coretext requires MacOS SDK 10.5 or newer])
3267      fi
3268      AC_DEFINE(MOZ_CORETEXT)
3269   fi
3270   ;;
3271 esac
3273 AC_SUBST(MOZ_CORETEXT)
3275 XLDFLAGS="$X_LIBS"
3276 XLIBS="$X_EXTRA_LIBS"
3278 dnl ========================================================
3279 dnl Checks for X libraries.
3280 dnl Ordering is important.
3281 dnl Xt is dependent upon SM as of X11R6
3282 dnl ========================================================
3283 if test "$no_x" = "yes"; then
3284     AC_DEFINE(NO_X11)
3285 else
3286     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3287         XLIBS="-lX11 $XLIBS"
3288         _SAVE_LDFLAGS="$LDFLAGS"
3289         LDFLAGS="$XLDFLAGS $LDFLAGS"
3290         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3291                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3292         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3293                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3294      
3295         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3296         unset ac_cv_lib_Xt_XtFree
3297             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3298             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3299         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3300                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3301         ])
3303     # AIX needs the motif library linked before libXt to prevent
3304     # crashes in plugins linked against Motif - Bug #98892
3305     case "${target_os}" in
3306     aix*)
3307         XT_LIBS="-lXm $XT_LIBS"
3308         ;;
3309     esac
3311     dnl ========================================================
3312     dnl = Check for XShm
3313     dnl ========================================================
3314     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3315         $XLIBS $XEXT_LIBS)
3316     AC_CHECK_HEADER(X11/extensions/XShm.h)
3317     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3318         test -n "$_HAVE_XSHM_XEXT"; then
3319         AC_DEFINE(HAVE_XSHM)
3320     fi
3322     dnl ========================================================
3323     dnl = Check for XIE
3324     dnl ========================================================
3325     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3326         $XLIBS $XEXT_LIBS)
3327     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3329     if test "$MOZ_XIE_LIBS"; then
3330         dnl ====================================================
3331         dnl = If XIE is present and is desired, turn it on
3332         dnl ====================================================
3333         case $target in
3334             *-hpux*)
3335                 ;;
3336             *)
3337                 HAVE_XIE=1
3338                 ;;
3339         esac
3340     fi
3342         LDFLAGS="$_SAVE_LDFLAGS"
3344     dnl ========================================================
3345     dnl = Check for freetype2 and its functionality
3346     dnl ========================================================
3347     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3349     if test "$_HAVE_FREETYPE2"; then
3350         _SAVE_LIBS="$LIBS"
3351         _SAVE_CFLAGS="$CFLAGS"
3352         LIBS="$LIBS $FT2_LIBS"
3353         CFLAGS="$CFLAGS $FT2_CFLAGS"
3355         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3356             ac_cv_member_FT_Bitmap_Size_y_ppem,
3357             [AC_TRY_COMPILE([#include <ft2build.h>
3358                              #include FT_FREETYPE_H],
3359                             [FT_Bitmap_Size s;
3360                              if (sizeof s.y_ppem) return 0;
3361                              return 1],
3362                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3363                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3364         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3365             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3366         else
3367             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3368         fi
3369         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3370                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3371                            [FT_Bitmap_Size structure includes y_ppem field])
3373         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3375         LIBS="$_SAVE_LIBS"
3376         CFLAGS="$_SAVE_CFLAGS"
3377     fi
3379 fi # $no_x
3381 AC_SUBST(XCFLAGS)
3382 AC_SUBST(XLDFLAGS)
3383 AC_SUBST(XLIBS)
3384 AC_SUBST(XEXT_LIBS)
3385 AC_SUBST(XT_LIBS)
3387 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3388 AC_TRY_COMPILE([],
3389                [asm("uqadd8 r1, r1, r2");],
3390                result="yes", result="no")
3391 AC_MSG_RESULT("$result")
3392 if test "$result" = "yes"; then
3393     AC_DEFINE(HAVE_ARM_SIMD)
3394     HAVE_ARM_SIMD=1
3396 AC_SUBST(HAVE_ARM_SIMD)
3398 AC_MSG_CHECKING(for ARM NEON support in compiler)
3399 _SAVE_CFLAGS="$CFLAGS"
3400 if test "$GNU_CC"; then
3401   # gcc needs -mfpu=neon to recognize NEON instructions
3402   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3404 AC_TRY_COMPILE([],
3405                [asm("vadd.i8 d0, d0, d0");],
3406                result="yes", result="no")
3407 AC_MSG_RESULT("$result")
3408 if test "$result" = "yes"; then
3409     AC_DEFINE(HAVE_ARM_NEON)
3410     HAVE_ARM_NEON=1
3412 CFLAGS="$_SAVE_CFLAGS"
3413 AC_SUBST(HAVE_ARM_NEON)
3415 dnl ========================================================
3416 dnl = pthread support
3417 dnl = Start by checking whether the system support pthreads
3418 dnl ========================================================
3419 case "$target_os" in
3420 darwin*)
3421     USE_PTHREADS=1
3422     ;;
3424     MOZ_CHECK_PTHREADS(pthreads,
3425         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3426         MOZ_CHECK_PTHREADS(pthread,
3427             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3428             MOZ_CHECK_PTHREADS(c_r,
3429                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3430                 MOZ_CHECK_PTHREADS(c,
3431                     USE_PTHREADS=1
3432                 )
3433             )
3434         )
3435     )
3436     ;;
3437 esac
3439 dnl ========================================================
3440 dnl Check the command line for --with-pthreads 
3441 dnl ========================================================
3442 MOZ_ARG_WITH_BOOL(pthreads,
3443 [  --with-pthreads         Force use of system pthread library with NSPR ],
3444 [ if test "$USE_PTHREADS"x = x; then
3445     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3446 fi],
3447     USE_PTHREADS=
3448     _PTHREAD_LDFLAGS=
3451 dnl ========================================================
3452 dnl Do the platform specific pthread hackery
3453 dnl ========================================================
3454 if test "$USE_PTHREADS"x != x
3455 then
3456         dnl
3457         dnl See if -pthread is supported.
3458         dnl
3459         rm -f conftest*
3460         ac_cv_have_dash_pthread=no
3461         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3462         echo 'int main() { return 0; }' | cat > conftest.c
3463         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3464         if test $? -eq 0; then
3465                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3466                         ac_cv_have_dash_pthread=yes
3467                 case "$target_os" in
3468                 freebsd*)
3469 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3470                 ;;
3471                 *)
3472                             CFLAGS="$CFLAGS -pthread"
3473                             CXXFLAGS="$CXXFLAGS -pthread"
3474                 ;;
3475                 esac
3476                 fi
3477         fi
3478         rm -f conftest*
3479     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3481         dnl
3482         dnl See if -pthreads is supported.
3483         dnl
3484     ac_cv_have_dash_pthreads=no
3485     if test "$ac_cv_have_dash_pthread" = "no"; then
3486             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3487         echo 'int main() { return 0; }' | cat > conftest.c
3488             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3489         if test $? -eq 0; then
3490                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3491                             ac_cv_have_dash_pthreads=yes
3492                             CFLAGS="$CFLAGS -pthreads"
3493                             CXXFLAGS="$CXXFLAGS -pthreads"
3494                     fi
3495             fi
3496             rm -f conftest*
3497         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3498     fi
3500         case "$target" in
3501             *-*-freebsd*)
3502                         AC_DEFINE(_REENTRANT)
3503                         AC_DEFINE(_THREAD_SAFE)
3504                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3505                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3506                                 _PTHREAD_LDFLAGS="-pthread"
3507                         else
3508                                 _PTHREAD_LDFLAGS="-lc_r"
3509                         fi
3510                         ;;
3512             *-*-openbsd*|*-*-bsdi*)
3513                         AC_DEFINE(_REENTRANT)
3514                         AC_DEFINE(_THREAD_SAFE)
3515                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3516                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3517                 _PTHREAD_LDFLAGS="-pthread"
3518                         fi
3519                         ;;
3521             *-*-linux*|*-*-kfreebsd*-gnu)
3522                         AC_DEFINE(_REENTRANT) 
3523                         ;;
3525             *-*-nto*) 
3526                         AC_DEFINE(_REENTRANT) 
3527                         ;;
3529             *-aix4.3*|*-aix5*)
3530                         AC_DEFINE(_REENTRANT) 
3531                         ;;
3533             *-hpux11.*)
3534                         AC_DEFINE(_REENTRANT) 
3535                         ;;
3537             alpha*-*-osf*)
3538                         AC_DEFINE(_REENTRANT)
3539                         ;;
3541             *-*-solaris*) 
3542                         AC_DEFINE(_REENTRANT)
3543                         if test "$SOLARIS_SUNPRO_CC"; then
3544                                 CFLAGS="$CFLAGS -mt" 
3545                                 CXXFLAGS="$CXXFLAGS -mt" 
3546                         fi
3547                         ;;
3548         esac
3549     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3552 dnl ========================================================
3553 dnl See if mmap sees writes
3554 dnl For cross compiling, just define it as no, which is a safe default
3555 dnl ========================================================
3556 AC_MSG_CHECKING(whether mmap() sees write()s)
3558 changequote(,)
3559 mmap_test_prog='
3560     #include <stdlib.h>
3561     #include <unistd.h>
3562     #include <sys/mman.h>
3563     #include <sys/types.h>
3564     #include <sys/stat.h>
3565     #include <fcntl.h>
3567     char fname[] = "conftest.file";
3568     char zbuff[1024]; /* Fractional page is probably worst case */
3570     int main() {
3571         char *map;
3572         int fd;
3573         int i;
3574         unlink(fname);
3575         fd = open(fname, O_RDWR | O_CREAT, 0660);
3576         if(fd<0) return 1;
3577         unlink(fname);
3578         write(fd, zbuff, sizeof(zbuff));
3579         lseek(fd, 0, SEEK_SET);
3580         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3581         if(map==(char*)-1) return 2;
3582         for(i=0; fname[i]; i++) {
3583             int rc = write(fd, &fname[i], 1);
3584             if(map[i]!=fname[i]) return 4;
3585         }
3586         return 0;
3587     }
3589 changequote([,])
3591 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3593 AC_MSG_RESULT("$result")
3595 if test "$result" = "no"; then
3596     AC_DEFINE(MMAP_MISSES_WRITES)
3600 dnl Checks for library functions.
3601 dnl ========================================================
3602 AC_PROG_GCC_TRADITIONAL
3603 AC_FUNC_MEMCMP
3604 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3605 AC_CHECK_FUNCS(flockfile getpagesize)
3606 AC_CHECK_FUNCS(localtime_r strtok_r)
3608 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3609 _SAVE_LDFLAGS=$LDFLAGS
3610 LDFLAGS="$LDFLAGS -lrt"
3611 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3612                ac_cv_have_clock_monotonic,
3613                [AC_TRY_LINK([#include <time.h>],
3614                             [ struct timespec ts;
3615                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3616                             ac_cv_have_clock_monotonic=yes,
3617                             ac_cv_have_clock_monotonic=no)])
3618 LDFLAGS=$_SAVE_LDFLAGS
3619 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3620     HAVE_CLOCK_MONOTONIC=1
3621     REALTIME_LIBS=-lrt
3622     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3623     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3624     AC_SUBST(REALTIME_LIBS)
3627 dnl check for wcrtomb/mbrtowc
3628 dnl =======================================================================
3629 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3630 AC_LANG_SAVE
3631 AC_LANG_CPLUSPLUS
3632 AC_CACHE_CHECK(for wcrtomb,
3633     ac_cv_have_wcrtomb,
3634     [AC_TRY_LINK([#include <wchar.h>],
3635                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3636                  ac_cv_have_wcrtomb="yes",
3637                  ac_cv_have_wcrtomb="no")])
3638 if test "$ac_cv_have_wcrtomb" = "yes"; then
3639     AC_DEFINE(HAVE_WCRTOMB)
3641 AC_CACHE_CHECK(for mbrtowc,
3642     ac_cv_have_mbrtowc,
3643     [AC_TRY_LINK([#include <wchar.h>],
3644                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3645                  ac_cv_have_mbrtowc="yes",
3646                  ac_cv_have_mbrtowc="no")])
3647 if test "$ac_cv_have_mbrtowc" = "yes"; then
3648     AC_DEFINE(HAVE_MBRTOWC)
3650 AC_LANG_RESTORE
3653 AC_CACHE_CHECK(
3654     [for res_ninit()],
3655     ac_cv_func_res_ninit,
3656     [AC_TRY_LINK([
3657         #ifdef linux
3658         #define _BSD_SOURCE 1
3659         #endif
3660         #include <resolv.h>
3661         ],
3662         [int foo = res_ninit(&_res);],
3663         [ac_cv_func_res_ninit=yes],
3664         [ac_cv_func_res_ninit=no])
3665     ])
3667 if test "$ac_cv_func_res_ninit" = "yes"; then
3668     AC_DEFINE(HAVE_RES_NINIT)
3669 dnl must add the link line we do something as foolish as this... dougt
3670 dnl else
3671 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3672 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3675 AC_LANG_CPLUSPLUS
3676 AC_CACHE_CHECK(
3677     [for gnu_get_libc_version()],
3678     ac_cv_func_gnu_get_libc_version,
3679     [AC_TRY_LINK([
3680         #ifdef HAVE_GNU_LIBC_VERSION_H
3681         #include <gnu/libc-version.h>
3682         #endif
3683         ],
3684         [const char *glibc_version = gnu_get_libc_version();],
3685         [ac_cv_func_gnu_get_libc_version=yes],
3686         [ac_cv_func_gnu_get_libc_version=no] 
3687         )]
3688     )
3690 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3691     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3694 case $target_os in
3695     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3696         ;;
3697     *)
3698     
3699 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3700     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3701         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3702 _SAVE_LIBS=$LIBS
3703 LIBS="$LIBS $_ICONV_LIBS"
3704 AC_CACHE_CHECK(
3705     [for iconv()],
3706     ac_cv_func_iconv,
3707     [AC_TRY_LINK([
3708         #include <stdlib.h>
3709         #include <iconv.h>
3710         ],
3711         [
3712             iconv_t h = iconv_open("", "");
3713             iconv(h, NULL, NULL, NULL, NULL);
3714             iconv_close(h);
3715         ],
3716         [ac_cv_func_iconv=yes],
3717         [ac_cv_func_iconv=no] 
3718         )]
3719     )
3720 if test "$ac_cv_func_iconv" = "yes"; then
3721     AC_DEFINE(HAVE_ICONV)
3722     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3723     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3724     LIBICONV="$_ICONV_LIBS"
3725     AC_CACHE_CHECK(
3726         [for iconv() with const input],
3727         ac_cv_func_const_iconv,
3728         [AC_TRY_COMPILE([
3729             #include <stdlib.h>
3730             #include <iconv.h>
3731             ],
3732             [
3733                 const char *input = "testing";
3734                 iconv_t h = iconv_open("", "");
3735                 iconv(h, &input, NULL, NULL, NULL);
3736                 iconv_close(h);
3737             ],
3738             [ac_cv_func_const_iconv=yes],
3739             [ac_cv_func_const_iconv=no] 
3740             )]
3741         )
3742     if test "$ac_cv_func_const_iconv" = "yes"; then
3743         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3744     fi
3746 LIBS=$_SAVE_LIBS
3748     ;;
3749 esac
3751 AM_LANGINFO_CODESET
3753 AC_LANG_C
3755 dnl **********************
3756 dnl *** va_copy checks ***
3757 dnl **********************
3758 dnl we currently check for all three va_copy possibilities, so we get
3759 dnl all results in config.log for bug reports.
3760 AC_MSG_CHECKING(for an implementation of va_copy())
3761 AC_CACHE_VAL(ac_cv_va_copy,[
3762     AC_TRY_RUN([
3763         #include <stdarg.h>
3764         void f (int i, ...) {
3765             va_list args1, args2;
3766             va_start (args1, i);
3767             va_copy (args2, args1);
3768             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3769                 exit (1);
3770             va_end (args1); va_end (args2);
3771         }
3772         int main() { f (0, 42); return 0; }],
3773         ac_cv_va_copy=yes,
3774         ac_cv_va_copy=no,
3775         ac_cv_va_copy=no
3776     )
3778 AC_MSG_RESULT($ac_cv_va_copy)
3779 AC_MSG_CHECKING(for an implementation of __va_copy())
3780 AC_CACHE_VAL(ac_cv___va_copy,[
3781     AC_TRY_RUN([
3782         #include <stdarg.h>
3783         void f (int i, ...) {
3784             va_list args1, args2;
3785             va_start (args1, i);
3786             __va_copy (args2, args1);
3787             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3788                 exit (1);
3789             va_end (args1); va_end (args2);
3790         }
3791         int main() { f (0, 42); return 0; }],
3792         ac_cv___va_copy=yes,
3793         ac_cv___va_copy=no,
3794         ac_cv___va_copy=no
3795     )
3797 AC_MSG_RESULT($ac_cv___va_copy)
3798 AC_MSG_CHECKING(whether va_lists can be copied by value)
3799 AC_CACHE_VAL(ac_cv_va_val_copy,[
3800     AC_TRY_RUN([
3801         #include <stdarg.h>
3802         void f (int i, ...) {
3803             va_list args1, args2;
3804             va_start (args1, i);
3805             args2 = args1;
3806             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3807                 exit (1);
3808             va_end (args1); va_end (args2);
3809         }
3810         int main() { f (0, 42); return 0; }],
3811         ac_cv_va_val_copy=yes,
3812         ac_cv_va_val_copy=no,
3813         ac_cv_va_val_copy=yes
3814     )
3816 if test "x$ac_cv_va_copy" = "xyes"; then
3817     AC_DEFINE(VA_COPY, va_copy)
3818     AC_DEFINE(HAVE_VA_COPY)
3819 elif test "x$ac_cv___va_copy" = "xyes"; then
3820     AC_DEFINE(VA_COPY, __va_copy)
3821     AC_DEFINE(HAVE_VA_COPY)
3824 if test "x$ac_cv_va_val_copy" = "xno"; then
3825    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3827 AC_MSG_RESULT($ac_cv_va_val_copy)
3829 dnl Check for dll-challenged libc's.
3830 dnl This check is apparently only needed for Linux.
3831 case "$target" in
3832         *-linux*)
3833             dnl ===================================================================
3834             _curdir=`pwd`
3835             export _curdir
3836             rm -rf conftest* _conftest
3837             mkdir _conftest
3838             cat >> conftest.C <<\EOF
3839 #include <stdio.h>
3840 #include <link.h>
3841 #include <dlfcn.h>
3842 #ifdef _dl_loaded
3843 void __dump_link_map(void) {
3844   struct link_map *map = _dl_loaded;
3845   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3847 int main() {
3848   dlopen("./conftest1.so",RTLD_LAZY);
3849   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3850   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3851   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3852   __dump_link_map();
3854 #else
3855 /* _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).*/
3856 int main() { printf("./conftest1.so\n"); }
3857 #endif
3860             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3862             cat >> conftest1.C <<\EOF
3863 #include <stdio.h>
3864 void foo(void) {printf("foo in dll called\n");}
3866             ${CXX-g++} -fPIC -c -g conftest1.C
3867             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3868             ${CXX-g++} -g conftest.C -o conftest -ldl
3869             cp -f conftest1.so conftest _conftest
3870             cd _conftest
3871             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3872             then
3873                 echo
3874                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3875                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3876                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3877                 echo "*** will be excessive memory usage at runtime."
3878                 echo
3879             fi
3880             cd ${_curdir}
3881             rm -rf conftest* _conftest
3882             dnl ===================================================================
3883             ;;
3884 esac
3886 dnl ===================================================================
3887 dnl ========================================================
3888 dnl By default, turn rtti and exceptions off on g++/egcs
3889 dnl ========================================================
3890 if test "$GNU_CXX"; then
3892   AC_MSG_CHECKING(for C++ exceptions flag)
3894   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3895   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3896   [echo "int main() { return 0; }" | cat > conftest.C
3898   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3900   if egrep "warning.*renamed" conftest.out >/dev/null; then
3901     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3902   else
3903     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3904   fi
3906   rm -f conftest*])
3908   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3909   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3910   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3913 dnl ========================================================
3914 dnl Put your C++ language/feature checks below
3915 dnl ========================================================
3916 AC_LANG_CPLUSPLUS
3918 HAVE_GCC3_ABI=
3919 if test "$GNU_CC"; then
3920   AC_CACHE_CHECK(for gcc 3.0 ABI,
3921       ac_cv_gcc_three_abi,
3922       [AC_TRY_COMPILE([],
3923                       [
3924 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3925   return 0;
3926 #else
3927 #error Not gcc3.
3928 #endif
3929                       ],
3930                       ac_cv_gcc_three_abi="yes",
3931                       ac_cv_gcc_three_abi="no")])
3932   if test "$ac_cv_gcc_three_abi" = "yes"; then
3933       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3934       HAVE_GCC3_ABI=1
3935   else
3936       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3937   fi
3939 AC_SUBST(HAVE_GCC3_ABI)
3942 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3943                ac_cv_cpp_explicit,
3944                [AC_TRY_COMPILE(class X {
3945                                public: explicit X(int i) : i_(i) {}
3946                                private: int i_;
3947                                };,
3948                                X x(3);,
3949                                ac_cv_cpp_explicit=yes,
3950                                ac_cv_cpp_explicit=no)])
3951 if test "$ac_cv_cpp_explicit" = yes ; then
3952    AC_DEFINE(HAVE_CPP_EXPLICIT)
3955 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3956                ac_cv_cpp_typename,
3957                [AC_TRY_COMPILE(class param {
3958                                public:
3959                                    typedef unsigned long num_type;
3960                                };
3962                                template <class T> class tplt {
3963                                public:
3964                                    typedef typename T::num_type t_num_type;
3965                                    t_num_type foo(typename T::num_type num) {
3966                                        return num;
3967                                    }
3968                                };,
3969                                tplt<param> A;
3970                                A.foo(0);,
3971                                ac_cv_cpp_typename=yes,
3972                                ac_cv_cpp_typename=no)])
3973 if test "$ac_cv_cpp_typename" = yes ; then
3974    AC_DEFINE(HAVE_CPP_TYPENAME)
3977 dnl Check for support of modern template specialization syntax
3978 dnl Test code and requirement from scc@netscape.com.
3979 dnl Autoconf cut-and-paste job by waterson@netscape.com
3980 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3981                ac_cv_cpp_modern_specialize_template_syntax,
3982                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3983                                class Y {};
3984                                template <> struct X<Y> { double a; };,
3985                                X<int> int_x;
3986                                X<Y> y_x;,
3987                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3988                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3989 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3990   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3994 dnl Some compilers support only full specialization, and some don't.
3995 AC_CACHE_CHECK(whether partial template specialization works,
3996                ac_cv_cpp_partial_specialization,
3997                [AC_TRY_COMPILE(template <class T> class Foo {};
3998                                template <class T> class Foo<T*> {};,
3999                                return 0;,
4000                                ac_cv_cpp_partial_specialization=yes,
4001                                ac_cv_cpp_partial_specialization=no)])
4002 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4003   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4006 dnl Some compilers have limited support for operators with templates;
4007 dnl specifically, it is necessary to define derived operators when a base
4008 dnl class's operator declaration should suffice.
4009 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4010                ac_cv_need_derived_template_operators,
4011                [AC_TRY_COMPILE([template <class T> class Base { };
4012                                 template <class T>
4013                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4014                                 template <class T> class Derived : public Base<T> { };],
4015                                [Derived<char> a, b;
4016                                 Base<char> c = a + b;
4017                                 return 0;],
4018                                ac_cv_need_derived_template_operators=no,
4019                                ac_cv_need_derived_template_operators=yes)])
4020 if test "$ac_cv_need_derived_template_operators" = yes ; then
4021   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4025 dnl Some compilers have trouble detecting that a template class
4026 dnl that derives from another template is actually an instance
4027 dnl of the base class. This test checks for that.
4028 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4029                ac_cv_need_cpp_template_cast_to_base,
4030                [AC_TRY_COMPILE([template <class T> class Base { };
4031                                 template <class T> class Derived : public Base<T> { };
4032                                 template <class T> int foo(const Base<T>&) { return 0; }],
4033                                [Derived<char> bar; return foo(bar);],
4034                                ac_cv_need_cpp_template_cast_to_base=no,
4035                                ac_cv_need_cpp_template_cast_to_base=yes)])
4036 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4037   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4040 dnl Some compilers have trouble resolving the ambiguity between two
4041 dnl functions whose arguments differ only by cv-qualifications.
4042 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4043                ac_cv_can_resolve_const_ambiguity,
4044                [AC_TRY_COMPILE([
4045                                 template <class T> class ptrClass {
4046                                   public: T* ptr;
4047                                 };
4049                                 template <class T> T* a(ptrClass<T> *arg) {
4050                                   return arg->ptr;
4051                                 }
4053                                 template <class T>
4054                                 const T* a(const ptrClass<T> *arg) {
4055                                   return arg->ptr;
4056                                 }
4057                                ],
4058                                [ ptrClass<int> i;
4059                                  a(&i); ],
4060                                ac_cv_can_resolve_const_ambiguity=yes,
4061                                ac_cv_can_resolve_const_ambiguity=no)])
4062 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4063   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4067 dnl We don't do exceptions on unix.  The only reason this used to be here
4068 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4069 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4070 dnl So im commenting this out until someone writes some artificial 
4071 dnl intelligence to detect not only if the compiler has exceptions, but if 
4072 dnl they are enabled as well.
4073 dnl 
4074 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4075 dnl                ac_cv_cpp_exceptions,
4076 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4077 dnl                                static void F() { throw X(); },
4078 dnl                                try { F(); } catch(X & e) { },
4079 dnl                                ac_cv_cpp_exceptions=yes,
4080 dnl                                ac_cv_cpp_exceptions=no)])
4081 dnl if test $ac_cv_cpp_exceptions = yes ; then
4082 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4083 dnl fi
4085 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4086 dnl supports it well enough to allow us to use it to change access, but not
4087 dnl to resolve ambiguity. The next two tests determine how well the |using|
4088 dnl keyword is supported.
4090 dnl Check to see if we can change access with |using|.  Test both a
4091 dnl legal and an illegal example.
4092 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4093                ac_cv_cpp_access_changing_using2,
4094                [AC_TRY_COMPILE(
4095                    class A { protected: int foo() { return 0; } };
4096                    class B : public A { public: using A::foo; };,
4097                    B b; return b.foo();,
4098                    [AC_TRY_COMPILE(
4099                        class A { public: int foo() { return 1; } };
4100                        class B : public A { private: using A::foo; };,
4101                        B b; return b.foo();,
4102                        ac_cv_cpp_access_changing_using2=no,
4103                        ac_cv_cpp_access_changing_using2=yes)],
4104                    ac_cv_cpp_access_changing_using2=no)])
4105 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4106    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4109 dnl Check to see if we can resolve ambiguity with |using|.
4110 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4111                ac_cv_cpp_ambiguity_resolving_using,
4112                [AC_TRY_COMPILE(class X { 
4113                                  public: int go(const X&) {return 3;}
4114                                          int jo(const X&) {return 3;}
4115                                };
4116                                class Y : public X {
4117                                  public:  int go(int) {return 2;}
4118                                           int jo(int) {return 2;}
4119                                           using X::jo;
4120                                  private: using X::go;
4121                                };,
4122                                X x; Y y; y.jo(x);,
4123                                ac_cv_cpp_ambiguity_resolving_using=yes,
4124                                ac_cv_cpp_ambiguity_resolving_using=no)])
4125 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4126    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4129 dnl Check to see if the |std| namespace is supported. If so, we'll want
4130 dnl to qualify any standard library calls with "std::" to ensure that
4131 dnl those functions can be resolved.
4132 AC_CACHE_CHECK(for \"std::\" namespace,
4133                ac_cv_cpp_namespace_std,
4134                [AC_TRY_COMPILE([#include <algorithm>],
4135                                [return std::min(0, 1);],
4136                                ac_cv_cpp_namespace_std=yes,
4137                                ac_cv_cpp_namespace_std=no)])
4138 if test "$ac_cv_cpp_namespace_std" = yes ; then
4139    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4142 dnl Older compilers are overly ambitious with respect to using the standard
4143 dnl template library's |operator!=()| when |operator==()| is defined. In
4144 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4145 dnl ambiguity at compile-time. This test checks for that case.
4146 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4147                ac_cv_cpp_unambiguous_std_notequal,
4148                [AC_TRY_COMPILE([#include <algorithm>
4149                                 struct T1 {};
4150                                 int operator==(const T1&, const T1&) { return 0; }
4151                                 int operator!=(const T1&, const T1&) { return 0; }],
4152                                [T1 a,b; return a != b;],
4153                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4154                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4155 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4156   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4160 AC_CACHE_CHECK(for C++ reinterpret_cast,
4161                ac_cv_cpp_reinterpret_cast,
4162                [AC_TRY_COMPILE(struct X { int i; };
4163                                struct Y { int i; };,
4164                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4165                                ac_cv_cpp_reinterpret_cast=yes,
4166                                ac_cv_cpp_reinterpret_cast=no)])
4167 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4168    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4171 dnl See if a dynamic_cast to void* gives the most derived object.
4172 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4173                ac_cv_cpp_dynamic_cast_void_ptr,
4174                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4175                             class Y { int j; public: virtual ~Y() { } };
4176                             class Z : public X, public Y { int k; };
4178                             int main() {
4179                                  Z mdo;
4180                                  X *subx = (X*)&mdo;
4181                                  Y *suby = (Y*)&mdo;
4182                                  return !((((void*)&mdo != (void*)subx) &&
4183                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4184                                           (((void*)&mdo != (void*)suby) &&
4185                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4186                             }],
4187                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4188                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4189                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4190 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4191    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4195 dnl note that this one is reversed - if the test fails, then
4196 dnl we require implementations of unused virtual methods. Which
4197 dnl really blows because it means we'll have useless vtable
4198 dnl bloat.
4199 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4200                ac_cv_cpp_unused_required,
4201                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4202                                X x;,
4203                                ac_cv_cpp_unused_required=no,
4204                                ac_cv_cpp_unused_required=yes)])
4205 if test "$ac_cv_cpp_unused_required" = yes ; then
4206    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4210 dnl Some compilers have trouble comparing a constant reference to a templatized
4211 dnl class to zero, and require an explicit operator==() to be defined that takes
4212 dnl an int. This test separates the strong from the weak.
4214 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4215                ac_cv_trouble_comparing_to_zero,
4216                [AC_TRY_COMPILE([#include <algorithm>
4217                                 template <class T> class Foo {};
4218                                 class T2;
4219                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4220                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4221                                [Foo<int> f; return (0 != f);],
4222                                ac_cv_trouble_comparing_to_zero=no,
4223                                ac_cv_trouble_comparing_to_zero=yes)])
4224 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4225   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4228 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4229 _SAVE_LDFLAGS=$LDFLAGS
4230 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4231 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4232                ac_cv_thread_keyword,
4233                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4234                             [return tlsIsMainThread;],
4235                             ac_cv_thread_keyword=yes,
4236                             ac_cv_thread_keyword=no)])
4237 LDFLAGS=$_SAVE_LDFLAGS
4238 if test "$ac_cv_thread_keyword" = yes; then
4239   AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4242 dnl End of C++ language/feature checks
4243 AC_LANG_C
4245 dnl ========================================================
4246 dnl =  Internationalization checks
4247 dnl ========================================================
4249 dnl Internationalization and Locale support is different
4250 dnl on various UNIX platforms.  Checks for specific i18n
4251 dnl features go here.
4253 dnl check for LC_MESSAGES
4254 AC_CACHE_CHECK(for LC_MESSAGES,
4255                 ac_cv_i18n_lc_messages,
4256                 [AC_TRY_COMPILE([#include <locale.h>],
4257                                 [int category = LC_MESSAGES;],
4258                                 ac_cv_i18n_lc_messages=yes,
4259                                 ac_cv_i18n_lc_messages=no)])
4260 if test "$ac_cv_i18n_lc_messages" = yes; then
4261    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4262 fi      
4264 fi # SKIP_COMPILER_CHECKS
4266 TARGET_XPCOM_ABI=
4267 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4268     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4271 dnl Mozilla specific options
4272 dnl ========================================================
4273 dnl The macros used for command line options
4274 dnl are defined in build/autoconf/altoptions.m4.
4277 dnl ========================================================
4278 dnl =
4279 dnl = Check for external package dependencies
4280 dnl =
4281 dnl ========================================================
4282 MOZ_ARG_HEADER(External Packages)
4284 MOZ_ENABLE_LIBXUL=1
4286 MOZ_ARG_WITH_STRING(libxul-sdk,
4287 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4288   LIBXUL_SDK_DIR=$withval)
4290 if test "$LIBXUL_SDK_DIR" = "yes"; then
4291     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4292 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4293     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4295     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4296         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4297     fi
4299     MOZ_ENABLE_LIBXUL=1
4301 AC_SUBST(LIBXUL_SDK)
4303 if test -n "$LIBXUL_SDK"; then
4304     LIBXUL_DIST="$LIBXUL_SDK"
4305 else
4306     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4308 AC_SUBST(LIBXUL_DIST)
4310 SYSTEM_LIBXUL=
4312 MOZ_ARG_WITH_BOOL(system-libxul,
4313 [  --with-system-libxul   Use system installed libxul SDK],
4314     SYSTEM_LIBXUL=1)
4316 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4317     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4320 dnl ========================================================
4321 dnl = If NSPR was not detected in the system, 
4322 dnl = use the one in the source tree (mozilla/nsprpub)
4323 dnl ========================================================
4324 MOZ_ARG_WITH_BOOL(system-nspr,
4325 [  --with-system-nspr      Use system installed NSPR],
4326     _USE_SYSTEM_NSPR=1 )
4328 if test -n "$_USE_SYSTEM_NSPR"; then
4329     AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4332 if test -n "$MOZ_NATIVE_NSPR"; then
4333     _SAVE_CFLAGS=$CFLAGS
4334     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4335     AC_TRY_COMPILE([#include "prlog.h"],
4336                 [#ifndef PR_STATIC_ASSERT
4337                  #error PR_STATIC_ASSERT not defined
4338                  #endif],
4339                 [MOZ_NATIVE_NSPR=1],
4340                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4341     CFLAGS=$_SAVE_CFLAGS
4342 else
4343     if test "$OS_ARCH" = "WINCE"; then
4344         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4345         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4346     elif test "$OS_ARCH" = "WINNT"; then
4347         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4348         if test -n "$GNU_CC"; then
4349             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4350         else
4351             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4352         fi
4353     else
4354         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4355         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4356     fi
4359 dnl ========================================================
4360 dnl = If NSS was not detected in the system, 
4361 dnl = use the one in the source tree (mozilla/security/nss)
4362 dnl ========================================================
4364 MOZ_ARG_WITH_BOOL(system-nss,
4365 [  --with-system-nss      Use system installed NSS],
4366     _USE_SYSTEM_NSS=1 )
4368 if test -n "$_USE_SYSTEM_NSS"; then
4369     AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4372 if test -n "$MOZ_NATIVE_NSS"; then
4373    NSS_LIBS="$NSS_LIBS -lcrmf"
4374 else
4375    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4376    NSS_DEP_LIBS="\
4377         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4378         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4379         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4380         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4381         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4383    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4384        NSS_LIBS="\
4385         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4386         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4387         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4388         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4389         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4390    else
4391        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4392    fi
4395 if test -z "$SKIP_LIBRARY_CHECKS"; then
4396 dnl system JPEG support
4397 dnl ========================================================
4398 MOZ_ARG_WITH_STRING(system-jpeg,
4399 [  --with-system-jpeg[=PFX]
4400                           Use system libjpeg [installed at prefix PFX]],
4401     JPEG_DIR=$withval)
4403 _SAVE_CFLAGS=$CFLAGS
4404 _SAVE_LDFLAGS=$LDFLAGS
4405 _SAVE_LIBS=$LIBS
4406 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4407     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4408     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4410 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4411     SYSTEM_JPEG=
4412 else
4413     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4416 if test "$SYSTEM_JPEG" = 1; then
4417     LIBS="$JPEG_LIBS $LIBS"
4418     AC_TRY_COMPILE([ #include <stdio.h>
4419                      #include <sys/types.h>
4420                      #include <jpeglib.h> ],
4421                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4422                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4423                      #endif ],
4424                    SYSTEM_JPEG=1,
4425                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4426 fi 
4427 CFLAGS=$_SAVE_CFLAGS
4428 LDFLAGS=$_SAVE_LDFLAGS
4429 LIBS=$_SAVE_LIBS
4431 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4432     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4433     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4436 dnl system ZLIB support
4437 dnl ========================================================
4438 MOZ_ARG_WITH_STRING(system-zlib,
4439 [  --with-system-zlib[=PFX]
4440                           Use system libz [installed at prefix PFX]],
4441     ZLIB_DIR=$withval)
4443 _SAVE_CFLAGS=$CFLAGS
4444 _SAVE_LDFLAGS=$LDFLAGS
4445 _SAVE_LIBS=$LIBS
4446 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4447     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4448     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4450 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4451     SYSTEM_ZLIB=
4452 else
4453     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4454         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4456 if test "$SYSTEM_ZLIB" = 1; then
4457     LIBS="$ZLIB_LIBS $LIBS"
4458     AC_TRY_COMPILE([ #include <stdio.h>
4459                      #include <string.h>
4460                      #include <zlib.h> ],
4461                    [ #if ZLIB_VERNUM < $MOZZLIB 
4462                      #error "Insufficient zlib version ($MOZZLIB required)."
4463                      #endif ],
4464                    SYSTEM_ZLIB=1,
4465                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4467 CFLAGS=$_SAVE_CFLAGS
4468 LDFLAGS=$_SAVE_LDFLAGS
4469 LIBS=$_SAVE_LIBS
4471 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4472     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4473     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4476 dnl system BZIP2 Support
4477 dnl ========================================================
4478 MOZ_ARG_WITH_STRING(system-bz2,
4479 [  --with-system-bz2[=PFX]
4480                           Use system libbz2 [installed at prefix PFX]],
4481     BZ2_DIR=$withval)
4483 _SAVE_CFLAGS=$CFLAGS
4484 _SAVE_LDFLAGS=$LDFLAGS
4485 _SAVE_LIBS=$LIBS
4486 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4487     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4488     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4490 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4491     SYSTEM_BZ2=
4492 else
4493     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4494         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4496 CFLAGS=$_SAVE_CFLAGS
4497 LDFLAGS=$_SAVE_LDFLAGS
4498 LIBS=$_SAVE_LIBS
4500 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4501     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4502     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4505 dnl system PNG Support
4506 dnl ========================================================
4507 MOZ_ARG_WITH_STRING(system-png, 
4508 [  --with-system-png[=PFX]
4509                           Use system libpng [installed at prefix PFX]],
4510     PNG_DIR=$withval)
4512 _SAVE_CFLAGS=$CFLAGS
4513 _SAVE_LDFLAGS=$LDFLAGS
4514 _SAVE_LIBS=$LIBS
4515 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4516 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4517 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4518     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4519     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4521 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4522     SYSTEM_PNG=
4523 else
4524     _SAVE_PNG_LIBS=$PNG_LIBS
4525     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4526                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4527                  $PNG_LIBS)
4528     AC_CHECK_LIB(png, png_get_acTL, ,
4529                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4530                  $_SAVE_PNG_LIBS)
4532 if test "$SYSTEM_PNG" = 1; then
4533     LIBS="$PNG_LIBS $LIBS"
4534     AC_TRY_COMPILE([ #include <stdio.h>
4535                      #include <sys/types.h>
4536                      #include <png.h> ],
4537                    [ #if PNG_LIBPNG_VER < $MOZPNG
4538                      #error "Insufficient libpng version ($MOZPNG required)."
4539                      #endif
4540                      #ifndef PNG_UINT_31_MAX
4541                      #error "Insufficient libpng version."
4542                      #endif ],
4543                    SYSTEM_PNG=1,
4544                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4546 CFLAGS=$_SAVE_CFLAGS
4547 LDFLAGS=$_SAVE_LDFLAGS
4548 LIBS=$_SAVE_LIBS
4550 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4551     PNG_CFLAGS="-I${PNG_DIR}/include"
4552     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4555 fi # SKIP_LIBRARY_CHECKS
4557 dnl system HunSpell Support
4558 dnl ========================================================
4559 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4560 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4561     SYSTEM_HUNSPELL=1 )
4563 if test -n "$SYSTEM_HUNSPELL"; then
4564     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4567 AC_SUBST(SYSTEM_HUNSPELL)
4569 dnl ========================================================
4570 dnl Java SDK support
4571 dnl ========================================================
4572 JAVA_INCLUDE_PATH=
4573 MOZ_ARG_WITH_STRING(java-include-path,
4574 [  --with-java-include-path=dir   Location of Java SDK headers],
4575     JAVA_INCLUDE_PATH=$withval)
4577 JAVA_BIN_PATH=
4578 MOZ_ARG_WITH_STRING(java-bin-path,
4579 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4580     JAVA_BIN_PATH=$withval)
4582 dnl ========================================================
4583 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4584 dnl their usage and use them in spidermonkey.
4585 dnl ========================================================
4586 MOZ_ARG_WITH_BOOL(arm-kuser,
4587 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4588     USE_ARM_KUSER=1,
4589     USE_ARM_KUSER=)
4590 if test -n "$USE_ARM_KUSER"; then
4591    AC_DEFINE(USE_ARM_KUSER)
4594 dnl ========================================================
4595 dnl =
4596 dnl = Application
4597 dnl =
4598 dnl ========================================================
4600 MOZ_ARG_HEADER(Application)
4602 BUILD_STATIC_LIBS=
4603 ENABLE_TESTS=1
4604 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4605 MOZ_BRANDING_DIRECTORY=
4606 MOZ_OFFICIAL_BRANDING=
4607 MOZ_DBGRINFO_MODULES=
4608 MOZ_FEEDS=1
4609 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4610 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4611 MOZ_IPC=1
4612 MOZ_JAVAXPCOM=
4613 MOZ_JSDEBUGGER=1
4614 MOZ_JSLOADER=1
4615 MOZ_MATHML=1
4616 MOZ_MORK=1
4617 MOZ_MORKREADER=
4618 MOZ_AUTH_EXTENSION=1
4619 MOZ_NO_ACTIVEX_SUPPORT=1
4620 MOZ_NO_INSPECTOR_APIS=
4621 MOZ_NO_FAST_LOAD=
4622 MOZ_OGG=1
4623 MOZ_SYDNEYAUDIO=
4624 MOZ_WAVE=1
4625 MOZ_MEDIA=
4626 MOZ_PERMISSIONS=1
4627 MOZ_PLACES=
4628 MOZ_PLAINTEXT_EDITOR_ONLY=
4629 MOZ_PLUGINS=1
4630 MOZ_PREF_EXTENSIONS=1
4631 MOZ_PROFILELOCKING=1
4632 MOZ_PSM=1
4633 MOZ_RDF=1
4634 MOZ_REFLOW_PERF=
4635 MOZ_SAFE_BROWSING=
4636 MOZ_FASTSTART=
4637 MOZ_HELP_VIEWER=
4638 MOZ_SPELLCHECK=1
4639 MOZ_SPLASHSCREEN=
4640 MOZ_STATIC_MAIL_BUILD=
4641 MOZ_STORAGE=1
4642 MOZ_SVG=1
4643 MOZ_TIMELINE=
4644 MOZ_UI_LOCALE=en-US
4645 MOZ_UNIVERSALCHARDET=1
4646 MOZ_URL_CLASSIFIER=
4647 MOZ_USE_NATIVE_UCONV=
4648 MOZ_VIEW_SOURCE=1
4649 MOZ_XPFE_COMPONENTS=1
4650 MOZ_XPINSTALL=1
4651 MOZ_XSLT_STANDALONE=
4652 MOZ_XTF=1
4653 MOZ_XUL=1
4654 MOZ_ZIPWRITER=1
4655 NS_PRINTING=1
4656 NECKO_WIFI=1
4657 NECKO_COOKIES=1
4658 NECKO_DISK_CACHE=1
4659 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4660 NECKO_SMALL_BUFFERS=
4661 XPC_IDISPATCH_SUPPORT=
4664 case "$target_os" in
4665 darwin*)
4666     ACCESSIBILITY=
4667     ;;
4669     ACCESSIBILITY=1
4670     ;;
4671 esac
4673 case "$target_os" in
4674     msvc*|mks*|cygwin*|mingw*)
4675         NS_ENABLE_TSF=1
4676         if test -z "$GNU_CC"; then 
4677             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4678                 NS_ENABLE_TSF=
4679             fi
4680             XPC_IDISPATCH_SUPPORT=1
4681             MOZ_NO_ACTIVEX_SUPPORT=
4682         fi
4683         if test -n "$NS_ENABLE_TSF"; then
4684             AC_DEFINE(NS_ENABLE_TSF)
4685         fi
4686         ;;
4687 esac
4689 MOZ_ARG_ENABLE_STRING(application,
4690 [  --enable-application=APP
4691                           Options include:
4692                             browser (Firefox)
4693                             xulrunner
4694                             content/xslt (Standalone Transformiix XSLT)
4695                             netwerk (Standalone Necko)
4696                             tools/update-packaging (AUS-related packaging tools)
4697                             standalone (use this for standalone
4698                               xpcom/xpconnect or to manually drive a build)],
4699 [ MOZ_BUILD_APP=$enableval ] )
4701 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4702 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4703   XULRUNNER_STUB_NAME=$withval)
4705 if test -z "$XULRUNNER_STUB_NAME"; then
4706   case "$target_os" in
4707   darwin*)
4708     XULRUNNER_STUB_NAME=xulrunner
4709     ;;
4710   *)
4711     XULRUNNER_STUB_NAME=xulrunner-stub
4712   esac
4714 AC_SUBST(XULRUNNER_STUB_NAME)
4716 if test -z "$MOZ_BUILD_APP"; then
4717   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4718 else
4719   # We have a valid application only if it has a build.mk file in its top
4720   # directory.
4721   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4722     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4723   fi
4726 # Allow the application to influence configure with a confvars.sh script.
4728 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4729 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4730   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4731   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4732 else
4733   AC_MSG_RESULT([no])
4736 # Now is a good time to test for logic errors, define mismatches, etc.
4737 case "$MOZ_BUILD_APP" in
4738 xulrunner)
4739   if test "$LIBXUL_SDK"; then
4740     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4741   fi
4742   ;;
4743 esac
4745 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4746 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4747 # MOZ_BUILD_APP.
4748 case "$MOZ_BUILD_APP" in
4749 browser)
4750   AC_DEFINE(MOZ_PHOENIX)
4751   ;;
4753 xulrunner)
4754   AC_DEFINE(MOZ_XULRUNNER)
4755   ;;
4757 content/xslt)
4758   AC_DEFINE(TX_EXE)
4759   ;;
4761 standalone) 
4762   MOZ_APP_NAME=mozilla
4763   MOZ_APP_DISPLAYNAME=Mozilla
4764   MOZ_APP_VERSION=$MOZILLA_VERSION
4765   ;;
4767 esac
4769 AC_SUBST(MOZ_BUILD_APP)
4770 AC_SUBST(MOZ_PHOENIX)
4771 AC_SUBST(MOZ_XULRUNNER)
4773 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4775 dnl ========================================================
4776 dnl = 
4777 dnl = Toolkit Options
4778 dnl = 
4779 dnl ========================================================
4780 MOZ_ARG_HEADER(Toolkit Options)
4782     dnl ========================================================
4783     dnl = Select the default toolkit
4784     dnl ========================================================
4785         MOZ_ARG_ENABLE_STRING(default-toolkit,
4786         [  --enable-default-toolkit=TK
4787                           Select default toolkit
4788                           Platform specific defaults:
4789                             BeOS - cairo-beos
4790                             Mac OS X - cairo-cocoa
4791                             Neutrino/QNX - photon
4792                             OS/2 - cairo-os2
4793                             Win32/WinCE - cairo-windows
4794                             Gtk2 with DirectFB - cairo-gtk2-dfb
4795                             * - cairo-gtk2
4796                             * - cairo-qt],
4797     [ _DEFAULT_TOOLKIT=$enableval ],
4798     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4800     if test "$_DEFAULT_TOOLKIT" = "photon" \
4801         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4802         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4803         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4804         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4805         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4806         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4807         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4808         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4809     then
4810         dnl nglayout only supports building with one toolkit,
4811         dnl so ignore everything after the first comma (",").
4812         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4813     else
4814         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4815     fi
4817 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4819 dnl ========================================================
4820 dnl = Enable the toolkit as needed                         =
4821 dnl ========================================================
4823 case "$MOZ_WIDGET_TOOLKIT" in
4824 photon)
4825         MOZ_ENABLE_PHOTON=1
4826         AC_DEFINE(MOZ_WIDGET_PHOTON)
4827     ;;
4829 cairo-windows)
4830     MOZ_WIDGET_TOOLKIT=windows
4831     MOZ_WEBGL=1
4832     ;;
4834 cairo-gtk2|cairo-gtk2-x11)
4835     MOZ_WIDGET_TOOLKIT=gtk2
4836     MOZ_ENABLE_GTK2=1
4837     MOZ_ENABLE_XREMOTE=1
4838     MOZ_WEBGL=1
4839     MOZ_WEBGL_GLX=1
4841     AC_DEFINE(MOZ_X11)
4842     MOZ_X11=1
4843     USE_FC_FREETYPE=1
4845     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4846     TK_LIBS='$(MOZ_GTK2_LIBS)'
4847     AC_DEFINE(MOZ_WIDGET_GTK2)
4848     ;;
4850 cairo-gtk2-dfb)
4851     MOZ_WIDGET_TOOLKIT=gtk2
4852     MOZ_ENABLE_GTK2=1
4853     MOZ_WEBGL=
4855     AC_DEFINE(MOZ_DFB)
4856     MOZ_DFB=1
4858     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4859     TK_LIBS='$(MOZ_GTK2_LIBS)'
4860     AC_DEFINE(MOZ_WIDGET_GTK2)
4861     if test "$no_x" != "yes"; then
4862         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4863         no_x=yes
4864     fi
4865     ;;
4867 cairo-qt)
4868     MOZ_WIDGET_TOOLKIT=qt
4869     MOZ_ENABLE_QT=1
4870     MOZ_ENABLE_XREMOTE=1
4871     USE_ELF_DYNSTR_GC=
4872     NS_PRINTING=
4874     AC_DEFINE(MOZ_X11)
4875     MOZ_X11=1
4876     USE_FC_FREETYPE=1
4878     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4879     TK_LIBS='$(MOZ_QT_LIBS)'
4880     AC_DEFINE(MOZ_WIDGET_QT)
4881     ;;
4883 cairo-beos)
4884     MOZ_WIDGET_TOOLKIT=beos
4885     USE_FC_FREETYPE=1
4886     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4887     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4888     ;;
4890 cairo-os2)
4891     MOZ_WIDGET_TOOLKIT=os2
4892     USE_FC_FREETYPE=1
4893     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4894     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4895     ;;
4897 cairo-cocoa)
4898     MOZ_WIDGET_TOOLKIT=cocoa
4899     AC_DEFINE(MOZ_WIDGET_COCOA)
4900     MOZ_USER_DIR="Mozilla"
4901     AC_DEFINE(XP_MACOSX)
4902     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4903     TK_CFLAGS="-DNO_X11"
4904     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4905     CFLAGS="$CFLAGS $TK_CFLAGS"
4906     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4907     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4908     MOZ_FS_LAYOUT=bundle
4909     MOZ_WEBGL=1
4910     ;;
4911 esac
4913 if test "$MOZ_ENABLE_XREMOTE"; then
4914     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4917 if test "$COMPILE_ENVIRONMENT"; then
4918   if test "$MOZ_ENABLE_GTK2"; then
4919     if test "$MOZ_X11"; then
4920       GDK_PACKAGES=gdk-x11-2.0
4921     elif test "$MOZ_DFB"; then
4922       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4923       GDK_PACKAGES=directfb
4924     fi
4926     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4927   fi
4929 fi # COMPILE_ENVIRONMENT
4931 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4932 AC_SUBST(MOZ_FS_LAYOUT)
4934 dnl ========================================================
4935 dnl = startup-notification support module
4936 dnl ========================================================
4938 if test "$MOZ_ENABLE_GTK2"
4939 then
4940     MOZ_ENABLE_STARTUP_NOTIFICATION=
4942     MOZ_ARG_ENABLE_BOOL(startup-notification,
4943     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4944         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4945         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4946     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4947     then
4948         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4949                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4950         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4951             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4952             then
4953                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4954             fi
4955             MOZ_ENABLE_STARTUP_NOTIFICATION=
4956         ])
4957     fi
4959     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4960         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4961     fi
4963     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4965 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4966 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4967 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4969 dnl ========================================================
4970 dnl = QT support
4971 dnl ========================================================
4972 if test "$MOZ_ENABLE_QT"
4973 then
4974     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4975     AC_SUBST(MOZ_QT_CFLAGS)
4976     AC_SUBST(MOZ_QT_LIBS)
4978     MOZ_ARG_WITH_STRING(qtdir,
4979     [  --with-qtdir=\$dir       Specify Qt directory ],
4980     [ QTDIR=$withval])
4982     if test -z "$QTDIR"; then
4983       QTDIR="/usr"
4984     fi
4985     QTINCDIR="/include/qt"
4986     if test ! -d "$QTDIR$QTINCDIR"; then
4987        QTINCDIR="/include/X11/qt"
4988     fi
4989     if test ! -d "$QTDIR$QTINCDIR"; then
4990        QTINCDIR="/include"
4991     fi
4993     if test -x "$QTDIR/bin/moc-qt4"; then
4994       HOST_MOC="$QTDIR/bin/moc-qt4"
4995     else
4996       if test -x "$QTDIR/bin/moc"; then
4997         HOST_MOC="$QTDIR/bin/moc"
4998       else
4999         AC_CHECK_PROGS(HOST_MOC, moc, "")
5000       fi
5001     fi
5002     if test -z "$HOST_MOC"; then
5003       AC_MSG_ERROR([no acceptable moc preprocessor found])
5004     fi
5005     MOC=$HOST_MOC
5008 AC_SUBST(GTK_CONFIG)
5009 AC_SUBST(TK_CFLAGS)
5010 AC_SUBST(TK_LIBS)
5012 AC_SUBST(MOZ_ENABLE_GTK2)
5013 AC_SUBST(MOZ_ENABLE_PHOTON)
5014 AC_SUBST(MOZ_ENABLE_QT)
5015 AC_SUBST(MOZ_ENABLE_XREMOTE)
5016 AC_SUBST(MOZ_GTK2_CFLAGS)
5017 AC_SUBST(MOZ_GTK2_LIBS)
5018 AC_SUBST(MOZ_QT_CFLAGS)
5019 AC_SUBST(MOZ_QT_LIBS)
5021 AC_SUBST(MOC)
5023 AC_SUBST(MOZ_DFB)
5024 AC_SUBST(MOZ_X11)
5026 dnl ========================================================
5027 dnl =
5028 dnl = Components & Features
5029 dnl = 
5030 dnl ========================================================
5031 MOZ_ARG_HEADER(Components and Features)
5033 dnl ========================================================
5034 dnl = Localization
5035 dnl ========================================================
5036 MOZ_ARG_ENABLE_STRING(ui-locale,
5037 [  --enable-ui-locale=ab-CD
5038                           Select the user interface locale (default: en-US)],
5039     MOZ_UI_LOCALE=$enableval )
5040 AC_SUBST(MOZ_UI_LOCALE)
5042 dnl ========================================================
5043 dnl = Trademarked Branding 
5044 dnl ========================================================
5045 MOZ_ARG_ENABLE_BOOL(official-branding,
5046 [  --enable-official-branding Enable Official mozilla.org Branding
5047                           Do not distribute builds with
5048                           --enable-official-branding unless you have
5049                           permission to use trademarks per
5050                           http://www.mozilla.org/foundation/trademarks/ .],
5052   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5053     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5054   else
5055     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5056     MOZ_OFFICIAL_BRANDING=1
5057   fi
5058 ], MOZ_OFFICIAL_BRANDING=)
5060 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5061 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5062   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5065 MOZ_ARG_WITH_STRING(branding,
5066 [  --with-branding=dir    Use branding from the specified directory.],
5067     MOZ_BRANDING_DIRECTORY=$withval)
5069 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5070 if test -z "$REAL_BRANDING_DIRECTORY"; then
5071   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5074 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5075   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
5078 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5080 dnl ========================================================
5081 dnl = Distribution ID
5082 dnl ========================================================
5083 MOZ_ARG_WITH_STRING(distribution-id,
5084 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
5085 [ val=`echo $withval`
5086     MOZ_DISTRIBUTION_ID="$val"])
5088 if test -z "$MOZ_DISTRIBUTION_ID"; then
5089    MOZ_DISTRIBUTION_ID="org.mozilla"
5092 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5093 AC_SUBST(MOZ_DISTRIBUTION_ID)
5096 dnl ========================================================
5097 dnl complex text support off by default
5098 dnl ========================================================
5099 MOZ_PANGO=1
5100 MOZ_ARG_DISABLE_BOOL(pango,
5101 [  --disable-pango Disable usage of Pango ],
5102     MOZ_PANGO=,
5103     MOZ_PANGO=1)
5106 dnl ========================================================
5107 dnl = Pango
5108 dnl ========================================================
5109 if test "$MOZ_ENABLE_GTK2"
5110 then
5111     AC_SUBST(MOZ_PANGO)
5113     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5115     if test "$MOZ_PANGO"
5116     then
5117         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5118         AC_SUBST(MOZ_PANGO_CFLAGS)
5119         AC_SUBST(MOZ_PANGO_LIBS)
5120         AC_DEFINE(MOZ_PANGO)
5121     else
5122         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5123         AC_SUBST(MOZ_PANGO_CFLAGS)
5124         AC_SUBST(MOZ_PANGO_LIBS)
5126         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5127         AC_SUBST(FT2_CFLAGS)
5128         AC_SUBST(FT2_LIBS)
5129     fi
5132 dnl ========================================================
5133 dnl = GnomeVFS, GIO and GConf support module
5134 dnl ========================================================
5136 if test "$MOZ_X11"
5137 then
5138     dnl build the gnomevfs extension by default only when the
5139     dnl GTK2 toolkit is in use.
5140     if test "$MOZ_ENABLE_GTK2"
5141     then
5142         MOZ_ENABLE_GNOMEVFS=1
5143         MOZ_ENABLE_GCONF=1
5144     fi
5146     dnl ========================================================
5147     dnl = GnomeVFS support module
5148     dnl ========================================================
5149     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5150     [  --disable-gnomevfs      Disable GnomeVFS support ],
5151         MOZ_ENABLE_GNOMEVFS=,
5152         MOZ_ENABLE_GNOMEVFS=force)
5154     if test "$MOZ_ENABLE_GNOMEVFS"
5155     then
5156         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5157             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5158             MOZ_ENABLE_GNOMEVFS=1
5159             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5160         ],[
5161             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5162             then
5163                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5164             fi
5165             MOZ_ENABLE_GNOMEVFS=
5166         ])
5167     else
5168         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5169             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5170               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5171             ])
5172         fi
5173     fi
5175     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5176     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5177     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5179     dnl ========================================================
5180     dnl = GIO support module
5181     dnl ========================================================
5182     MOZ_ARG_ENABLE_BOOL(gio,
5183     [  --enable-gio            Enable GIO support (default: disabled)],
5184         MOZ_ENABLE_GIO=force,
5185         MOZ_ENABLE_GIO=)
5187     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5188     then
5189         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5190             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5191             MOZ_ENABLE_GIO=1
5192             AC_DEFINE(MOZ_ENABLE_GIO)
5193         ],[
5194             if test "$MOZ_ENABLE_GIO" = "force"
5195             then
5196                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5197             fi
5198             MOZ_ENABLE_GIO=
5199         ])
5200     fi
5202     AC_SUBST(MOZ_ENABLE_GIO)
5203     AC_SUBST(MOZ_GIO_CFLAGS)
5204     AC_SUBST(MOZ_GIO_LIBS)
5205    
5206     dnl ========================================================
5207     dnl = GConf support module
5208     dnl ========================================================
5209     if test "$MOZ_ENABLE_GCONF"
5210     then
5211         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5212             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5213             MOZ_ENABLE_GCONF=1
5214         ],[
5215             if test "$MOZ_ENABLE_GCONF" = "force"
5216             then
5217                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5218             fi
5219             MOZ_ENABLE_GCONF=
5220         ])
5221     fi
5223     if test "$MOZ_ENABLE_GCONF"; then
5224         AC_DEFINE(MOZ_ENABLE_GCONF)
5225     fi
5227     AC_SUBST(MOZ_ENABLE_GCONF)
5228     AC_SUBST(MOZ_GCONF_CFLAGS)
5229     AC_SUBST(MOZ_GCONF_LIBS)
5232 dnl ========================================================
5233 dnl = libnotify support
5234 dnl ========================================================
5236 if test "$MOZ_ENABLE_GTK2"
5237 then
5238     MOZ_ENABLE_LIBNOTIFY=1
5240     MOZ_ARG_DISABLE_BOOL(libnotify,
5241     [  --disable-libnotify       Disable libnotify support ],
5242     MOZ_ENABLE_LIBNOTIFY=,
5243     MOZ_ENABLE_LIBNOTIFY=1)
5245     if test "$MOZ_ENABLE_LIBNOTIFY"
5246     then
5247         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5248     fi
5251 if test -z "$SKIP_LIBRARY_CHECKS"
5252 then
5253     if test "$MOZ_ENABLE_GTK2"
5254     then
5255         if test "$MOZ_ENABLE_LIBNOTIFY"
5256         then
5257             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5258         fi
5259     fi
5261 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5262 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5263 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5265 dnl ========================================================
5266 dnl = GNOME component (mozgnome)
5267 dnl ========================================================
5269 # The GNOME component is built if one of 
5270 # gnome-vfs, gio, gconf or libnotify is available.
5271 if test "$MOZ_ENABLE_GCONF" || \
5272    test "$MOZ_ENABLE_GNOMEVFS" || \
5273    test "$MOZ_ENABLE_GIO" || \
5274    test "$MOZ_ENABLE_LIBNOTIFY"; then
5275     MOZ_ENABLE_GNOME_COMPONENT=1
5276 else
5277     MOZ_ENABLE_GNOME_COMPONENT=
5279 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5281 dnl ========================================================
5282 dnl = libgnomeui support module
5283 dnl ========================================================
5285 if test "$MOZ_ENABLE_GTK2"
5286 then
5287     MOZ_ENABLE_GNOMEUI=1
5289     MOZ_ARG_DISABLE_BOOL(gnomeui,
5290     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5291         MOZ_ENABLE_GNOMEUI=,
5292         MOZ_ENABLE_GNOMEUI=force)
5294     if test "$MOZ_ENABLE_GNOMEUI"
5295     then
5296         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5297         [
5298             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5299             MOZ_ENABLE_GNOMEUI=1
5300         ],[
5301             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5302             then
5303                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5304             fi
5305             MOZ_ENABLE_GNOMEUI=
5306         ])
5307     fi
5309     if test "$MOZ_ENABLE_GNOMEUI"; then
5310         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5311     fi
5314 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5315 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5316 AC_SUBST(MOZ_GNOMEUI_LIBS)
5318 dnl ========================================================
5319 dnl = dbus support
5320 dnl ========================================================
5322 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5323 then
5324     MOZ_ENABLE_DBUS=1
5326     MOZ_ARG_DISABLE_BOOL(dbus,
5327     [  --disable-dbus       Disable dbus support ],
5328         MOZ_ENABLE_DBUS=,
5329         MOZ_ENABLE_DBUS=1)
5331     if test "$MOZ_ENABLE_DBUS"
5332     then
5333         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5334         AC_DEFINE(MOZ_ENABLE_DBUS)
5335     fi
5337 AC_SUBST(MOZ_ENABLE_DBUS)
5338 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5339 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5341 dnl ========================================================
5342 dnl = Build Personal Security Manager
5343 dnl ========================================================
5344 MOZ_ARG_DISABLE_BOOL(crypto,
5345 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5346     MOZ_PSM=,
5347     MOZ_PSM=1 )
5349 dnl ========================================================
5350 dnl = JS Debugger XPCOM component (js/jsd)
5351 dnl ========================================================
5352 MOZ_ARG_DISABLE_BOOL(jsd,
5353 [  --disable-jsd           Disable JavaScript debug library],
5354     MOZ_JSDEBUGGER=,
5355     MOZ_JSDEBUGGER=1)
5358 dnl ========================================================
5359 dnl = Disable IPC support for tabs and plugins
5360 dnl ========================================================
5361 case "${target}" in
5362 *-apple-darwin*)
5363     MOZ_IPC=
5364     ;;
5365 *-wince*)
5366     MOZ_IPC=
5367     ;;
5368 esac
5370 MOZ_ARG_DISABLE_BOOL(ipc,
5371 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5372     MOZ_IPC=,
5373     MOZ_IPC=1)
5375 if test -n "$MOZ_IPC"; then
5376     AC_DEFINE(MOZ_IPC)
5379 AC_SUBST(MOZ_IPC)
5381 dnl ========================================================
5382 dnl = Enable IPDL's "expensive" unit tests
5383 dnl ========================================================
5384 MOZ_IPDL_TESTS=
5386 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5387 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5388     MOZ_IPDL_TESTS=1,
5389     MOZ_IPDL_TESTS=)
5391 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5392     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5395 if test -n "$MOZ_IPDL_TESTS"; then
5396     AC_DEFINE(MOZ_IPDL_TESTS)
5399 AC_SUBST(MOZ_IPDL_TESTS)
5401 dnl ========================================================
5402 dnl = Disable plugin support
5403 dnl ========================================================
5404 MOZ_ARG_DISABLE_BOOL(plugins,
5405 [  --disable-plugins       Disable plugins support],
5406     MOZ_PLUGINS=,
5407     MOZ_PLUGINS=1)
5409 dnl ========================================================
5410 dnl = Disable building dbm
5411 dnl ========================================================
5412 MOZ_ARG_DISABLE_BOOL(dbm,
5413 [  --disable-dbm       Disable building dbm],
5414     NSS_DISABLE_DBM=1,
5415     NSS_DISABLE_DBM=)
5417 dnl bi-directional support always on
5418 IBMBIDI=1
5419 AC_DEFINE(IBMBIDI)
5421 dnl ========================================================
5422 dnl view source support on by default
5423 dnl ========================================================
5424 if test "$MOZ_VIEW_SOURCE"; then
5425     AC_DEFINE(MOZ_VIEW_SOURCE)
5428 dnl ========================================================
5429 dnl accessibility support on by default on all platforms 
5430 dnl except OS X.
5431 dnl ========================================================
5432 MOZ_ARG_DISABLE_BOOL(accessibility,
5433 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5434     ACCESSIBILITY=,
5435     ACCESSIBILITY=1 )
5436 if test "$ACCESSIBILITY"; then
5437     AC_DEFINE(ACCESSIBILITY)
5440 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5441 case "$target" in
5442 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5443     if test "$ac_cv_header_atlbase_h" = "no"; then
5444         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.])
5445     fi
5446     if test "$ac_cv_header_oleacc_idl" = "no"; then
5447         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.])
5448     fi
5449     ;;
5450 esac
5453 dnl ========================================================
5454 dnl xpfe/components on by default
5455 dnl ========================================================
5456 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5457 [  --disable-xpfe-components
5458                           Disable xpfe components],
5459     MOZ_XPFE_COMPONENTS=,
5460     MOZ_XPFE_COMPONENTS=1 )
5462 dnl ========================================================
5463 dnl xpinstall support on by default
5464 dnl ========================================================
5465 MOZ_ARG_DISABLE_BOOL(xpinstall,
5466 [  --disable-xpinstall     Disable xpinstall support],
5467     MOZ_XPINSTALL=,
5468     MOZ_XPINSTALL=1 )
5469 if test "$MOZ_XPINSTALL"; then
5470     AC_DEFINE(MOZ_XPINSTALL)
5473 dnl ========================================================
5474 dnl xpcom js loader support on by default
5475 dnl ========================================================
5476 if test "$MOZ_JSLOADER"; then
5477     AC_DEFINE(MOZ_JSLOADER)
5480 dnl ========================================================
5481 dnl Disable printing
5482 dnl ========================================================
5483 MOZ_ARG_DISABLE_BOOL(printing,
5484 [  --disable-printing  Disable printing support],
5485     NS_PRINTING=,
5486     NS_PRINTING=1 )
5488 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5489     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5490     NS_PRINTING=
5493 if test "$NS_PRINTING"; then
5494     AC_DEFINE(NS_PRINTING)
5495     AC_DEFINE(NS_PRINT_PREVIEW)
5498 dnl ========================================================
5499 dnl use native unicode converters
5500 dnl ========================================================
5501 MOZ_ARG_ENABLE_BOOL(native-uconv,
5502 [  --enable-native-uconv   Enable iconv support],
5503     MOZ_USE_NATIVE_UCONV=1,
5504     MOZ_USE_NATIVE_UCONV= )
5505 if test "$MOZ_USE_NATIVE_UCONV"; then
5506     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5508 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5509     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5513 dnl ========================================================
5514 dnl Libeditor can be build as plaintext-only,
5515 dnl or as a full html and text editing component.
5516 dnl We build both by default.
5517 dnl ========================================================
5518 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5519 [  --enable-plaintext-editor-only
5520                           Allow only plaintext editing],
5521     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5522     MOZ_PLAINTEXT_EDITOR_ONLY= )
5523 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5524 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5526 dnl ========================================================
5527 dnl = Disable Fast Load
5528 dnl ========================================================
5529 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5530 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5531     MOZ_NO_FAST_LOAD=1,
5532     MOZ_NO_FAST_LOAD=)
5534 AC_SUBST(MOZ_NO_FAST_LOAD)
5536 if test -n "$MOZ_NO_FAST_LOAD"; then
5537     AC_DEFINE(MOZ_NO_FAST_LOAD)
5540 dnl ========================================================
5541 dnl = Disable Ogg Codecs
5542 dnl ========================================================
5543 MOZ_ARG_DISABLE_BOOL(ogg,
5544 [  --disable-ogg           Disable Ogg Codec support],
5545     MOZ_OGG=,
5546     MOZ_OGG=1)
5548 AC_SUBST(MOZ_OGG)
5550 if test -n "$MOZ_OGG"; then
5551     AC_DEFINE(MOZ_OGG)
5552     MOZ_SYDNEYAUDIO=1
5553     MOZ_MEDIA=1
5555     dnl Checks for __attribute__(aligned()) directive
5556     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5557         [ac_cv_c_attribute_aligned],
5558         [ac_cv_c_attribute_aligned=0
5559          CFLAGS_save="${CFLAGS}"
5560          CFLAGS="${CFLAGS} -Werror"
5561          for ac_cv_c_attr_align_try in 64 32 16 8; do
5562            echo "trying $ac_cv_c_attr_align_try"
5563            AC_TRY_COMPILE([],
5564                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5565                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5566            if test "$ac_cv_c_attribute_aligned" != 0; then
5567              break;
5568            fi
5569          done
5570            CFLAGS="${CFLAGS_save}"])
5571     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5572       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5573                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5574     fi
5577 dnl ========================================================
5578 dnl = Disable Wave decoder support
5579 dnl ========================================================
5580 MOZ_ARG_DISABLE_BOOL(wave,
5581 [  --disable-wave          Disable Wave decoder support],
5582     MOZ_WAVE=,
5583     MOZ_WAVE=1)
5585 AC_SUBST(MOZ_WAVE)
5587 if test -n "$MOZ_WAVE"; then
5588     AC_DEFINE(MOZ_WAVE)
5589     MOZ_SYDNEYAUDIO=1
5590     MOZ_MEDIA=1
5593 dnl ========================================================
5594 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5595 dnl ========================================================
5597 AC_SUBST(MOZ_SYDNEYAUDIO)
5599 if test -n "$MOZ_SYDNEYAUDIO"; then
5600     AC_DEFINE(MOZ_SYDNEYAUDIO)
5603 AC_SUBST(MOZ_MEDIA)
5605 if test -n "$MOZ_MEDIA"; then
5606     AC_DEFINE(MOZ_MEDIA)
5609 dnl ========================================================
5610 dnl = Check alsa availability on Linux if using sydneyaudio
5611 dnl ========================================================
5613 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5614 if test -n "$MOZ_SYDNEYAUDIO"; then
5615    case "$target_os" in
5616 linux*)
5617       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5618          [echo "$MOZ_ALSA_PKG_ERRORS"
5619           AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux.  Disable with --disable-ogg --disable-wave.])])
5620       ;;
5621    esac
5623 AC_SUBST(MOZ_ALSA_LIBS)
5625 dnl ========================================================
5626 dnl Splashscreen
5627 dnl ========================================================
5628 AC_ARG_ENABLE(splashscreen,
5629               [  --enable-splashscreen   display splashscreen while loading (default=no)],
5630               [enable_splash="yes"],[enable_splash=""])
5631 if test "x$enable_splash" = "xyes"; then
5632   MOZ_SPLASHSCREEN=1
5633   AC_DEFINE(MOZ_SPLASHSCREEN)
5635 AC_SUBST(MOZ_SPLASHSCREEN)
5637 dnl ========================================================
5638 dnl Permissions System
5639 dnl ========================================================
5640 MOZ_ARG_DISABLE_BOOL(permissions,
5641 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5642     MOZ_PERMISSIONS=,
5643     MOZ_PERMISSIONS=1
5646 dnl ========================================================
5647 dnl NegotiateAuth
5648 dnl ========================================================
5649 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5650 [  --disable-negotiateauth Disable GSS-API negotiation ],
5651     MOZ_AUTH_EXTENSION=,
5652     MOZ_AUTH_EXTENSION=1 )
5654 dnl ========================================================
5655 dnl XTF
5656 dnl ========================================================
5657 MOZ_ARG_DISABLE_BOOL(xtf,
5658 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5659     MOZ_XTF=,
5660     MOZ_XTF=1 )
5661 if test "$MOZ_XTF"; then
5662   AC_DEFINE(MOZ_XTF)
5665 dnl ========================================================
5666 dnl Pref extensions (autoconfig and system-pref)
5667 dnl ========================================================
5668 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5669 [  --disable-pref-extensions
5670                           Disable pref extensions such as autoconfig and
5671                           system-pref],
5672   MOZ_PREF_EXTENSIONS=,
5673   MOZ_PREF_EXTENSIONS=1 )
5675 dnl ========================================================
5676 dnl = Universalchardet
5677 dnl ========================================================
5678 MOZ_ARG_DISABLE_BOOL(universalchardet,
5679 [  --disable-universalchardet
5680                           Disable universal encoding detection],
5681   MOZ_UNIVERSALCHARDET=,
5682   MOZ_UNIVERSALCHARDET=1 )
5684 dnl ========================================================
5685 dnl JavaXPCOM
5686 dnl ========================================================
5687 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5688 [  --enable-javaxpcom
5689                           Enable Java-XPCOM bridge],
5690     MOZ_JAVAXPCOM=1,
5691     MOZ_JAVAXPCOM= )
5693 if test -n "${MOZ_JAVAXPCOM}"; then
5694   case "$host_os" in
5695     cygwin*|msvc*|mks*)
5696       if test -n "$JAVA_HOME"; then
5697         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5698       fi
5699       ;;
5700     *mingw*)
5701       if test -n "$JAVA_HOME"; then
5702         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5703       fi
5704       ;;
5705   esac
5707   if test -n "${JAVA_INCLUDE_PATH}"; then
5708     dnl Make sure jni.h exists in the given include path.
5709     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5710       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5711     fi
5712   else
5713     case "$target_os" in
5714       darwin*)
5715         dnl Default to java system location
5716         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5717         ;;
5718       *)
5719         dnl Try $JAVA_HOME
5720         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5721         ;;
5722     esac
5723     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5724       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.])
5725     fi
5726   fi
5728   if test -n "${JAVA_BIN_PATH}"; then
5729     dnl Look for javac and jar in the specified path.
5730     JAVA_PATH="$JAVA_BIN_PATH"
5731   else
5732     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5733     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5734   fi
5736   MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5737   MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5738   MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5739   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5740     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.])
5741   fi
5744 dnl ========================================================
5745 dnl = Breakpad crash reporting (on by default on supported platforms)
5746 dnl ========================================================
5748 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5749     || test "$OS_ARCH" = "Darwin" \
5750     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5751     || test "$OS_ARCH" = "SunOS") \
5752    && test -z "$HAVE_64BIT_OS"; then
5753    MOZ_CRASHREPORTER=1
5756 MOZ_ARG_DISABLE_BOOL(crashreporter,
5757 [  --disable-crashreporter          Disable breakpad crash reporting],
5758     MOZ_CRASHREPORTER=,
5759     MOZ_CRASHREPORTER=1)
5761 if test -n "$MOZ_CRASHREPORTER"; then
5762    AC_DEFINE(MOZ_CRASHREPORTER)
5764   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5765     test -z "$SKIP_LIBRARY_CHECKS"; then
5766     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5767     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5768     AC_SUBST(MOZ_GTHREAD_LIBS)
5770     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.])])
5771   fi
5774 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5775 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5776 [ val=`echo $withval | sed 's/[^0-9]//g'`
5777     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5779 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5780    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5782 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5784 dnl ========================================================
5785 dnl = Enable compilation of specific extension modules
5786 dnl ========================================================
5788 MOZ_ARG_ENABLE_STRING(extensions,
5789 [  --enable-extensions     Enable extensions],
5790 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5791     if test "$option" = "yes" || test "$option" = "all"; then
5792         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5793     elif test "$option" = "no" || test "$option" = "none"; then
5794         MOZ_EXTENSIONS=""
5795     elif test "$option" = "default"; then
5796         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5797     elif test `echo "$option" | grep -c \^-` != 0; then
5798         option=`echo $option | sed 's/^-//'`
5799         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5800     else
5801         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5802     fi
5803 done],
5804     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5806 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5807     # Suppress warning on non-X11 platforms
5808     if test -n "$MOZ_X11"; then
5809         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5810     fi
5811     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5814 dnl Do not build gnomevfs with libxul based apps
5815 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5816     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5819 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5820     # Suppress warning on non-X11 platforms
5821     if test -n "$MOZ_X11"; then
5822         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5823     fi
5824     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5827 dnl Do not build gio with libxul based apps
5828 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5829     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5832 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5833     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5834     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5837 dnl This might be temporary: build tridentprofile only on Windows
5838 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5839     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5840     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5843 dnl cookie must be built before tridentprofile. put it at list's end.
5844 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5845   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5846   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5849 dnl xforms requires xtf and schema-validation
5850 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5851     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5852     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5854 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5855     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5856     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5859 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5860     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5861     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5864 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5865     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5866     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5869 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5870     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5871     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5874 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5875     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5876     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5879 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5880     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5881     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5884 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5885     AC_MSG_WARN([spellcheck is no longer an extension.])
5886     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5889 dnl Remove dupes
5890 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5892 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5893 dnl when trying to build a non-existent extension.
5894 for extension in $MOZ_EXTENSIONS; do
5895     if test ! -d "${srcdir}/extensions/${extension}"; then
5896         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5897     fi
5898 done
5901 dnl ========================================================
5902 dnl Image decoders
5903 dnl ========================================================
5904 case "$MOZ_WIDGET_TOOLKIT" in
5905 beos|windows|os2|mac|cocoa)
5906     ;;
5908     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
5909        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
5910     fi
5911     ;;
5912 esac
5914 MOZ_ARG_ENABLE_STRING(image-decoders,
5915 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5916                           Enable specific image decoders],
5917 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5918     if test "$option" = "yes" || test "$option" = "all"; then
5919         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5920     elif test "$option" = "no" || test "$option" = "none"; then
5921         MOZ_IMG_DECODERS=""
5922     elif test "$option" = "default"; then
5923         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5924     elif test `echo "$option" | grep -c \^-` != 0; then
5925         option=`echo $option | sed 's/^-//'`
5926         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5927     else
5928         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5929     fi
5930 done],
5931     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5933 dnl Dupes are removed in the encoder section because it will also add decoders
5935 dnl ========================================================
5936 dnl Image encoders
5937 dnl ========================================================
5938 MOZ_ARG_ENABLE_STRING(image-encoders,
5939 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5940                           Enable specific image encoders],
5941 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5942     if test "$option" = "yes" || test "$option" = "all"; then
5943         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5944     elif test "$option" = "no" || test "$option" = "none"; then
5945         MOZ_IMG_ENCODERS=""
5946         addencoder=""
5947     elif test "$option" = "default"; then
5948         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5949     elif test `echo "$option" | grep -c \^-` != 0; then
5950         option=`echo $option | sed 's/^-//'`
5951         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5952     else
5953         addencoder="$option"
5954     fi
5955     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5956 done],
5957     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5959 dnl Remove dupes
5960 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5961 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5963 dnl ========================================================
5964 dnl MathML on by default
5965 dnl ========================================================
5966 MOZ_ARG_DISABLE_BOOL(mathml,
5967 [  --disable-mathml        Disable MathML support],
5968     MOZ_MATHML=,
5969     MOZ_MATHML=1 )
5970 if test "$MOZ_MATHML"; then
5971   AC_DEFINE(MOZ_MATHML)
5974 dnl ========================================================
5975 dnl SVG
5976 dnl ========================================================
5977 MOZ_ARG_DISABLE_BOOL(svg,
5978 [  --disable-svg            Disable SVG support],
5979     MOZ_SVG=,
5980     MOZ_SVG=1 )
5981 if test -n "$MOZ_SVG"; then
5982   AC_DEFINE(MOZ_SVG)
5985 dnl ========================================================
5986 dnl SMIL
5987 dnl ========================================================
5988 MOZ_SMIL=1
5989 MOZ_ARG_DISABLE_BOOL(smil,
5990 [  --disable-smil           Disable SMIL animation support],
5991     MOZ_SMIL=,
5992     MOZ_SMIL=1 )
5993 # Automatically disable SMIL if SVG is disabled
5994 if test -z "$MOZ_SVG"; then
5995   MOZ_SMIL=
5997 if test -n "$MOZ_SMIL"; then
5998   AC_DEFINE(MOZ_SMIL)
6001 dnl ========================================================
6002 dnl Build Freetype in the tree
6003 dnl ========================================================
6004 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6005 [  --enable-tree-freetype         Enable Tree FreeType],
6006     MOZ_TREE_FREETYPE=1,
6007     MOZ_TREE_FREETYPE= )
6008 if test -n "$MOZ_TREE_FREETYPE"; then
6009    AC_DEFINE(MOZ_TREE_FREETYPE)
6010    AC_SUBST(MOZ_TREE_FREETYPE)
6011    MOZ_ENABLE_CAIRO_FT=1       
6012    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6013    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6014    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6015    FT2_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
6016    CAIRO_FT_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
6017    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6018    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6019    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6020    AC_SUBST(CAIRO_FT_CFLAGS)
6024 dnl ========================================================
6025 dnl Installer
6026 dnl ========================================================
6027 case "$target_os" in
6028     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6029         MOZ_INSTALLER=1
6030         ;;
6031 esac
6033 MOZ_ARG_DISABLE_BOOL(installer,
6034 [  --disable-installer     Disable building of installer],
6035     MOZ_INSTALLER=,
6036     MOZ_INSTALLER=1 )
6037 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6038     # Disable installer for Windows builds that use the new toolkit if NSIS
6039     # isn't in the path.
6040     MOZ_PATH_PROGS(MAKENSIS, makensis)
6041     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
6042         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
6043     fi
6044     # The Windows build for NSIS requires the iconv command line utility to
6045     # convert the charset of the locale files.
6046     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6047     if test -z "$HOST_ICONV"; then
6048         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6049     fi
6052 # Automatically disable installer if xpinstall isn't built
6053 if test -z "$MOZ_XPINSTALL"; then
6054     MOZ_INSTALLER=
6056 AC_SUBST(MOZ_INSTALLER)
6058 AC_MSG_CHECKING([for tar archiver])
6059 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6060 if test -z "$TAR"; then
6061     AC_MSG_ERROR([no tar archiver found in \$PATH])
6063 AC_MSG_RESULT([$TAR])
6064 AC_SUBST(TAR)
6066 AC_MSG_CHECKING([for wget])
6067 AC_CHECK_PROGS(WGET, wget, "")
6068 AC_MSG_RESULT([$WGET])
6069 AC_SUBST(WGET)
6071 dnl ========================================================
6072 dnl Updater
6073 dnl ========================================================
6075 MOZ_ARG_DISABLE_BOOL(updater,
6076 [  --disable-updater       Disable building of updater],
6077     MOZ_UPDATER=,
6078     MOZ_UPDATER=1 )
6079 AC_SUBST(MOZ_UPDATER)
6081 # app update channel is 'default' when not supplied.
6082 MOZ_ARG_ENABLE_STRING([update-channel],
6083 [  --enable-update-channel=CHANNEL
6084                            Select application update channel (default=default)],
6085     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6087 if test -z "$MOZ_UPDATE_CHANNEL"; then
6088     MOZ_UPDATE_CHANNEL=default
6090 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6092 # tools/update-packaging is not checked out by default.
6093 MOZ_ARG_ENABLE_BOOL(update-packaging,
6094 [  --enable-update-packaging
6095                            Enable tools/update-packaging],
6096     MOZ_UPDATE_PACKAGING=1,
6097     MOZ_UPDATE_PACKAGING= )
6098 AC_SUBST(MOZ_UPDATE_PACKAGING)
6100 dnl ========================================================
6101 dnl ActiveX
6102 dnl ========================================================
6104 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6105 [  --disable-xpconnect-idispatch
6106                           Disable building of xpconnect support for IDispatch
6107                           (win32 only)],
6108     XPC_IDISPATCH_SUPPORT=,
6109     XPC_IDISPATCH_SUPPORT=1)
6110 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6112 MOZ_ARG_DISABLE_BOOL(activex,
6113 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6114     MOZ_NO_ACTIVEX_SUPPORT=1,
6115     MOZ_NO_ACTIVEX_SUPPORT= )
6116 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6118 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6119 [  --enable-activex-scripting
6120                           Enable building of ActiveX scripting support (win32)],
6121     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6122     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6123 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6125 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6126 then
6127     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6130 if test "$COMPILE_ENVIRONMENT" = "1"; then
6131 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6132 case "$target" in
6133 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6134     if test "$ac_cv_header_atlbase_h" = "no"; then
6135         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.])
6136     fi
6137     ;;
6138 esac
6142 dnl ========================================================
6143 dnl leaky
6144 dnl ========================================================
6145 MOZ_ARG_ENABLE_BOOL(leaky,
6146 [  --enable-leaky          Build leaky memory tool],
6147     MOZ_LEAKY=1,
6148     MOZ_LEAKY=)
6151 dnl ========================================================
6152 dnl xpctools
6153 dnl ========================================================
6154 MOZ_ARG_ENABLE_BOOL(xpctools,
6155 [  --enable-xpctools       Build JS profiling tool],
6156     MOZ_XPCTOOLS=1,
6157     MOZ_XPCTOOLS= )
6160 dnl ========================================================
6161 dnl build the tests by default
6162 dnl ========================================================
6163 MOZ_ARG_DISABLE_BOOL(tests,
6164 [  --disable-tests         Do not build test libraries & programs],
6165     ENABLE_TESTS=,
6166     ENABLE_TESTS=1 )
6168 dnl ========================================================
6169 dnl parental controls (for Windows Vista)
6170 dnl ========================================================
6171 MOZ_ARG_DISABLE_BOOL(parental-controls,
6172 [  --disable-parental-controls
6173                            Do not build parental controls],
6174    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6175    MOZ_DISABLE_PARENTAL_CONTROLS=)
6176 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6177     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6180 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6182 dnl ========================================================
6183 dnl =
6184 dnl = Module specific options
6185 dnl =
6186 dnl ========================================================
6187 MOZ_ARG_HEADER(Individual module options)
6189 dnl ========================================================
6190 dnl = Enable places (new history/bookmarks)
6191 dnl ========================================================
6192 MOZ_ARG_ENABLE_BOOL(places,
6193 [  --enable-places        Enable 'places' bookmark/history implementation],
6194     MOZ_PLACES=1,
6195     MOZ_PLACES= )
6196 if test -n "$MOZ_PLACES"; then
6197     AC_DEFINE(MOZ_PLACES)
6198     if test -z "$MOZ_MAIL_NEWS"; then
6199       MOZ_MORK=
6200     fi
6201     MOZ_MORKREADER=1
6202 else
6203   if test "$MOZ_BUILD_APP" = "browser"; then
6204     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
6205   fi
6208 dnl ========================================================
6209 dnl = Disable feed handling components
6210 dnl ========================================================
6211 MOZ_ARG_DISABLE_BOOL(feeds,
6212 [  --disable-feeds        Disable feed handling and processing components],
6213     MOZ_FEEDS=,
6214     MOZ_FEEDS=1 )
6215 if test -n "$MOZ_FEEDS"; then
6216     AC_DEFINE(MOZ_FEEDS)
6217 else
6218     if test "$MOZ_BUILD_APP" = "browser"; then
6219         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6220     fi
6223 dnl ========================================================
6224 dnl = Enable mozStorage
6225 dnl ========================================================
6226 dnl Implicitly enabled by default if building calendar or places
6227 MOZ_ARG_ENABLE_BOOL(storage,
6228 [  --enable-storage        Enable mozStorage module and related components],
6229     MOZ_STORAGE=1,
6230     MOZ_STORAGE= )
6231 if test -n "$MOZ_STORAGE"; then
6232     AC_DEFINE(MOZ_STORAGE)
6235 dnl ========================================================
6236 dnl Check for sqlite
6237 dnl ========================================================
6239 MOZ_NATIVE_SQLITE=
6240 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6241 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6242 MOZ_NATIVE_SQLITE=1,
6243 MOZ_NATIVE_SQLITE= )
6245 if test -z "$MOZ_NATIVE_SQLITE"
6246 then
6247     SQLITE_CFLAGS=
6248     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6249 else
6250     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6251     dnl ===================================
6252     dnl === SQLITE_SECURE_DELETE checks ===
6253     dnl ===================================
6254     dnl check to see if the system sqlite package is compiled with
6255     dnl SQLITE_SECURE_DELETE enabled.
6256     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system sqlite)
6257     _SAVE_CFLAGS="$CFLAGS"
6258     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6259     _SAVE_LIBS="$LIBS"
6260     LIBS="$LIBS $SQLITE_LIBS"
6261     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6262         AC_TRY_RUN([
6263             #include "sqlite3.h"
6264             #include <stdio.h>
6265             #include <assert.h>
6267             int main(int argc, char **argv){
6268               sqlite3 *db;
6269               sqlite3_uint64 r;
6270               char *zFilename;
6271               FILE *in;
6272               int i;
6273               int rc;
6274               char *zBuf;
6275               const int bufSize = 1024*3;
6277               zBuf = malloc(bufSize*sizeof(char));
6278               assert( zBuf );
6279               rc = sqlite3_open(":memory:", &db);
6280               assert( rc==SQLITE_OK );
6281               sqlite3_close(db);
6282               sqlite3_randomness(sizeof(r), &r);
6283               zFilename = sqlite3_mprintf("test_db_%llu.sqlite", r);
6284               rc = sqlite3_open(zFilename, &db);
6285               assert( rc==SQLITE_OK );
6286               rc = sqlite3_exec(db, 
6287                 "BEGIN;"
6288                 "CREATE TABLE t1(x);"
6289                 "INSERT INTO t1 VALUES(zeroblob(1000)||'abcdefghijklmnopqrstuvwxyz');"
6290                 "COMMIT;"
6291                 "DELETE FROM t1;",
6292                 0, 0, 0
6293               );
6294               assert( rc==SQLITE_OK );
6295               sqlite3_close(db);
6296               in = fopen(zFilename, "r");
6297               assert( in!=0 );
6298               rc = fread(zBuf, 1, bufSize, in);
6299               assert( rc==bufSize );
6300               fclose(in);
6301               unlink(zFilename);
6302               free( zBuf );
6303               for(i=0; i<bufSize-11; i++){
6304                 if( *(zBuf+i)=='h' && memcmp(zBuf+i, "hijklmnopq", 10)==0 ){
6305                   return 1;
6306                 }
6307               }
6308               return 0;
6309             }],
6310             ac_cv_sqlite_secure_delete=yes,
6311             ac_cv_sqlite_secure_delete=no,
6312             ac_cv_sqlite_secure_delete=no
6313         )
6314     ])
6315     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6316     CFLAGS="$_SAVE_CFLAGS"
6317     LIBS="$_SAVE_LIBS"
6318     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6319         AC_MSG_ERROR([System Sqlite library is not compiled with SQLITE_SECURE_DELETE.])
6320     fi
6323 AC_SUBST(MOZ_NATIVE_SQLITE)
6325 dnl ========================================================
6326 dnl = Enable help viewer (off by default)
6327 dnl ========================================================
6328 MOZ_ARG_ENABLE_BOOL(help-viewer,
6329 [  --enable-help-viewer        Enable help viewer],
6330     MOZ_HELP_VIEWER=1,
6331     MOZ_HELP_VIEWER= )
6332 if test -n "$MOZ_HELP_VIEWER"; then
6333      AC_DEFINE(MOZ_HELP_VIEWER)
6335 AC_SUBST(MOZ_HELP_VIEWER)
6336 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6337     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6340 dnl ========================================================
6341 dnl = Enable safe browsing (anti-phishing)
6342 dnl ========================================================
6343 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6344 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6345     MOZ_SAFE_BROWSING=1,
6346     MOZ_SAFE_BROWSING= )
6347 if test -n "$MOZ_SAFE_BROWSING"; then
6348     AC_DEFINE(MOZ_SAFE_BROWSING)
6350 AC_SUBST(MOZ_SAFE_BROWSING)
6352 dnl ========================================================
6353 dnl = Enable faststart component
6354 dnl ========================================================
6355 MOZ_ARG_ENABLE_BOOL(faststart,
6356 [  --enable-faststart            Enable the faststart component],
6357     MOZ_FASTSTART=1,
6358     MOZ_FASTSTART= )
6359 if test -n "$MOZ_FASTSTART"; then
6360     AC_DEFINE(MOZ_FASTSTART)
6362 AC_SUBST(MOZ_FASTSTART)
6364 dnl ========================================================
6365 dnl = Enable url-classifier
6366 dnl ========================================================
6367 dnl Implicitly enabled by default if building with safe-browsing
6368 if test -n "$MOZ_SAFE_BROWSING"; then
6369     MOZ_URL_CLASSIFIER=1
6371 MOZ_ARG_ENABLE_BOOL(url-classifier,
6372 [  --enable-url-classifier        Enable url classifier module],
6373     MOZ_URL_CLASSIFIER=1,
6374     MOZ_URL_CLASSIFIER= )
6375 if test -n "$MOZ_URL_CLASSIFIER"; then
6376     AC_DEFINE(MOZ_URL_CLASSIFIER)
6378 AC_SUBST(MOZ_URL_CLASSIFIER)
6380 dnl ========================================================
6381 dnl = Disable zipwriter
6382 dnl ========================================================
6383 MOZ_ARG_DISABLE_BOOL(zipwriter,
6384 [  --disable-zipwriter             Disable zipwriter component],
6385     MOZ_ZIPWRITER=,
6386     MOZ_ZIPWRITER=1 )
6387 AC_SUBST(MOZ_ZIPWRITER)
6389 dnl ========================================================
6390 dnl = Disable libconic
6391 dnl ========================================================
6392 MOZ_ENABLE_LIBCONIC=1
6393 MOZ_ARG_DISABLE_BOOL(libconic,
6394 [  --disable-libconic              Disable libconic],
6395     MOZ_ENABLE_LIBCONIC=,
6396     MOZ_ENABLE_LIBCONIC=1 )
6398 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6399     PKG_CHECK_MODULES(LIBCONIC, conic,
6400                       MOZ_ENABLE_LIBCONIC=1,
6401                       MOZ_ENABLE_LIBCONIC=)
6403 if test "$MOZ_ENABLE_LIBCONIC"; then
6404     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6407 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6408 AC_SUBST(LIBCONIC_CFLAGS)
6409 AC_SUBST(LIBCONIC_LIBS)
6411 dnl ========================================================
6412 dnl = Maemo checks
6413 dnl ========================================================
6415 MAEMO_SDK_TARGET_VER=-1
6417 MOZ_ARG_WITH_STRING(maemo-version,
6418 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6419                         Maemo SDK Version],
6420   MAEMO_SDK_TARGET_VER=$withval)
6422 case "$MAEMO_SDK_TARGET_VER" in
6424     MOZ_PLATFORM_MAEMO=5
6425     ;;
6428     MOZ_PLATFORM_MAEMO=6
6429     ;;
6432     dnl We aren't compiling for Maemo, move on.
6433     ;;
6435     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6436     ;;
6437 esac
6439 if test $MOZ_PLATFORM_MAEMO; then
6440    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6442    if test -z "$MOZ_ENABLE_DBUS"; then
6443        AC_MSG_ERROR([DBus is required when building for Maemo])
6444    fi
6445    
6446    MOZ_GFX_OPTIMIZE_MOBILE=1
6447    MOZ_WEBGL_GLX=
6449    if test $MOZ_PLATFORM_MAEMO = 5; then
6450       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6451       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6452                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6453       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6454                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6456       AC_SUBST(XCOMPOSITE_LIBS)
6458       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6459       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6460       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6461       if test -z "$_LIB_FOUND"; then
6462          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6463       fi
6466       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6467       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6468       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6469       if test -z "$_LIB_FOUND"; then
6470          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6471       fi
6473       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6474       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6475       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6476       if test -z "$_LIB_FOUND"; then
6477          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6478       fi
6479    fi
6481    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6482    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6485 dnl ========================================================
6486 dnl = faststripe theme
6487 dnl ========================================================
6488 MOZ_ARG_ENABLE_BOOL(faststripe,
6489 [  --enable-faststripe  Use faststripe theme],
6490     MOZ_THEME_FASTSTRIPE=1,
6491     MOZ_THEME_FASTSTRIPE= )
6492 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6494 dnl ========================================================
6495 dnl =
6496 dnl = Feature options that require extra sources to be pulled
6497 dnl =
6498 dnl ========================================================
6499 dnl MOZ_ARG_HEADER(Features that require extra sources)
6501 dnl ========================================================
6502 dnl =
6503 dnl = Debugging Options
6504 dnl = 
6505 dnl ========================================================
6506 MOZ_ARG_HEADER(Debugging and Optimizations)
6508 dnl ========================================================
6509 dnl = Disable building with debug info.
6510 dnl = Debugging is OFF by default
6511 dnl ========================================================
6512 if test -z "$MOZ_DEBUG_FLAGS"
6513 then
6514     case "$target" in
6515     *-irix*)
6516         if test "$GNU_CC"; then
6517             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6518             case "$GCC_VERSION" in
6519             2.95.*)
6520                 MOZ_DEBUG_FLAGS=""
6521                 ;;
6522             *)
6523                 MOZ_DEBUG_FLAGS="-g"
6524                 ;;
6525             esac
6526         else
6527             MOZ_DEBUG_FLAGS="-g"
6528         fi
6529         ;;
6530     *)
6531         MOZ_DEBUG_FLAGS="-g"
6532         ;;
6533     esac
6536 MOZ_ARG_ENABLE_STRING(debug,
6537 [  --enable-debug[=DBG]    Enable building with developer debug info
6538                           (Using compiler flags DBG)],
6539 [ if test "$enableval" != "no"; then
6540     MOZ_DEBUG=1
6541     if test -n "$enableval" && test "$enableval" != "yes"; then
6542         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6543     fi
6544   else
6545     MOZ_DEBUG=
6546   fi ],
6547   MOZ_DEBUG=)
6549 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6550  case "${target_os}" in
6551     beos*)
6552         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6553         ;;
6554     msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6555         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6556         ;;
6557     *) 
6558         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6559         ;;
6560   esac
6561 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6563 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6565 if test -n "$MOZ_DEBUG"; then
6566     AC_MSG_CHECKING([for valid debug flags])
6567     _SAVE_CFLAGS=$CFLAGS
6568     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6569     AC_TRY_COMPILE([#include <stdio.h>], 
6570         [printf("Hello World\n");],
6571         _results=yes,
6572         _results=no)
6573     AC_MSG_RESULT([$_results])
6574     if test "$_results" = "no"; then
6575         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6576     fi
6577     CFLAGS=$_SAVE_CFLAGS
6580 dnl ========================================================
6581 dnl enable mobile optimizations
6582 dnl ========================================================
6583 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6584 [  --enable-mobile-optimize   Enable mobile optimizations],
6585     MOZ_GFX_OPTIMIZE_MOBILE=1)
6587 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6589 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6590     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6593 dnl ========================================================
6594 dnl = Enable code optimization. ON by default.
6595 dnl ========================================================
6596 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6597         MOZ_OPTIMIZE_FLAGS="-O"
6600 MOZ_ARG_ENABLE_STRING(optimize,
6601 [  --disable-optimize      Disable compiler optimization
6602   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6603 [ if test "$enableval" != "no"; then
6604     MOZ_OPTIMIZE=1
6605     if test -n "$enableval" && test "$enableval" != "yes"; then
6606         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6607         MOZ_OPTIMIZE=2
6608     fi
6609 else
6610     MOZ_OPTIMIZE=
6611 fi ], MOZ_OPTIMIZE=1)
6613 if test "$COMPILE_ENVIRONMENT"; then
6614 if test -n "$MOZ_OPTIMIZE"; then
6615     AC_MSG_CHECKING([for valid optimization flags])
6616     _SAVE_CFLAGS=$CFLAGS
6617     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6618     AC_TRY_COMPILE([#include <stdio.h>], 
6619         [printf("Hello World\n");],
6620         _results=yes,
6621         _results=no)
6622     AC_MSG_RESULT([$_results])
6623     if test "$_results" = "no"; then
6624         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6625     fi
6626     CFLAGS=$_SAVE_CFLAGS
6628 fi # COMPILE_ENVIRONMENT
6630 AC_SUBST(MOZ_OPTIMIZE)
6631 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6632 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6633 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6635 dnl ========================================================
6636 dnl = Enable/disable debug for specific modules only
6637 dnl =   module names beginning with ^ will be disabled 
6638 dnl ========================================================
6639 MOZ_ARG_ENABLE_STRING(debug-modules,
6640 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6641 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6643 dnl ========================================================
6644 dnl = Enable/disable generation of debugger info for specific modules only
6645 dnl =    the special module name ALL_MODULES can be used to denote all modules
6646 dnl =    module names beginning with ^ will be disabled
6647 dnl ========================================================
6648 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6649 [  --enable-debugger-info-modules
6650                           Enable/disable debugger info for specific modules],
6651 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6652       dnl note that the list of module names is reversed as it is copied
6653       dnl this is important, as it will allow config.mk to interpret stuff like
6654       dnl "^ALL_MODULES xpcom" properly
6655       if test "$i" = "no"; then
6656         i="^ALL_MODULES"
6657       fi
6658       if test "$i" = "yes"; then
6659         i="ALL_MODULES"
6660       fi
6661       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6662     done ])
6664 dnl ========================================================
6665 dnl Disable runtime logging checks
6666 dnl ========================================================
6667 MOZ_ARG_DISABLE_BOOL(logging,
6668 [  --disable-logging       Disable logging facilities],
6669     NS_DISABLE_LOGGING=1,
6670     NS_DISABLE_LOGGING= )
6671 if test "$NS_DISABLE_LOGGING"; then
6672     AC_DEFINE(NS_DISABLE_LOGGING)
6673 else
6674     AC_DEFINE(MOZ_LOGGING)
6677 dnl ========================================================
6678 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6679 dnl ========================================================
6680 _ENABLE_LOGREFCNT=42
6681 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6682 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6683     _ENABLE_LOGREFCNT=1,
6684     _ENABLE_LOGREFCNT= )
6685 if test "$_ENABLE_LOGREFCNT" = "1"; then
6686     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6687 elif test -z "$_ENABLE_LOGREFCNT"; then
6688     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6691 dnl ========================================================
6692 dnl = Enable trace malloc
6693 dnl ========================================================
6694 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6695 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6696 [  --enable-trace-malloc   Enable malloc tracing],
6697     NS_TRACE_MALLOC=1,
6698     NS_TRACE_MALLOC= )
6699 if test "$NS_TRACE_MALLOC"; then
6700   # Please, Mr. Linker Man, don't take away our symbol names
6701   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6702   USE_ELF_DYNSTR_GC=
6703   AC_DEFINE(NS_TRACE_MALLOC)
6705 AC_SUBST(NS_TRACE_MALLOC)
6707 dnl ========================================================
6708 dnl = Enable jemalloc
6709 dnl ========================================================
6710 MOZ_ARG_ENABLE_BOOL(jemalloc,
6711 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6712     MOZ_MEMORY=1,
6713     MOZ_MEMORY=)
6715 if test "$NS_TRACE_MALLOC"; then
6716     MOZ_MEMORY=
6719 if test "$MOZ_MEMORY"; then
6721   dnl Don't try to run compiler tests on Windows  
6722   if test "$OS_ARCH" = "WINNT"; then
6723     if test -z "$HAVE_64BIT_OS"; then
6724       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6725     else
6726       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6727     fi
6728   else
6729     AC_CHECK_SIZEOF([int *], [4])
6730     case "${ac_cv_sizeof_int_p}" in
6731     4)
6732       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6733       ;;
6734     8)
6735       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6736       ;;
6737     *)
6738       AC_MSG_ERROR([Unexpected pointer size])
6739       ;;
6740     esac
6741   fi
6743   AC_DEFINE(MOZ_MEMORY)
6744   if test "x$MOZ_DEBUG" = "x1"; then
6745     AC_DEFINE(MOZ_MEMORY_DEBUG)
6746   fi
6747   dnl The generic feature tests that determine how to compute ncpus are long and
6748   dnl complicated.  Therefore, simply define special cpp variables for the
6749   dnl platforms we have special knowledge of.
6750   case "${target_os}" in
6751   darwin*)
6752     AC_DEFINE(MOZ_MEMORY_DARWIN)
6753     ;;
6754   *freebsd*)
6755     AC_DEFINE(MOZ_MEMORY_BSD)
6756     ;;
6757   *linux*)
6758     AC_DEFINE(MOZ_MEMORY_LINUX)
6759     ;;
6760   netbsd*)
6761     AC_DEFINE(MOZ_MEMORY_BSD)
6762     ;;
6763   solaris*)
6764     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6765     ;;
6766   msvc*|mks*|cygwin*|mingw*)
6767     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6768     dnl This is sort of awful. Will revisit if we add support for more versions
6769     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
6770         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
6771     fi
6772     if test -z "$WIN32_CRT_SRC_DIR"; then
6773       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6774         AC_MSG_ERROR([When building jemalloc, set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src, but VCINSTALLDIR is not set, so I can't autodetect it for you).])
6775       else
6776         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6777       fi
6778     fi
6779     dnl cpu check
6780     case "${target_cpu}" in
6781     i*86)
6782       _WIN32_CRT_CPU=intel
6783       ;;
6784     *)
6785       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6786       ;;
6787     esac
6789     if test ! -d "$WIN32_CRT_SRC_DIR"; then
6790       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
6791     fi
6792     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
6793     _objdir_win=`pwd -W`
6794     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$_WIN32_CRT_CPU"
6795     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
6796     dnl Also pass this to NSPR/NSS
6797     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
6798     export DLLFLAGS
6799     ;;
6800   *wince)
6801     AC_DEFINE(MOZ_MEMORY_WINCE)
6802     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6803     if test -z "$WINCE_WINDOWS_MOBILE"; then
6804       AC_DEFINE(MOZ_MEMORY_WINCE6)
6805     fi
6806     ;;
6807   *winmo)
6808     AC_DEFINE(MOZ_MEMORY_WINCE)
6809     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6810     ;;
6811   *)
6812     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6813     ;;
6814   esac
6816 AC_SUBST(MOZ_MEMORY)
6817 AC_SUBST(MOZ_MEMORY_LDFLAGS)
6818 AC_SUBST(WIN32_CRT_SRC_DIR)
6819 dnl Need to set this for make because NSS doesn't have configure
6820 AC_SUBST(DLLFLAGS)
6822 dnl ========================================================
6823 dnl = Use malloc wrapper lib
6824 dnl ========================================================
6825 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6826 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6827     _WRAP_MALLOC=1,
6828     _WRAP_MALLOC= )
6830 if test -n "$_WRAP_MALLOC"; then
6831     if test "$GNU_CC"; then
6832     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"
6833     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6834     fi
6837 dnl ========================================================
6838 dnl = Location of malloc wrapper lib
6839 dnl ========================================================
6840 MOZ_ARG_WITH_STRING(wrap-malloc,
6841 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6842     WRAP_MALLOC_LIB=$withval)
6844 dnl ========================================================
6845 dnl = Use TraceVis
6846 dnl ========================================================
6847 MOZ_ARG_ENABLE_BOOL(tracevis,
6848 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
6849     MOZ_TRACEVIS=1,
6850     MOZ_TRACEVIS= )
6851 if test -n "$MOZ_TRACEVIS"; then
6852     AC_DEFINE(MOZ_TRACEVIS)
6855 dnl ========================================================
6856 dnl = Use Valgrind
6857 dnl ========================================================
6858 MOZ_ARG_ENABLE_BOOL(valgrind,
6859 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
6860     MOZ_VALGRIND=1,
6861     MOZ_VALGRIND= )
6862 if test -n "$MOZ_VALGRIND"; then
6863     AC_CHECK_HEADER([valgrind/valgrind.h], [],
6864         AC_MSG_ERROR(
6865             [--enable-valgrind specified but Valgrind is not installed]))
6866     AC_DEFINE(MOZ_VALGRIND)
6869 dnl ========================================================
6870 dnl jprof
6871 dnl ========================================================
6872 MOZ_ARG_ENABLE_BOOL(jprof,
6873 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6874     MOZ_JPROF=1,
6875     MOZ_JPROF= )
6876 if test -n "$MOZ_JPROF"; then
6877     AC_DEFINE(MOZ_JPROF)
6880 dnl ========================================================
6881 dnl shark
6882 dnl ========================================================
6883 MOZ_ARG_ENABLE_BOOL(shark,
6884 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6885     MOZ_SHARK=1,
6886     MOZ_SHARK= )
6887 if test -n "$MOZ_SHARK"; then
6888     AC_DEFINE(MOZ_SHARK)
6891 dnl ========================================================
6892 dnl callgrind
6893 dnl ========================================================
6894 MOZ_ARG_ENABLE_BOOL(callgrind,
6895 [  --enable-callgrind      Enable callgrind profiling],
6896     MOZ_CALLGRIND=1,
6897     MOZ_CALLGRIND= )
6898 if test -n "$MOZ_CALLGRIND"; then
6899     AC_DEFINE(MOZ_CALLGRIND)
6902 dnl ========================================================
6903 dnl vtune
6904 dnl ========================================================
6905 MOZ_ARG_ENABLE_BOOL(vtune,
6906 [  --enable-vtune          Enable vtune profiling],
6907     MOZ_VTUNE=1,
6908     MOZ_VTUNE= )
6909 if test -n "$MOZ_VTUNE"; then
6910     AC_DEFINE(MOZ_VTUNE)
6913 dnl ========================================================
6914 dnl Zealous JavaScript GC
6915 dnl ========================================================
6916 MOZ_ARG_ENABLE_BOOL(gczeal,
6917 [  --enable-gczeal          Enable zealous JavaScript GCing],
6918     JS_GC_ZEAL=1,
6919     JS_GC_ZEAL= )
6920 if test -n "$JS_GC_ZEAL"; then
6921     AC_DEFINE(JS_GC_ZEAL)
6924 dnl ========================================================
6925 dnl = Enable static checking using gcc-dehydra
6926 dnl ========================================================
6928 MOZ_ARG_WITH_STRING(static-checking,
6929 [  --with-static-checking=path/to/gcc_dehydra.so
6930                             Enable static checking of code using GCC-dehydra],
6931     DEHYDRA_PATH=$withval,
6932     DEHYDRA_PATH= )
6934 if test -n "$DEHYDRA_PATH"; then
6935     if test ! -f "$DEHYDRA_PATH"; then
6936         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6937     fi
6938     AC_DEFINE(NS_STATIC_CHECKING)
6940 AC_SUBST(DEHYDRA_PATH)
6942 dnl ========================================================
6943 dnl = Enable stripping of libs & executables
6944 dnl ========================================================
6945 MOZ_ARG_ENABLE_BOOL(strip,
6946 [  --enable-strip          Enable stripping of libs & executables ],
6947     ENABLE_STRIP=1,
6948     ENABLE_STRIP= )
6950 dnl ========================================================
6951 dnl = Enable stripping of libs & executables when packaging
6952 dnl ========================================================
6953 MOZ_ARG_ENABLE_BOOL(install-strip,
6954 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6955     PKG_SKIP_STRIP= ,
6956     PKG_SKIP_STRIP=1)
6958 dnl ========================================================
6959 dnl = --enable-elf-dynstr-gc
6960 dnl ========================================================
6961 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6962 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6963     USE_ELF_DYNSTR_GC=1,
6964     USE_ELF_DYNSTR_GC= )
6966 dnl ========================================================
6967 dnl = 
6968 dnl = Profiling and Instrumenting
6969 dnl = 
6970 dnl ========================================================
6971 MOZ_ARG_HEADER(Profiling and Instrumenting)
6973 dnl ========================================================
6974 dnl = Enable timeline service, which provides lightweight
6975 dnl = instrumentation of mozilla for performance measurement.
6976 dnl = Timeline is off by default.
6977 dnl ========================================================
6978 MOZ_ARG_ENABLE_BOOL(timeline,
6979 [  --enable-timeline       Enable timeline services ],
6980     MOZ_TIMELINE=1,
6981     MOZ_TIMELINE= )
6982 if test -n "$MOZ_TIMELINE"; then
6983     AC_DEFINE(MOZ_TIMELINE)
6986 dnl ========================================================
6987 dnl Turn on reflow counting
6988 dnl ========================================================
6989 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6990 [  --enable-reflow-perf    Enable reflow performance tracing],
6991     MOZ_REFLOW_PERF=1,
6992     MOZ_REFLOW_PERF= )
6993 if test -n "$MOZ_REFLOW_PERF"; then
6994     AC_DEFINE(MOZ_REFLOW_PERF)
6997 dnl ========================================================
6998 dnl Enable code size metrics.
6999 dnl ========================================================
7000 MOZ_ARG_ENABLE_BOOL(codesighs,
7001 [  --enable-codesighs      Enable code size analysis tools],
7002     _ENABLE_CODESIGHS=1,
7003     _ENABLE_CODESIGHS= )
7004 if test -n "$_ENABLE_CODESIGHS"; then
7005     if test -d $srcdir/tools/codesighs; then 
7006         MOZ_MAPINFO=1
7007     else
7008         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7009     fi
7012 MOZ_ARG_ENABLE_BOOL(insure,
7013 [  --enable-insure         Enable insure++ instrumentation (linux only)],
7014     _ENABLE_INSURE=1,
7015     _ENABLE_INSURE= )
7016 if test -n "$_ENABLE_INSURE"; then
7017     MOZ_INSURE="insure"
7018     MOZ_INSURIFYING=1
7019     MOZ_INSURE_DIRS="."
7020     MOZ_INSURE_EXCLUDE_DIRS="config"
7023 MOZ_ARG_WITH_STRING(insure-dirs,
7024 [  --with-insure-dirs=DIRS
7025                           Dirs to instrument with insure ],
7026     MOZ_INSURE_DIRS=$withval )
7028 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
7029 [  --with-insure-exclude-dirs=DIRS
7030                           Dirs to not instrument with insure ],
7031     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
7033 dnl ========================================================
7034 dnl = Support for Quantify (Windows)
7035 dnl ========================================================
7036 MOZ_ARG_ENABLE_BOOL(quantify,
7037 [  --enable-quantify      Enable Quantify support (Windows only) ],
7038     MOZ_QUANTIFY=1,
7039     MOZ_QUANTIFY= )
7041 dnl ========================================================
7042 dnl = Support for demangling undefined symbols
7043 dnl ========================================================
7044 if test -z "$SKIP_LIBRARY_CHECKS"; then
7045     AC_LANG_SAVE
7046     AC_LANG_CPLUSPLUS
7047     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7048     AC_LANG_RESTORE
7051 # Demangle only for debug or trace-malloc builds
7052 MOZ_DEMANGLE_SYMBOLS=
7053 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7054     MOZ_DEMANGLE_SYMBOLS=1
7055     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7057 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7059 dnl ========================================================
7060 dnl = Support for gcc stack unwinding (from gcc 3.3)
7061 dnl ========================================================
7062 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7063     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7066 dnl ========================================================
7067 dnl =
7068 dnl = Misc. Options
7069 dnl = 
7070 dnl ========================================================
7071 MOZ_ARG_HEADER(Misc. Options)
7073 dnl ========================================================
7074 dnl update xterm title
7075 dnl ========================================================
7076 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7077 [  --enable-xterm-updates  Update XTERM titles with current command.],
7078     MOZ_UPDATE_XTERM=1,
7079     MOZ_UPDATE_XTERM= )
7081 dnl =========================================================
7082 dnl = Chrome format
7083 dnl =========================================================
7084 MOZ_ARG_ENABLE_STRING([chrome-format],
7085 [  --enable-chrome-format=jar|flat|both|symlink
7086                           Select FORMAT of chrome files (default=jar)],
7087     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7089 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7090     MOZ_CHROME_FILE_FORMAT=jar
7093 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7094     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7095     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7096     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
7097     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
7100 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7101    AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7103 dnl ========================================================
7104 dnl = Define default location for MOZILLA_FIVE_HOME
7105 dnl ========================================================
7106 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7107 [  --with-default-mozilla-five-home
7108                           Set the default value for MOZILLA_FIVE_HOME],
7109 [ val=`echo $withval`
7110   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7112 dnl ========================================================
7113 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7114 dnl ========================================================
7115 MOZ_ARG_WITH_STRING(user-appdir,
7116 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7117 [ val=`echo $withval`
7118 if echo "$val" | grep "\/" >/dev/null; then
7119     AC_MSG_ERROR("Homedir must be single relative path.")
7120 else 
7121     MOZ_USER_DIR="$val"
7122 fi])
7124 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7126 dnl ========================================================
7127 dnl = Doxygen configuration
7128 dnl ========================================================
7129 dnl Use commas to specify multiple dirs to this arg
7130 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7131 MOZ_ARG_WITH_STRING(doc-input-dirs,
7132 [  --with-doc-input-dirs=DIRS
7133                           Header/idl dirs to create docs from],
7134 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7135 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7137 dnl Use commas to specify multiple dirs to this arg
7138 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7139 MOZ_ARG_WITH_STRING(doc-include-dirs,
7140 [  --with-doc-include-dirs=DIRS  
7141                           Include dirs to preprocess doc headers],
7142 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7143 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7145 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7146 MOZ_ARG_WITH_STRING(doc-output-dir,
7147 [  --with-doc-output-dir=DIR
7148                           Dir to generate docs into],
7149 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7150 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7152 if test -z "$SKIP_COMPILER_CHECKS"; then
7153 dnl ========================================================
7154 dnl =
7155 dnl = Compiler Options
7156 dnl = 
7157 dnl ========================================================
7158 MOZ_ARG_HEADER(Compiler Options)
7160 dnl ========================================================
7161 dnl Check for gcc -pipe support
7162 dnl ========================================================
7163 AC_MSG_CHECKING([for gcc -pipe support])
7164 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7165     echo '#include <stdio.h>' > dummy-hello.c
7166     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7167     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7168     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7169     if test $? = 0; then
7170         _res_as_stdin="yes"
7171     else
7172         _res_as_stdin="no"
7173     fi
7174     if test "$_res_as_stdin" = "yes"; then
7175         _SAVE_CFLAGS=$CFLAGS
7176         CFLAGS="$CFLAGS -pipe"
7177         AC_TRY_COMPILE( [ #include <stdio.h> ],
7178             [printf("Hello World\n");],
7179             [_res_gcc_pipe="yes"],
7180             [_res_gcc_pipe="no"] )
7181         CFLAGS=$_SAVE_CFLAGS
7182     fi
7183     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7184         _res="yes";
7185         CFLAGS="$CFLAGS -pipe"
7186         CXXFLAGS="$CXXFLAGS -pipe"
7187     else
7188         _res="no"
7189     fi
7190     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7191     AC_MSG_RESULT([$_res])
7192 else
7193     AC_MSG_RESULT([no])
7196 dnl pass -Wno-long-long to the compiler
7197 MOZ_ARG_ENABLE_BOOL(long-long-warning,
7198 [  --enable-long-long-warning 
7199                           Warn about use of non-ANSI long long type],
7200     _IGNORE_LONG_LONG_WARNINGS=,
7201     _IGNORE_LONG_LONG_WARNINGS=1)
7203 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
7204      _SAVE_CFLAGS="$CFLAGS"
7205      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
7206      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
7207      AC_TRY_COMPILE([], [return(0);], 
7208         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7209           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7210           result="yes" ], result="no")
7211      AC_MSG_RESULT([$result])
7212      CFLAGS="$_SAVE_CFLAGS"
7215 dnl ========================================================
7216 dnl Profile guided optimization
7217 dnl ========================================================
7218 dnl Test for profiling options
7219 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7220 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7222 dnl Provide a switch to disable PGO even when called via profiledbuild.
7223 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7224 [  --disable-profile-guided-optimization
7225                            Don't build with PGO even if called via make profiledbuild],
7226 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7227 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7229 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7231 _SAVE_CFLAGS="$CFLAGS"
7232 CFLAGS="$CFLAGS -fprofile-generate"
7234 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7235 AC_TRY_COMPILE([], [return 0;],
7236                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7237                  result="yes" ], result="no")
7238 AC_MSG_RESULT([$result])
7240 if test $result = "yes"; then
7241   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7242   PROFILE_USE_CFLAGS="-fprofile-use"
7243   PROFILE_USE_LDFLAGS="-fprofile-use"
7244 else
7245   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7246   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7247   AC_TRY_COMPILE([], [return 0;],
7248                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7249                    result="yes" ], result="no")
7250   AC_MSG_RESULT([$result])
7251   if test $result = "yes"; then
7252     PROFILE_USE_CFLAGS="-fbranch-probabilities"
7253   fi
7254   # don't really care, this is an old GCC
7255   PROFILE_GEN_LDFLAGS=
7256   PROFILE_USE_LDFLAGS=
7259 CFLAGS="$_SAVE_CFLAGS"
7261 if test -n "$INTEL_CC"; then
7262   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7263   PROFILE_GEN_LDFLAGS=
7264   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7265   PROFILE_USE_LDFLAGS=
7268 dnl Sun Studio on Solaris
7269 if test "$SOLARIS_SUNPRO_CC"; then
7270   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7271   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7272   if test "$CPU_ARCH" != "sparc"; then
7273     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7274     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7275   else
7276     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7277     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7278   fi
7281 AC_SUBST(PROFILE_GEN_CFLAGS)
7282 AC_SUBST(PROFILE_GEN_LDFLAGS)
7283 AC_SUBST(PROFILE_USE_CFLAGS)
7284 AC_SUBST(PROFILE_USE_LDFLAGS)
7286 AC_LANG_CPLUSPLUS
7288 dnl ========================================================
7289 dnl Test for -pedantic bustage
7290 dnl ========================================================
7291 MOZ_ARG_DISABLE_BOOL(pedantic,
7292 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7293 _PEDANTIC= )
7294 if test "$_PEDANTIC"; then
7295     _SAVE_CXXFLAGS=$CXXFLAGS
7296     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7297     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7298     AC_TRY_COMPILE([$configure_static_assert_macros],
7299                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7300                    result="no", result="yes" )
7301     AC_MSG_RESULT([$result])
7302     CXXFLAGS="$_SAVE_CXXFLAGS"
7304     case "$result" in
7305     no)
7306         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7307         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7308         ;;
7309     yes)
7310         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7311         ;;
7312     esac
7315 dnl ========================================================
7316 dnl Test for correct temporary object destruction order
7317 dnl ========================================================
7318 dnl We want to make sure the compiler follows the C++ spec here as 
7319 dnl xpcom and the string classes depend on it (bug 235381).
7320 AC_MSG_CHECKING([for correct temporary object destruction order])
7321 AC_TRY_RUN([ class A {
7322              public:  A(int& x) : mValue(x) {}
7323                       ~A() { mValue--; }
7324                       operator char**() { return 0; }
7325              private:  int& mValue;
7326              };
7327              void func(char **arg) {}
7328              int m=2;
7329              void test() {
7330                   func(A(m));
7331                   if (m==1) m = 0;
7332              }
7333              int main() {
7334                  test();
7335                  return(m);
7336              }
7337              ],
7338      result="yes", result="no", result="maybe")
7339 AC_MSG_RESULT([$result])
7341 if test "$result" = "no"; then
7342     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7345 dnl ========================================================
7346 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7347 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7348 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7349 dnl ========================================================
7350 _SAVE_CXXFLAGS=$CXXFLAGS
7351 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7352 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7353     ac_nscap_nonconst_opeq_bug,
7354     [AC_TRY_COMPILE([
7355                       template <class T>
7356                       class Pointer
7357                         {
7358                         public:
7359                           T* myPtr;
7360                         };
7361                       
7362                       template <class T, class U>
7363                       int operator==(const Pointer<T>& rhs, U* lhs)
7364                         {
7365                           return rhs.myPtr == lhs;
7366                         }
7367                       
7368                       template <class T, class U>
7369                       int operator==(const Pointer<T>& rhs, const U* lhs)
7370                         {
7371                           return rhs.myPtr == lhs;
7372                         }
7373                     ],
7374                     [
7375                       Pointer<int> foo;
7376                       const int* bar;
7377                       return foo == bar;
7378                     ],
7379                     ac_nscap_nonconst_opeq_bug="no",
7380                     ac_nscap_nonconst_opeq_bug="yes")])
7381 CXXFLAGS="$_SAVE_CXXFLAGS"
7383 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7384     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7386 fi # SKIP_COMPILER_CHECKS
7388 dnl ========================================================
7389 dnl C++ rtti
7390 dnl Should be smarter and check that the compiler does indeed have rtti
7391 dnl ========================================================
7393 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7394 [  --enable-cpp-rtti       Enable C++ RTTI ],
7395 [ _MOZ_USE_RTTI=1 ],
7396 [ _MOZ_USE_RTTI= ])
7398 if test "$_MOZ_USE_RTTI"; then
7399    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7400 else
7401    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7404 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7406 dnl ========================================================
7407 dnl C++ exceptions (g++/egcs only - for now)
7408 dnl Should be smarter and check that the compiler does indeed have exceptions
7409 dnl ========================================================
7410 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7411 [  --enable-cpp-exceptions Enable C++ exceptions ],
7412 [ _MOZ_CPP_EXCEPTIONS=1 ],
7413 [ _MOZ_CPP_EXCEPTIONS= ])
7415 if test "$_MOZ_CPP_EXCEPTIONS"; then
7416     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7417 else
7418     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7421 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7423 # Irix & OSF native compilers do not like exception declarations 
7424 # when exceptions are disabled
7425 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7426     AC_DEFINE(CPP_THROW_NEW, [])
7427 else
7428     AC_DEFINE(CPP_THROW_NEW, [throw()])
7430 AC_LANG_C
7432 dnl ========================================================
7433 dnl =
7434 dnl = Build depencency options
7435 dnl =
7436 dnl ========================================================
7437 MOZ_ARG_HEADER(Build dependencies)
7439 dnl ========================================================
7440 dnl = Do not auto generate dependency info
7441 dnl ========================================================
7442 MOZ_AUTO_DEPS=1
7443 MOZ_ARG_DISABLE_BOOL(auto-deps,
7444 [  --disable-auto-deps     Do not automatically generate dependency info],
7445     MOZ_AUTO_DEPS=,
7446     MOZ_AUTO_DEPS=1)
7448 if test -n "$MOZ_AUTO_DEPS"; then
7449 dnl ========================================================
7450 dnl = Use mkdepend instead of $CC -MD for dependency generation
7451 dnl ========================================================
7452 _cpp_md_flag=
7453 MOZ_ARG_DISABLE_BOOL(md,
7454 [  --disable-md            Do not use compiler-based dependencies ],
7455   [_cpp_md_flag=],
7456   [_cpp_md_flag=1],
7457   [dnl Default is to turn on -MD if using GNU-compatible compilers
7458    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7459      _cpp_md_flag=1
7460    fi
7461   dnl Default is to use -xM if using Sun Studio on Solaris
7462    if test "$SOLARIS_SUNPRO_CC"; then
7463      _cpp_md_flag=1
7464    fi])
7465 if test "$_cpp_md_flag"; then
7466   COMPILER_DEPEND=1
7467   if test "$OS_ARCH" = "OpenVMS"; then
7468     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7469   else
7470     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7471   fi
7472   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7473   if test "$SOLARIS_SUNPRO_CC"; then
7474     _DEPEND_CFLAGS=
7475   fi
7476 else
7477   COMPILER_DEPEND=
7478   dnl Don't override this for MSVC
7479   if test -z "$_WIN32_MSVC"; then
7480     _USE_CPP_INCLUDE_FLAG=
7481     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7482     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7483   fi
7485 fi # MOZ_AUTO_DEPS
7486 MDDEPDIR='.deps'
7487 AC_SUBST(MOZ_AUTO_DEPS)
7488 AC_SUBST(COMPILER_DEPEND)
7489 AC_SUBST(MDDEPDIR)
7492 dnl ========================================================
7493 dnl =
7494 dnl = Static Build Options
7495 dnl =
7496 dnl ========================================================
7497 MOZ_ARG_HEADER(Static build options)
7499 MOZ_ARG_ENABLE_BOOL(static,
7500 [  --enable-static         Enable building of internal static libs],
7501     BUILD_STATIC_LIBS=1,
7502     BUILD_STATIC_LIBS=)
7504 MOZ_ARG_ENABLE_BOOL(libxul,
7505 [  --enable-libxul         Enable building of libxul],
7506     MOZ_ENABLE_LIBXUL=1,
7507     MOZ_ENABLE_LIBXUL=)
7509 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7510         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7513 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7514         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7517 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
7518     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
7521 AC_SUBST(LIBXUL_LIBS)
7523 if test -n "$MOZ_ENABLE_LIBXUL"; then
7524     XPCOM_LIBS="$LIBXUL_LIBS"
7525     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7526 else
7527     if test -n "$BUILD_STATIC_LIBS"; then
7528         AC_DEFINE(MOZ_STATIC_BUILD)
7529     fi
7530     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7533 dnl ========================================================
7534 dnl =
7535 dnl = Standalone module options
7536 dnl = 
7537 dnl ========================================================
7538 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7540 dnl Check for GLib and libIDL.
7541 dnl ========================================================
7542 case "$target_os" in
7543 msvc*|mks*|cygwin*|mingw*|wince*|winmo*)
7544     SKIP_IDL_CHECK="yes"
7545     ;;
7547     SKIP_IDL_CHECK="no"
7548     ;;
7549 esac
7551 if test -z "$COMPILE_ENVIRONMENT"; then
7552     SKIP_IDL_CHECK="yes"
7555 dnl = Allow users to disable libIDL checking for standalone modules
7556 MOZ_ARG_WITHOUT_BOOL(libIDL,
7557 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7558         SKIP_IDL_CHECK="yes")
7560 if test "$SKIP_IDL_CHECK" = "no"
7561 then
7562     _LIBIDL_FOUND=
7563     if test "$MACOS_SDK_DIR"; then 
7564       dnl xpidl, and therefore libIDL, is only needed on the build host.
7565       dnl Don't build it against the SDK, as that causes problems.
7566       _MACSAVE_CFLAGS="$CFLAGS"
7567       _MACSAVE_LIBS="$LIBS"
7568       _MACSAVE_LDFLAGS="$LDFLAGS"
7569       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7570       changequote(,)
7571       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"`
7572       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7573       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7574       changequote([,])
7575       unset NEXT_ROOT
7576     fi
7578     if test "$MOZ_ENABLE_GTK2"; then
7579         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7580     fi
7581     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7582     dnl to either libIDL1 or libIDL2.
7583     if test -z "$_LIBIDL_FOUND"; then
7584         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7585         if test -z "$_LIBIDL_FOUND"; then
7586             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7587         fi
7588     fi
7589     dnl
7590     dnl If we don't have a libIDL config program & not cross-compiling, 
7591     dnl     look for orbit-config instead.
7592     dnl
7593     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7594         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7595         if test -n "$ORBIT_CONFIG"; then
7596             AC_MSG_CHECKING([for ORBit libIDL usability])
7597                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7598             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7599             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7600             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7601             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7602             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7603             LIBIDL_CONFIG=
7604             _SAVE_CFLAGS="$CFLAGS"
7605             _SAVE_LIBS="$LIBS"
7606             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7607             LIBS="$LIBIDL_LIBS $LIBS"
7608             AC_TRY_RUN([
7609 #include <stdlib.h>
7610 #include <libIDL/IDL.h>
7611 int main() {
7612   char *s;
7613   s=strdup(IDL_get_libver_string());
7614   if(s==NULL) {
7615     exit(1);
7616   }
7617   exit(0);
7619             ], [_LIBIDL_FOUND=1
7620                 result="yes"],
7621                [LIBIDL_CFLAGS=
7622                 LIBIDL_LIBS=
7623                 result="no"],
7624                [_LIBIDL_FOUND=1
7625                 result="maybe"] )
7626             AC_MSG_RESULT($result)
7627             CFLAGS="$_SAVE_CFLAGS"
7628             LIBS="$_SAVE_LIBS"
7629         fi
7630     fi
7631     if test -z "$_LIBIDL_FOUND"; then
7632         AC_MSG_ERROR([libIDL not found.
7633         libIDL $LIBIDL_VERSION or higher is required.])
7634     fi
7635     if test "$MACOS_SDK_DIR"; then
7636       CFLAGS="$_MACSAVE_CFLAGS"
7637       LIBS="$_MACSAVE_LIBS"
7638       LDFLAGS="$_MACSAVE_LDFLAGS"
7639       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7640         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7641       fi
7642     fi
7645 if test -n "$CROSS_COMPILE"; then
7646      if test -z "$HOST_LIBIDL_CONFIG"; then
7647         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7648     fi
7649     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7650         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7651         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7652     else
7653         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7654         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7655     fi
7658 if test -z "$SKIP_PATH_CHECKS"; then
7659 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7660     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7661         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7662     else
7663         AM_PATH_GLIB(${GLIB_VERSION})
7664     fi
7668 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7669     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7672 AC_SUBST(LIBIDL_CFLAGS)
7673 AC_SUBST(LIBIDL_LIBS)
7674 AC_SUBST(STATIC_LIBIDL)
7675 AC_SUBST(GLIB_CFLAGS)
7676 AC_SUBST(GLIB_LIBS)
7677 AC_SUBST(GLIB_GMODULE_LIBS)
7678 AC_SUBST(HOST_LIBIDL_CONFIG)
7679 AC_SUBST(HOST_LIBIDL_CFLAGS)
7680 AC_SUBST(HOST_LIBIDL_LIBS)
7682 dnl ========================================================
7683 dnl Check for cairo
7684 dnl ========================================================
7685 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7687 MOZ_TREE_CAIRO=1
7688 MOZ_ARG_ENABLE_BOOL(system-cairo,
7689 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7690 MOZ_TREE_CAIRO=,
7691 MOZ_TREE_CAIRO=1 )
7693 # Check for headers defining standard int types.
7694 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7696 if test "$MOZ_TREE_CAIRO"; then
7697     AC_DEFINE(MOZ_TREE_CAIRO)
7699     # For now we assume that we will have a uint64_t available through
7700     # one of the above headers or mozstdint.h.
7701     AC_DEFINE(HAVE_UINT64_T)
7703     # Define macros for cairo-features.h
7704     if test "$MOZ_X11"; then
7705         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7706         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7707         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7708         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7709         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7710         MOZ_ENABLE_CAIRO_FT=1
7711         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7712     fi
7713     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7714         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7715     fi
7716     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7717         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7718         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7719         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7720     fi
7721     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7722         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7723         if test -z "$WINCE"; then
7724             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7725             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7726                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7727                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7728                 MOZ_ENABLE_D2D_SURFACE=1
7729                 MOZ_ENABLE_DWRITE_FONT=1
7730             else
7731                 WIN32_DWRITE_FONT_FEATURE=
7732                 WIN32_D2D_SURFACE_FEATURE=
7733             fi
7734         else
7735             WIN32_FONT_FEATURE=
7736             WIN32_DWRITE_FONT_FEATURE=
7737             WIN32_D2D_SURFACE_FEATURE=
7738         fi
7740         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
7741         if test -z "$HAS_DDRAW"; then
7742             AC_MSG_WARN([DirectDraw ddraw.h header not found or it's missing DDLOCK_WAITNOTBUSY, disabling DirectDraw surface.  If you have an older SDK (such as the CE5 SDK), try copying in ddraw.lib and ddraw.h from the WM6 SDK.])
7743             DDRAW_SURFACE_FEATURE=
7744         else
7745             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
7746         fi
7748         if test -z "$OGLES_SDK_DIR"; then
7749             OGLES_SURFACE_FEATURE=
7750         else
7751             AC_TRY_COMPILE([
7752               #include <EGL/egl.h>
7753               #include <EGL/eglext.h>
7754               #include <GLES2/gl2.h>
7755               #include <GLES2/gl2ext.h>
7756             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
7757             if test -z "$HAS_OGLES"; then
7758               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
7759               OGLES_SURFACE_FEATURE=
7760             else
7761               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
7762             fi
7763         fi
7765         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7766     fi
7767     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7768         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7769         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7770         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7771         MOZ_ENABLE_CAIRO_FT=1
7772         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7773         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7774     fi
7775     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7776         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7777         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7778         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7779         MOZ_ENABLE_CAIRO_FT=1
7780     fi
7781     if test "$USE_FC_FREETYPE"; then
7782         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7783     fi
7784     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7785     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
7786     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
7787     AC_SUBST(CAIRO_FT_CFLAGS)
7788     AC_SUBST(HAS_OGLES)
7790     if test "$MOZ_DEBUG"; then
7791       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7792     else
7793       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7794     fi
7796     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7798     AC_SUBST(PS_SURFACE_FEATURE)
7799     AC_SUBST(PDF_SURFACE_FEATURE)
7800     AC_SUBST(SVG_SURFACE_FEATURE)
7801     AC_SUBST(XLIB_SURFACE_FEATURE)
7802     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7803     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7804     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7805     AC_SUBST(XCB_SURFACE_FEATURE)
7806     AC_SUBST(WIN32_SURFACE_FEATURE)
7807     AC_SUBST(DDRAW_SURFACE_FEATURE)
7808     AC_SUBST(OGLES_SURFACE_FEATURE)    
7809     AC_SUBST(OS2_SURFACE_FEATURE)
7810     AC_SUBST(BEOS_SURFACE_FEATURE)
7811     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7812     AC_SUBST(FT_FONT_FEATURE)
7813     AC_SUBST(FC_FONT_FEATURE)
7814     AC_SUBST(WIN32_FONT_FEATURE)
7815     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
7816     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
7817     AC_SUBST(QUARTZ_FONT_FEATURE)
7818     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7819     AC_SUBST(QT_SURFACE_FEATURE)
7821     if test "$_WIN32_MSVC"; then
7822         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7823     else
7824         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"
7826         if test "$MOZ_X11"; then
7827             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7828         fi
7829     fi
7831     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7832     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7834 else
7835    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
7836    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7837    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7838    if test "$MOZ_X11"; then
7839         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7840         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7841         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7842    fi
7845 AC_SUBST(MOZ_TREE_CAIRO)
7846 AC_SUBST(MOZ_CAIRO_CFLAGS)
7847 AC_SUBST(MOZ_CAIRO_LIBS)
7849 dnl qcms
7850 dnl ========================================================
7852 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7853 AC_SUBST(QCMS_LIBS)
7855 dnl ========================================================
7856 dnl disable xul
7857 dnl ========================================================
7858 MOZ_ARG_DISABLE_BOOL(xul,
7859 [  --disable-xul           Disable XUL],
7860     MOZ_XUL= )
7861 if test "$MOZ_XUL"; then
7862   AC_DEFINE(MOZ_XUL)
7863 else
7864   dnl remove extensions that require XUL
7865   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7868 AC_SUBST(MOZ_XUL)
7870 dnl ========================================================
7871 dnl disable profile locking
7872 dnl   do no use this in applications that can have more than
7873 dnl   one process accessing the profile directory.
7874 dnl ========================================================
7875 MOZ_ARG_DISABLE_BOOL(profilelocking,
7876 [  --disable-profilelocking           Disable profile locking],
7877     MOZ_PROFILELOCKING=,
7878     MOZ_PROFILELOCKING=1 )
7879 if test "$MOZ_PROFILELOCKING"; then
7880   AC_DEFINE(MOZ_PROFILELOCKING)
7883 dnl ========================================================
7884 dnl disable rdf services
7885 dnl ========================================================
7886 MOZ_ARG_DISABLE_BOOL(rdf,
7887 [  --disable-rdf           Disable RDF],
7888     MOZ_RDF= )
7889 if test "$MOZ_RDF"; then
7890   AC_DEFINE(MOZ_RDF)
7893 AC_SUBST(MOZ_RDF)
7895 dnl ========================================================
7896 dnl necko configuration options
7897 dnl ========================================================
7900 dnl option to disable various necko protocols
7902 MOZ_ARG_ENABLE_STRING(necko-protocols,
7903 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7904                           Enable/disable specific protocol handlers],
7905 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7906     if test "$option" = "yes" || test "$option" = "all"; then
7907         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7908     elif test "$option" = "no" || test "$option" = "none"; then
7909         NECKO_PROTOCOLS=""
7910     elif test "$option" = "default"; then
7911         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7912     elif test `echo "$option" | grep -c \^-` != 0; then
7913         option=`echo $option | sed 's/^-//'`
7914         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7915     else
7916         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7917     fi
7918 done],
7919     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7920 dnl Remove dupes
7921 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7922 AC_SUBST(NECKO_PROTOCOLS)
7923 for p in $NECKO_PROTOCOLS; do
7924     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7925 done
7928 dnl option to disable necko's disk cache
7930 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7931 [  --disable-necko-disk-cache
7932                           Disable necko disk cache],
7933     NECKO_DISK_CACHE=,
7934     NECKO_DISK_CACHE=1)
7935 AC_SUBST(NECKO_DISK_CACHE)
7936 if test "$NECKO_DISK_CACHE"; then
7937     AC_DEFINE(NECKO_DISK_CACHE)
7941 dnl option to disable necko's wifi scanner
7943 MOZ_ARG_DISABLE_BOOL(necko-wifi,
7944 [  --disable-necko-wifi   Disable necko wifi scanner],
7945     NECKO_WIFI=,
7946     NECKO_WIFI=1
7949 if test "$OS_ARCH" = "OS2"; then
7950   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
7951   NECKO_WIFI=
7953 if test "$NECKO_WIFI" -a \
7954         "$OS_ARCH" != "Linux" -a \
7955         "$OS_ARCH" != "Darwin" -a \
7956         "$OS_ARCH" != "WINNT" -a \
7957         "$OS_ARCH" != "WINCE"; then
7958   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
7961 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
7962 then
7963   AC_CHECK_HEADER([iwlib.h])
7964   if test "$ac_cv_header_iwlib_h" != "yes"; then
7965     AC_MSG_ERROR([Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora)); use --disable-necko-wifi to disable])
7966   fi
7969 if test "$NECKO_WIFI"; then
7970   AC_DEFINE(NECKO_WIFI)
7972 AC_SUBST(NECKO_WIFI)
7975 dnl option to minimize size of necko's i/o buffers
7977 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7978 [  --enable-necko-small-buffers
7979                           Minimize size of necko's i/o buffers],
7980     NECKO_SMALL_BUFFERS=1,
7981     NECKO_SMALL_BUFFERS=)
7982 AC_SUBST(NECKO_SMALL_BUFFERS)
7983 if test "$NECKO_SMALL_BUFFERS"; then
7984     AC_DEFINE(NECKO_SMALL_BUFFERS)
7985 fi 
7988 dnl option to disable cookies
7990 MOZ_ARG_DISABLE_BOOL(cookies,
7991 [  --disable-cookies       Disable cookie support],
7992     NECKO_COOKIES=,
7993     NECKO_COOKIES=1)
7994 AC_SUBST(NECKO_COOKIES)
7995 if test "$NECKO_COOKIES"; then
7996     AC_DEFINE(NECKO_COOKIES)
8000 dnl Build jsctypes on the platforms we can.
8002 AC_SUBST(BUILD_CTYPES)
8003 if test "$OS_ARCH" != "WINCE" -o `echo $OS_TEST | grep -ic arm` != 1; then
8004   BUILD_CTYPES=1
8005   AC_DEFINE(BUILD_CTYPES)
8008 dnl NECKO_ configuration options are not global
8009 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8011 dnl Only build Mork if it's required
8012 AC_SUBST(MOZ_MORK)
8013 if test "$MOZ_MORK"; then
8014   AC_DEFINE(MOZ_MORK)
8017 dnl Build the lightweight Mork reader if required
8018 AC_SUBST(MOZ_MORKREADER)
8019 if test "$MOZ_MORKREADER"; then
8020   AC_DEFINE(MOZ_MORKREADER)
8023 dnl ========================================================
8024 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8025     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8028 dnl ========================================================
8029 dnl =
8030 dnl = Maintainer debug option (no --enable equivalent)
8031 dnl =
8032 dnl ========================================================
8034 AC_SUBST(AR)
8035 AC_SUBST(AR_FLAGS)
8036 AC_SUBST(AR_LIST)
8037 AC_SUBST(AR_EXTRACT)
8038 AC_SUBST(AR_DELETE)
8039 AC_SUBST(AS)
8040 AC_SUBST(ASFLAGS)
8041 AC_SUBST(AS_DASH_C_FLAG)
8042 AC_SUBST(LD)
8043 AC_SUBST(RC)
8044 AC_SUBST(RCFLAGS)
8045 AC_SUBST(WINDRES)
8046 AC_SUBST(IMPLIB)
8047 AC_SUBST(FILTER)
8048 AC_SUBST(BIN_FLAGS)
8049 AC_SUBST(NS_USE_NATIVE)
8050 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8051 AC_SUBST(MOZ_UPDATE_XTERM)
8052 AC_SUBST(MINIMO)
8053 AC_SUBST(MOZ_PLATFORM_MAEMO)
8054 AC_SUBST(MOZ_AUTH_EXTENSION)
8055 AC_SUBST(MOZ_MATHML)
8056 AC_SUBST(MOZ_PERMISSIONS)
8057 AC_SUBST(MOZ_XTF)
8058 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8059 AC_SUBST(MOZ_PREF_EXTENSIONS)
8060 AC_SUBST(MOZ_SVG)
8061 AC_SUBST(MOZ_SMIL)
8062 AC_SUBST(MOZ_XSLT_STANDALONE)
8063 AC_SUBST(MOZ_JS_LIBS)
8064 AC_SUBST(MOZ_PSM)
8065 AC_SUBST(MOZ_DEBUG)
8066 AC_SUBST(MOZ_DEBUG_MODULES)
8067 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8068 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8069 AC_SUBST(MOZ_DEBUG_FLAGS)
8070 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8071 AC_SUBST(WARNINGS_AS_ERRORS)
8072 AC_SUBST(MOZ_DBGRINFO_MODULES)
8073 AC_SUBST(MOZ_EXTENSIONS)
8074 AC_SUBST(MOZ_IMG_DECODERS)
8075 AC_SUBST(MOZ_IMG_ENCODERS)
8076 AC_SUBST(MOZ_JSDEBUGGER)
8077 AC_SUBST(MOZ_PLUGINS)
8078 AC_SUBST(MOZ_LOG_REFCNT)
8079 AC_SUBST(MOZ_LEAKY)
8080 AC_SUBST(MOZ_JPROF)
8081 AC_SUBST(MOZ_SHARK)
8082 AC_SUBST(MOZ_CALLGRIND)
8083 AC_SUBST(MOZ_VTUNE)
8084 AC_SUBST(MOZ_XPCTOOLS)
8085 AC_SUBST(MOZ_JSLOADER)
8086 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8087 AC_SUBST(MOZ_INSURE)
8088 AC_SUBST(MOZ_INSURE_DIRS)
8089 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
8090 AC_SUBST(MOZ_QUANTIFY)
8091 AC_SUBST(MOZ_INSURIFYING)
8092 AC_SUBST(LIBICONV)
8093 AC_SUBST(MOZ_PLACES)
8094 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8095 AC_SUBST(MOZ_STORAGE)
8096 AC_SUBST(MOZ_FEEDS)
8097 AC_SUBST(NS_PRINTING)
8098 AC_SUBST(MOZ_WEBGL)
8100 AC_SUBST(MOZ_JAVAXPCOM)
8101 AC_SUBST(JAVA_INCLUDE_PATH)
8102 AC_SUBST(JAVA)
8103 AC_SUBST(JAVAC)
8104 AC_SUBST(JAR)
8106 AC_SUBST(MOZ_PROFILELOCKING)
8108 AC_SUBST(HAVE_XIE)
8109 AC_SUBST(MOZ_XIE_LIBS)
8110 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8112 AC_SUBST(BUILD_STATIC_LIBS)
8113 AC_SUBST(MOZ_ENABLE_LIBXUL)
8114 AC_SUBST(ENABLE_TESTS)
8115 AC_SUBST(IBMBIDI)
8116 AC_SUBST(MOZ_UNIVERSALCHARDET)
8117 AC_SUBST(ACCESSIBILITY)
8118 AC_SUBST(MOZ_XPINSTALL)
8119 AC_SUBST(MOZ_VIEW_SOURCE)
8120 AC_SUBST(MOZ_SPELLCHECK)
8121 AC_SUBST(MOZ_XPFE_COMPONENTS)
8122 AC_SUBST(MOZ_USER_DIR)
8123 AC_SUBST(MOZ_CRASHREPORTER)
8125 AC_SUBST(ENABLE_STRIP)
8126 AC_SUBST(PKG_SKIP_STRIP)
8127 AC_SUBST(USE_ELF_DYNSTR_GC)
8128 AC_SUBST(INCREMENTAL_LINKER)
8129 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8130 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8132 AC_SUBST(MOZ_FIX_LINK_PATHS)
8133 AC_SUBST(XPCOM_LIBS)
8134 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8135 AC_SUBST(XPCOM_GLUE_LDOPTS)
8136 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8138 AC_SUBST(USE_DEPENDENT_LIBS)
8140 AC_SUBST(MOZ_BUILD_ROOT)
8141 AC_SUBST(MOZ_OS2_TOOLS)
8142 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8144 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8145 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8146 AC_SUBST(MOZ_TIMELINE)
8147 AC_SUBST(OGLES_SDK_DIR)
8149 AC_SUBST(MOZ_APP_NAME)
8150 AC_SUBST(MOZ_APP_DISPLAYNAME)
8151 AC_SUBST(MOZ_APP_VERSION)
8152 AC_SUBST(MOZ_APP_UA_EXTRA)
8153 AC_SUBST(FIREFOX_VERSION)
8155 AC_SUBST(MOZ_PKG_SPECIAL)
8157 AC_SUBST(MOZILLA_OFFICIAL)
8159 dnl win32 options
8160 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8161 AC_SUBST(MOZ_MAPINFO)
8162 AC_SUBST(MOZ_BROWSE_INFO)
8163 AC_SUBST(MOZ_TOOLS_DIR)
8164 AC_SUBST(CYGWIN_WRAPPER)
8165 AC_SUBST(AS_PERL)
8166 AC_SUBST(WIN32_REDIST_DIR)
8167 AC_SUBST(PYTHON)
8169 AC_SUBST(WINCE)
8170 AC_SUBST(WINCE_SDK_DIR)
8171 AC_SUBST(WINCE_WINDOWS_MOBILE)
8173 dnl Echo the CFLAGS to remove extra whitespace.
8174 CFLAGS=`echo \
8175         $_WARNINGS_CFLAGS \
8176         $CFLAGS`
8178 CXXFLAGS=`echo \
8179         $_MOZ_RTTI_FLAGS \
8180         $_MOZ_EXCEPTIONS_FLAGS \
8181         $_WARNINGS_CXXFLAGS \
8182         $CXXFLAGS`
8184 COMPILE_CFLAGS=`echo \
8185     $_DEFINES_CFLAGS \
8186         $_DEPEND_CFLAGS \
8187     $COMPILE_CFLAGS`
8189 COMPILE_CXXFLAGS=`echo \
8190     $_DEFINES_CXXFLAGS \
8191         $_DEPEND_CFLAGS \
8192     $COMPILE_CXXFLAGS`
8194 AC_SUBST(SYSTEM_MAKEDEPEND)
8195 AC_SUBST(SYSTEM_LIBXUL)
8196 AC_SUBST(SYSTEM_JPEG)
8197 AC_SUBST(SYSTEM_PNG)
8198 AC_SUBST(SYSTEM_ZLIB)
8199 AC_SUBST(SYSTEM_BZ2)
8201 AC_SUBST(JPEG_CFLAGS)
8202 AC_SUBST(JPEG_LIBS)
8203 AC_SUBST(ZLIB_CFLAGS)
8204 AC_SUBST(ZLIB_LIBS)
8205 AC_SUBST(BZ2_CFLAGS)
8206 AC_SUBST(BZ2_LIBS)
8207 AC_SUBST(PNG_CFLAGS)
8208 AC_SUBST(PNG_LIBS)
8210 AC_SUBST(MOZ_JPEG_CFLAGS)
8211 AC_SUBST(MOZ_JPEG_LIBS)
8212 AC_SUBST(MOZ_ZLIB_CFLAGS)
8213 AC_SUBST(MOZ_ZLIB_LIBS)
8214 AC_SUBST(MOZ_BZ2_CFLAGS)
8215 AC_SUBST(MOZ_BZ2_LIBS)
8216 AC_SUBST(MOZ_PNG_CFLAGS)
8217 AC_SUBST(MOZ_PNG_LIBS)
8219 AC_SUBST(NSPR_CFLAGS)
8220 AC_SUBST(NSPR_LIBS)
8221 AC_SUBST(MOZ_NATIVE_NSPR)
8223 AC_SUBST(NSS_CFLAGS)
8224 AC_SUBST(NSS_LIBS)
8225 AC_SUBST(NSS_DEP_LIBS)
8226 AC_SUBST(MOZ_NATIVE_NSS)
8227 AC_SUBST(NSS_DISABLE_DBM)
8229 AC_SUBST(CFLAGS)
8230 AC_SUBST(CXXFLAGS)
8231 AC_SUBST(CPPFLAGS)
8232 AC_SUBST(COMPILE_CFLAGS)
8233 AC_SUBST(COMPILE_CXXFLAGS)
8234 AC_SUBST(LDFLAGS)
8235 AC_SUBST(LIBS)
8236 AC_SUBST(CROSS_COMPILE)
8237 AC_SUBST(WCHAR_CFLAGS)
8239 AC_SUBST(HOST_CC)
8240 AC_SUBST(HOST_CXX)
8241 AC_SUBST(HOST_CFLAGS)
8242 AC_SUBST(HOST_CXXFLAGS)
8243 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8244 AC_SUBST(HOST_AR)
8245 AC_SUBST(HOST_AR_FLAGS)
8246 AC_SUBST(HOST_LD)
8247 AC_SUBST(HOST_RANLIB)
8248 AC_SUBST(HOST_NSPR_MDCPUCFG)
8249 AC_SUBST(HOST_BIN_SUFFIX)
8250 AC_SUBST(HOST_OS_ARCH)
8252 AC_SUBST(TARGET_CPU)
8253 AC_SUBST(TARGET_VENDOR)
8254 AC_SUBST(TARGET_OS)
8255 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8256 AC_SUBST(TARGET_MD_ARCH)
8257 AC_SUBST(TARGET_XPCOM_ABI)
8258 AC_SUBST(OS_TARGET)
8259 AC_SUBST(OS_ARCH)
8260 AC_SUBST(OS_RELEASE)
8261 AC_SUBST(OS_TEST)
8263 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8264 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8266 AC_SUBST(WRAP_MALLOC_CFLAGS)
8267 AC_SUBST(WRAP_MALLOC_LIB)
8268 AC_SUBST(MKSHLIB)
8269 AC_SUBST(MKCSHLIB)
8270 AC_SUBST(MKSHLIB_FORCE_ALL)
8271 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8272 AC_SUBST(DSO_CFLAGS)
8273 AC_SUBST(DSO_PIC_CFLAGS)
8274 AC_SUBST(DSO_LDOPTS)
8275 AC_SUBST(LIB_PREFIX)
8276 AC_SUBST(DLL_PREFIX)
8277 AC_SUBST(DLL_SUFFIX)
8278 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8279 AC_SUBST(LIB_SUFFIX)
8280 AC_SUBST(OBJ_SUFFIX)
8281 AC_SUBST(BIN_SUFFIX)
8282 AC_SUBST(ASM_SUFFIX)
8283 AC_SUBST(IMPORT_LIB_SUFFIX)
8284 AC_SUBST(USE_N32)
8285 AC_SUBST(CC_VERSION)
8286 AC_SUBST(CXX_VERSION)
8287 AC_SUBST(MSMANIFEST_TOOL)
8288 AC_SUBST(NS_ENABLE_TSF)
8289 AC_SUBST(MOZ_NSS_PATCH)
8291 if test "$USING_HCC"; then
8292    CC='${topsrcdir}/build/hcc'
8293    CC="$CC '$_OLDCC'"
8294    CXX='${topsrcdir}/build/hcpp'
8295    CXX="$CXX '$_OLDCXX'"
8296    AC_SUBST(CC)
8297    AC_SUBST(CXX)
8300 dnl Check for missing components
8301 if test "$COMPILE_ENVIRONMENT"; then
8302 if test "$MOZ_X11"; then
8303     dnl ====================================================
8304     dnl = Check if X headers exist
8305     dnl ====================================================
8306     _SAVE_CFLAGS=$CFLAGS
8307     CFLAGS="$CFLAGS $XCFLAGS"
8308     AC_TRY_COMPILE([
8309         #include <stdio.h>
8310         #include <stdlib.h>
8311         #include <X11/Xlib.h>
8312         #include <X11/Intrinsic.h>
8313     ],
8314     [
8315         Display *dpy = 0;
8316         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8317             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8318             exit(1);
8319         }
8320     ], [], 
8321     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8322     CFLAGS="$_SAVE_CFLAGS"
8324     if test ! -z "$MISSING_X"; then
8325         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8326     fi
8328 fi # MOZ_X11
8330 dnl Check for headers, etc. needed by WebGL.
8331 if test -n "$MOZ_WEBGL_GLX"; then
8332     AC_CHECK_HEADER(GL/glx.h)
8333     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8334         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8335     fi
8336 fi # MOZ_WEBGL_GLX
8337 fi # COMPILE_ENVIRONMENT
8339 if test "$USE_FC_FREETYPE"; then
8340     if test "$COMPILE_ENVIRONMENT"; then
8341         _SAVE_CPPFLAGS="$CPPFLAGS"
8342         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8343         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
8344             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8345         CPPFLAGS="$_SAVE_CPPFLAGS"
8346     else
8347         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8348     fi
8351 dnl Set various defines and substitutions
8352 dnl ========================================================
8354 if test "$OS_ARCH" = "BeOS"; then
8355   AC_DEFINE(XP_BEOS)
8356   MOZ_MOVEMAIL=1
8357 elif test "$OS_ARCH" = "Darwin"; then
8358   AC_DEFINE(XP_UNIX)
8359   AC_DEFINE(UNIX_ASYNC_DNS)
8360   MOZ_MOVEMAIL=1
8361 elif test "$OS_ARCH" = "OpenVMS"; then
8362   AC_DEFINE(XP_UNIX)
8363 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8364   AC_DEFINE(XP_UNIX)
8365   AC_DEFINE(UNIX_ASYNC_DNS)
8366   MOZ_MOVEMAIL=1
8368 AC_SUBST(MOZ_MOVEMAIL)
8370 if test "$MOZ_DEBUG"; then
8371     AC_DEFINE(MOZ_REFLOW_PERF)
8372     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8375 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8376     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8377     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8378     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8379     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8380     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8381     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8382     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8383     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8386 dnl ========================================================
8387 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8388 dnl ========================================================
8389 case "$host_os" in
8390 mingw*)
8391     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8392     ;;
8393 cygwin*|msvc*|mks*)
8394     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8395     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8396     CC="\$(CYGWIN_WRAPPER) $CC"
8397     CXX="\$(CYGWIN_WRAPPER) $CXX"
8398     CPP="\$(CYGWIN_WRAPPER) $CPP"
8399     LD="\$(CYGWIN_WRAPPER) $LD"
8400     AS="\$(CYGWIN_WRAPPER) $AS"
8401     RC="\$(CYGWIN_WRAPPER) $RC"
8402     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8403     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8404     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8405     ;;
8406 esac
8408 AC_SUBST(CYGDRIVE_MOUNT)
8409 AC_SUBST(WIN_TOP_SRC)
8411 AC_SUBST(MOZILLA_VERSION)
8413 AC_SUBST(ac_configure_args)
8415 dnl Spit out some output
8416 dnl ========================================================
8418 dnl The following defines are used by xpcom
8419 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8420 CPP_THROW_NEW
8421 HAVE_CPP_2BYTE_WCHAR_T
8422 HAVE_CPP_ACCESS_CHANGING_USING
8423 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8424 HAVE_CPP_BOOL
8425 HAVE_CPP_CHAR16_T
8426 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8427 HAVE_CPP_EXPLICIT
8428 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8429 HAVE_CPP_NAMESPACE_STD
8430 HAVE_CPP_NEW_CASTS
8431 HAVE_CPP_PARTIAL_SPECIALIZATION
8432 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8433 HAVE_CPP_TYPENAME
8434 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8435 HAVE_STATVFS
8436 NEED_CPP_UNUSED_IMPLEMENTATIONS
8437 NEW_H
8438 HAVE_GETPAGESIZE
8439 HAVE_ICONV
8440 HAVE_ICONV_WITH_CONST_INPUT
8441 HAVE_MBRTOWC
8442 HAVE_SYS_MOUNT_H
8443 HAVE_SYS_VFS_H
8444 HAVE_WCRTOMB
8447 AC_CONFIG_HEADER(
8448 netwerk/necko-config.h
8449 xpcom/xpcom-config.h
8450 xpcom/xpcom-private.h
8453 # Save the defines header file before autoconf removes it.
8454 # (Do not add AC_DEFINE calls after this line.)
8455   _CONFIG_TMP=confdefs-tmp.h
8456   _CONFIG_DEFS_H=mozilla-config.h
8458   cat > $_CONFIG_TMP <<\EOF
8459 /* List of defines generated by configure. Included with preprocessor flag,
8460  * -include, to avoid long list of -D defines on the compile command-line.
8461  * Do not edit.
8462  */
8464 #ifndef _MOZILLA_CONFIG_H_
8465 #define _MOZILLA_CONFIG_H_
8468 _EGREP_PATTERN='^#define ('
8469 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8470     for f in $_NON_GLOBAL_ACDEFINES; do
8471         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8472     done
8474 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8476   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8478   cat >> $_CONFIG_TMP <<\EOF
8480 #endif /* _MOZILLA_CONFIG_H_ */
8484   # Only write mozilla-config.h when something changes (or it doesn't exist)
8485   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8486     rm $_CONFIG_TMP
8487   else
8488     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8489     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8491     echo ==== $_CONFIG_DEFS_H =================================
8492     cat $_CONFIG_DEFS_H
8493   fi
8495 dnl Probably shouldn't call this manually but we always want the output of DEFS
8496 rm -f confdefs.h.save
8497 mv confdefs.h confdefs.h.save
8498 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8499 AC_OUTPUT_MAKE_DEFS()
8500 MOZ_DEFINES=$DEFS
8501 AC_SUBST(MOZ_DEFINES)
8502 rm -f confdefs.h
8503 mv confdefs.h.save confdefs.h
8505 dnl Load the list of Makefiles to generate.
8506 dnl   To add new Makefiles, edit allmakefiles.sh.
8507 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8508 . ${srcdir}/allmakefiles.sh
8509 dnl 
8510 dnl Run a perl script to quickly create the makefiles.
8511 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8512 dnl   for the files it cannot handle correctly. This way, config.status
8513 dnl   will handle these files.
8514 dnl If it fails, nothing is set and config.status will run as usual.
8516 dnl This does not change the $MAKEFILES variable.
8518 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8520 if test -z "${AS_PERL}"; then
8521 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8522 else
8523 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8525 . ./conftest.sh
8526 rm conftest.sh
8528 echo $MAKEFILES > unallmakefiles
8530 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8532 AC_OUTPUT($MAKEFILES)
8534 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8535 if test "$CAIRO_FEATURES_H"; then
8536   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8537     echo "$CAIRO_FEATURES_H is unchanged"
8538     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8539   else
8540     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8541   fi
8544 dnl ========================================================
8545 dnl = Setup a nice relatively clean build environment for
8546 dnl = sub-configures.
8547 dnl ========================================================
8548 CC="$_SUBDIR_CC" 
8549 CXX="$_SUBDIR_CXX" 
8550 CFLAGS="$_SUBDIR_CFLAGS" 
8551 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8552 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8553 LDFLAGS="$_SUBDIR_LDFLAGS"
8554 HOST_CC="$_SUBDIR_HOST_CC" 
8555 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8556 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8559 unset MAKEFILES
8560 unset CONFIG_FILES
8562 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8563 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8565 if test -z "$MOZ_NATIVE_NSPR"; then
8566     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8567     if test -z "$MOZ_DEBUG"; then
8568         ac_configure_args="$ac_configure_args --disable-debug"
8569     fi
8570     if test "$MOZ_OPTIMIZE" = "1"; then
8571         ac_configure_args="$ac_configure_args --enable-optimize"
8572     fi
8573     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8574        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8575     fi
8576     if test -n "$HAVE_64BIT_OS"; then
8577         ac_configure_args="$ac_configure_args --enable-64bit"
8578     fi
8579     if test -n "$USE_ARM_KUSER"; then
8580         ac_configure_args="$ac_configure_args --with-arm-kuser"
8581     fi
8582     AC_OUTPUT_SUBDIRS(nsprpub)
8583     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8586 if test -z "$MOZ_NATIVE_NSPR"; then
8587     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8588     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8589     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8590        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8591        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8592        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8593        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8594     fi
8595     rm -f config/autoconf.mk.bak
8598 # Run the SpiderMonkey 'configure' script.
8599 dist=$MOZ_BUILD_ROOT/dist
8600 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8601 ac_configure_args="$ac_configure_args --enable-threadsafe"
8602 if test -z "$MOZ_NATIVE_NSPR"; then
8603     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8604     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8606 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8607 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8608 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8609 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8610 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8611 if test "$MOZ_MEMORY"; then
8612    ac_configure_args="$ac_configure_args --enable-jemalloc"
8613    if test -n "$MOZ_MEMORY_LDFLAGS"; then
8614      export MOZ_MEMORY_LDFLAGS
8615    fi
8617 AC_OUTPUT_SUBDIRS(js/src)
8618 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8620 # Build jsctypes on the platforms we can.
8621 if test "$BUILD_CTYPES"; then
8622   # Run the libffi 'configure' script on platforms that it supports.
8623   if test -z "$_MSC_VER"; then
8624     ac_configure_args="--disable-shared --enable-static --disable-raw-api"
8625     if test "$MOZ_DEBUG"; then
8626       ac_configure_args="$ac_configure_args --enable-debug"
8627     fi
8628     if test -n "$DSO_PIC_CFLAGS"; then
8629       ac_configure_args="$ac_configure_args --with-pic"
8630     fi
8631     if test -n "$CROSS_COMPILE"; then
8632       ac_configure_args="$ac_configure_args --build=$build --host=$target"
8633     fi
8634     if test "$SOLARIS_SUNPRO_CC"; then
8635       # Always use gcc for libffi on Solaris
8636       old_cache_file=$cache_file
8637       cache_file=js/ctypes/libffi/config.cache
8638       ac_configure_args="$ac_configure_args CC=gcc"
8639       AC_OUTPUT_SUBDIRS(js/ctypes/libffi)
8640       cache_file=$old_cache_file
8641     else
8642       AC_OUTPUT_SUBDIRS(js/ctypes/libffi)
8643     fi
8644     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8645   fi
8648 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8650 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8651 dnl Needs to be at the end to respect possible changes from NSPR configure
8652 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8653   echo "config/autoconf.mk is unchanged"
8654   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8655 else
8656   rm -f config/autoconf.mk.orig 2> /dev/null