Bug 563259: Fix shark/dtrace enabled combo. (r=me)
[mozilla-central.git] / configure.in
blob3b40b2a57e1b7b809f5f4a0cebee122d1d73f1a5
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 GIO_VERSION=2.0
133 STARTUP_NOTIFICATION_VERSION=0.8
134 DBUS_VERSION=0.60
135 SQLITE_VERSION=3.6.23.1
136 LIBNOTIFY_VERSION=0.4
138 MSMANIFEST_TOOL=
140 dnl Set various checks
141 dnl ========================================================
142 MISSING_X=
143 AC_PROG_AWK
145 dnl Initialize the Pthread test variables early so they can be
146 dnl  overridden by each platform.
147 dnl ========================================================
148 USE_PTHREADS=
149 _PTHREAD_LDFLAGS=""
151 dnl Do not allow a separate objdir build if a srcdir build exists.
152 dnl ==============================================================
153 _topsrcdir=`cd \`dirname $0\`; pwd`
154 _objdir=`pwd`
156 if test "$_topsrcdir" != "$_objdir"
157 then
158   # Check for a couple representative files in the source tree
159   _conflict_files=
160   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
161     if test -f $file; then
162       _conflict_files="$_conflict_files $file"
163     fi
164   done
165   if test "$_conflict_files"; then
166     echo "***"
167     echo "*   Your source tree contains these files:"
168     for file in $_conflict_files; do
169       echo "*         $file"
170     done
171     cat 1>&2 <<-EOF
172         *   This indicates that you previously built in the source tree.
173         *   A source tree build can confuse the separate objdir build.
174         *
175         *   To clean up the source tree:
176         *     1. cd $_topsrcdir
177         *     2. gmake distclean
178         ***
179         EOF
180     exit 1
181     break
182   fi
184 MOZ_BUILD_ROOT=`pwd`
186 dnl Default to MSVC for win32 and gcc-4.2 for darwin
187 dnl ==============================================================
188 if test -z "$CROSS_COMPILE"; then
189 case "$target" in
190 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
191     if test -z "$CC"; then CC=cl; fi
192     if test -z "$CXX"; then CXX=cl; fi
193     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
194     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
195     if test -z "$LD"; then LD=link; fi
196     if test -z "$AS"; then
197         case "${target_cpu}" in
198         i*86)
199             AS=ml;
200             ;;
201         x86_64)
202             AS=ml64;
203             ;;
204         esac
205     fi
206     if test -z "$MIDL"; then MIDL=midl; fi
207     ;;
208 *-darwin*)
209     if test -z "$CC"; then CC=gcc-4.2; fi
210     if test -z "$CXX"; then CXX=g++-4.2; fi
211     ;;
212 esac
215 COMPILE_ENVIRONMENT=1
216 MOZ_ARG_DISABLE_BOOL(compile-environment,
217 [  --disable-compile-environment
218                            Disable compiler/library checks.],
219     COMPILE_ENVIRONMENT= )
220 AC_SUBST(COMPILE_ENVIRONMENT)
222 MOZ_ARG_WITH_STRING(l10n-base,
223 [  --with-l10n-base=DIR     path to l10n repositories],
224     L10NBASEDIR=$withval)
225 if test ! -z "$L10NBASEDIR"; then
226     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
227         AC_MSG_ERROR([--with-l10n-base must specify a path])
228     elif test -d "$L10NBASEDIR"; then
229         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
230     else
231         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
232     fi
234 AC_SUBST(L10NBASEDIR)
236 dnl Check for Perl first -- needed for win32 SDK checks
237 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
238 if test -z "$PERL" || test "$PERL" = ":"; then
239     AC_MSG_ERROR([perl not found in \$PATH])
242 dnl ========================================================
243 dnl Checks for compilers.
244 dnl ========================================================
245 dnl Set CROSS_COMPILE in the environment when running configure
246 dnl to use the cross-compile setup for now
247 dnl ========================================================
249 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
250 AR_FLAGS='cr $@'
252 if test "$COMPILE_ENVIRONMENT"; then
254 dnl Do some special WinCE toolchain stuff
255 case "$target" in
256 *wince|*winmo)
258     MOZ_ARG_WITH_STRING(wince-sdk,
259     [  --with-wince-sdk=WINCE_SDK_DIR
260                         The path to the Windows CE SDK],
261     WINCE_SDK_DIR=$withval)
263     MOZ_ARG_WITH_STRING(ogles-sdk,
264     [  --with-ogles-sdk=OGLES_SDK_DIR
265                         The path to the OGLES SDK],
266     OGLES_SDK_DIR=$withval)
268     AC_DEFINE(WINCE)
269     
270     export WINCE=1
272     echo -----------------------------------------------------------------------------
273     echo Building Windows CE Shunt Library and Tool Chain
274     echo Using SDK in:
275     echo $WINCE_SDK_DIR
277     ac_exeext=.exe
279     _pwd=`pwd -W`
280     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
281     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
282     TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
283     -C $srcdir/build/wince/tools
285     CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
286     CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
287     CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
288     CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
289     LD="$_pwd/dist/sdk/bin/$target-link.exe"
290     AR="$_pwd/dist/sdk/bin/$target-lib.exe"
291     AS="$_pwd/dist/sdk/bin/$target-as.exe"
292     RC="$_pwd/dist/sdk/bin/$target-res.exe"
295     echo -----------------------------------------------------------------------------
297     ;;
298 esac
300 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
301     echo "cross compiling from $host to $target"
302     cross_compiling=yes
304     _SAVE_CC="$CC"
305     _SAVE_CFLAGS="$CFLAGS"
306     _SAVE_LDFLAGS="$LDFLAGS"
308     AC_MSG_CHECKING([for host c compiler])
309     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
310     if test -z "$HOST_CC"; then
311         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
312     fi
313     AC_MSG_RESULT([$HOST_CC])
314     AC_MSG_CHECKING([for host c++ compiler])
315     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
316     if test -z "$HOST_CXX"; then
317         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
318     fi
319     AC_MSG_RESULT([$HOST_CXX])
321     if test -z "$HOST_CFLAGS"; then
322         HOST_CFLAGS="$CFLAGS"
323     fi
324     if test -z "$HOST_CXXFLAGS"; then
325         HOST_CXXFLAGS="$CXXFLAGS"
326     fi
327     if test -z "$HOST_LDFLAGS"; then
328         HOST_LDFLAGS="$LDFLAGS"
329     fi
330     if test -z "$HOST_AR_FLAGS"; then
331         HOST_AR_FLAGS="$AR_FLAGS"
332     fi
333     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
334     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
335     CC="$HOST_CC"
336     CFLAGS="$HOST_CFLAGS"
337     LDFLAGS="$HOST_LDFLAGS"
339     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
340     AC_TRY_COMPILE([], [return(0);], 
341         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
342         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
344     CC="$HOST_CXX"
345     CFLAGS="$HOST_CXXFLAGS"
347     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
348     AC_TRY_COMPILE([], [return(0);], 
349         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
350         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
351     
352     CC=$_SAVE_CC
353     CFLAGS=$_SAVE_CFLAGS
354     LDFLAGS=$_SAVE_LDFLAGS
356     case "$build:$target" in
357       powerpc-apple-darwin8*:i?86-apple-darwin*)
358         dnl The Darwin cross compiler doesn't necessarily point itself at a
359         dnl root that has libraries for the proper architecture, it defaults
360         dnl to the system root.  The libraries in the system root on current
361         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
362         dnl checks will fail.  Fake a working SDK in that case.
363         _SAVE_CFLAGS=$CFLAGS
364         _SAVE_CXXFLAGS=$CXXLAGS
365         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
366         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
367         ;;
368     esac
370     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
371     unset ac_cv_prog_CC
372     AC_PROG_CC
373     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
374     unset ac_cv_prog_CXX
375     AC_PROG_CXX
377     case "$build:$target" in
378       powerpc-apple-darwin8*:i?86-apple-darwin*)
379         dnl Revert the changes made above.  From this point on, the target
380         dnl compiler will never be used without applying the SDK to CFLAGS
381         dnl (see --with-macos-sdk below).
382         CFLAGS=$_SAVE_CFLAGS
383         CXXFLAGS=$_SAVE_CXXFLAGS
384         ;;
385     esac
387     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
388     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
389     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
390     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
391     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
392     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
393     AC_DEFINE(CROSS_COMPILE)
394 else
395     AC_PROG_CC
396     AC_PROG_CXX
397     AC_PROG_RANLIB
398     MOZ_PATH_PROGS(AS, $AS as, $CC)
399     AC_CHECK_PROGS(AR, ar, :)
400     AC_CHECK_PROGS(LD, ld, :)
401     AC_CHECK_PROGS(STRIP, strip, :)
402     AC_CHECK_PROGS(WINDRES, windres, :)
403     if test -z "$HOST_CC"; then
404         HOST_CC='$(CC)'
405     fi
406     if test -z "$HOST_CFLAGS"; then
407         HOST_CFLAGS='$(CFLAGS)'
408     fi
409     if test -z "$HOST_CXX"; then
410         HOST_CXX='$(CXX)'
411     fi
412     if test -z "$HOST_CXXFLAGS"; then
413         HOST_CXXFLAGS='$(CXXFLAGS)'
414     fi
415     if test -z "$HOST_LDFLAGS"; then
416         HOST_LDFLAGS='$(LDFLAGS)'
417     fi
418     if test -z "$HOST_RANLIB"; then
419         HOST_RANLIB='$(RANLIB)'
420     fi
421     if test -z "$HOST_AR"; then
422         HOST_AR='$(AR)'
423     fi
424     if test -z "$HOST_AR_FLAGS"; then
425         HOST_AR_FLAGS='$(AR_FLAGS)'
426     fi
429 GNU_AS=
430 GNU_LD=
431 GNU_CC=
432 GNU_CXX=
433 CC_VERSION='N/A'
434 CXX_VERSION='N/A'
435 if test "$GCC" = "yes"; then
436     GNU_CC=1
437     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
439 if test "$GXX" = "yes"; then
440     GNU_CXX=1
441     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
443 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
444     GNU_AS=1
446 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
447     GNU_LD=1
449 if test "$GNU_CC"; then
450     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
451         GCC_USE_GNU_LD=1
452     fi
455 INTEL_CC=
456 INTEL_CXX=
457 if test "$GCC" = yes; then
458    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
459      INTEL_CC=1
460    fi
463 if test "$GXX" = yes; then
464    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
465      INTEL_CXX=1
466    fi
469 dnl Special win32 checks
470 dnl ========================================================
471 case "$target" in
472 *-wince|*-winmo)
473     WINVER=500
474     WINSDK_TARGETVER=502
475     ;;
477     WINVER=502
478     dnl Target the Windows 7 SDK by default
479     WINSDK_TARGETVER=601
480     ;;
481 esac
484 MOZ_ARG_WITH_STRING(windows-version,
485 [  --with-windows-version=WINSDK_TARGETVER
486                           Highest Windows version to target using this SDK
487                               502: Windows Server 2003
488                               600: Windows Vista
489                               601: Windows 7],
490   WINSDK_TARGETVER=$withval)
492 case "$WINSDK_TARGETVER" in
493 502|600|601)
494     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
495     ;;
498     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
499     ;;
501 esac
503 dnl Vista SDK specific api (deprecated)
504 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
505 [  --disable-vista-sdk-requirements
506                            Do not build Vista SDK specific code],
507    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
508    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=$_PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
509 if test -n "$COMPILE_ENVIRONMENT"; then
510 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
511     AC_MSG_WARN([--disable-vista-sdk-requirements is deprecated, use --with-windows-version=502 instead])
512     MOZ_WINSDK_TARGETVER=05020000
515 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
516     MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
517     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
518     # We can't build parental controls either
519     MOZ_DISABLE_PARENTAL_CONTROLS=1
523 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
525 case "$target" in
526 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
527     if test "$GCC" != "yes"; then
528         # Check to see if we are really running in a msvc environemnt
529         _WIN32_MSVC=1
530         AC_CHECK_PROGS(MIDL, midl)
532         # Make sure compilers are valid
533         CFLAGS="$CFLAGS -TC -nologo"
534         CXXFLAGS="$CXXFLAGS -TP -nologo"
535         AC_LANG_SAVE
536         AC_LANG_C
537         AC_TRY_COMPILE([#include <stdio.h>],
538             [ printf("Hello World\n"); ],,
539             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
541         AC_LANG_CPLUSPLUS
542         AC_TRY_COMPILE([#include <new.h>],
543             [ unsigned *test = new unsigned(42); ],,
544             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
545         AC_LANG_RESTORE
546         
547         changequote(,)
548         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
549         changequote([,])
550         
551         # Determine compiler version
552         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
553         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
554         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
555         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
556         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
557         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
559         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
560         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
562         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
563             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
564         fi
565         if test "$_CC_MAJOR_VERSION" = "13"; then
566             _CC_SUITE=7
567         elif test "$_CC_MAJOR_VERSION" = "14"; then
568             _CC_SUITE=8
569             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
570             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
571             dnl so be very specific here!
572             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
573             if test $_CC_RELEASE -gt 50727; then
574                _USE_DYNAMICBASE=1
575             elif test $_CC_BUILD -ge 762; then
576                _USE_DYNAMICBASE=1
577             fi
578             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
579             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
580         elif test "$_CC_MAJOR_VERSION" = "15"; then
581             _CC_SUITE=9
582             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
583             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
584             _USE_DYNAMICBASE=1
585             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
586             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
587         elif test "$_CC_MAJOR_VERSION" = "16"; then
588             _CC_SUITE=10
589             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
590             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
591             _USE_DYNAMICBASE=1
592             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
593             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
594         else
595             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
596         fi
598         _MOZ_RTTI_FLAGS_ON='-GR'
599         _MOZ_RTTI_FLAGS_OFF='-GR-'
600         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
601         _MOZ_EXCEPTIONS_FLAGS_OFF=''
603         if test -n "$WIN32_REDIST_DIR"; then
604             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
605         fi
606         
607         # bug #249782
608         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
609         if test "$_CC_SUITE" -ge "8"; then
610                 changequote(,)
611                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
612                 changequote([,])
614                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
615                 if test -n "$MSMT_TOOL"; then
616                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
617                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
618                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
619                         fi
620                         MSMANIFEST_TOOL=1
621                         unset MSMT_TOOL
622                 else
623                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
624                 fi
625         fi
627         # Check linker version
628         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
629         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
630         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
631             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
632         fi
633         INCREMENTAL_LINKER=1
635         # Check midl version
636         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
637         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
638         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
639         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
640         # Add flags if necessary
641         AC_MSG_CHECKING([for midl flags])
642         case "$target" in
643         i*86-*)
644             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
645                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
646                 # MIDL version 7.00.0500 or later has no problem.
647                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
648                 AC_MSG_RESULT([need -env win32])
649             else
650                 AC_MSG_RESULT([none needed])
651             fi
652             ;;
653         x86_64-*)
654             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
655             ;;
656         *)
657             AC_MSG_RESULT([none needed])
658             ;;
659         esac
661         # Identify which version of the SDK we're building with
662         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
663         # from there
664         AC_CHECK_HEADERS([winsdkver.h])
665         if test "$ac_cv_header_winsdkver_h" = "yes"; then
666             # Get the highest _WIN32_WINNT and NTDDI versions supported
667             # Take the higher of the two
668             # This is done because the Windows 7 beta SDK reports its
669             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
670             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
671                            ac_cv_winsdk_maxver,
672                            [cat > conftest.h <<EOF
673 #include <winsdkver.h>
674 #include <sdkddkver.h>
676 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
677 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
678 #else
679 #define WINSDK_MAXVER NTDDI_MAXVER
680 #endif
682 WINSDK_MAXVER
684                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
685                             rm -f conftest.h
686                            ])
687             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
688         else
689             # The Vista SDK is the only one to have sdkddkver.h but not
690             # WinSDKVer.h
691             AC_CHECK_HEADERS([sdkddkver.h])
692             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
693                 MOZ_WINSDK_MAXVER=0x06000000
694             else
695                 # Assume the Server 2003 Platform SDK
696                 MOZ_WINSDK_MAXVER=0x05020000
697             fi
698         fi
700         unset _MSVC_VER_FILTER
702         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
703             [
704                 AC_LANG_SAVE
705                 AC_LANG_CPLUSPLUS
706                 _SAVE_CXXFLAGS="$CXXFLAGS"
707                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
708                 AC_TRY_COMPILE([#include <exception>],
709                             [std::_Throw(std::exception()); return 0;],
710                             ac_cv_have_std__Throw="yes",
711                             ac_cv_have_std__Throw="no")
712                 CXXFLAGS="$_SAVE_CXXFLAGS"
713                 AC_LANG_RESTORE
714             ])
716         if test "$ac_cv_have_std__Throw" = "no"; then
717           AC_MSG_ERROR([Your MSVC/SDK doesn't export std::_Throw.  This breaks assumptions in Gecko.  Please file a bug describing this error along with your build configuration.])
718         fi
720         AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
721                        ac_cv_have_dllimport_exception_bug,
722             [
723                 AC_LANG_SAVE
724                 AC_LANG_CPLUSPLUS
725                 _SAVE_CXXFLAGS="$CXXFLAGS"
726                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
727                 AC_TRY_LINK([#include <vector>],
728                             [std::vector<int> v; return v.at(1);],
729                             ac_cv_have_dllimport_exception_bug="no",
730                             ac_cv_have_dllimport_exception_bug="yes")
731                 CXXFLAGS="$_SAVE_CXXFLAGS"
732                 AC_LANG_RESTORE
733             ])
735         if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
736             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
737             WRAP_STL_INCLUDES=1
738         fi
739     else
740         # Check w32api version
741         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
742         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
743         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
744         AC_TRY_COMPILE([#include <w32api.h>],
745             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
746                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
747                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
748                 #error "test failed."
749             #endif
750             , [ res=yes ], [ res=no ])
751         AC_MSG_RESULT([$res])
752         if test "$res" != "yes"; then
753             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
754         fi
755         # Check windres version
756         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
757         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
758         AC_MSG_RESULT([$_WINDRES_VERSION])
759         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
760         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
761         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
762         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
763         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
764         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
765         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
766                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
767                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
768                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
769                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
770                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
771         then
772             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
773         fi
775         # Server 2003 is the highest version supported
776         MOZ_WINSDK_MAXVER=0x05020000
777     fi # !GNU_CC
779     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
780     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
781     # Require OS features provided by IE 5.0
782     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
784     # If the maximum version supported by this SDK is lower than the target
785     # version, error out
786     AC_MSG_CHECKING([for Windows SDK being recent enough])
787     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
788         AC_MSG_RESULT("yes")
789     else
790         AC_MSG_RESULT("no")
791         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.])
792     fi
794     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
795     # Definitions matching sdkddkver.h
796     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
797     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
798     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
799     ;;
800 esac
802 dnl Test breaks icc on OS/2 && MSVC
803 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
804     AC_PROG_CC_C_O
805     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
806         USING_HCC=1
807         _OLDCC=$CC
808         _OLDCXX=$CXX
809         CC="${srcdir}/build/hcc '$CC'"
810         CXX="${srcdir}/build/hcpp '$CXX'"
811     fi
814 AC_PROG_CPP
815 AC_PROG_CXXCPP
817 if test -n "$_WIN32_MSVC"; then
818     SKIP_PATH_CHECKS=1
819     SKIP_COMPILER_CHECKS=1
820     SKIP_LIBRARY_CHECKS=1
822     # Since we're skipping compiler and library checks, hard-code
823     # some facts here.
824     case "$target" in
825     *-wince|*-winmo)
826         ;;
827     *)
828         AC_DEFINE(HAVE_IO_H)
829         AC_DEFINE(HAVE_SETBUF)
830         AC_DEFINE(HAVE_ISATTY)
831         ;;
832     esac
835 fi # COMPILE_ENVIRONMENT
837 AC_SUBST(MIDL_FLAGS)
838 AC_SUBST(_MSC_VER)
840 AC_SUBST(GNU_AS)
841 AC_SUBST(GNU_LD)
842 AC_SUBST(GNU_CC)
843 AC_SUBST(GNU_CXX)
844 AC_SUBST(INTEL_CC)
845 AC_SUBST(INTEL_CXX)
847 AC_SUBST(STL_FLAGS)
848 AC_SUBST(WRAP_STL_INCLUDES)
850 dnl ========================================================
851 dnl Checks for programs.
852 dnl ========================================================
853 AC_PROG_INSTALL
854 AC_PROG_LN_S
856 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
857 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
858 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
859 _perl_res=$?
860 AC_MSG_RESULT([$_perl_version])
862 if test "$_perl_res" != 0; then
863     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
867 AC_MSG_CHECKING([for full perl installation])
868 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
869 _perl_res=$?
870 if test "$_perl_res" != 0; then
871     AC_MSG_RESULT([no])
872     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
873 else
874     AC_MSG_RESULT([yes])    
877 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.6 python2.5 python2.4 python)
878 if test -z "$PYTHON"; then
879     AC_MSG_ERROR([python was not found in \$PATH])
882 if test -z "$COMPILE_ENVIRONMENT"; then
883     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
885 AC_SUBST(NSINSTALL_BIN)
887 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
888 MOZ_PATH_PROG(WHOAMI, whoami, :)
889 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
890 MOZ_PATH_PROG(UNZIP, unzip, :)
891 MOZ_PATH_PROGS(ZIP, zip)
892 if test -z "$ZIP" || test "$ZIP" = ":"; then
893     AC_MSG_ERROR([zip not found in \$PATH])
895 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
896 MOZ_PATH_PROG(XARGS, xargs)
897 if test -z "$XARGS" || test "$XARGS" = ":"; then
898     AC_MSG_ERROR([xargs not found in \$PATH .])
901 if test "$COMPILE_ENVIRONMENT"; then
903 dnl ========================================================
904 dnl = Mac OS X toolchain support
905 dnl ========================================================
907 case "$target_os" in
908 darwin*)
909     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
910     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
911     dnl the environment and includedir purposes (when using an SDK, below),
912     dnl but remember the full version number for the libdir (SDK).
913     changequote(,)
914     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
915     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
916     changequote([,])
917     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
918         dnl Bug 280479, but this keeps popping up in bug 292530 too because
919         dnl 4.0.0/4061 is the default compiler in Tiger.
920         changequote(,)
921         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
922         changequote([,])
923         if test "$GCC_BUILD" = "4061" ; then
924             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
925 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
926 from building Mozilla. Upgrade to Xcode 2.1 or later.])
927         fi
928     fi
930     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
931     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
932     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
933     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
935     case "$PBBUILD" in
936       *xcodebuild*)
937         changequote(,)
938         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
939         changequote([,])
940         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
941           HAS_XCODE_2_1=1;
942         fi
943       ;;
944     esac
946     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
947     dnl it has moved into /usr/bin.
948     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
949     ;;
950 esac
952 AC_SUBST(GCC_VERSION)
953 AC_SUBST(XCODEBUILD_VERSION)
954 AC_SUBST(HAS_XCODE_2_1)
956 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
957 dnl that a universal binary is being produced.
958 AC_SUBST(UNIVERSAL_BINARY)
960 dnl ========================================================
961 dnl Check for MacOS deployment target version
962 dnl ========================================================
964 MOZ_ARG_ENABLE_STRING(macos-target,
965                       [  --enable-macos-target=VER (default=10.5)
966                           Set the minimum MacOS version needed at runtime],
967                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
969 case "$target" in
970 *-darwin*)
971     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
972         dnl Use the specified value
973         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
974         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
975     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
976         dnl No value specified on the command line or in the environment,
977         dnl use architecture minimum.
978         export MACOSX_DEPLOYMENT_TARGET=10.5
979     fi
980     ;;
981 esac
983 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
985 dnl ========================================================
986 dnl = Mac OS X SDK support
987 dnl ========================================================
988 MACOS_SDK_DIR=
989 NEXT_ROOT=
990 MOZ_ARG_WITH_STRING(macos-sdk,
991 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
992     MACOS_SDK_DIR=$withval)
994 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
995 dnl NEXT_ROOT will be set and exported only if it's needed.
996 AC_SUBST(MACOS_SDK_DIR)
997 AC_SUBST(NEXT_ROOT)
999 if test "$MACOS_SDK_DIR"; then
1000   dnl Sync this section with the ones in NSPR and NSS.
1001   dnl Changes to the cross environment here need to be accounted for in
1002   dnl the libIDL checks (below) and xpidl build.
1004   if test ! -d "$MACOS_SDK_DIR"; then
1005     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1006 specify a valid SDK.  SDKs are installed when the optional cross-development
1007 tools are selected during the Xcode/Developer Tools installation.])
1008   fi
1010   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1011   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1012     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1013   else
1014     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1015     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1017     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1018     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1019     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1021     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1022       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1023       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1024       dnl be ignored and cause warnings when -syslibroot is specified.
1025       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1026       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1027       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1028     fi
1029   fi
1031   AC_LANG_SAVE
1032   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1033   AC_LANG_CPLUSPLUS
1034   AC_TRY_COMPILE([#include <new>
1035                  int main() { return 0; }],
1036    result=yes,
1037    result=no)
1038   AC_LANG_RESTORE
1039   AC_MSG_RESULT($result)
1041   if test "$result" = "no" ; then
1042     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1043   fi
1046 fi # COMPILE_ENVIRONMENT
1048 if test -n "$MAKE"; then
1049   if test `echo $MAKE | grep -c make.py` != 1; then
1050      NOT_PYMAKE=$MAKE
1051   fi
1054 case "$host_os" in
1055 cygwin*|mingw*|mks*|msvc*)
1056     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1057     ;;
1059     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1060     ;;
1061 esac
1062 if test "$GMAKE" = ":"; then
1063    AC_MSG_ERROR([GNU make not found])
1065 AC_SUBST(GMAKE)
1067 if test "$COMPILE_ENVIRONMENT"; then
1069 AC_PATH_XTRA
1071 XCFLAGS="$X_CFLAGS"
1073 fi # COMPILE_ENVIRONMENT
1075 dnl ========================================================
1076 dnl set the defaults first
1077 dnl ========================================================
1078 AS_BIN=$AS
1079 AR_LIST='$(AR) t'
1080 AR_EXTRACT='$(AR) x'
1081 AR_DELETE='$(AR) d'
1082 AS='$(CC)'
1083 AS_DASH_C_FLAG='-c'
1084 DLL_PREFIX=lib
1085 LIB_PREFIX=lib
1086 DLL_SUFFIX=.so
1087 OBJ_SUFFIX=o
1088 LIB_SUFFIX=a
1089 ASM_SUFFIX=s
1090 IMPORT_LIB_SUFFIX=
1091 TARGET_MD_ARCH=unix
1092 DIRENT_INO=d_ino
1093 CYGWIN_WRAPPER=
1094 WIN_TOP_SRC=
1095 MOZ_USER_DIR=".mozilla"
1097 MOZ_JPEG_CFLAGS=
1098 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1099 MOZ_ZLIB_CFLAGS=
1100 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1101 MOZ_BZ2_CFLAGS=
1102 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1103 MOZ_PNG_CFLAGS=
1104 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1106 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1107 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1108 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1109 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1110 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1111 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1112 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1114 MOZ_FS_LAYOUT=unix
1116 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1118 USE_DEPENDENT_LIBS=1
1120 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1122 MOZ_ENABLE_POSTSCRIPT=1 
1124 if test -n "$CROSS_COMPILE"; then
1125     OS_TARGET="${target_os}"
1126     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1127     OS_RELEASE=
1128     case "${target_os}" in
1129         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1130         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1131         gnu*)         OS_ARCH=GNU ;;
1132         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1133         mingw*)       OS_ARCH=WINNT ;;
1134         wince*)       OS_ARCH=WINCE ;;
1135         winmo*)       OS_ARCH=WINCE ;;
1136         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1137     esac
1138 else
1139     OS_TARGET=`uname -s`
1140     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1141     OS_RELEASE=`uname -r`
1144 # Before this used `uname -m` when not cross compiling
1145 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1146 OS_TEST="${target_cpu}"
1148 _COMPILER_PREFIX=
1150 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1152 #######################################################################
1153 # Master "Core Components" macros for getting the OS target           #
1154 #######################################################################
1157 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1158 # cross-compilation.
1162 # Define and override various archtecture-specific variables, including
1163 # HOST_OS_ARCH
1164 # OS_ARCH
1165 # OS_TEST
1166 # OS_TARGET
1167 # OS_RELEASE
1168 # OS_MINOR_RELEASE
1171 case "$HOST_OS_ARCH" in
1172 cygwin*|mingw*|mks*|msvc*)
1173     HOST_OS_ARCH=WINNT
1174     ;;
1175 darwin*)
1176     HOST_OS_ARCH=Darwin
1177     ;;
1178 linux*)
1179     HOST_OS_ARCH=Linux
1180     ;;
1181 solaris*)
1182     HOST_OS_ARCH=SunOS
1183     SOLARIS_SUNPRO_CC=
1184     SOLARIS_SUNPRO_CXX=
1185     if test -z "$GNU_CC"; then
1186         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1187             SOLARIS_SUNPRO_CC=1
1188        fi
1189     fi
1191     if test -z "$GNU_CXX"; then
1192        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1193            SOLARIS_SUNPRO_CXX=1
1194        fi
1195     fi
1196     AC_SUBST(SOLARIS_SUNPRO_CC)
1197     AC_SUBST(SOLARIS_SUNPRO_CXX)
1198     ;;
1199 BSD_386)
1200     HOST_OS_ARCH=BSD
1201     ;;
1202 dgux)
1203     HOST_OS_ARCH=DGUX
1204     ;;
1205 IRIX64)
1206     HOST_OS_ARCH=IRIX
1207     ;;
1208 UNIX_SV)
1209     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1210         HOST_OS_ARCH=NCR
1211     else
1212         HOST_OS_ARCH=UNIXWARE
1213     fi
1214     ;;
1215 ncr)
1216     HOST_OS_ARCH=NCR
1217     ;;
1218 UNIX_SYSTEM_V)
1219     HOST_OS_ARCH=NEC
1220     ;;
1221 OSF1)
1222     ;;
1223 *OpenVMS*)
1224     HOST_OS_ARCH=OpenVMS
1225     ;;
1226 OS_2)
1227     HOST_OS_ARCH=OS2
1228     ;;
1229 QNX)
1230     ;;
1231 SCO_SV)
1232     HOST_OS_ARCH=SCOOS
1233     ;;
1234 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1235     HOST_OS_ARCH=SINIX
1236     ;;
1237 UnixWare)
1238     HOST_OS_ARCH=UNIXWARE
1239     ;;
1240 esac
1242 case "$OS_ARCH" in
1243 WINNT)
1244     if test -z "$CROSS_COMPILE" ; then
1245         OS_TEST=`uname -p`
1246     fi
1247     ;;
1248 Windows_NT)
1250 # If uname -s returns "Windows_NT", we assume that we are using
1251 # the uname.exe in MKS toolkit.
1253 # The -r option of MKS uname only returns the major version number.
1254 # So we need to use its -v option to get the minor version number.
1255 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1257     OS_ARCH=WINNT
1258     OS_TARGET=WINNT
1259     OS_MINOR_RELEASE=`uname -v`
1260     if test "$OS_MINOR_RELEASE" = "00"; then
1261         OS_MINOR_RELEASE=0
1262     fi
1263     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1264     ;;
1265 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1267 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1268 # the uname.exe in the Cygwin tools.
1269 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1270 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1271 # the uname.exe in the GNU-Win32 tools.
1272 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1273 # the uname.exe in the MSYS tools.
1275     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1276     OS_ARCH=WINNT
1277     OS_TARGET=WINNT
1278     ;;
1279 AIX)
1280     OS_RELEASE=`uname -v`.`uname -r`
1281     OS_TEST=${target_cpu}
1282     ;;
1283 BSD_386)
1284     OS_ARCH=BSD
1285     ;;
1286 dgux)
1287     OS_ARCH=DGUX
1288     ;;
1289 IRIX64)
1290     OS_ARCH=IRIX
1291     ;;
1292 UNIX_SV)
1293     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1294         OS_ARCH=NCR
1295     else
1296         OS_ARCH=UNIXWARE
1297         OS_RELEASE=`uname -v`
1298     fi
1299     ;;
1300 ncr)
1301     OS_ARCH=NCR
1302     ;;
1303 UNIX_SYSTEM_V)
1304     OS_ARCH=NEC
1305     ;;
1306 OSF1)
1307     case `uname -v` in
1308     148)
1309         OS_RELEASE=V3.2C
1310         ;;
1311     564)
1312         OS_RELEASE=V4.0B
1313         ;;
1314     878)
1315         OS_RELEASE=V4.0D
1316         ;;
1317     esac
1318     ;;
1319 *OpenVMS*)
1320     OS_ARCH=OpenVMS
1321     OS_RELEASE=`uname -v`
1322     OS_TEST=`uname -p`
1323     ;;
1324 OS_2)
1325     OS_ARCH=OS2
1326     OS_TARGET=OS2
1327     OS_RELEASE=`uname -v`
1328     ;;
1329 QNX)
1330     if test "$OS_TARGET" != "NTO"; then
1331         changequote(,)
1332         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1333         changequote([,])
1334     fi
1335     OS_TEST=x86
1336     ;;
1337 SCO_SV)
1338     OS_ARCH=SCOOS
1339     OS_RELEASE=5.0
1340     ;;
1341 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1342     OS_ARCH=SINIX
1343     OS_TEST=`uname -p`
1344     ;;
1345 UnixWare)
1346     OS_ARCH=UNIXWARE
1347     OS_RELEASE=`uname -v`
1348     ;;
1349 WINCE)
1350     OS_ARCH=WINCE
1351     case "${target_os}" in
1352     *winmo)
1353         OS_TARGET=WINMO
1354         WINCE_WINDOWS_MOBILE=1
1355         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1356         ;;
1357     *)
1358         OS_TARGET=WINCE
1359         ;;
1360     esac
1361     ;;
1362 Darwin)
1363     case "${target_cpu}" in
1364     powerpc*)
1365         OS_TEST=ppc
1366         ;;
1367     i*86*)
1368         OS_TEST=i386 
1369         ;;
1370     x86_64)
1371         OS_TEST=x86_64
1372         ;;
1373     *)
1374         if test -z "$CROSS_COMPILE" ; then
1375             OS_TEST=`uname -p`
1376         fi
1377         ;;
1378     esac
1379     ;;
1380 esac
1382 if test "$OS_ARCH" = "NCR"; then
1383     changequote(,)
1384     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1385     changequote([,])
1388 # Only set CPU_ARCH if we recognize the value of OS_TEST
1390 case "$OS_TEST" in
1391 *86 | i86pc)
1392     CPU_ARCH=x86
1393     ;;
1395 powerpc64 | ppc64)
1396     CPU_ARCH=ppc64
1397     ;;
1399 powerpc | ppc | rs6000)
1400     CPU_ARCH=ppc
1401     ;;
1403 Alpha | alpha | ALPHA)
1404     CPU_ARCH=Alpha
1405     ;;
1407 s390)
1408     CPU_ARCH=s390
1409     ;;
1411 s390x)
1412     CPU_ARCH=s390x
1413     ;;
1415 hppa* | parisc)
1416     CPU_ARCH=hppa
1417     ;;
1419 sun4u | sparc*)
1420     CPU_ARCH=sparc
1421     ;;
1423 x86_64 | ia64)
1424     CPU_ARCH="$OS_TEST"
1425     ;;
1427 arm)
1428     CPU_ARCH=arm
1429     ;;
1430 esac
1432 if test -z "$OS_TARGET"; then
1433     OS_TARGET=$OS_ARCH
1435 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1437 dnl ========================================================
1438 dnl GNU specific defaults
1439 dnl ========================================================
1440 if test "$GNU_CC"; then
1441     # FIXME: Let us build with strict aliasing. bug 414641.
1442     CFLAGS="$CFLAGS -fno-strict-aliasing"
1443     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1444     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1445     DSO_LDOPTS='-shared'
1446     if test "$GCC_USE_GNU_LD"; then
1447         # Don't allow undefined symbols in libraries
1448         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1449     fi
1450     WARNINGS_AS_ERRORS='-Werror'
1451     DSO_CFLAGS=''
1452     DSO_PIC_CFLAGS='-fPIC'
1453     ASFLAGS="$ASFLAGS -fPIC"
1454     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1455     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1456     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1457     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1459     # Turn on GNU specific features
1460     # -Wall - turn on all warnings
1461     # -pedantic - make compiler warn about non-ANSI stuff, and
1462     #             be a little bit stricter
1463     # Warnings slamm took out for now (these were giving more noise than help):
1464     # -Wbad-function-cast - warns when casting a function to a new return type
1465     # -Wshadow - removed because it generates more noise than help --pete
1466     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1467     if test -z "$INTEL_CC"; then
1468        # Don't use -Wcast-align with ICC
1469        case "$CPU_ARCH" in
1470            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1471            hppa | ia64 | sparc | arm)
1472            ;;
1473            *)
1474         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1475            ;;
1476        esac
1477     fi
1479     dnl Turn pedantic on but disable the warnings for long long
1480     _PEDANTIC=1
1482     if test -z "$INTEL_CC"; then
1483       _IGNORE_LONG_LONG_WARNINGS=1
1484       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1485     else
1486       _IGNORE_LONG_LONG_WARNINGS=
1487     fi
1490     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1491     _USE_CPP_INCLUDE_FLAG=1
1492 elif test "$SOLARIS_SUNPRO_CC"; then
1493     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1494     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1496     DSO_LDOPTS='-shared'
1497     if test "$GNU_LD"; then
1498         # Don't allow undefined symbols in libraries
1499         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1500     fi
1502     DSO_CFLAGS=''
1503     if test "$CPU_ARCH" = "sparc"; then
1504         # for Sun Studio on Solaris/SPARC
1505         DSO_PIC_CFLAGS='-xcode=pic32'
1506     else
1507         DSO_PIC_CFLAGS='-KPIC'
1508     fi
1509     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1510 else
1511     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1512     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1514     DSO_LDOPTS='-shared'
1515     if test "$GNU_LD"; then
1516         # Don't allow undefined symbols in libraries
1517         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1518     fi
1520     DSO_CFLAGS=''
1521     DSO_PIC_CFLAGS='-KPIC'
1522     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1525 if test "$GNU_CXX"; then
1526     # FIXME: Let us build with strict aliasing. bug 414641.
1527     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1528     # Turn on GNU specific features
1529     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1530     if test -z "$INTEL_CC"; then
1531        # Don't use -Wcast-align with ICC
1532        case "$CPU_ARCH" in
1533            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1534            hppa | ia64 | sparc | arm)
1535            ;;
1536            *)
1537         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1538            ;;
1539        esac
1540     fi
1542     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1543     _USE_CPP_INCLUDE_FLAG=1
1545     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1546                    ac_has_wno_invalid_offsetof,
1547         [
1548             AC_LANG_SAVE
1549             AC_LANG_CPLUSPLUS
1550             _SAVE_CXXFLAGS="$CXXFLAGS"
1551             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1552             AC_TRY_COMPILE([],
1553                            [return(0);],
1554                            ac_has_wno_invalid_offsetof="yes",
1555                            ac_has_wno_invalid_offsetof="no")
1556             CXXFLAGS="$_SAVE_CXXFLAGS"
1557             AC_LANG_RESTORE
1558         ])
1559     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1560         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1561     fi
1563     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1564                    ac_has_wno_variadic_macros,
1565         [
1566             AC_LANG_SAVE
1567             AC_LANG_CPLUSPLUS
1568             _SAVE_CXXFLAGS="$CXXFLAGS"
1569             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1570             AC_TRY_COMPILE([],
1571                            [return(0);],
1572                            ac_has_wno_variadic_macros="yes",
1573                            ac_has_wno_variadic_macros="no")
1574             CXXFLAGS="$_SAVE_CXXFLAGS"
1575             AC_LANG_RESTORE
1576         ])
1577     if test "$ac_has_wno_variadic_macros" = "yes"; then
1578         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1579     fi
1581     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1582                    ac_has_werror_return_type,
1583         [
1584             AC_LANG_SAVE
1585             AC_LANG_CPLUSPLUS
1586             _SAVE_CXXFLAGS="$CXXFLAGS"
1587             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1588             AC_TRY_COMPILE([],
1589                            [return(0);],
1590                            ac_has_werror_return_type="yes",
1591                            ac_has_werror_return_type="no")
1592             CXXFLAGS="$_SAVE_CXXFLAGS"
1593             AC_LANG_RESTORE
1594         ])
1595     if test "$ac_has_werror_return_type" = "yes"; then
1596         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1597     fi
1599 else
1600     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1603 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1604 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1605 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1606 dnl normal behavior.
1607 dnl ========================================================
1608 MKSHLIB_FORCE_ALL=
1609 MKSHLIB_UNFORCE_ALL=
1611 if test "$COMPILE_ENVIRONMENT"; then
1612 if test "$GNU_CC"; then
1613   AC_MSG_CHECKING(whether ld has archive extraction flags)
1614   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1615    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1616     ac_cv_mkshlib_force_and_unforce="no"
1617     exec 3<&0 <<LOOP_INPUT
1618         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1619         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1620         force="-Wl,-all";              unforce="-Wl,-none"
1621 LOOP_INPUT
1622     while read line
1623     do
1624       eval $line
1625       LDFLAGS=$force
1626       LIBS=$unforce
1627       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1628     done
1629     exec 0<&3 3<&-
1630     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1631    ])
1632   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1633     AC_MSG_RESULT(no)
1634   else
1635     AC_MSG_RESULT(yes)
1636     eval $ac_cv_mkshlib_force_and_unforce
1637     MKSHLIB_FORCE_ALL=$force
1638     MKSHLIB_UNFORCE_ALL=$unforce
1639   fi
1640 fi # GNU_CC
1641 fi # COMPILE_ENVIRONMENT
1643 dnl =================================================================
1644 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1645 dnl which is bad when cross compiling.
1646 dnl =================================================================
1647 if test "$COMPILE_ENVIRONMENT"; then
1648 configure_static_assert_macros='
1649 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1650 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1651 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1654 dnl test that the macros actually work:
1655 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1656 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1657  [AC_LANG_SAVE
1658   AC_LANG_C
1659   ac_cv_static_assertion_macros_work="yes"
1660   AC_TRY_COMPILE([$configure_static_assert_macros],
1661                  [CONFIGURE_STATIC_ASSERT(1)],
1662                  ,
1663                  ac_cv_static_assertion_macros_work="no")
1664   AC_TRY_COMPILE([$configure_static_assert_macros],
1665                  [CONFIGURE_STATIC_ASSERT(0)],
1666                  ac_cv_static_assertion_macros_work="no",
1667                  )
1668   AC_LANG_CPLUSPLUS
1669   AC_TRY_COMPILE([$configure_static_assert_macros],
1670                  [CONFIGURE_STATIC_ASSERT(1)],
1671                  ,
1672                  ac_cv_static_assertion_macros_work="no")
1673   AC_TRY_COMPILE([$configure_static_assert_macros],
1674                  [CONFIGURE_STATIC_ASSERT(0)],
1675                  ac_cv_static_assertion_macros_work="no",
1676                  )
1677   AC_LANG_RESTORE
1678  ])
1679 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1680 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1681     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1683 fi # COMPILE_ENVIRONMENT
1685 dnl ========================================================
1686 dnl Checking for 64-bit OS
1687 dnl ========================================================
1688 if test "$COMPILE_ENVIRONMENT"; then
1689 AC_LANG_SAVE
1690 AC_LANG_C
1691 AC_MSG_CHECKING(for 64-bit OS)
1692 AC_TRY_COMPILE([$configure_static_assert_macros],
1693                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1694                result="yes", result="no")
1695 AC_MSG_RESULT("$result")
1696 if test "$result" = "yes"; then
1697     AC_DEFINE(HAVE_64BIT_OS)
1698     HAVE_64BIT_OS=1
1700 AC_SUBST(HAVE_64BIT_OS)
1701 AC_LANG_RESTORE
1702 fi # COMPILE_ENVIRONMENT
1704 dnl ========================================================
1705 dnl Enable high-memory support on OS/2 by default.
1706 dnl ========================================================
1707 MOZ_OS2_HIGH_MEMORY=1
1708 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1709 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1710     MOZ_OS2_HIGH_MEMORY=,
1711     MOZ_OS2_HIGH_MEMORY=1 )
1712 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1714 dnl ========================================================
1715 dnl System overrides of the defaults for host
1716 dnl ========================================================
1717 case "$host" in
1718 *-beos*)
1719     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1720     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1721     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1722     ;;
1724 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1725     # we need Python 2.5 on Windows
1726     PYTHON_VERSION=2.5
1727     if test -n "$_WIN32_MSVC"; then
1728         HOST_AR=lib
1729         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1730         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1731         HOST_RANLIB='echo ranlib'
1732     else
1733         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1734     fi
1735     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1736     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1737     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1738     HOST_BIN_SUFFIX=.exe
1739     case "$host" in
1740     *mingw*)
1741     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1742         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1743         ;;
1744     *)
1745         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1746         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1747             _pwd=`pwd`
1748             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1749         fi
1750         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1751             AS_PERL=1
1752             PERL="${CYGWIN_WRAPPER} $PERL"
1753         fi
1755         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1756             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1757         fi
1758         ;;
1759     esac
1761     case "${host_cpu}" in
1762     x86_64)
1763         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1764         ;;
1765     esac
1766     ;;
1768 *-darwin*)
1769     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1770     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1771     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1772     ;;
1774 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1775     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1776     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1777     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1778     ;;
1780 *os2*)
1781     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1782     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1783     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1784     HOST_BIN_SUFFIX=.exe
1785     MOZ_FIX_LINK_PATHS=
1786     ;;
1788 *-osf*)
1789     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1790     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1791     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1792     ;;
1795     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1796     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1797     ;;
1798 esac
1800 dnl We require version 2.4 or newer of Python to build,
1801 dnl and 2.5 or newer on Windows.
1802 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1803 changequote(,)
1804 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1805 _python_res=$?
1806 changequote([,])
1807 if test "$_python_res" != 0; then
1808     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1810 AC_MSG_RESULT([yes])
1812 dnl Get mozilla version from central milestone file
1813 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1815 dnl Get version of various core apps from the version files.
1816 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1818 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1819 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1821 dnl ========================================================
1822 dnl System overrides of the defaults for target
1823 dnl ========================================================
1825 case "$target" in
1826 *-aix*)
1827     AC_DEFINE(AIX)
1828     if test ! "$GNU_CC"; then
1829         if test ! "$HAVE_64BIT_OS"; then
1830             # Compiling with Visual Age C++ object model compat is the
1831             # default. To compile with object model ibm, add 
1832             # AIX_OBJMODEL=ibm to .mozconfig.
1833             if test "$AIX_OBJMODEL" = "ibm"; then
1834                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1835             else
1836                 AIX_OBJMODEL=compat
1837             fi
1838         else
1839             AIX_OBJMODEL=compat
1840         fi
1841         AC_SUBST(AIX_OBJMODEL)
1842         DSO_LDOPTS='-qmkshrobj=1'
1843         DSO_CFLAGS='-qflag=w:w'
1844         DSO_PIC_CFLAGS=
1845         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1846         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1847         MOZ_FIX_LINK_PATHS=
1848         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1849         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1850         if test "$COMPILE_ENVIRONMENT"; then
1851             AC_LANG_SAVE
1852             AC_LANG_CPLUSPLUS
1853             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1854             AC_TRY_COMPILE([],
1855                 [#if (__IBMCPP__ < 600)
1856                  #error "Bad compiler"
1857                  #endif],
1858                 _BAD_COMPILER=,_BAD_COMPILER=1)
1859             if test -n "$_BAD_COMPILER"; then
1860                 AC_MSG_RESULT([no])    
1861                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1862             else
1863                 AC_MSG_RESULT([yes])    
1864             fi
1865             AC_LANG_RESTORE
1866             TARGET_COMPILER_ABI="ibmc"
1867             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1868             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1869         fi
1870     fi
1871     case "${target_os}" in
1872     aix4.1*)
1873         DLL_SUFFIX='_shr.a'
1874         ;;
1875     esac
1876     if test "$COMPILE_ENVIRONMENT"; then
1877         AC_CHECK_HEADERS(sys/inttypes.h)
1878     fi
1879     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1880     ;;
1882 *-beos*)
1883     no_x=yes
1884     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1885     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1886     DSO_LDOPTS='-nostart'
1887     TK_LIBS='-lbe -lroot'
1888     LIBS="$LIBS -lbe"
1889     if test "$COMPILE_ENVIRONMENT"; then
1890         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1891         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1892     fi
1893     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1894     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1895     _MOZ_USE_RTTI=1
1896     USE_DEPENDENT_LIBS=
1897     MOZ_USER_DIR="Mozilla"
1898     ;;
1900 *-bsdi*)
1901     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1902     _PEDANTIC=
1903     _IGNORE_LONG_LONG_WARNINGS=
1904     case $OS_RELEASE in
1905         4.*|5.*)
1906             STRIP="$STRIP -d"
1907             ;;
1908         *)
1909             DSO_CFLAGS=''
1910             DSO_LDOPTS='-r'
1911             _WARNINGS_CFLAGS="-Wall"
1912             _WARNINGS_CXXFLAGS="-Wall"
1913             # The test above doesn't work properly, at least on 3.1.
1914             MKSHLIB_FORCE_ALL=''
1915             MKSHLIB_UNFORCE_ALL=''
1916         ;;
1917     esac
1918     ;;
1920 *-darwin*) 
1921     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1922     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1923     MOZ_OPTIMIZE_FLAGS="-O3"
1924     _PEDANTIC=
1925     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1926     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1927     DLL_SUFFIX=".dylib"
1928     DSO_LDOPTS=''
1929     STRIP="$STRIP -x -S"
1930     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1931     MOZ_ENABLE_POSTSCRIPT=
1932     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1933     # The ExceptionHandling framework is needed for Objective-C exception
1934     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1935     # builds.
1936     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1938     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1939     dnl ===================================================================
1940     if test "x$enable_dtrace" = "xyes"; then
1941         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1942     else
1943         dnl check for the presence of the -dead_strip linker flag
1944         AC_MSG_CHECKING([for -dead_strip option to ld])
1945         _SAVE_LDFLAGS=$LDFLAGS
1946         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1947         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1948         if test -n "$_HAVE_DEAD_STRIP" ; then
1949             AC_MSG_RESULT([yes])
1950             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1951         else
1952             AC_MSG_RESULT([no])
1953         fi
1954         
1955         LDFLAGS=$_SAVE_LDFLAGS
1956     fi
1957     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1958     ;;
1960 *-freebsd*)
1961     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1962         DLL_SUFFIX=".so.1.0"
1963         DSO_LDOPTS="-shared"
1964     fi
1965     if test ! "$GNU_CC"; then
1966         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1967     fi
1968 # Can't have force w/o an unforce.
1969 #    # Hack for FreeBSD 2.2
1970 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1971 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1972 #       MKSHLIB_UNFORCE_ALL=''
1973 #    fi
1974     ;; 
1976 ia64*-hpux*)
1977     DLL_SUFFIX=".so"
1978     if test ! "$GNU_CC"; then
1979        DSO_LDOPTS='-b'
1980        DSO_CFLAGS=""
1981        DSO_PIC_CFLAGS=
1982        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1983        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1984        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1985     else
1986        DSO_LDOPTS='-b -E'
1987        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1988        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1989     fi
1990     MOZ_FIX_LINK_PATHS=
1991     SYSTEM_MAKEDEPEND=
1992     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1993     AC_DEFINE(_LARGEFILE64_SOURCE)
1994     ;;
1996 *-hpux*)
1997     DLL_SUFFIX=".sl"
1998     if test ! "$GNU_CC"; then
1999         DSO_LDOPTS='-b -Wl,+s'
2000         DSO_CFLAGS=""
2001         DSO_PIC_CFLAGS="+Z"
2002         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2003         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2004         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2005     else
2006         DSO_LDOPTS='-b -E +s'
2007         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2008         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2009     fi
2010     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2011     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2012     ;;
2014 *-irix5*)
2015     AC_DEFINE(IRIX)
2016     DSO_LDOPTS='-elf -shared'
2018     if test "$GNU_CC"; then
2019        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2020        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2021        MKSHLIB_FORCE_ALL='-Wl,-all'
2022        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2023        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2024     else
2025        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2026        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2027        MKSHLIB_FORCE_ALL='-all'
2028        MKSHLIB_UNFORCE_ALL='-none'
2029     fi
2030     ;;
2032 *-irix6*)
2033     AC_DEFINE(IRIX)
2034     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2035     dnl compile and link using -n32
2036     USE_N32=1
2037     TARGET_COMPILER_ABI=n32
2038     DSO_LDOPTS='-elf -shared'
2039     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2040     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2041     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2042     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2043     if test "$GNU_CC"; then
2044        MKSHLIB_FORCE_ALL='-Wl,-all'
2045        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2046        _WARNINGS_CFLAGS="-Wall"
2047        _WARNINGS_CXXFLAGS="-Wall"
2048        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2049     else
2050        MKSHLIB_FORCE_ALL='-all'
2051        MKSHLIB_UNFORCE_ALL='-none'
2052            AR_LIST="$AR t"
2053            AR_EXTRACT="$AR x"
2054            AR_DELETE="$AR d"
2055            AR='$(CXX) -ar'
2056            AR_FLAGS='-o $@'
2057        CFLAGS="$CFLAGS -woff 3262 -G 4"
2058        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2059        if test -n "$USE_N32"; then
2060            ASFLAGS="$ASFLAGS -n32"
2061            CFLAGS="$CFLAGS -n32"
2062            CXXFLAGS="$CXXFLAGS -n32"
2063            LDFLAGS="$LDFLAGS -n32"
2064        fi
2065        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2066        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2067        MOZ_FIX_LINK_PATHS=
2068     fi
2069     if test -z "$GNU_CXX"; then
2070       MIPSPRO_CXX=1
2071     fi
2072     ;;
2074 *-*linux*)
2075     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2076     # Similarly for GNU_CXX and INTEL_CXX.
2077     if test "$INTEL_CC" || test "$INTEL_CXX"; then
2078         # -Os has been broken on Intel's C/C++ compilers for quite a
2079         # while; Intel recommends against using it.
2080         MOZ_OPTIMIZE_FLAGS="-O2"
2081         MOZ_DEBUG_FLAGS="-g"
2082     elif test "$GNU_CC" || test "$GNU_CXX"; then
2083         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2084         case $GCC_VERSION in
2085         4.1.*|4.2.*)
2086             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
2087             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2088         esac
2089         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2090         MOZ_DEBUG_FLAGS="-g"
2091     fi
2093     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2095     MOZ_MEMORY=1
2097     case "${target_cpu}" in
2098     alpha*)
2099         CFLAGS="$CFLAGS -mieee"
2100         CXXFLAGS="$CXXFLAGS -mieee"
2101     ;;
2102     i*86)
2103         USE_ELF_DYNSTR_GC=1
2104     ;;
2105     mips*)
2106         MOZ_DEBUG_FLAGS="-g" # We want inlining
2107     ;;
2108     esac
2109     ;;
2111 *-wince*|*-winmo*)
2112     TARGET_COMPILER_ABI=msvc
2113     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2114     _PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
2115     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2116     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2117     AR_LIST="$AR -list"
2118     AR_EXTRACT="$AR -extract"
2119     AR_DELETE="$AR d"
2120     AR_FLAGS='-OUT:"$@"'
2121     MOZ_MEMORY=1
2122     NSS_DISABLE_DBM=1
2123     MOZ_OGG=
2124     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2126     if test "$AS_BIN"; then
2127         AS="$AS_BIN"
2128     fi
2129     DSO_CFLAGS=
2130     DSO_PIC_CFLAGS=
2131     DLL_SUFFIX=.dll
2132     BIN_SUFFIX='.exe'
2133     if test -z "$RC"; then 
2134         RC=rc.exe  
2135     fi
2136     # certain versions of cygwin's makedepend barf on the 
2137     # #include <string> vs -I./dist/include/string issue so don't use it
2138     SYSTEM_MAKEDEPEND=
2140     HOST_CC=cl
2141     HOST_CXX=cl
2142     HOST_LD=link
2143     HOST_AR='lib -OUT:$@'
2144     HOST_RANLIB='echo ranlib'
2145     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2146         
2147         
2148     WARNINGS_AS_ERRORS='-WX'
2149     MOZ_OPTIMIZE_FLAGS='-Ox'
2150     AR_FLAGS='-NOLOGO -OUT:"$@"'
2151     ASM_SUFFIX=asm
2152     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2153     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2154     DLL_PREFIX=
2155     DOXYGEN=:
2156     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2157     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2158     GARBAGE=
2159     IMPORT_LIB_SUFFIX=lib
2160     dnl Need to force-link against mozalloc because it's used in the shunt
2161     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2162     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2163     LIB_PREFIX=
2164     LIB_SUFFIX=lib 
2165     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2166     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2167     MKSHLIB_FORCE_ALL=
2168     MKSHLIB_UNFORCE_ALL=
2169     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2170     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2171     MOZ_DEBUG_FLAGS='-Zi'
2172     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2173     MOZ_FIX_LINK_PATHS=
2174     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2175     OBJ_SUFFIX=obj
2176     RANLIB='echo not_ranlib'
2177     STRIP='echo not_strip'
2178     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2179     UNZIP=unzip
2180     XARGS=xargs
2181     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2182     ZIP=zip
2183     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2184     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2185     STATIC_LIBIDL=1
2186     MOZ_TREE_FREETYPE=1
2188     AC_DEFINE(HAVE_SNPRINTF)
2189     AC_DEFINE(_WINDOWS)
2190     AC_DEFINE(WIN32)
2191     AC_DEFINE(XP_WIN)
2192     AC_DEFINE(XP_WIN32)
2193     AC_DEFINE(HW_THREADS)
2194     AC_DEFINE(STDC_HEADERS)
2195     AC_DEFINE(NEW_H, <new>)
2196     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2197     AC_DEFINE(HAVE_LOCALTIME_R)
2199     TARGET_MD_ARCH=win32
2200     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2201     BIN_SUFFIX='.exe'
2202     MOZ_ENABLE_POSTSCRIPT=
2203     MOZ_USER_DIR="Mozilla"
2205     MOZ_GFX_OPTIMIZE_MOBILE=1
2207     # Sanity check for WINCE_WINDOWS_MOBILE
2208     # XXX disabled until we can fix the mobile tinderbox
2209     ##if test "$WINCE_WINDOWS_MOBILE"; then
2210     ##   AC_CHECK_HEADER(tpcshell.h, [],
2211     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2212     ##fi
2216 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2217     DSO_CFLAGS=
2218     DSO_PIC_CFLAGS=
2219     DLL_SUFFIX=.dll
2220     RC=rc.exe
2221     # certain versions of cygwin's makedepend barf on the 
2222     # #include <string> vs -I./dist/include/string issue so don't use it
2223     SYSTEM_MAKEDEPEND=
2224     if test -n "$GNU_CC"; then
2225         CC="$CC -mno-cygwin"
2226         CXX="$CXX -mno-cygwin"
2227         CPP="$CPP -mno-cygwin"
2228         CFLAGS="$CFLAGS -mms-bitfields"
2229         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2230         DSO_LDOPTS='-shared'
2231         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2232         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2233         RC='$(WINDRES)'
2234         # Use temp file for windres (bug 213281)
2235         RCFLAGS='-O coff --use-temp-file'
2236         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2237         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2238         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2239         MOZ_FIX_LINK_PATHS=
2240         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2241         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2242         DLL_PREFIX=
2243         IMPORT_LIB_SUFFIX=dll.a
2244     else
2245         TARGET_COMPILER_ABI=msvc
2246         HOST_CC='$(CC)'
2247         HOST_CXX='$(CXX)'
2248         HOST_LD='$(LD)'
2249         if test "$AS_BIN"; then
2250             AS="$(basename "$AS_BIN")"
2251         fi
2252         AR='lib -NOLOGO -OUT:"$@"'
2253         AR_FLAGS=
2254         RANLIB='echo not_ranlib'
2255         STRIP='echo not_strip'
2256         XARGS=xargs
2257         ZIP=zip
2258         UNZIP=unzip
2259         DOXYGEN=:
2260         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2261         ASM_SUFFIX=asm
2262         OBJ_SUFFIX=obj
2263         LIB_SUFFIX=lib
2264         DLL_PREFIX=
2265         LIB_PREFIX=
2266         IMPORT_LIB_SUFFIX=lib
2267         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2268         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2269         MKSHLIB_FORCE_ALL=
2270         MKSHLIB_UNFORCE_ALL=
2271         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2272         _USE_CPP_INCLUDE_FLAG=1
2273         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2274         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2275         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2276         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2277         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2278         MOZ_DEBUG_FLAGS='-Zi'
2279         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2280         WARNINGS_AS_ERRORS='-WX'
2281         MOZ_OPTIMIZE_FLAGS='-O1'
2282         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2283         MOZ_FIX_LINK_PATHS=
2284         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2285         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2286         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2287         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2288         if test $_MSC_VER -ge 1400; then
2289             LDFLAGS="$LDFLAGS -NXCOMPAT"
2290             dnl For profile-guided optimization
2291             PROFILE_GEN_CFLAGS="-GL"
2292             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2293             dnl XXX: PGO builds can fail with warnings treated as errors,
2294             dnl specifically "no profile data available" appears to be
2295             dnl treated as an error sometimes. This might be a consequence
2296             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2297             dnl with the linker doing most of the work in the whole-program
2298             dnl optimization/PGO case. I think it's probably a compiler bug,
2299             dnl but we work around it here.
2300             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2301             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2302             dnl Probably also a compiler bug, but what can you do?
2303             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2304             if test -n "$_USE_DYNAMICBASE"; then
2305                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2306             fi
2307         fi
2308     fi
2309     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2310     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2311     AC_DEFINE(HAVE_SNPRINTF)
2312     AC_DEFINE(_WINDOWS)
2313     AC_DEFINE(WIN32)
2314     AC_DEFINE(XP_WIN)
2315     AC_DEFINE(XP_WIN32)
2316     AC_DEFINE(HW_THREADS)
2317     AC_DEFINE(STDC_HEADERS)
2318     AC_DEFINE(NEW_H, <new>)
2319     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2320     TARGET_MD_ARCH=win32
2321     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2322     BIN_SUFFIX='.exe'
2323     MOZ_ENABLE_POSTSCRIPT=
2324     MOZ_USER_DIR="Mozilla"
2326     dnl Hardcode to win95 for now - cls
2327     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2329     dnl set NO_X11 defines here as the general check is skipped on win32
2330     no_x=yes
2331     AC_DEFINE(NO_X11)
2333     dnl MinGW/MSYS doesn't provide or need cygpath
2334     case "$host" in
2335     *-mingw*)
2336         CYGPATH_W=echo
2337         CYGPATH_S=cat
2338         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2339         ;;
2340     *-cygwin*|*-msvc*|*-mks*)
2341         CYGPATH_W="cygpath -a -w"
2342         CYGPATH_S="sed -e s|\\\\|/|g"
2343         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2344         ;;
2345     esac
2346     case "$host" in
2347     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2349     if test -z "$MOZ_TOOLS"; then
2350         AC_MSG_ERROR([MOZ_TOOLS is not set])
2351     fi
2353     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2354     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2355         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2356     fi
2357     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2358     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2359         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2360     fi
2361     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2363     if test -n "$GLIB_PREFIX"; then
2364         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2365         if test "$?" = "0"; then
2366             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2367                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2368             fi
2369             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2370         else
2371             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2372         fi
2373     else
2374         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2375     fi
2376     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2377         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2378     fi
2379     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2380     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2381         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2382     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2383         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2384     else
2385         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2386     fi
2388     if test -n "$LIBIDL_PREFIX"; then
2389         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2390         if test "$?" = "0"; then
2391             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2392                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2393             fi
2394             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2395         else
2396             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2397         fi
2398     else
2399         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2400     fi        
2401     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2402         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2403     fi
2404     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2405     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2406         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2407         STATIC_LIBIDL=1
2408     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2409         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2410     else
2411         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2412     fi
2413     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2414     ;;
2416     *) # else cross-compiling
2417         if test -n "$GLIB_PREFIX"; then
2418             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2419             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2420                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2421             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2422                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2423             else
2424                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2425             fi
2426         fi
2427         if test -n "$LIBIDL_PREFIX"; then
2428             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2429             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2430                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2431                 STATIC_LIBIDL=1
2432             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2433                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2434             else
2435                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2436             fi
2437         fi
2438         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2439         ;;
2440     esac 
2443     case "$host_os" in
2444     cygwin*|msvc*|mks*)
2445         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])
2446         ;;
2448     *)
2449         AC_CHECK_HEADERS(oleacc.idl)
2451         AC_LANG_SAVE
2452         AC_LANG_CPLUSPLUS
2453         AC_CHECK_HEADERS(atlbase.h)
2454         AC_LANG_RESTORE
2455         ;;
2456     esac
2458     case "$target" in
2459     i*86-*)
2460         if test "$HAVE_64BIT_OS"; then
2461             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2462         fi
2464         if test $_MSC_VER -ge 1400; then
2465             LDFLAGS="$LDFLAGS -SAFESEH"
2466         fi
2467         AC_CHECK_HEADERS(mmintrin.h)
2468         AC_DEFINE(_X86_)
2469         ;;
2470     alpha-*)
2471         AC_DEFINE(_ALPHA_)
2472         ;;
2473     mips-*)
2474         AC_DEFINE(_MIPS_)
2475         ;;
2476     x86_64-*)
2477         AC_DEFINE(_AMD64_)
2478         ;;
2479     *)
2480         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2481         ;;
2482     esac
2484     if test "$HAVE_64BIT_OS"; then
2485         AC_DEFINE(_WIN64)
2486     fi
2487     ;;
2489 *-netbsd*)
2490     DSO_CFLAGS=''
2491     CFLAGS="$CFLAGS -Dunix"
2492     CXXFLAGS="$CXXFLAGS -Dunix"
2493     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2494         DLL_SUFFIX=".so"
2495         DSO_PIC_CFLAGS='-fPIC -DPIC'
2496         DSO_LDOPTS='-shared'
2497         BIN_FLAGS='-Wl,--export-dynamic'
2498     else
2499         DSO_PIC_CFLAGS='-fPIC -DPIC'
2500         DLL_SUFFIX=".so.1.0"
2501         DSO_LDOPTS='-shared'
2502     fi
2503     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2504     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2505     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2506     if test "$LIBRUNPATH"; then
2507         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2508     fi
2509     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2510     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2511     ;;
2513 *-nto*) 
2514         AC_DEFINE(NTO)  
2515         AC_DEFINE(_QNX_SOURCE)
2516         AC_DEFINE(_i386)
2517         OS_TARGET=NTO
2518         WARNINGS_AS_ERRORS=''
2519         MOZ_OPTIMIZE_FLAGS="-O"
2520         MOZ_DEBUG_FLAGS="-gstabs"
2521         USE_PTHREADS=1
2522         _PEDANTIC=
2523         LIBS="$LIBS -lsocket -lstdc++"
2524         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2525         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2526         if test "$with_x" != "yes"
2527         then
2528                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2529             TK_CFLAGS='-I/usr/include/photon'
2530                 TK_LIBS='-lph'
2531         fi
2532         case "${target_cpu}" in
2533         ppc*)
2534         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2535         ;;
2536         esac
2537         case "${host_cpu}" in
2538         i*86)
2539         USE_ELF_DYNSTR_GC=1
2540         ;;
2541         esac
2542         ;;
2544 *-openbsd*)
2545     DLL_SUFFIX=".so.1.0"
2546     DSO_CFLAGS=''
2547     DSO_PIC_CFLAGS='-fPIC'
2548     DSO_LDOPTS='-shared -fPIC'
2549     if test "$LIBRUNPATH"; then
2550         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2551     fi
2552     ;;
2554 *-openvms*) 
2555     AC_DEFINE(NO_PW_GECOS)
2556     AC_DEFINE(NO_UDSOCK)
2557     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2558     USE_PTHREADS=1
2559     MKSHLIB_FORCE_ALL='-all'
2560     MKSHLIB_UNFORCE_ALL='-none'
2561     AS='as'
2562     AS_DASH_C_FLAG='-Wc/names=as_is'
2563     AR_FLAGS='c $@'
2564     DSO_LDOPTS='-shared -auto_symvec'
2565     DSO_PIC_CFLAGS=
2566     MOZ_DEBUG_LDFLAGS='-g'
2567     COMPAQ_CXX=1
2568     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2569     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2570     ;;
2573 *-os2*)
2574     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2575     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2576     AC_DEFINE(OS2)
2577     AC_DEFINE(XP_OS2)
2578     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2579     AC_DEFINE(TCPV40HDRS)
2580     DLL_PREFIX=
2581     LIB_PREFIX=
2582     LIB_SUFFIX=lib
2583     BIN_SUFFIX=".exe"
2584     DLL_SUFFIX=".dll"
2585     IMPORT_LIB_SUFFIX=lib
2586     DSO_PIC_CFLAGS=
2587     AR=emxomfar
2588     AR_FLAGS='r $@'
2589     CFLAGS="$CFLAGS -Zomf"
2590     CXXFLAGS="$CXXFLAGS -Zomf"
2591     DSO_LDOPTS='-Zdll'
2592     BIN_FLAGS='-Zlinker /ST:0x100000'
2593     IMPLIB='emximp -o'
2594     FILTER='emxexp -o'
2595     LDFLAGS='-Zmap'
2596     WARNINGS_AS_ERRORS='-Werror'
2597     MOZ_DEBUG_FLAGS="-g -fno-inline"
2598     MOZ_OPTIMIZE_FLAGS="-O2"
2599     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2600     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2601     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2602     TARGET_MD_ARCH=os2
2603     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2604     MOZ_ENABLE_POSTSCRIPT=
2605     RC=rc.exe
2606     RCFLAGS='-n'
2607     MOZ_USER_DIR="Mozilla"
2609     if test "$MOZTOOLS"; then
2610         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2611     else
2612         AC_MSG_ERROR([MOZTOOLS is not set])
2613     fi
2614     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2615         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2616         LDFLAGS="$LDFLAGS -Zhigh-mem"
2617         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2618         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2619     fi
2621     # GCC for OS/2 currently predefines these, but we don't want them
2622     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2623     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2625     AC_CACHE_CHECK(for __declspec(dllexport),
2626         ac_os2_declspec,
2627         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2628                         [return 0;],
2629                         ac_os2_declspec="yes",
2630                         ac_os2_declspec="no")])
2631     if test "$ac_os2_declspec" = "yes"; then
2632         FILTER='true'
2633         MOZ_OS2_USE_DECLSPEC='1'
2634     fi
2635     ;;
2637 alpha*-*-osf*)
2638     if test "$GNU_CC"; then
2639       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2640       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2642     else
2643         MOZ_DEBUG_FLAGS='-g'
2644         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2645         CFLAGS="$CFLAGS -ieee"
2646         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2647         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2648         DSO_CFLAGS=
2649         DSO_PIC_CFLAGS=
2650         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2651         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2652         MKSHLIB_FORCE_ALL='-all'
2653         MKSHLIB_UNFORCE_ALL='-none'
2654         dnl Might fix the libxpcom.so breakage on this platform as well....
2655         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2656         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2657     fi
2658     if test -z "$GNU_CXX"; then
2659       COMPAQ_CXX=1
2660     fi
2661     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2662     ;;
2664 *-qnx*) 
2665     DIRENT_INO=d_stat.st_ino
2666     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2667     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2668     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2669     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2670     AC_DEFINE(STDC_HEADERS)
2671     if test "$no_x" = "yes"; then
2672             _PLATFORM_DEFAULT_TOOLKIT='photon'
2673             TK_CFLAGS='-I/usr/nto/include/photon'
2674             TK_LIBS='-lphoton -lphrender'
2675     fi
2676     ;;
2678 *-sco*) 
2679     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2680     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2681     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2682     if test ! "$GNU_CC"; then
2683        DSO_LDOPTS='-G'
2684     fi
2685     ;;
2687 *-solaris*) 
2688     AC_DEFINE(SOLARIS)
2689     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2690     SYSTEM_MAKEDEPEND=
2691     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2692     # libraries one level up (e.g. libnspr4.so)
2693     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2694     MOZ_MEMORY=1
2695     if test "$SOLARIS_SUNPRO_CC"; then
2696        LIBS="-lCrun -lCstd $LIBS"
2697        NS_USE_NATIVE=1
2698        MOZ_FIX_LINK_PATHS=
2699        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2700        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2701        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath"
2702        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2703        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2704        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2705        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2706            _SAVE_LDFLAGS=$LDFLAGS
2707            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2708            AC_TRY_LINK([#include <stdio.h>],
2709                        [printf("Hello World\n");],
2710                        ,
2711                        [LDFLAGS=$_SAVE_LDFLAGS])
2712        fi
2713        WARNINGS_AS_ERRORS='-Werror'
2714        MOZ_OPTIMIZE_FLAGS="-xO4"
2715        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2716        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2717        MKSHLIB_FORCE_ALL='-z allextract'
2718        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2719        DSO_LDOPTS='-G -z muldefs'
2720        AR_LIST="$AR t"
2721        AR_EXTRACT="$AR x"
2722        AR_DELETE="$AR d"
2723        AR='$(CXX) -xar'
2724        AR_FLAGS='-o $@'
2725        AS='/usr/ccs/bin/as'
2726        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2727        AS_DASH_C_FLAG=''
2728        TARGET_COMPILER_ABI="sunc"
2729        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2730        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2731        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2732        AC_LANG_SAVE
2733        AC_LANG_CPLUSPLUS
2734        AC_TRY_COMPILE([],
2735            [#if (__SUNPRO_CC < 0x590)
2736            #error "Denied"
2737            #endif],
2738            _BAD_COMPILER=,_BAD_COMPILER=1)
2739         if test -n "$_BAD_COMPILER"; then
2740             _res="no"
2741             AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2742         else
2743             _res="yes"
2744         fi
2745         AC_MSG_RESULT([$_res])
2746         AC_LANG_RESTORE
2747     else
2748        ASFLAGS="$ASFLAGS -fPIC"
2749        DSO_LDOPTS='-G'
2750        _WARNINGS_CFLAGS=''
2751        _WARNINGS_CXXFLAGS=''
2752        if test "$OS_RELEASE" = "5.3"; then
2753           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2754        fi
2755     fi
2756     if test "$OS_RELEASE" = "5.5.1"; then
2757        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2758     fi
2759     ;;
2761 *-sunos*) 
2762     DSO_LDOPTS='-Bdynamic'
2763     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2764     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2765     AC_DEFINE(SUNOS4)
2766     AC_DEFINE(SPRINTF_RETURNS_STRING)
2767     case "$(target_os)" in
2768     sunos4.1*)
2769         DLL_SUFFIX='.so.1.0'
2770         ;;
2771     esac
2772     ;;
2774 *-sysv4.2uw7*) 
2775         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2776     ;;
2778 *-os2*)
2779     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2780     ;;
2782 esac
2784 dnl Only one oddball right now (QNX), but this gives us flexibility
2785 dnl if any other platforms need to override this in the future.
2786 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2788 dnl ========================================================
2789 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2790 dnl by now will not have any way to link most binaries (tests
2791 dnl as well as viewer, apprunner, etc.), because some symbols
2792 dnl will be left out of the "composite" .so's by ld as unneeded.
2793 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2794 dnl they can link in the static libs that provide the missing
2795 dnl symbols.
2796 dnl ========================================================
2797 NO_LD_ARCHIVE_FLAGS=
2798 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2799     NO_LD_ARCHIVE_FLAGS=1
2801 case "$target" in
2802 *-os2*)
2803     NO_LD_ARCHIVE_FLAGS=
2804     ;;
2805 *-aix4.3*|*-aix5*)
2806     NO_LD_ARCHIVE_FLAGS=
2807     ;;
2808 *-openvms*)
2809     NO_LD_ARCHIVE_FLAGS=
2810     ;;
2811 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2812     if test -z "$GNU_CC"; then
2813         NO_LD_ARCHIVE_FLAGS=
2814     fi
2815     ;;
2816 esac
2817 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2819 dnl ========================================================
2820 dnl = Flags to strip unused symbols from .so components
2821 dnl ========================================================
2822 case "$target" in
2823     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2824         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2825         ;;
2826     *-solaris*)
2827         if test -z "$GNU_CC"; then
2828          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2829         else
2830          if test -z "$GCC_USE_GNU_LD"; then
2831           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2832          else
2833           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2834          fi
2835         fi
2836         ;;
2837     *-nto*) 
2838         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2839         ;;
2840     *-darwin*)
2841         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2842         ;;
2843     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2844         if test -n "$GNU_CC"; then
2845            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2846         fi
2847         ;;
2848 esac
2850 if test -z "$COMPILE_ENVIRONMENT"; then
2851     SKIP_COMPILER_CHECKS=1
2852     SKIP_LIBRARY_CHECKS=1
2855 if test -z "$SKIP_COMPILER_CHECKS"; then
2856 dnl Checks for typedefs, structures, and compiler characteristics.
2857 dnl ========================================================
2858 AC_LANG_C
2859 AC_HEADER_STDC
2860 AC_C_CONST
2861 AC_TYPE_MODE_T
2862 AC_TYPE_OFF_T
2863 AC_TYPE_PID_T
2864 AC_TYPE_SIZE_T
2865 AC_MSG_CHECKING(for __stdcall)
2866 AC_CACHE_VAL(ac_cv___stdcall,
2867  [AC_TRY_COMPILE([],
2868                  [void foo(); void __stdcall foo();],
2869                  [ac_cv___stdcall=true],
2870                  [ac_cv___stdcall=false])])
2871 if test "$ac_cv___stdcall" = true ; then
2872   AC_DEFINE(HAVE_STDCALL)
2873   AC_MSG_RESULT(yes)
2874 else
2875   AC_MSG_RESULT(no)
2877 AC_MSG_CHECKING(for ssize_t)
2878 AC_CACHE_VAL(ac_cv_type_ssize_t,
2879  [AC_TRY_COMPILE([#include <stdio.h>
2880                   #include <sys/types.h>],
2881                  [ssize_t foo = 0;],
2882                  [ac_cv_type_ssize_t=true],
2883                  [ac_cv_type_ssize_t=false])])
2884 if test "$ac_cv_type_ssize_t" = true ; then
2885   AC_DEFINE(HAVE_SSIZE_T)
2886   AC_MSG_RESULT(yes)
2887 else
2888   AC_MSG_RESULT(no)
2890 AC_STRUCT_ST_BLKSIZE
2891 AC_MSG_CHECKING(for siginfo_t)
2892 AC_CACHE_VAL(ac_cv_siginfo_t,
2893  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2894                   #include <signal.h>],
2895                  [siginfo_t* info;],
2896                  [ac_cv_siginfo_t=true],
2897                  [ac_cv_siginfo_t=false])])
2898 if test "$ac_cv_siginfo_t" = true ; then
2899   AC_DEFINE(HAVE_SIGINFO_T)
2900   AC_MSG_RESULT(yes)
2901 else
2902   AC_MSG_RESULT(no)
2905 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2906 dnl ========================================================
2907 AC_MSG_CHECKING(for int16_t)
2908 AC_CACHE_VAL(ac_cv_int16_t,
2909  [AC_TRY_COMPILE([#include <stdio.h>
2910                   #include <sys/types.h>],
2911                  [int16_t foo = 0;],
2912                  [ac_cv_int16_t=true],
2913                  [ac_cv_int16_t=false])])
2914 if test "$ac_cv_int16_t" = true ; then
2915   AC_DEFINE(HAVE_INT16_T)
2916   AC_MSG_RESULT(yes)
2917 else
2918   AC_MSG_RESULT(no)
2920 AC_MSG_CHECKING(for int32_t)
2921 AC_CACHE_VAL(ac_cv_int32_t,
2922  [AC_TRY_COMPILE([#include <stdio.h>
2923                   #include <sys/types.h>],
2924                  [int32_t foo = 0;],
2925                  [ac_cv_int32_t=true],
2926                  [ac_cv_int32_t=false])])
2927 if test "$ac_cv_int32_t" = true ; then
2928   AC_DEFINE(HAVE_INT32_T)
2929   AC_MSG_RESULT(yes)
2930 else
2931   AC_MSG_RESULT(no)
2933 AC_MSG_CHECKING(for int64_t)
2934 AC_CACHE_VAL(ac_cv_int64_t,
2935  [AC_TRY_COMPILE([#include <stdio.h>
2936                   #include <sys/types.h>],
2937                  [int64_t foo = 0;],
2938                  [ac_cv_int64_t=true],
2939                  [ac_cv_int64_t=false])])
2940 if test "$ac_cv_int64_t" = true ; then
2941   AC_DEFINE(HAVE_INT64_T)
2942   AC_MSG_RESULT(yes)
2943 else
2944   AC_MSG_RESULT(no)
2946 AC_MSG_CHECKING(for int64)
2947 AC_CACHE_VAL(ac_cv_int64,
2948  [AC_TRY_COMPILE([#include <stdio.h>
2949                   #include <sys/types.h>],
2950                  [int64 foo = 0;],
2951                  [ac_cv_int64=true],
2952                  [ac_cv_int64=false])])
2953 if test "$ac_cv_int64" = true ; then
2954   AC_DEFINE(HAVE_INT64)
2955   AC_MSG_RESULT(yes)
2956 else
2957   AC_MSG_RESULT(no)
2959 AC_MSG_CHECKING(for uint)
2960 AC_CACHE_VAL(ac_cv_uint,
2961  [AC_TRY_COMPILE([#include <stdio.h>
2962                   #include <sys/types.h>],
2963                  [uint foo = 0;],
2964                  [ac_cv_uint=true],
2965                  [ac_cv_uint=false])])
2966 if test "$ac_cv_uint" = true ; then
2967   AC_DEFINE(HAVE_UINT)
2968   AC_MSG_RESULT(yes)
2969 else
2970   AC_MSG_RESULT(no)
2972 AC_MSG_CHECKING(for uint_t)
2973 AC_CACHE_VAL(ac_cv_uint_t,
2974  [AC_TRY_COMPILE([#include <stdio.h>
2975                   #include <sys/types.h>],
2976                  [uint_t foo = 0;],
2977                  [ac_cv_uint_t=true],
2978                  [ac_cv_uint_t=false])])
2979 if test "$ac_cv_uint_t" = true ; then
2980   AC_DEFINE(HAVE_UINT_T)
2981   AC_MSG_RESULT(yes)
2982 else
2983   AC_MSG_RESULT(no)
2985 AC_MSG_CHECKING(for uint16_t)
2986 AC_CACHE_VAL(ac_cv_uint16_t,
2987  [AC_TRY_COMPILE([#include <stdio.h>
2988                   #include <sys/types.h>],
2989                  [uint16_t foo = 0;],
2990                  [ac_cv_uint16_t=true],
2991                  [ac_cv_uint16_t=false])])
2992 if test "$ac_cv_uint16_t" = true ; then
2993   AC_DEFINE(HAVE_UINT16_T)
2994   AC_MSG_RESULT(yes)
2995 else
2996   AC_MSG_RESULT(no)
2999 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3000 dnl are defined when compiling C++ but not C.  Since the result of this
3001 dnl test is used only in C++, do it in C++.
3002 AC_LANG_CPLUSPLUS
3004 AC_MSG_CHECKING(for uname.domainname)
3005 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3006     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3007         [ struct utsname *res; char *domain; 
3008             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3009         [ac_cv_have_uname_domainname_field=true],
3010         [ac_cv_have_uname_domainname_field=false])])
3012 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3013     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3014     AC_MSG_RESULT(yes)
3015 else
3016     AC_MSG_RESULT(no)
3019 AC_MSG_CHECKING(for uname.__domainname)
3020 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3021     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3022         [ struct utsname *res; char *domain; 
3023             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3024         [ac_cv_have_uname_us_domainname_field=true],
3025         [ac_cv_have_uname_us_domainname_field=false])])
3027 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3028     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3029     AC_MSG_RESULT(yes)
3030 else
3031     AC_MSG_RESULT(no)
3034 AC_LANG_CPLUSPLUS
3036 dnl Check for usable char16_t (2 bytes, unsigned)
3037 dnl (we might not need the unsignedness check anymore)
3038 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3039     ac_cv_have_usable_char16_t,
3040     [AC_TRY_COMPILE([$configure_static_assert_macros],
3041                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3042                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3043                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3044                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3045                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3046                     ac_cv_have_usable_char16_t="yes",
3047                     ac_cv_have_usable_char16_t="no")])
3048 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3049     AC_DEFINE(HAVE_CPP_CHAR16_T)
3050     HAVE_CPP_CHAR16_T=1
3053 dnl Check for usable wchar_t (2 bytes, unsigned)
3054 dnl (we really don't need the unsignedness check anymore)
3055 dnl ========================================================
3057 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3058     ac_cv_have_usable_wchar_v2,
3059     [AC_TRY_COMPILE([#include <stddef.h>
3060                      $configure_static_assert_macros],
3061                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3062                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3063                     ac_cv_have_usable_wchar_v2="yes",
3064                     ac_cv_have_usable_wchar_v2="no")])
3065 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3066     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3067     HAVE_CPP_2BYTE_WCHAR_T=1
3068 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3069 dnl This is really gcc-only
3070 dnl Do this test using CXX only since some versions of gcc
3071 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3072 dnl only have short-wchar support for c++.
3073 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3075     _SAVE_CXXFLAGS=$CXXFLAGS
3076     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3078     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3079         ac_cv_have_usable_wchar_option_v2,
3080         [AC_TRY_LINK([#include <stddef.h>
3081                       $configure_static_assert_macros],
3082                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3083                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3084                      ac_cv_have_usable_wchar_option_v2="yes",
3085                      ac_cv_have_usable_wchar_option_v2="no")])
3087     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3088         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3089         HAVE_CPP_2BYTE_WCHAR_T=1
3090         WCHAR_CFLAGS="-fshort-wchar"
3091     else    
3092         CXXFLAGS=$_SAVE_CXXFLAGS
3093     fi
3096 AC_LANG_C
3098 dnl Check for .hidden assembler directive and visibility attribute.
3099 dnl Borrowed from glibc configure.in
3100 dnl ===============================================================
3101 if test "$GNU_CC"; then
3102   AC_CACHE_CHECK(for visibility(hidden) attribute,
3103                  ac_cv_visibility_hidden,
3104                  [cat > conftest.c <<EOF
3105                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3107                   ac_cv_visibility_hidden=no
3108                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3109                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3110                       ac_cv_visibility_hidden=yes
3111                     fi
3112                   fi
3113                   rm -f conftest.[cs]
3114                  ])
3115   if test "$ac_cv_visibility_hidden" = "yes"; then
3116     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3118     AC_CACHE_CHECK(for visibility(default) attribute,
3119                    ac_cv_visibility_default,
3120                    [cat > conftest.c <<EOF
3121                     int foo __attribute__ ((visibility ("default"))) = 1;
3123                     ac_cv_visibility_default=no
3124                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3125                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3126                         ac_cv_visibility_default=yes
3127                       fi
3128                     fi
3129                     rm -f conftest.[cs]
3130                    ])
3131     if test "$ac_cv_visibility_default" = "yes"; then
3132       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3134       AC_CACHE_CHECK(for visibility pragma support,
3135                      ac_cv_visibility_pragma,
3136                      [cat > conftest.c <<EOF
3137 #pragma GCC visibility push(hidden)
3138                       int foo_hidden = 1;
3139 #pragma GCC visibility push(default)
3140                       int foo_default = 1;
3142                       ac_cv_visibility_pragma=no
3143                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3144                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3145                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3146                             ac_cv_visibility_pragma=yes
3147                           fi
3148                         fi
3149                       fi
3150                       rm -f conftest.[cs]
3151                     ])
3152       if test "$ac_cv_visibility_pragma" = "yes"; then
3153         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3154                        ac_cv_have_visibility_class_bug,
3155                        [cat > conftest.c <<EOF
3156 #pragma GCC visibility push(hidden)
3157 struct __attribute__ ((visibility ("default"))) TestStruct {
3158   static void Init();
3160 __attribute__ ((visibility ("default"))) void TestFunc() {
3161   TestStruct::Init();
3164                        ac_cv_have_visibility_class_bug=no
3165                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3166                          ac_cv_have_visibility_class_bug=yes
3167                        else
3168                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3169                            ac_cv_have_visibility_class_bug=yes
3170                          fi
3171                        fi
3172                        rm -rf conftest.{c,S}
3173                        ])
3175         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3176                        ac_cv_have_visibility_builtin_bug,
3177                        [cat > conftest.c <<EOF
3178 #pragma GCC visibility push(hidden)
3179 #pragma GCC visibility push(default)
3180 #include <string.h>
3181 #pragma GCC visibility pop
3183 __attribute__ ((visibility ("default"))) void Func() {
3184   char c[[100]];
3185   memset(c, 0, sizeof(c));
3188                        ac_cv_have_visibility_builtin_bug=no
3189                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3190                          ac_cv_have_visibility_builtin_bug=yes
3191                        else
3192                          if test `grep -c "@PLT" conftest.S` = 0; then
3193                            ac_cv_visibility_builtin_bug=yes
3194                          fi
3195                        fi
3196                        rm -f conftest.{c,S}
3197                        ])
3198         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3199                 "$ac_cv_have_visibility_class_bug" = "no"; then
3200           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3201           WRAP_SYSTEM_INCLUDES=1
3202           STL_FLAGS='-I$(DIST)/stl_wrappers'
3203           WRAP_STL_INCLUDES=1
3204         else
3205           VISIBILITY_FLAGS='-fvisibility=hidden'
3206         fi # have visibility pragma bug
3207       fi   # have visibility pragma
3208     fi     # have visibility(default) attribute
3209   fi       # have visibility(hidden) attribute
3210 fi         # GNU_CC
3212 # visibility hidden flag for Sun Studio on Solaris
3213 if test "$SOLARIS_SUNPRO_CC"; then
3214 VISIBILITY_FLAGS='-xldscope=hidden'
3215 fi         # Sun Studio on Solaris
3217 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3218 AC_SUBST(VISIBILITY_FLAGS)
3220 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3221 dnl ========================================================
3222 if test "$GNU_CC"; then
3223   CFLAGS_save="${CFLAGS}"
3224   CFLAGS="${CFLAGS} -Werror"
3225   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3226                  ac_cv_force_align_arg_pointer,
3227                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3228                                  [],
3229                                  ac_cv_force_align_arg_pointer="yes",
3230                                  ac_cv_force_align_arg_pointer="no")])
3231   CFLAGS="${CFLAGS_save}"
3232   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3233     HAVE_GCC_ALIGN_ARG_POINTER=1
3234   else
3235     HAVE_GCC_ALIGN_ARG_POINTER=
3236   fi
3238 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3240 dnl Checks for header files.
3241 dnl ========================================================
3242 AC_HEADER_DIRENT
3243 case "$target_os" in
3244 freebsd*)
3245 # for stuff like -lXshm
3246     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3247     ;;
3248 esac
3249 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3250 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3251 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3252 AC_CHECK_HEADERS(malloc.h)
3253 AC_CHECK_HEADERS(X11/XKBlib.h)
3254 AC_CHECK_HEADERS(io.h)
3256 dnl These are all the places some variant of statfs can be hiding.
3257 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3259 dnl Quota support
3260 AC_CHECK_HEADERS(sys/quota.h)
3262 dnl Try for MMX support
3263 dnl NB - later gcc versions require -mmmx for this header to be successfully
3264 dnl included (or another option which implies it, such as -march=pentium-mmx)
3265 AC_CHECK_HEADERS(mmintrin.h)
3267 dnl Check whether the compiler supports the new-style C++ standard
3268 dnl library headers (i.e. <new>) or needs the old "new.h"
3269 AC_LANG_CPLUSPLUS
3270 NEW_H=new.h
3271 AC_CHECK_HEADER(new, [NEW_H=new])
3272 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3273 AC_LANG_C
3275 AC_ARG_ENABLE(dtrace,
3276               [  --enable-dtrace         build with dtrace support if available (default=no)],
3277               [enable_dtrace="yes"],)
3278 if test "x$enable_dtrace" = "xyes"; then
3279   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3280   if test -n "$HAVE_DTRACE"; then
3281       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3282   else
3283       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3284   fi
3286 AC_SUBST(HAVE_DTRACE)
3288 case $target in
3289 *-aix4.3*|*-aix5*)
3290         ;;
3292         AC_CHECK_HEADERS(sys/cdefs.h)
3293         ;;
3294 esac
3296 dnl Checks for libraries.
3297 dnl ========================================================
3298 case $target in
3299 *-hpux11.*)
3300         ;;
3302         AC_CHECK_LIB(c_r, gethostbyname_r)
3303         ;;
3304 esac
3306 dnl We don't want to link with libdl even if it's present on OS X, since
3307 dnl it's not used and not part of the default installation.
3308 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3309 dnl We don't want to link against libm or libpthread on Darwin since
3310 dnl they both are just symlinks to libSystem and explicitly linking
3311 dnl against libSystem causes issues when debugging (see bug 299601).
3312 case $target in
3313 *-darwin*)
3314     ;;
3315 *-beos*)
3316     ;;
3317 *-os2*)
3318     ;;
3320     AC_CHECK_LIB(m, atan)
3321     AC_CHECK_LIB(dl, dlopen,
3322     AC_CHECK_HEADER(dlfcn.h, 
3323         LIBS="-ldl $LIBS"
3324         AC_DEFINE(HAVE_LIBDL)))
3325     ;;
3326 esac
3328 _SAVE_CFLAGS="$CFLAGS"
3329 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3330 AC_CHECK_FUNCS(dladdr)
3331 CFLAGS="$_SAVE_CFLAGS"
3333 if test ! "$GNU_CXX"; then
3335     case $target in
3336     *-aix*)
3337         AC_CHECK_LIB(C_r, demangle)
3338         ;;
3339      *)
3340         AC_CHECK_LIB(C, demangle)
3341         ;;
3342      esac
3345 dnl OS/2 has socket in libc.
3346 case $target in
3347 *-os2*)
3348     ;;
3350     AC_CHECK_LIB(socket, socket)
3351 esac
3353 dnl ========================================================
3354 dnl Check whether we can compile code for Core Text
3355 dnl (available on Mac OS X 10.5 or later)
3356 dnl ========================================================
3357 case "$target" in
3358 *-darwin*)
3359   AC_MSG_CHECKING([for Core Text])
3360   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3361                  [CTLineRef lineRef;],
3362                   ac_cv_have_core_text="yes",
3363                   ac_cv_have_core_text="no")
3364   AC_MSG_RESULT([$ac_cv_have_core_text])
3366   if test "$ac_cv_have_core_text" = "no"; then
3367     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3368   fi
3369   ;;
3370 esac
3372 XLDFLAGS="$X_LIBS"
3373 XLIBS="$X_EXTRA_LIBS"
3375 dnl ========================================================
3376 dnl Checks for X libraries.
3377 dnl Ordering is important.
3378 dnl Xt is dependent upon SM as of X11R6
3379 dnl ========================================================
3380 if test "$no_x" = "yes"; then
3381     AC_DEFINE(NO_X11)
3382 else
3383     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3384         XLIBS="-lX11 $XLIBS"
3385         _SAVE_LDFLAGS="$LDFLAGS"
3386         LDFLAGS="$XLDFLAGS $LDFLAGS"
3387         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3388                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3389         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3390                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3391      
3392         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3393         unset ac_cv_lib_Xt_XtFree
3394             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3395             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3396         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3397                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3398         ])
3400     # AIX needs the motif library linked before libXt to prevent
3401     # crashes in plugins linked against Motif - Bug #98892
3402     case "${target_os}" in
3403     aix*)
3404         XT_LIBS="-lXm $XT_LIBS"
3405         ;;
3406     esac
3408     dnl ========================================================
3409     dnl = Check for XShm
3410     dnl ========================================================
3411     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3412         $XLIBS $XEXT_LIBS)
3413     AC_CHECK_HEADER(X11/extensions/XShm.h)
3414     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3415         test -n "$_HAVE_XSHM_XEXT"; then
3416         AC_DEFINE(HAVE_XSHM)
3417     fi
3419     dnl ========================================================
3420     dnl = Check for XIE
3421     dnl ========================================================
3422     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3423         $XLIBS $XEXT_LIBS)
3424     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3426     if test "$MOZ_XIE_LIBS"; then
3427         dnl ====================================================
3428         dnl = If XIE is present and is desired, turn it on
3429         dnl ====================================================
3430         case $target in
3431             *-hpux*)
3432                 ;;
3433             *)
3434                 HAVE_XIE=1
3435                 ;;
3436         esac
3437     fi
3439         LDFLAGS="$_SAVE_LDFLAGS"
3441     dnl ========================================================
3442     dnl = Check for freetype2 and its functionality
3443     dnl ========================================================
3444     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3446     if test "$_HAVE_FREETYPE2"; then
3447         _SAVE_LIBS="$LIBS"
3448         _SAVE_CFLAGS="$CFLAGS"
3449         LIBS="$LIBS $FT2_LIBS"
3450         CFLAGS="$CFLAGS $FT2_CFLAGS"
3452         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3453             ac_cv_member_FT_Bitmap_Size_y_ppem,
3454             [AC_TRY_COMPILE([#include <ft2build.h>
3455                              #include FT_FREETYPE_H],
3456                             [FT_Bitmap_Size s;
3457                              if (sizeof s.y_ppem) return 0;
3458                              return 1],
3459                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3460                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3461         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3462             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3463         else
3464             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3465         fi
3466         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3467                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3468                            [FT_Bitmap_Size structure includes y_ppem field])
3470         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3472         LIBS="$_SAVE_LIBS"
3473         CFLAGS="$_SAVE_CFLAGS"
3474     fi
3476 fi # $no_x
3478 AC_SUBST(XCFLAGS)
3479 AC_SUBST(XLDFLAGS)
3480 AC_SUBST(XLIBS)
3481 AC_SUBST(XEXT_LIBS)
3482 AC_SUBST(XT_LIBS)
3484 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3485 AC_TRY_COMPILE([],
3486                [asm("uqadd8 r1, r1, r2");],
3487                result="yes", result="no")
3488 AC_MSG_RESULT("$result")
3489 if test "$result" = "yes"; then
3490     AC_DEFINE(HAVE_ARM_SIMD)
3491     HAVE_ARM_SIMD=1
3493 AC_SUBST(HAVE_ARM_SIMD)
3495 AC_MSG_CHECKING(for ARM NEON support in compiler)
3496 _SAVE_CFLAGS="$CFLAGS"
3497 if test "$GNU_CC"; then
3498   # gcc needs -mfpu=neon to recognize NEON instructions
3499   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3501 AC_TRY_COMPILE([],
3502                [asm("vadd.i8 d0, d0, d0");],
3503                result="yes", result="no")
3504 AC_MSG_RESULT("$result")
3505 if test "$result" = "yes"; then
3506     AC_DEFINE(HAVE_ARM_NEON)
3507     HAVE_ARM_NEON=1
3509 CFLAGS="$_SAVE_CFLAGS"
3510 AC_SUBST(HAVE_ARM_NEON)
3512 dnl ========================================================
3513 dnl = pthread support
3514 dnl = Start by checking whether the system support pthreads
3515 dnl ========================================================
3516 case "$target_os" in
3517 darwin*)
3518     USE_PTHREADS=1
3519     ;;
3521     MOZ_CHECK_PTHREADS(pthreads,
3522         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3523         MOZ_CHECK_PTHREADS(pthread,
3524             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3525             MOZ_CHECK_PTHREADS(c_r,
3526                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3527                 MOZ_CHECK_PTHREADS(c,
3528                     USE_PTHREADS=1
3529                 )
3530             )
3531         )
3532     )
3533     ;;
3534 esac
3536 dnl ========================================================
3537 dnl Check the command line for --with-pthreads 
3538 dnl ========================================================
3539 MOZ_ARG_WITH_BOOL(pthreads,
3540 [  --with-pthreads         Force use of system pthread library with NSPR ],
3541 [ if test "$USE_PTHREADS"x = x; then
3542     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3543 fi],
3544     USE_PTHREADS=
3545     _PTHREAD_LDFLAGS=
3548 dnl ========================================================
3549 dnl Do the platform specific pthread hackery
3550 dnl ========================================================
3551 if test "$USE_PTHREADS"x != x
3552 then
3553         dnl
3554         dnl See if -pthread is supported.
3555         dnl
3556         rm -f conftest*
3557         ac_cv_have_dash_pthread=no
3558         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3559         echo 'int main() { return 0; }' | cat > conftest.c
3560         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3561         if test $? -eq 0; then
3562                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3563                         ac_cv_have_dash_pthread=yes
3564                 case "$target_os" in
3565                 freebsd*)
3566 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3567                 ;;
3568                 *)
3569                             CFLAGS="$CFLAGS -pthread"
3570                             CXXFLAGS="$CXXFLAGS -pthread"
3571                 ;;
3572                 esac
3573                 fi
3574         fi
3575         rm -f conftest*
3576     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3578         dnl
3579         dnl See if -pthreads is supported.
3580         dnl
3581     ac_cv_have_dash_pthreads=no
3582     if test "$ac_cv_have_dash_pthread" = "no"; then
3583             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3584         echo 'int main() { return 0; }' | cat > conftest.c
3585             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3586         if test $? -eq 0; then
3587                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3588                             ac_cv_have_dash_pthreads=yes
3589                             CFLAGS="$CFLAGS -pthreads"
3590                             CXXFLAGS="$CXXFLAGS -pthreads"
3591                     fi
3592             fi
3593             rm -f conftest*
3594         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3595     fi
3597         case "$target" in
3598             *-*-freebsd*)
3599                         AC_DEFINE(_REENTRANT)
3600                         AC_DEFINE(_THREAD_SAFE)
3601                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3602                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3603                                 _PTHREAD_LDFLAGS="-pthread"
3604                         else
3605                                 _PTHREAD_LDFLAGS="-lc_r"
3606                         fi
3607                         ;;
3609             *-*-openbsd*|*-*-bsdi*)
3610                         AC_DEFINE(_REENTRANT)
3611                         AC_DEFINE(_THREAD_SAFE)
3612                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3613                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3614                 _PTHREAD_LDFLAGS="-pthread"
3615                         fi
3616                         ;;
3618             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3619                         AC_DEFINE(_REENTRANT) 
3620                         ;;
3622             *-*-nto*) 
3623                         AC_DEFINE(_REENTRANT) 
3624                         ;;
3626             *-aix4.3*|*-aix5*)
3627                         AC_DEFINE(_REENTRANT) 
3628                         ;;
3630             *-hpux11.*)
3631                         AC_DEFINE(_REENTRANT) 
3632                         ;;
3634             alpha*-*-osf*)
3635                         AC_DEFINE(_REENTRANT)
3636                         ;;
3638             *-*-solaris*) 
3639                         AC_DEFINE(_REENTRANT)
3640                         if test "$SOLARIS_SUNPRO_CC"; then
3641                                 CFLAGS="$CFLAGS -mt" 
3642                                 CXXFLAGS="$CXXFLAGS -mt" 
3643                         fi
3644                         ;;
3645         esac
3646     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3649 dnl ========================================================
3650 dnl See if mmap sees writes
3651 dnl For cross compiling, just define it as no, which is a safe default
3652 dnl ========================================================
3653 AC_MSG_CHECKING(whether mmap() sees write()s)
3655 changequote(,)
3656 mmap_test_prog='
3657     #include <stdlib.h>
3658     #include <unistd.h>
3659     #include <sys/mman.h>
3660     #include <sys/types.h>
3661     #include <sys/stat.h>
3662     #include <fcntl.h>
3664     char fname[] = "conftest.file";
3665     char zbuff[1024]; /* Fractional page is probably worst case */
3667     int main() {
3668         char *map;
3669         int fd;
3670         int i;
3671         unlink(fname);
3672         fd = open(fname, O_RDWR | O_CREAT, 0660);
3673         if(fd<0) return 1;
3674         unlink(fname);
3675         write(fd, zbuff, sizeof(zbuff));
3676         lseek(fd, 0, SEEK_SET);
3677         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3678         if(map==(char*)-1) return 2;
3679         for(i=0; fname[i]; i++) {
3680             int rc = write(fd, &fname[i], 1);
3681             if(map[i]!=fname[i]) return 4;
3682         }
3683         return 0;
3684     }
3686 changequote([,])
3688 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3690 AC_MSG_RESULT("$result")
3692 if test "$result" = "no"; then
3693     AC_DEFINE(MMAP_MISSES_WRITES)
3697 dnl Checks for library functions.
3698 dnl ========================================================
3699 AC_PROG_GCC_TRADITIONAL
3700 AC_FUNC_MEMCMP
3701 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3702 AC_CHECK_FUNCS(flockfile getpagesize)
3703 AC_CHECK_FUNCS(localtime_r strtok_r)
3705 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3706 _SAVE_LDFLAGS=$LDFLAGS
3707 LDFLAGS="$LDFLAGS -lrt"
3708 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3709                ac_cv_have_clock_monotonic,
3710                [AC_TRY_LINK([#include <time.h>],
3711                             [ struct timespec ts;
3712                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3713                             ac_cv_have_clock_monotonic=yes,
3714                             ac_cv_have_clock_monotonic=no)])
3715 LDFLAGS=$_SAVE_LDFLAGS
3716 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3717     HAVE_CLOCK_MONOTONIC=1
3718     REALTIME_LIBS=-lrt
3719     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3720     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3721     AC_SUBST(REALTIME_LIBS)
3724 dnl check for wcrtomb/mbrtowc
3725 dnl =======================================================================
3726 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3727 AC_LANG_SAVE
3728 AC_LANG_CPLUSPLUS
3729 AC_CACHE_CHECK(for wcrtomb,
3730     ac_cv_have_wcrtomb,
3731     [AC_TRY_LINK([#include <wchar.h>],
3732                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3733                  ac_cv_have_wcrtomb="yes",
3734                  ac_cv_have_wcrtomb="no")])
3735 if test "$ac_cv_have_wcrtomb" = "yes"; then
3736     AC_DEFINE(HAVE_WCRTOMB)
3738 AC_CACHE_CHECK(for mbrtowc,
3739     ac_cv_have_mbrtowc,
3740     [AC_TRY_LINK([#include <wchar.h>],
3741                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3742                  ac_cv_have_mbrtowc="yes",
3743                  ac_cv_have_mbrtowc="no")])
3744 if test "$ac_cv_have_mbrtowc" = "yes"; then
3745     AC_DEFINE(HAVE_MBRTOWC)
3747 AC_LANG_RESTORE
3750 AC_CACHE_CHECK(
3751     [for res_ninit()],
3752     ac_cv_func_res_ninit,
3753     [AC_TRY_LINK([
3754         #ifdef linux
3755         #define _BSD_SOURCE 1
3756         #endif
3757         #include <resolv.h>
3758         ],
3759         [int foo = res_ninit(&_res);],
3760         [ac_cv_func_res_ninit=yes],
3761         [ac_cv_func_res_ninit=no])
3762     ])
3764 if test "$ac_cv_func_res_ninit" = "yes"; then
3765     AC_DEFINE(HAVE_RES_NINIT)
3766 dnl must add the link line we do something as foolish as this... dougt
3767 dnl else
3768 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3769 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3772 AC_LANG_CPLUSPLUS
3773 AC_CACHE_CHECK(
3774     [for gnu_get_libc_version()],
3775     ac_cv_func_gnu_get_libc_version,
3776     [AC_TRY_LINK([
3777         #ifdef HAVE_GNU_LIBC_VERSION_H
3778         #include <gnu/libc-version.h>
3779         #endif
3780         ],
3781         [const char *glibc_version = gnu_get_libc_version();],
3782         [ac_cv_func_gnu_get_libc_version=yes],
3783         [ac_cv_func_gnu_get_libc_version=no] 
3784         )]
3785     )
3787 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3788     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3791 case $target_os in
3792     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3793         ;;
3794     *)
3795     
3796 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3797     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3798         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3799 _SAVE_LIBS=$LIBS
3800 LIBS="$LIBS $_ICONV_LIBS"
3801 AC_CACHE_CHECK(
3802     [for iconv()],
3803     ac_cv_func_iconv,
3804     [AC_TRY_LINK([
3805         #include <stdlib.h>
3806         #include <iconv.h>
3807         ],
3808         [
3809             iconv_t h = iconv_open("", "");
3810             iconv(h, NULL, NULL, NULL, NULL);
3811             iconv_close(h);
3812         ],
3813         [ac_cv_func_iconv=yes],
3814         [ac_cv_func_iconv=no] 
3815         )]
3816     )
3817 if test "$ac_cv_func_iconv" = "yes"; then
3818     AC_DEFINE(HAVE_ICONV)
3819     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3820     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3821     LIBICONV="$_ICONV_LIBS"
3822     AC_CACHE_CHECK(
3823         [for iconv() with const input],
3824         ac_cv_func_const_iconv,
3825         [AC_TRY_COMPILE([
3826             #include <stdlib.h>
3827             #include <iconv.h>
3828             ],
3829             [
3830                 const char *input = "testing";
3831                 iconv_t h = iconv_open("", "");
3832                 iconv(h, &input, NULL, NULL, NULL);
3833                 iconv_close(h);
3834             ],
3835             [ac_cv_func_const_iconv=yes],
3836             [ac_cv_func_const_iconv=no] 
3837             )]
3838         )
3839     if test "$ac_cv_func_const_iconv" = "yes"; then
3840         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3841     fi
3843 LIBS=$_SAVE_LIBS
3845     ;;
3846 esac
3848 AM_LANGINFO_CODESET
3850 AC_LANG_C
3852 dnl **********************
3853 dnl *** va_copy checks ***
3854 dnl **********************
3855 dnl we currently check for all three va_copy possibilities, so we get
3856 dnl all results in config.log for bug reports.
3857 AC_MSG_CHECKING(for an implementation of va_copy())
3858 AC_CACHE_VAL(ac_cv_va_copy,[
3859     AC_TRY_RUN([
3860         #include <stdarg.h>
3861         void f (int i, ...) {
3862             va_list args1, args2;
3863             va_start (args1, i);
3864             va_copy (args2, args1);
3865             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3866                 exit (1);
3867             va_end (args1); va_end (args2);
3868         }
3869         int main() { f (0, 42); return 0; }],
3870         ac_cv_va_copy=yes,
3871         ac_cv_va_copy=no,
3872         ac_cv_va_copy=no
3873     )
3875 AC_MSG_RESULT($ac_cv_va_copy)
3876 AC_MSG_CHECKING(for an implementation of __va_copy())
3877 AC_CACHE_VAL(ac_cv___va_copy,[
3878     AC_TRY_RUN([
3879         #include <stdarg.h>
3880         void f (int i, ...) {
3881             va_list args1, args2;
3882             va_start (args1, i);
3883             __va_copy (args2, args1);
3884             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3885                 exit (1);
3886             va_end (args1); va_end (args2);
3887         }
3888         int main() { f (0, 42); return 0; }],
3889         ac_cv___va_copy=yes,
3890         ac_cv___va_copy=no,
3891         ac_cv___va_copy=no
3892     )
3894 AC_MSG_RESULT($ac_cv___va_copy)
3895 AC_MSG_CHECKING(whether va_lists can be copied by value)
3896 AC_CACHE_VAL(ac_cv_va_val_copy,[
3897     AC_TRY_RUN([
3898         #include <stdarg.h>
3899         void f (int i, ...) {
3900             va_list args1, args2;
3901             va_start (args1, i);
3902             args2 = args1;
3903             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3904                 exit (1);
3905             va_end (args1); va_end (args2);
3906         }
3907         int main() { f (0, 42); return 0; }],
3908         ac_cv_va_val_copy=yes,
3909         ac_cv_va_val_copy=no,
3910         ac_cv_va_val_copy=yes
3911     )
3913 if test "x$ac_cv_va_copy" = "xyes"; then
3914     AC_DEFINE(VA_COPY, va_copy)
3915     AC_DEFINE(HAVE_VA_COPY)
3916 elif test "x$ac_cv___va_copy" = "xyes"; then
3917     AC_DEFINE(VA_COPY, __va_copy)
3918     AC_DEFINE(HAVE_VA_COPY)
3921 if test "x$ac_cv_va_val_copy" = "xno"; then
3922    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3924 AC_MSG_RESULT($ac_cv_va_val_copy)
3926 dnl Check for dll-challenged libc's.
3927 dnl This check is apparently only needed for Linux.
3928 case "$target" in
3929         *-linux*)
3930             dnl ===================================================================
3931             _curdir=`pwd`
3932             export _curdir
3933             rm -rf conftest* _conftest
3934             mkdir _conftest
3935             cat >> conftest.C <<\EOF
3936 #include <stdio.h>
3937 #include <link.h>
3938 #include <dlfcn.h>
3939 #ifdef _dl_loaded
3940 void __dump_link_map(void) {
3941   struct link_map *map = _dl_loaded;
3942   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3944 int main() {
3945   dlopen("./conftest1.so",RTLD_LAZY);
3946   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3947   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3948   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3949   __dump_link_map();
3951 #else
3952 /* _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).*/
3953 int main() { printf("./conftest1.so\n"); }
3954 #endif
3957             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3959             cat >> conftest1.C <<\EOF
3960 #include <stdio.h>
3961 void foo(void) {printf("foo in dll called\n");}
3963             ${CXX-g++} -fPIC -c -g conftest1.C
3964             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3965             ${CXX-g++} -g conftest.C -o conftest -ldl
3966             cp -f conftest1.so conftest _conftest
3967             cd _conftest
3968             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3969             then
3970                 echo
3971                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3972                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3973                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3974                 echo "*** will be excessive memory usage at runtime."
3975                 echo
3976             fi
3977             cd ${_curdir}
3978             rm -rf conftest* _conftest
3979             dnl ===================================================================
3980             ;;
3981 esac
3983 dnl ===================================================================
3984 dnl ========================================================
3985 dnl By default, turn rtti and exceptions off on g++/egcs
3986 dnl ========================================================
3987 if test "$GNU_CXX"; then
3989   AC_MSG_CHECKING(for C++ exceptions flag)
3991   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3992   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3993   [echo "int main() { return 0; }" | cat > conftest.C
3995   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3997   if egrep "warning.*renamed" conftest.out >/dev/null; then
3998     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3999   else
4000     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
4001   fi
4003   rm -f conftest*])
4005   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
4006   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
4007   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
4010 dnl ========================================================
4011 dnl Put your C++ language/feature checks below
4012 dnl ========================================================
4013 AC_LANG_CPLUSPLUS
4015 ARM_ABI_PREFIX=
4016 HAVE_GCC3_ABI=
4017 if test "$GNU_CC"; then
4018   if test "$CPU_ARCH" = "arm" ; then
4019     AC_CACHE_CHECK(for ARM EABI,
4020         ac_cv_gcc_arm_eabi,
4021         [AC_TRY_COMPILE([],
4022                         [
4023 #if defined(__ARM_EABI__)
4024   return 0;
4025 #else
4026 #error Not ARM EABI.
4027 #endif
4028                         ],
4029                         ac_cv_gcc_arm_eabi="yes",
4030                         ac_cv_gcc_arm_eabi="no")])
4031     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4032         HAVE_ARM_EABI=1
4033         ARM_ABI_PREFIX=eabi-
4034     else
4035         ARM_ABI_PREFIX=oabi-
4036     fi
4037   fi
4039   AC_CACHE_CHECK(for gcc 3.0 ABI,
4040       ac_cv_gcc_three_abi,
4041       [AC_TRY_COMPILE([],
4042                       [
4043 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4044   return 0;
4045 #else
4046 #error Not gcc3.
4047 #endif
4048                       ],
4049                       ac_cv_gcc_three_abi="yes",
4050                       ac_cv_gcc_three_abi="no")])
4051   if test "$ac_cv_gcc_three_abi" = "yes"; then
4052       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4053       HAVE_GCC3_ABI=1
4054   else
4055       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4056   fi
4058 AC_SUBST(HAVE_GCC3_ABI)
4061 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4062                ac_cv_cpp_explicit,
4063                [AC_TRY_COMPILE(class X {
4064                                public: explicit X(int i) : i_(i) {}
4065                                private: int i_;
4066                                };,
4067                                X x(3);,
4068                                ac_cv_cpp_explicit=yes,
4069                                ac_cv_cpp_explicit=no)])
4070 if test "$ac_cv_cpp_explicit" = yes ; then
4071    AC_DEFINE(HAVE_CPP_EXPLICIT)
4074 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4075                ac_cv_cpp_typename,
4076                [AC_TRY_COMPILE(class param {
4077                                public:
4078                                    typedef unsigned long num_type;
4079                                };
4081                                template <class T> class tplt {
4082                                public:
4083                                    typedef typename T::num_type t_num_type;
4084                                    t_num_type foo(typename T::num_type num) {
4085                                        return num;
4086                                    }
4087                                };,
4088                                tplt<param> A;
4089                                A.foo(0);,
4090                                ac_cv_cpp_typename=yes,
4091                                ac_cv_cpp_typename=no)])
4092 if test "$ac_cv_cpp_typename" = yes ; then
4093    AC_DEFINE(HAVE_CPP_TYPENAME)
4096 dnl Check for support of modern template specialization syntax
4097 dnl Test code and requirement from scc@netscape.com.
4098 dnl Autoconf cut-and-paste job by waterson@netscape.com
4099 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4100                ac_cv_cpp_modern_specialize_template_syntax,
4101                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4102                                class Y {};
4103                                template <> struct X<Y> { double a; };,
4104                                X<int> int_x;
4105                                X<Y> y_x;,
4106                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4107                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4108 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4109   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4113 dnl Some compilers support only full specialization, and some don't.
4114 AC_CACHE_CHECK(whether partial template specialization works,
4115                ac_cv_cpp_partial_specialization,
4116                [AC_TRY_COMPILE(template <class T> class Foo {};
4117                                template <class T> class Foo<T*> {};,
4118                                return 0;,
4119                                ac_cv_cpp_partial_specialization=yes,
4120                                ac_cv_cpp_partial_specialization=no)])
4121 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4122   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4125 dnl Some compilers have limited support for operators with templates;
4126 dnl specifically, it is necessary to define derived operators when a base
4127 dnl class's operator declaration should suffice.
4128 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4129                ac_cv_need_derived_template_operators,
4130                [AC_TRY_COMPILE([template <class T> class Base { };
4131                                 template <class T>
4132                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4133                                 template <class T> class Derived : public Base<T> { };],
4134                                [Derived<char> a, b;
4135                                 Base<char> c = a + b;
4136                                 return 0;],
4137                                ac_cv_need_derived_template_operators=no,
4138                                ac_cv_need_derived_template_operators=yes)])
4139 if test "$ac_cv_need_derived_template_operators" = yes ; then
4140   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4144 dnl Some compilers have trouble detecting that a template class
4145 dnl that derives from another template is actually an instance
4146 dnl of the base class. This test checks for that.
4147 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4148                ac_cv_need_cpp_template_cast_to_base,
4149                [AC_TRY_COMPILE([template <class T> class Base { };
4150                                 template <class T> class Derived : public Base<T> { };
4151                                 template <class T> int foo(const Base<T>&) { return 0; }],
4152                                [Derived<char> bar; return foo(bar);],
4153                                ac_cv_need_cpp_template_cast_to_base=no,
4154                                ac_cv_need_cpp_template_cast_to_base=yes)])
4155 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4156   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4159 dnl Some compilers have trouble resolving the ambiguity between two
4160 dnl functions whose arguments differ only by cv-qualifications.
4161 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4162                ac_cv_can_resolve_const_ambiguity,
4163                [AC_TRY_COMPILE([
4164                                 template <class T> class ptrClass {
4165                                   public: T* ptr;
4166                                 };
4168                                 template <class T> T* a(ptrClass<T> *arg) {
4169                                   return arg->ptr;
4170                                 }
4172                                 template <class T>
4173                                 const T* a(const ptrClass<T> *arg) {
4174                                   return arg->ptr;
4175                                 }
4176                                ],
4177                                [ ptrClass<int> i;
4178                                  a(&i); ],
4179                                ac_cv_can_resolve_const_ambiguity=yes,
4180                                ac_cv_can_resolve_const_ambiguity=no)])
4181 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4182   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4186 dnl We don't do exceptions on unix.  The only reason this used to be here
4187 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4188 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4189 dnl So im commenting this out until someone writes some artificial 
4190 dnl intelligence to detect not only if the compiler has exceptions, but if 
4191 dnl they are enabled as well.
4192 dnl 
4193 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4194 dnl                ac_cv_cpp_exceptions,
4195 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4196 dnl                                static void F() { throw X(); },
4197 dnl                                try { F(); } catch(X & e) { },
4198 dnl                                ac_cv_cpp_exceptions=yes,
4199 dnl                                ac_cv_cpp_exceptions=no)])
4200 dnl if test $ac_cv_cpp_exceptions = yes ; then
4201 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4202 dnl fi
4204 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4205 dnl supports it well enough to allow us to use it to change access, but not
4206 dnl to resolve ambiguity. The next two tests determine how well the |using|
4207 dnl keyword is supported.
4209 dnl Check to see if we can change access with |using|.  Test both a
4210 dnl legal and an illegal example.
4211 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4212                ac_cv_cpp_access_changing_using2,
4213                [AC_TRY_COMPILE(
4214                    class A { protected: int foo() { return 0; } };
4215                    class B : public A { public: using A::foo; };,
4216                    B b; return b.foo();,
4217                    [AC_TRY_COMPILE(
4218                        class A { public: int foo() { return 1; } };
4219                        class B : public A { private: using A::foo; };,
4220                        B b; return b.foo();,
4221                        ac_cv_cpp_access_changing_using2=no,
4222                        ac_cv_cpp_access_changing_using2=yes)],
4223                    ac_cv_cpp_access_changing_using2=no)])
4224 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4225    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4228 dnl Check to see if we can resolve ambiguity with |using|.
4229 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4230                ac_cv_cpp_ambiguity_resolving_using,
4231                [AC_TRY_COMPILE(class X { 
4232                                  public: int go(const X&) {return 3;}
4233                                          int jo(const X&) {return 3;}
4234                                };
4235                                class Y : public X {
4236                                  public:  int go(int) {return 2;}
4237                                           int jo(int) {return 2;}
4238                                           using X::jo;
4239                                  private: using X::go;
4240                                };,
4241                                X x; Y y; y.jo(x);,
4242                                ac_cv_cpp_ambiguity_resolving_using=yes,
4243                                ac_cv_cpp_ambiguity_resolving_using=no)])
4244 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4245    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4248 dnl Check to see if the |std| namespace is supported. If so, we'll want
4249 dnl to qualify any standard library calls with "std::" to ensure that
4250 dnl those functions can be resolved.
4251 AC_CACHE_CHECK(for \"std::\" namespace,
4252                ac_cv_cpp_namespace_std,
4253                [AC_TRY_COMPILE([#include <algorithm>],
4254                                [return std::min(0, 1);],
4255                                ac_cv_cpp_namespace_std=yes,
4256                                ac_cv_cpp_namespace_std=no)])
4257 if test "$ac_cv_cpp_namespace_std" = yes ; then
4258    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4261 dnl Older compilers are overly ambitious with respect to using the standard
4262 dnl template library's |operator!=()| when |operator==()| is defined. In
4263 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4264 dnl ambiguity at compile-time. This test checks for that case.
4265 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4266                ac_cv_cpp_unambiguous_std_notequal,
4267                [AC_TRY_COMPILE([#include <algorithm>
4268                                 struct T1 {};
4269                                 int operator==(const T1&, const T1&) { return 0; }
4270                                 int operator!=(const T1&, const T1&) { return 0; }],
4271                                [T1 a,b; return a != b;],
4272                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4273                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4274 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4275   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4279 AC_CACHE_CHECK(for C++ reinterpret_cast,
4280                ac_cv_cpp_reinterpret_cast,
4281                [AC_TRY_COMPILE(struct X { int i; };
4282                                struct Y { int i; };,
4283                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4284                                ac_cv_cpp_reinterpret_cast=yes,
4285                                ac_cv_cpp_reinterpret_cast=no)])
4286 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4287    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4290 dnl See if a dynamic_cast to void* gives the most derived object.
4291 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4292                ac_cv_cpp_dynamic_cast_void_ptr,
4293                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4294                             class Y { int j; public: virtual ~Y() { } };
4295                             class Z : public X, public Y { int k; };
4297                             int main() {
4298                                  Z mdo;
4299                                  X *subx = (X*)&mdo;
4300                                  Y *suby = (Y*)&mdo;
4301                                  return !((((void*)&mdo != (void*)subx) &&
4302                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4303                                           (((void*)&mdo != (void*)suby) &&
4304                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4305                             }],
4306                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4307                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4308                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4309 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4310    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4314 dnl note that this one is reversed - if the test fails, then
4315 dnl we require implementations of unused virtual methods. Which
4316 dnl really blows because it means we'll have useless vtable
4317 dnl bloat.
4318 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4319                ac_cv_cpp_unused_required,
4320                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4321                                X x;,
4322                                ac_cv_cpp_unused_required=no,
4323                                ac_cv_cpp_unused_required=yes)])
4324 if test "$ac_cv_cpp_unused_required" = yes ; then
4325    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4329 dnl Some compilers have trouble comparing a constant reference to a templatized
4330 dnl class to zero, and require an explicit operator==() to be defined that takes
4331 dnl an int. This test separates the strong from the weak.
4333 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4334                ac_cv_trouble_comparing_to_zero,
4335                [AC_TRY_COMPILE([#include <algorithm>
4336                                 template <class T> class Foo {};
4337                                 class T2;
4338                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4339                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4340                                [Foo<int> f; return (0 != f);],
4341                                ac_cv_trouble_comparing_to_zero=no,
4342                                ac_cv_trouble_comparing_to_zero=yes)])
4343 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4344   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4347 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4348 _SAVE_LDFLAGS=$LDFLAGS
4349 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4350 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4351                ac_cv_thread_keyword,
4352                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4353                             [return tlsIsMainThread;],
4354                             ac_cv_thread_keyword=yes,
4355                             ac_cv_thread_keyword=no)])
4356 LDFLAGS=$_SAVE_LDFLAGS
4357 if test "$ac_cv_thread_keyword" = yes; then
4358   # mips builds fail with TLS variables because of a binutils bug.
4359   # See bug 528687
4360   case "${target_cpu}" in
4361     mips*)
4362       :
4363       ;;
4364     *)
4365       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4366       ;;
4367   esac
4370 dnl Check for the existence of various allocation headers/functions
4372 MALLOC_H=
4373 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4374 if test "$MALLOC_H" = ""; then
4375   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4376   if test "$MALLOC_H" = ""; then
4377     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4378   fi
4380 if test "$MALLOC_H" != ""; then
4381    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4384 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4385 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4387 dnl See if compiler supports some gcc-style attributes
4389 AC_CACHE_CHECK(for __attribute__((always_inline)),
4390                ac_cv_attribute_always_inline,
4391                [AC_TRY_COMPILE([],
4392                                [inline void f(void) __attribute__((always_inline));],
4393                                ac_cv_attribute_always_inline=yes,
4394                                ac_cv_attribute_always_inline=no)])
4396 AC_CACHE_CHECK(for __attribute__((malloc)),
4397                ac_cv_attribute_malloc,
4398                [AC_TRY_COMPILE([],
4399                                [void* f(int) __attribute__((malloc));],
4400                                ac_cv_attribute_malloc=yes,
4401                                ac_cv_attribute_malloc=no)])
4403 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4404                ac_cv_attribute_warn_unused,
4405                [AC_TRY_COMPILE([],
4406                                [int f(void) __attribute__((warn_unused_result));],
4407                                ac_cv_attribute_warn_unused=yes,
4408                                ac_cv_attribute_warn_unused=no)])
4410 AC_CACHE_CHECK(for __attribute__((noreturn)),
4411                ac_cv_attribute_noreturn,
4412                [AC_TRY_COMPILE([],
4413                                [void f(void) __attribute__((noreturn));],
4414                                ac_cv_attribute_noreturn=yes,
4415                                ac_cv_attribute_noreturn=no)])
4417 dnl End of C++ language/feature checks
4418 AC_LANG_C
4420 dnl ========================================================
4421 dnl =  Internationalization checks
4422 dnl ========================================================
4424 dnl Internationalization and Locale support is different
4425 dnl on various UNIX platforms.  Checks for specific i18n
4426 dnl features go here.
4428 dnl check for LC_MESSAGES
4429 AC_CACHE_CHECK(for LC_MESSAGES,
4430                 ac_cv_i18n_lc_messages,
4431                 [AC_TRY_COMPILE([#include <locale.h>],
4432                                 [int category = LC_MESSAGES;],
4433                                 ac_cv_i18n_lc_messages=yes,
4434                                 ac_cv_i18n_lc_messages=no)])
4435 if test "$ac_cv_i18n_lc_messages" = yes; then
4436    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4437 fi      
4439 fi # SKIP_COMPILER_CHECKS
4441 TARGET_XPCOM_ABI=
4442 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4443     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4446 dnl Mozilla specific options
4447 dnl ========================================================
4448 dnl The macros used for command line options
4449 dnl are defined in build/autoconf/altoptions.m4.
4451 dnl If the compiler supports these attributes, define them as
4452 dnl convenience macros.
4453 if test "$ac_cv_attribute_always_inline" = yes ; then
4454   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4455 else
4456   AC_DEFINE(NS_ALWAYS_INLINE,)
4459 if test "$ac_cv_attribute_malloc" = yes ; then
4460   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4461 else
4462   AC_DEFINE(NS_ATTR_MALLOC,)
4465 if test "$ac_cv_attribute_warn_unused" = yes ; then
4466   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4467 else
4468   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4471 if test "$ac_cv_attribute_noreturn" = yes ; then
4472   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4473 else
4474   AC_DEFINE(NS_NORETURN,)
4477 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4478 dnl features that Windows actually does support.
4480 if test -n "$SKIP_COMPILER_CHECKS"; then
4481    dnl Windows has malloc.h
4482    AC_DEFINE(MALLOC_H, [<malloc.h>])
4483    AC_DEFINE(HAVE_FORCEINLINE)
4484 fi # SKIP_COMPILER_CHECKS
4486 dnl ========================================================
4487 dnl =
4488 dnl = Check for external package dependencies
4489 dnl =
4490 dnl ========================================================
4491 MOZ_ARG_HEADER(External Packages)
4493 MOZ_ENABLE_LIBXUL=1
4495 MOZ_ARG_WITH_STRING(libxul-sdk,
4496 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4497   LIBXUL_SDK_DIR=$withval)
4499 if test "$LIBXUL_SDK_DIR" = "yes"; then
4500     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4501 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4502     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4504     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4505         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4506     fi
4508     MOZ_ENABLE_LIBXUL=1
4510 AC_SUBST(LIBXUL_SDK)
4512 if test -n "$LIBXUL_SDK"; then
4513     LIBXUL_DIST="$LIBXUL_SDK"
4514 else
4515     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4517 AC_SUBST(LIBXUL_DIST)
4519 SYSTEM_LIBXUL=
4521 MOZ_ARG_WITH_BOOL(system-libxul,
4522 [  --with-system-libxul   Use system installed libxul SDK],
4523     SYSTEM_LIBXUL=1)
4525 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4526     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4529 dnl ========================================================
4530 dnl = If NSPR was not detected in the system, 
4531 dnl = use the one in the source tree (mozilla/nsprpub)
4532 dnl ========================================================
4533 MOZ_ARG_WITH_BOOL(system-nspr,
4534 [  --with-system-nspr      Use system installed NSPR],
4535     _USE_SYSTEM_NSPR=1 )
4537 if test -n "$_USE_SYSTEM_NSPR"; then
4538     AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4541 if test -n "$MOZ_NATIVE_NSPR"; then
4542     _SAVE_CFLAGS=$CFLAGS
4543     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4544     AC_TRY_COMPILE([#include "prlog.h"],
4545                 [#ifndef PR_STATIC_ASSERT
4546                  #error PR_STATIC_ASSERT not defined
4547                  #endif],
4548                 [MOZ_NATIVE_NSPR=1],
4549                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4550     CFLAGS=$_SAVE_CFLAGS
4551 else
4552     if test "$OS_ARCH" = "WINCE"; then
4553         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4554         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4555     elif test "$OS_ARCH" = "WINNT"; then
4556         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4557         if test -n "$GNU_CC"; then
4558             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4559         else
4560             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4561         fi
4562     else
4563         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4564         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4565     fi
4568 dnl system libevent Support
4569 dnl ========================================================
4570 MOZ_ARG_WITH_STRING(system-libevent,
4571 [  --with-system-libevent=[PFX]
4572                           Use system libevent [installed at prefix PFX]],
4573     LIBEVENT_DIR=$withval)
4575 _SAVE_CFLAGS=$CFLAGS
4576 _SAVE_LDFLAGS=$LDFLAGS
4577 _SAVE_LIBS=$LIBS
4578 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4579     MOZ_NATIVE_LIBEVENT=
4580 else
4581     if test "${LIBEVENT_DIR}" = "yes"; then
4582         LIBEVENT_DIR=/usr
4583     fi
4584     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4585     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4586     AC_CHECK_HEADER(event.h,
4587                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4588                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4589                      fi],
4590                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4591     AC_CHECK_LIB(event, event_init,
4592                  [MOZ_NATIVE_LIBEVENT=1
4593                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4594                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4595                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4597 CFLAGS=$_SAVE_CFLAGS
4598 LDFLAGS=$_SAVE_LDFLAGS
4599 LIBS=$_SAVE_LIBS
4601 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4602 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4603 AC_SUBST(MOZ_LIBEVENT_LIBS)
4605 dnl ========================================================
4606 dnl = If NSS was not detected in the system, 
4607 dnl = use the one in the source tree (mozilla/security/nss)
4608 dnl ========================================================
4610 MOZ_ARG_WITH_BOOL(system-nss,
4611 [  --with-system-nss      Use system installed NSS],
4612     _USE_SYSTEM_NSS=1 )
4614 if test -n "$_USE_SYSTEM_NSS"; then
4615     AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4618 if test -n "$MOZ_NATIVE_NSS"; then
4619    NSS_LIBS="$NSS_LIBS -lcrmf"
4620 else
4621    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4622    NSS_DEP_LIBS="\
4623         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4624         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4625         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4626         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4627         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4629    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4630        NSS_LIBS="\
4631         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4632         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4633         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4634         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4635         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4636    else
4637        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4638    fi
4641 if test -z "$SKIP_LIBRARY_CHECKS"; then
4642 dnl system JPEG support
4643 dnl ========================================================
4644 MOZ_ARG_WITH_STRING(system-jpeg,
4645 [  --with-system-jpeg[=PFX]
4646                           Use system libjpeg [installed at prefix PFX]],
4647     JPEG_DIR=$withval)
4649 _SAVE_CFLAGS=$CFLAGS
4650 _SAVE_LDFLAGS=$LDFLAGS
4651 _SAVE_LIBS=$LIBS
4652 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4653     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4654     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4656 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4657     SYSTEM_JPEG=
4658 else
4659     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4662 if test "$SYSTEM_JPEG" = 1; then
4663     LIBS="$JPEG_LIBS $LIBS"
4664     AC_TRY_COMPILE([ #include <stdio.h>
4665                      #include <sys/types.h>
4666                      #include <jpeglib.h> ],
4667                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4668                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4669                      #endif ],
4670                    SYSTEM_JPEG=1,
4671                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4672 fi 
4673 CFLAGS=$_SAVE_CFLAGS
4674 LDFLAGS=$_SAVE_LDFLAGS
4675 LIBS=$_SAVE_LIBS
4677 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4678     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4679     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4682 dnl system ZLIB support
4683 dnl ========================================================
4684 MOZ_ARG_WITH_STRING(system-zlib,
4685 [  --with-system-zlib[=PFX]
4686                           Use system libz [installed at prefix PFX]],
4687     ZLIB_DIR=$withval)
4689 _SAVE_CFLAGS=$CFLAGS
4690 _SAVE_LDFLAGS=$LDFLAGS
4691 _SAVE_LIBS=$LIBS
4692 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4693     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4694     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4696 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4697     SYSTEM_ZLIB=
4698 else
4699     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4700         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4702 if test "$SYSTEM_ZLIB" = 1; then
4703     LIBS="$ZLIB_LIBS $LIBS"
4704     AC_TRY_COMPILE([ #include <stdio.h>
4705                      #include <string.h>
4706                      #include <zlib.h> ],
4707                    [ #if ZLIB_VERNUM < $MOZZLIB 
4708                      #error "Insufficient zlib version ($MOZZLIB required)."
4709                      #endif ],
4710                    SYSTEM_ZLIB=1,
4711                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4713 CFLAGS=$_SAVE_CFLAGS
4714 LDFLAGS=$_SAVE_LDFLAGS
4715 LIBS=$_SAVE_LIBS
4717 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4718     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4719     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4722 dnl system BZIP2 Support
4723 dnl ========================================================
4724 MOZ_ARG_WITH_STRING(system-bz2,
4725 [  --with-system-bz2[=PFX]
4726                           Use system libbz2 [installed at prefix PFX]],
4727     BZ2_DIR=$withval)
4729 _SAVE_CFLAGS=$CFLAGS
4730 _SAVE_LDFLAGS=$LDFLAGS
4731 _SAVE_LIBS=$LIBS
4732 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4733     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4734     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4736 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4737     SYSTEM_BZ2=
4738 else
4739     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4740         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4742 CFLAGS=$_SAVE_CFLAGS
4743 LDFLAGS=$_SAVE_LDFLAGS
4744 LIBS=$_SAVE_LIBS
4746 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4747     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4748     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4751 dnl system PNG Support
4752 dnl ========================================================
4753 MOZ_ARG_WITH_STRING(system-png, 
4754 [  --with-system-png[=PFX]
4755                           Use system libpng [installed at prefix PFX]],
4756     PNG_DIR=$withval)
4758 _SAVE_CFLAGS=$CFLAGS
4759 _SAVE_LDFLAGS=$LDFLAGS
4760 _SAVE_LIBS=$LIBS
4761 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4762 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4763 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4764     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4765     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4767 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4768     SYSTEM_PNG=
4769 else
4770     _SAVE_PNG_LIBS=$PNG_LIBS
4771     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4772                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4773                  $PNG_LIBS)
4774     AC_CHECK_LIB(png, png_get_acTL, ,
4775                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4776                  $_SAVE_PNG_LIBS)
4778 if test "$SYSTEM_PNG" = 1; then
4779     LIBS="$PNG_LIBS $LIBS"
4780     AC_TRY_COMPILE([ #include <stdio.h>
4781                      #include <sys/types.h>
4782                      #include <png.h> ],
4783                    [ #if PNG_LIBPNG_VER < $MOZPNG
4784                      #error "Insufficient libpng version ($MOZPNG required)."
4785                      #endif
4786                      #ifndef PNG_UINT_31_MAX
4787                      #error "Insufficient libpng version."
4788                      #endif ],
4789                    SYSTEM_PNG=1,
4790                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4792 CFLAGS=$_SAVE_CFLAGS
4793 LDFLAGS=$_SAVE_LDFLAGS
4794 LIBS=$_SAVE_LIBS
4796 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4797     PNG_CFLAGS="-I${PNG_DIR}/include"
4798     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4801 fi # SKIP_LIBRARY_CHECKS
4803 dnl system HunSpell Support
4804 dnl ========================================================
4805 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4806 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4807     SYSTEM_HUNSPELL=1 )
4809 if test -n "$SYSTEM_HUNSPELL"; then
4810     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4813 AC_SUBST(SYSTEM_HUNSPELL)
4815 dnl ========================================================
4816 dnl Java SDK support
4817 dnl ========================================================
4818 JAVA_INCLUDE_PATH=
4819 MOZ_ARG_WITH_STRING(java-include-path,
4820 [  --with-java-include-path=dir   Location of Java SDK headers],
4821     JAVA_INCLUDE_PATH=$withval)
4823 JAVA_BIN_PATH=
4824 MOZ_ARG_WITH_STRING(java-bin-path,
4825 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4826     JAVA_BIN_PATH=$withval)
4828 dnl ========================================================
4829 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4830 dnl their usage and use them in spidermonkey.
4831 dnl ========================================================
4832 MOZ_ARG_WITH_BOOL(arm-kuser,
4833 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4834     USE_ARM_KUSER=1,
4835     USE_ARM_KUSER=)
4836 if test -n "$USE_ARM_KUSER"; then
4837    AC_DEFINE(USE_ARM_KUSER)
4840 dnl ========================================================
4841 dnl =
4842 dnl = Application
4843 dnl =
4844 dnl ========================================================
4846 MOZ_ARG_HEADER(Application)
4848 BUILD_STATIC_LIBS=
4849 ENABLE_TESTS=1
4850 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4851 MOZ_BRANDING_DIRECTORY=
4852 MOZ_OFFICIAL_BRANDING=
4853 MOZ_FEEDS=1
4854 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4855 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4856 MOZ_IPC=1
4857 MOZ_JAVAXPCOM=
4858 MOZ_JSDEBUGGER=1
4859 MOZ_JSLOADER=1
4860 MOZ_MATHML=1
4861 MOZ_MORK=
4862 MOZ_MORKREADER=1
4863 MOZ_AUTH_EXTENSION=1
4864 MOZ_NO_ACTIVEX_SUPPORT=1
4865 MOZ_NO_INSPECTOR_APIS=
4866 MOZ_NO_FAST_LOAD=
4867 MOZ_OGG=1
4868 MOZ_SYDNEYAUDIO=
4869 MOZ_WAVE=1
4870 MOZ_MEDIA=
4871 MOZ_PANGO=1
4872 MOZ_PERMISSIONS=1
4873 MOZ_PLACES=1
4874 MOZ_PLAINTEXT_EDITOR_ONLY=
4875 MOZ_PLUGINS=1
4876 MOZ_PREF_EXTENSIONS=1
4877 MOZ_PROFILELOCKING=1
4878 MOZ_PSM=1
4879 MOZ_RDF=1
4880 MOZ_REFLOW_PERF=
4881 MOZ_SAFE_BROWSING=
4882 MOZ_FASTSTART=
4883 MOZ_HELP_VIEWER=
4884 MOZ_SPELLCHECK=1
4885 MOZ_SPLASHSCREEN=
4886 MOZ_STORAGE=1
4887 MOZ_SVG=1
4888 MOZ_TIMELINE=
4889 MOZ_TOOLKIT_SEARCH=1
4890 MOZ_UI_LOCALE=en-US
4891 MOZ_UNIVERSALCHARDET=1
4892 MOZ_URL_CLASSIFIER=
4893 MOZ_USE_NATIVE_UCONV=
4894 MOZ_VIEW_SOURCE=1
4895 MOZ_XPINSTALL=1
4896 MOZ_XSLT_STANDALONE=
4897 MOZ_XTF=1
4898 MOZ_XUL=1
4899 MOZ_ZIPWRITER=1
4900 NS_PRINTING=1
4901 NECKO_WIFI=1
4902 NECKO_COOKIES=1
4903 NECKO_DISK_CACHE=1
4904 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4905 BUILD_CTYPES=1
4906 XPC_IDISPATCH_SUPPORT=
4909 case "$target_os" in
4910 darwin*|*wince*|*winmo*)
4911     ACCESSIBILITY=
4912     ;;
4914     ACCESSIBILITY=1
4915     ;;
4916 esac
4918 case "$target_os" in
4919     msvc*|mks*|cygwin*|mingw*)
4920         NS_ENABLE_TSF=1
4921         if test -z "$GNU_CC"; then 
4922             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4923                 NS_ENABLE_TSF=
4924             fi
4925             XPC_IDISPATCH_SUPPORT=1
4926             MOZ_NO_ACTIVEX_SUPPORT=
4927         fi
4928         if test -n "$NS_ENABLE_TSF"; then
4929             AC_DEFINE(NS_ENABLE_TSF)
4930         fi
4931         ;;
4932 esac
4934 MOZ_ARG_ENABLE_STRING(application,
4935 [  --enable-application=APP
4936                           Options include:
4937                             browser (Firefox)
4938                             xulrunner
4939                             content/xslt (Standalone Transformiix XSLT)
4940                             netwerk (Standalone Necko)
4941                             tools/update-packaging (AUS-related packaging tools)
4942                             standalone (use this for standalone
4943                               xpcom/xpconnect or to manually drive a build)],
4944 [ MOZ_BUILD_APP=$enableval ] )
4946 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4947 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4948   XULRUNNER_STUB_NAME=$withval)
4950 if test -z "$XULRUNNER_STUB_NAME"; then
4951   case "$target_os" in
4952   darwin*)
4953     XULRUNNER_STUB_NAME=xulrunner
4954     ;;
4955   *)
4956     XULRUNNER_STUB_NAME=xulrunner-stub
4957   esac
4959 AC_SUBST(XULRUNNER_STUB_NAME)
4961 if test -z "$MOZ_BUILD_APP"; then
4962   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4963 else
4964   # We have a valid application only if it has a build.mk file in its top
4965   # directory.
4966   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4967     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4968   fi
4971 # Allow the application to influence configure with a confvars.sh script.
4973 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4974 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4975   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4976   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4977 else
4978   AC_MSG_RESULT([no])
4981 # Now is a good time to test for logic errors, define mismatches, etc.
4982 case "$MOZ_BUILD_APP" in
4983 xulrunner)
4984   if test "$LIBXUL_SDK"; then
4985     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4986   fi
4987   ;;
4988 esac
4990 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4991 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4992 # MOZ_BUILD_APP.
4993 case "$MOZ_BUILD_APP" in
4994 browser)
4995   AC_DEFINE(MOZ_PHOENIX)
4996   ;;
4998 xulrunner)
4999   AC_DEFINE(MOZ_XULRUNNER)
5000   ;;
5002 content/xslt)
5003   AC_DEFINE(TX_EXE)
5004   ;;
5006 standalone) 
5007   MOZ_APP_NAME=mozilla
5008   MOZ_APP_DISPLAYNAME=Mozilla
5009   MOZ_APP_VERSION=$MOZILLA_VERSION
5010   ;;
5012 esac
5014 AC_SUBST(MOZ_BUILD_APP)
5015 AC_SUBST(MOZ_PHOENIX)
5016 AC_SUBST(MOZ_XULRUNNER)
5018 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5020 dnl ========================================================
5021 dnl = 
5022 dnl = Toolkit Options
5023 dnl = 
5024 dnl ========================================================
5025 MOZ_ARG_HEADER(Toolkit Options)
5027     dnl ========================================================
5028     dnl = Select the default toolkit
5029     dnl ========================================================
5030         MOZ_ARG_ENABLE_STRING(default-toolkit,
5031         [  --enable-default-toolkit=TK
5032                           Select default toolkit
5033                           Platform specific defaults:
5034                             BeOS - cairo-beos
5035                             Mac OS X - cairo-cocoa
5036                             Neutrino/QNX - photon
5037                             OS/2 - cairo-os2
5038                             Win32/WinCE - cairo-windows
5039                             Gtk2 with DirectFB - cairo-gtk2-dfb
5040                             * - cairo-gtk2
5041                             * - cairo-qt],
5042     [ _DEFAULT_TOOLKIT=$enableval ],
5043     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5045     if test "$_DEFAULT_TOOLKIT" = "photon" \
5046         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5047         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5048         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5049         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5050         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5051         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5052         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5053         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
5054     then
5055         dnl nglayout only supports building with one toolkit,
5056         dnl so ignore everything after the first comma (",").
5057         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5058     else
5059         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5060     fi
5062 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
5064 dnl ========================================================
5065 dnl = Enable the toolkit as needed                         =
5066 dnl ========================================================
5068 case "$MOZ_WIDGET_TOOLKIT" in
5069 photon)
5070         MOZ_ENABLE_PHOTON=1
5071         AC_DEFINE(MOZ_WIDGET_PHOTON)
5072     ;;
5074 cairo-windows)
5075     MOZ_WIDGET_TOOLKIT=windows
5076     MOZ_WEBGL=1
5077     case "${target}" in
5078     *-wince*)
5079         NS_PRINTING=
5080         ;;
5081     esac
5082     ;;
5084 cairo-gtk2|cairo-gtk2-x11)
5085     MOZ_WIDGET_TOOLKIT=gtk2
5086     MOZ_ENABLE_GTK2=1
5087     MOZ_ENABLE_XREMOTE=1
5088     MOZ_WEBGL=1
5089     MOZ_WEBGL_GLX=1
5091     AC_DEFINE(MOZ_X11)
5092     MOZ_X11=1
5093     USE_FC_FREETYPE=1
5095     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5096     TK_LIBS='$(MOZ_GTK2_LIBS)'
5097     AC_DEFINE(MOZ_WIDGET_GTK2)
5098     ;;
5100 cairo-gtk2-dfb)
5101     MOZ_WIDGET_TOOLKIT=gtk2
5102     MOZ_ENABLE_GTK2=1
5103     MOZ_WEBGL=
5105     AC_DEFINE(MOZ_DFB)
5106     MOZ_DFB=1
5108     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5109     TK_LIBS='$(MOZ_GTK2_LIBS)'
5110     AC_DEFINE(MOZ_WIDGET_GTK2)
5111     if test "$no_x" != "yes"; then
5112         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5113         no_x=yes
5114     fi
5115     ;;
5117 cairo-qt)
5118     MOZ_WIDGET_TOOLKIT=qt
5119     MOZ_ENABLE_QT=1
5120     MOZ_ENABLE_XREMOTE=1
5121     MOZ_WEBGL=1
5122     MOZ_WEBGL_GLX=1
5123     USE_ELF_DYNSTR_GC=
5124     NS_PRINTING=
5126     AC_DEFINE(MOZ_X11)
5127     MOZ_X11=1
5128     USE_FC_FREETYPE=1
5130     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5131     TK_LIBS='$(MOZ_QT_LIBS)'
5132     AC_DEFINE(MOZ_WIDGET_QT)
5133     ;;
5135 cairo-beos)
5136     MOZ_WIDGET_TOOLKIT=beos
5137     USE_FC_FREETYPE=1
5138     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5139     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5140     ;;
5142 cairo-os2)
5143     MOZ_WIDGET_TOOLKIT=os2
5144     USE_FC_FREETYPE=1
5145     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5146     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5147     ;;
5149 cairo-cocoa)
5150     MOZ_WIDGET_TOOLKIT=cocoa
5151     AC_DEFINE(MOZ_WIDGET_COCOA)
5152     MOZ_USER_DIR="Mozilla"
5153     AC_DEFINE(XP_MACOSX)
5154     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5155     TK_CFLAGS="-DNO_X11"
5156     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5157     CFLAGS="$CFLAGS $TK_CFLAGS"
5158     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5159     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5160     MOZ_FS_LAYOUT=bundle
5161     MOZ_WEBGL=1
5162     ;;
5163 esac
5165 if test "$MOZ_ENABLE_XREMOTE"; then
5166     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5169 if test "$COMPILE_ENVIRONMENT"; then
5170   if test "$MOZ_ENABLE_GTK2"; then
5171     if test "$MOZ_X11"; then
5172       GDK_PACKAGES=gdk-x11-2.0
5173     elif test "$MOZ_DFB"; then
5174       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5175       GDK_PACKAGES=directfb
5176     fi
5178     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5179   fi
5181 fi # COMPILE_ENVIRONMENT
5183 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
5184 AC_SUBST(MOZ_FS_LAYOUT)
5186 dnl ========================================================
5187 dnl = startup-notification support module
5188 dnl ========================================================
5190 if test "$MOZ_ENABLE_GTK2"
5191 then
5192     MOZ_ENABLE_STARTUP_NOTIFICATION=
5194     MOZ_ARG_ENABLE_BOOL(startup-notification,
5195     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
5196         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5197         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5198     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5199     then
5200         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5201                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5202         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5203             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5204             then
5205                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5206             fi
5207             MOZ_ENABLE_STARTUP_NOTIFICATION=
5208         ])
5209     fi
5211     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5212         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5213     fi
5215     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5217 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5218 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5219 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5221 dnl ========================================================
5222 dnl = QT support
5223 dnl ========================================================
5224 if test "$MOZ_ENABLE_QT"
5225 then
5226     MOZ_ARG_WITH_STRING(qtdir,
5227     [  --with-qtdir=\$dir       Specify Qt directory ],
5228     [ QTDIR=$withval])
5230     if test -z "$QTDIR"; then
5231         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5232         AC_CHECK_PROGS(HOST_MOC, moc, "")
5233     else
5234         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5236         MOZ_QT_CFLAGS="-DQT_SHARED"
5237         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5238         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5239         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5240         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5241         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5242         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5243         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5244         HOST_MOC="$QTDIR/bin/moc"
5245     fi
5246     if test -z "$HOST_MOC"; then
5247         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5248 incorrect])
5249     fi
5250     MOC=$HOST_MOC
5253 AC_SUBST(GTK_CONFIG)
5254 AC_SUBST(TK_CFLAGS)
5255 AC_SUBST(TK_LIBS)
5257 AC_SUBST(MOZ_ENABLE_GTK2)
5258 AC_SUBST(MOZ_ENABLE_PHOTON)
5259 AC_SUBST(MOZ_ENABLE_QT)
5260 AC_SUBST(MOZ_ENABLE_XREMOTE)
5261 AC_SUBST(MOZ_GTK2_CFLAGS)
5262 AC_SUBST(MOZ_GTK2_LIBS)
5263 AC_SUBST(MOZ_QT_CFLAGS)
5264 AC_SUBST(MOZ_QT_LIBS)
5266 AC_SUBST(MOC)
5268 AC_SUBST(MOZ_DFB)
5269 AC_SUBST(MOZ_X11)
5271 dnl ========================================================
5272 dnl =
5273 dnl = Components & Features
5274 dnl = 
5275 dnl ========================================================
5276 MOZ_ARG_HEADER(Components and Features)
5278 dnl ========================================================
5279 dnl = Localization
5280 dnl ========================================================
5281 MOZ_ARG_ENABLE_STRING(ui-locale,
5282 [  --enable-ui-locale=ab-CD
5283                           Select the user interface locale (default: en-US)],
5284     MOZ_UI_LOCALE=$enableval )
5285 AC_SUBST(MOZ_UI_LOCALE)
5287 dnl ========================================================
5288 dnl = Trademarked Branding 
5289 dnl ========================================================
5290 MOZ_ARG_ENABLE_BOOL(official-branding,
5291 [  --enable-official-branding Enable Official mozilla.org Branding
5292                           Do not distribute builds with
5293                           --enable-official-branding unless you have
5294                           permission to use trademarks per
5295                           http://www.mozilla.org/foundation/trademarks/ .],
5297   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5298     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5299   else
5300     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5301     MOZ_OFFICIAL_BRANDING=1
5302   fi
5303 ], MOZ_OFFICIAL_BRANDING=)
5305 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5306 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5307   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5310 MOZ_ARG_WITH_STRING(branding,
5311 [  --with-branding=dir    Use branding from the specified directory.],
5312     MOZ_BRANDING_DIRECTORY=$withval)
5314 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5315 if test -z "$REAL_BRANDING_DIRECTORY"; then
5316   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5319 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5320   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5323 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5325 dnl ========================================================
5326 dnl = Distribution ID
5327 dnl ========================================================
5328 MOZ_ARG_WITH_STRING(distribution-id,
5329 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
5330 [ val=`echo $withval`
5331     MOZ_DISTRIBUTION_ID="$val"])
5333 if test -z "$MOZ_DISTRIBUTION_ID"; then
5334    MOZ_DISTRIBUTION_ID="org.mozilla"
5337 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5338 AC_SUBST(MOZ_DISTRIBUTION_ID)
5341 dnl ========================================================
5342 dnl complex text support off by default
5343 dnl ========================================================
5344 MOZ_ARG_DISABLE_BOOL(pango,
5345 [  --disable-pango Disable usage of Pango ],
5346     MOZ_PANGO=,
5347     MOZ_PANGO=1)
5349 dnl ========================================================
5350 dnl = Pango
5351 dnl ========================================================
5352 if test "$MOZ_ENABLE_GTK2"
5353 then
5354     AC_SUBST(MOZ_PANGO)
5356     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5358     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5359     AC_SUBST(MOZ_PANGO_CFLAGS)
5360     AC_SUBST(MOZ_PANGO_LIBS)
5361     if test "$MOZ_PANGO"
5362     then
5363         AC_DEFINE(MOZ_PANGO)
5364     else
5365         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5366         AC_SUBST(FT2_CFLAGS)
5367         AC_SUBST(FT2_LIBS)
5368     fi
5371 if test "$MOZ_ENABLE_QT"
5372 then
5373     if test "$MOZ_PANGO"
5374     then
5375         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5376         [
5377             AC_SUBST(MOZ_PANGO_CFLAGS)
5378             AC_SUBST(MOZ_PANGO_LIBS)
5379             AC_DEFINE(MOZ_PANGO)
5380         ],
5381         [
5382             echo "Pango library not found, will use FT2 font engine"
5383             MOZ_PANGO=
5384         ])
5385     fi
5386     AC_SUBST(MOZ_PANGO)
5389 dnl ========================================================
5390 dnl = GnomeVFS, GIO and GConf support module
5391 dnl ========================================================
5393 if test "$MOZ_X11"
5394 then
5395     dnl build the gnomevfs extension by default only when the
5396     dnl GTK2 toolkit is in use.
5397     if test "$MOZ_ENABLE_GTK2"
5398     then
5399         MOZ_ENABLE_GNOMEVFS=1
5400         MOZ_ENABLE_GCONF=1
5401     fi
5403     dnl ========================================================
5404     dnl = GnomeVFS support module
5405     dnl ========================================================
5406     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5407     [  --disable-gnomevfs      Disable GnomeVFS support ],
5408         MOZ_ENABLE_GNOMEVFS=,
5409         MOZ_ENABLE_GNOMEVFS=force)
5411     if test "$MOZ_ENABLE_GNOMEVFS"
5412     then
5413         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5414             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5415             MOZ_ENABLE_GNOMEVFS=1
5416             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5417         ],[
5418             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5419             then
5420                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5421             fi
5422             MOZ_ENABLE_GNOMEVFS=
5423         ])
5424     else
5425         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5426             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5427               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5428             ])
5429         fi
5430     fi
5432     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5433     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5434     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5436     dnl ========================================================
5437     dnl = GIO support module
5438     dnl ========================================================
5439     MOZ_ARG_ENABLE_BOOL(gio,
5440     [  --enable-gio            Enable GIO support (default: disabled)],
5441         MOZ_ENABLE_GIO=force,
5442         MOZ_ENABLE_GIO=)
5444     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5445     then
5446         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5447             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5448             MOZ_ENABLE_GIO=1
5449             AC_DEFINE(MOZ_ENABLE_GIO)
5450         ],[
5451             if test "$MOZ_ENABLE_GIO" = "force"
5452             then
5453                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5454             fi
5455             MOZ_ENABLE_GIO=
5456         ])
5457     fi
5459     AC_SUBST(MOZ_ENABLE_GIO)
5460     AC_SUBST(MOZ_GIO_CFLAGS)
5461     AC_SUBST(MOZ_GIO_LIBS)
5462    
5463     dnl ========================================================
5464     dnl = GConf support module
5465     dnl ========================================================
5466     if test "$MOZ_ENABLE_GCONF"
5467     then
5468         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5469             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5470             MOZ_ENABLE_GCONF=1
5471         ],[
5472             if test "$MOZ_ENABLE_GCONF" = "force"
5473             then
5474                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5475             fi
5476             MOZ_ENABLE_GCONF=
5477         ])
5478     fi
5480     if test "$MOZ_ENABLE_GCONF"; then
5481         AC_DEFINE(MOZ_ENABLE_GCONF)
5482     fi
5484     AC_SUBST(MOZ_ENABLE_GCONF)
5485     AC_SUBST(MOZ_GCONF_CFLAGS)
5486     AC_SUBST(MOZ_GCONF_LIBS)
5489 dnl ========================================================
5490 dnl = libnotify support
5491 dnl ========================================================
5493 if test "$MOZ_ENABLE_GTK2"
5494 then
5495     MOZ_ENABLE_LIBNOTIFY=1
5497     MOZ_ARG_DISABLE_BOOL(libnotify,
5498     [  --disable-libnotify       Disable libnotify support ],
5499     MOZ_ENABLE_LIBNOTIFY=,
5500     MOZ_ENABLE_LIBNOTIFY=1)
5502     if test "$MOZ_ENABLE_LIBNOTIFY"
5503     then
5504         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5505     fi
5508 if test -z "$SKIP_LIBRARY_CHECKS"
5509 then
5510     if test "$MOZ_ENABLE_GTK2"
5511     then
5512         if test "$MOZ_ENABLE_LIBNOTIFY"
5513         then
5514             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5515         fi
5516     fi
5518 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5519 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5520 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5522 dnl ========================================================
5523 dnl = GNOME component (mozgnome)
5524 dnl ========================================================
5526 # The GNOME component is built if one of 
5527 # gnome-vfs, gio, gconf or libnotify is available.
5528 if test "$MOZ_ENABLE_GCONF" || \
5529    test "$MOZ_ENABLE_GNOMEVFS" || \
5530    test "$MOZ_ENABLE_GIO" || \
5531    test "$MOZ_ENABLE_LIBNOTIFY"; then
5532     MOZ_ENABLE_GNOME_COMPONENT=1
5533 else
5534     MOZ_ENABLE_GNOME_COMPONENT=
5536 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5538 dnl ========================================================
5539 dnl = libgnomeui support module
5540 dnl ========================================================
5542 if test "$MOZ_ENABLE_GTK2"
5543 then
5544     MOZ_ENABLE_GNOMEUI=1
5546     MOZ_ARG_DISABLE_BOOL(gnomeui,
5547     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5548         MOZ_ENABLE_GNOMEUI=,
5549         MOZ_ENABLE_GNOMEUI=force)
5551     if test "$MOZ_ENABLE_GNOMEUI"
5552     then
5553         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5554         [
5555             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5556             MOZ_ENABLE_GNOMEUI=1
5557         ],[
5558             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5559             then
5560                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5561             fi
5562             MOZ_ENABLE_GNOMEUI=
5563         ])
5564     fi
5566     if test "$MOZ_ENABLE_GNOMEUI"; then
5567         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5568     fi
5571 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5572 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5573 AC_SUBST(MOZ_GNOMEUI_LIBS)
5575 dnl ========================================================
5576 dnl = dbus support
5577 dnl ========================================================
5579 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5580 then
5581     MOZ_ENABLE_DBUS=1
5583     MOZ_ARG_DISABLE_BOOL(dbus,
5584     [  --disable-dbus       Disable dbus support ],
5585         MOZ_ENABLE_DBUS=,
5586         MOZ_ENABLE_DBUS=1)
5588     if test "$MOZ_ENABLE_DBUS"
5589     then
5590         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5591         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5592         AC_DEFINE(MOZ_ENABLE_DBUS)
5593     fi
5595 AC_SUBST(MOZ_ENABLE_DBUS)
5596 AC_SUBST(MOZ_DBUS_CFLAGS)
5597 AC_SUBST(MOZ_DBUS_LIBS)
5598 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5599 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5601 dnl ========================================================
5602 dnl = Build Personal Security Manager
5603 dnl ========================================================
5604 MOZ_ARG_DISABLE_BOOL(crypto,
5605 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5606     MOZ_PSM=,
5607     MOZ_PSM=1 )
5609 dnl ========================================================
5610 dnl = JS Debugger XPCOM component (js/jsd)
5611 dnl ========================================================
5612 MOZ_ARG_DISABLE_BOOL(jsd,
5613 [  --disable-jsd           Disable JavaScript debug library],
5614     MOZ_JSDEBUGGER=,
5615     MOZ_JSDEBUGGER=1)
5618 dnl ========================================================
5619 dnl = Disable IPC support for tabs and plugins
5620 dnl ========================================================
5621 case "${target}" in
5622 powerpc-apple-darwin*)
5623     MOZ_IPC=
5624     ;;
5625 *-wince*)
5626     MOZ_IPC=
5627     ;;
5628 esac
5630 MOZ_ARG_DISABLE_BOOL(ipc,
5631 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5632     MOZ_IPC=,
5633     MOZ_IPC=1)
5635 if test -n "$MOZ_IPC"; then
5636     AC_DEFINE(MOZ_IPC)
5639 AC_SUBST(MOZ_IPC)
5641 dnl ========================================================
5642 dnl = Enable IPDL's "expensive" unit tests
5643 dnl ========================================================
5644 MOZ_IPDL_TESTS=
5646 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5647 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5648     MOZ_IPDL_TESTS=1,
5649     MOZ_IPDL_TESTS=)
5651 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5652     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5655 if test -n "$MOZ_IPDL_TESTS"; then
5656     AC_DEFINE(MOZ_IPDL_TESTS)
5659 AC_SUBST(MOZ_IPDL_TESTS)
5661 dnl ========================================================
5662 dnl = Disable plugin support
5663 dnl ========================================================
5664 MOZ_ARG_DISABLE_BOOL(plugins,
5665 [  --disable-plugins       Disable plugins support],
5666     MOZ_PLUGINS=,
5667     MOZ_PLUGINS=1)
5669 dnl ========================================================
5670 dnl = Disable building dbm
5671 dnl ========================================================
5672 MOZ_ARG_DISABLE_BOOL(dbm,
5673 [  --disable-dbm       Disable building dbm],
5674     NSS_DISABLE_DBM=1,
5675     NSS_DISABLE_DBM=)
5677 dnl bi-directional support always on
5678 IBMBIDI=1
5679 AC_DEFINE(IBMBIDI)
5681 dnl ========================================================
5682 dnl view source support on by default
5683 dnl ========================================================
5684 if test "$MOZ_VIEW_SOURCE"; then
5685     AC_DEFINE(MOZ_VIEW_SOURCE)
5688 dnl ========================================================
5689 dnl accessibility support on by default on all platforms 
5690 dnl except OS X.
5691 dnl ========================================================
5692 MOZ_ARG_DISABLE_BOOL(accessibility,
5693 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5694     ACCESSIBILITY=,
5695     ACCESSIBILITY=1 )
5696 if test "$ACCESSIBILITY"; then
5697     AC_DEFINE(ACCESSIBILITY)
5700 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5701 case "$target" in
5702 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5703     if test "$ac_cv_header_atlbase_h" = "no"; then
5704         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.])
5705     fi
5706     if test "$ac_cv_header_oleacc_idl" = "no"; then
5707         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.])
5708     fi
5709     ;;
5710 esac
5713 dnl ========================================================
5714 dnl xpinstall support on by default
5715 dnl ========================================================
5716 MOZ_ARG_DISABLE_BOOL(xpinstall,
5717 [  --disable-xpinstall     Disable xpinstall support],
5718     MOZ_XPINSTALL=,
5719     MOZ_XPINSTALL=1 )
5720 if test "$MOZ_XPINSTALL"; then
5721     AC_DEFINE(MOZ_XPINSTALL)
5724 dnl ========================================================
5725 dnl xpcom js loader support on by default
5726 dnl ========================================================
5727 if test "$MOZ_JSLOADER"; then
5728     AC_DEFINE(MOZ_JSLOADER)
5731 dnl ========================================================
5732 dnl Disable printing
5733 dnl ========================================================
5734 MOZ_ARG_DISABLE_BOOL(printing,
5735 [  --disable-printing  Disable printing support],
5736     NS_PRINTING=,
5737     NS_PRINTING=1 )
5739 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5740     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5741     NS_PRINTING=
5744 if test "$NS_PRINTING"; then
5745     AC_DEFINE(NS_PRINTING)
5746     AC_DEFINE(NS_PRINT_PREVIEW)
5749 dnl ========================================================
5750 dnl use native unicode converters
5751 dnl ========================================================
5752 MOZ_ARG_ENABLE_BOOL(native-uconv,
5753 [  --enable-native-uconv   Enable iconv support],
5754     MOZ_USE_NATIVE_UCONV=1,
5755     MOZ_USE_NATIVE_UCONV= )
5756 if test "$MOZ_USE_NATIVE_UCONV"; then
5757     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5759 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5760     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5764 dnl ========================================================
5765 dnl Libeditor can be build as plaintext-only,
5766 dnl or as a full html and text editing component.
5767 dnl We build both by default.
5768 dnl ========================================================
5769 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5770 [  --enable-plaintext-editor-only
5771                           Allow only plaintext editing],
5772     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5773     MOZ_PLAINTEXT_EDITOR_ONLY= )
5774 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5775 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5777 dnl ========================================================
5778 dnl = Disable Fast Load
5779 dnl ========================================================
5780 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5781 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5782     MOZ_NO_FAST_LOAD=1,
5783     MOZ_NO_FAST_LOAD=)
5785 AC_SUBST(MOZ_NO_FAST_LOAD)
5787 if test -n "$MOZ_NO_FAST_LOAD"; then
5788     AC_DEFINE(MOZ_NO_FAST_LOAD)
5791 dnl ========================================================
5792 dnl = Disable Ogg Codecs
5793 dnl ========================================================
5794 MOZ_ARG_DISABLE_BOOL(ogg,
5795 [  --disable-ogg           Disable Ogg Codec support],
5796     MOZ_OGG=,
5797     MOZ_OGG=1)
5799 AC_SUBST(MOZ_OGG)
5801 if test -n "$MOZ_OGG"; then
5802     AC_DEFINE(MOZ_OGG)
5803     MOZ_SYDNEYAUDIO=1
5804     MOZ_MEDIA=1
5806     dnl Checks for __attribute__(aligned()) directive
5807     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5808         [ac_cv_c_attribute_aligned],
5809         [ac_cv_c_attribute_aligned=0
5810          CFLAGS_save="${CFLAGS}"
5811          CFLAGS="${CFLAGS} -Werror"
5812          for ac_cv_c_attr_align_try in 64 32 16 8; do
5813            echo "trying $ac_cv_c_attr_align_try"
5814            AC_TRY_COMPILE([],
5815                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5816                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5817            if test "$ac_cv_c_attribute_aligned" != 0; then
5818              break;
5819            fi
5820          done
5821            CFLAGS="${CFLAGS_save}"])
5822     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5823       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5824                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5825     fi
5828 dnl ========================================================
5829 dnl = Disable Wave decoder support
5830 dnl ========================================================
5831 MOZ_ARG_DISABLE_BOOL(wave,
5832 [  --disable-wave          Disable Wave decoder support],
5833     MOZ_WAVE=,
5834     MOZ_WAVE=1)
5836 AC_SUBST(MOZ_WAVE)
5838 if test -n "$MOZ_WAVE"; then
5839     AC_DEFINE(MOZ_WAVE)
5840     MOZ_SYDNEYAUDIO=1
5841     MOZ_MEDIA=1
5844 dnl ========================================================
5845 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5846 dnl ========================================================
5848 AC_SUBST(MOZ_SYDNEYAUDIO)
5850 if test -n "$MOZ_SYDNEYAUDIO"; then
5851     AC_DEFINE(MOZ_SYDNEYAUDIO)
5854 AC_SUBST(MOZ_MEDIA)
5856 if test -n "$MOZ_MEDIA"; then
5857     AC_DEFINE(MOZ_MEDIA)
5860 dnl ========================================================
5861 dnl = Check alsa availability on Linux if using sydneyaudio
5862 dnl ========================================================
5864 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5865 if test -n "$MOZ_SYDNEYAUDIO"; then
5866    case "$target_os" in
5867 linux*)
5868       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5869          [echo "$MOZ_ALSA_PKG_ERRORS"
5870           AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux.  Disable with --disable-ogg --disable-wave.])])
5871       ;;
5872    esac
5874 AC_SUBST(MOZ_ALSA_LIBS)
5876 dnl ========================================================
5877 dnl Splashscreen
5878 dnl ========================================================
5879 AC_ARG_ENABLE(splashscreen,
5880               [  --enable-splashscreen   display splashscreen while loading (default=no)],
5881               [enable_splash="yes"],[enable_splash=""])
5882 if test "x$enable_splash" = "xyes"; then
5883   MOZ_SPLASHSCREEN=1
5884   AC_DEFINE(MOZ_SPLASHSCREEN)
5886 AC_SUBST(MOZ_SPLASHSCREEN)
5888 dnl ========================================================
5889 dnl Permissions System
5890 dnl ========================================================
5891 MOZ_ARG_DISABLE_BOOL(permissions,
5892 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5893     MOZ_PERMISSIONS=,
5894     MOZ_PERMISSIONS=1
5897 dnl ========================================================
5898 dnl NegotiateAuth
5899 dnl ========================================================
5900 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5901 [  --disable-negotiateauth Disable GSS-API negotiation ],
5902     MOZ_AUTH_EXTENSION=,
5903     MOZ_AUTH_EXTENSION=1 )
5905 dnl ========================================================
5906 dnl XTF
5907 dnl ========================================================
5908 MOZ_ARG_DISABLE_BOOL(xtf,
5909 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5910     MOZ_XTF=,
5911     MOZ_XTF=1 )
5912 if test "$MOZ_XTF"; then
5913   AC_DEFINE(MOZ_XTF)
5916 dnl ========================================================
5917 dnl Pref extensions (autoconfig and system-pref)
5918 dnl ========================================================
5919 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5920 [  --disable-pref-extensions
5921                           Disable pref extensions such as autoconfig and
5922                           system-pref],
5923   MOZ_PREF_EXTENSIONS=,
5924   MOZ_PREF_EXTENSIONS=1 )
5926 dnl ========================================================
5927 dnl = Universalchardet
5928 dnl ========================================================
5929 MOZ_ARG_DISABLE_BOOL(universalchardet,
5930 [  --disable-universalchardet
5931                           Disable universal encoding detection],
5932   MOZ_UNIVERSALCHARDET=,
5933   MOZ_UNIVERSALCHARDET=1 )
5935 dnl ========================================================
5936 dnl JavaXPCOM
5937 dnl ========================================================
5938 case "${target}" in
5939 *-wince*)
5940     MOZ_JAVAXPCOM=
5941     ;;
5942 esac
5944 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5945 [  --enable-javaxpcom
5946                           Enable Java-XPCOM bridge],
5947     MOZ_JAVAXPCOM=1,
5948     MOZ_JAVAXPCOM= )
5950 if test -n "${MOZ_JAVAXPCOM}"; then
5951   case "$host_os" in
5952     cygwin*|msvc*|mks*)
5953       if test -n "$JAVA_HOME"; then
5954         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5955       fi
5956       ;;
5957     *mingw*)
5958       if test -n "$JAVA_HOME"; then
5959         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5960       fi
5961       ;;
5962   esac
5964   if test -n "${JAVA_INCLUDE_PATH}"; then
5965     dnl Make sure jni.h exists in the given include path.
5966     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5967       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5968     fi
5969   else
5970     case "$target_os" in
5971       darwin*)
5972         dnl Default to java system location
5973         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5974         ;;
5975       *)
5976         dnl Try $JAVA_HOME
5977         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5978         ;;
5979     esac
5980     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5981       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.])
5982     fi
5983   fi
5985   if test -n "${JAVA_BIN_PATH}"; then
5986     dnl Look for javac and jar in the specified path.
5987     JAVA_PATH="$JAVA_BIN_PATH"
5988   else
5989     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5990     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5991   fi
5993   MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5994   MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5995   MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5996   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5997     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.])
5998   fi
6001 dnl ========================================================
6002 dnl = Breakpad crash reporting (on by default on supported platforms)
6003 dnl ========================================================
6005 case $target in
6006 i?86-*-mingw*)
6007   MOZ_CRASHREPORTER=1
6008   ;;
6009 i?86-apple-darwin*|powerpc-apple-darwin*)
6010   MOZ_CRASHREPORTER=1
6011   ;;
6012 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6013   MOZ_CRASHREPORTER=1
6014   ;;
6015 *solaris*)
6016   MOZ_CRASHREPORTER=1
6017   ;;
6018 esac
6020 MOZ_ARG_DISABLE_BOOL(crashreporter,
6021 [  --disable-crashreporter          Disable breakpad crash reporting],
6022     MOZ_CRASHREPORTER=,
6023     MOZ_CRASHREPORTER=1)
6025 if test -n "$MOZ_CRASHREPORTER"; then
6026    AC_DEFINE(MOZ_CRASHREPORTER)
6028   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
6029     test -z "$SKIP_LIBRARY_CHECKS"; then
6030     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6031     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6032     AC_SUBST(MOZ_GTHREAD_LIBS)
6034     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.])])
6035   fi
6038 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6039 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
6040 [ val=`echo $withval | sed 's/[^0-9]//g'`
6041     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6043 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6044    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6046 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6048 dnl ========================================================
6049 dnl = Enable compilation of specific extension modules
6050 dnl ========================================================
6052 MOZ_ARG_ENABLE_STRING(extensions,
6053 [  --enable-extensions     Enable extensions],
6054 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6055     if test "$option" = "yes" || test "$option" = "all"; then
6056         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6057     elif test "$option" = "no" || test "$option" = "none"; then
6058         MOZ_EXTENSIONS=""
6059     elif test "$option" = "default"; then
6060         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6061     elif test `echo "$option" | grep -c \^-` != 0; then
6062         option=`echo $option | sed 's/^-//'`
6063         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6064     else
6065         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6066     fi
6067 done],
6068     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6070 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6071     # Suppress warning on non-X11 platforms
6072     if test -n "$MOZ_X11"; then
6073         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6074     fi
6075     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6078 dnl Do not build gnomevfs with libxul based apps
6079 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6080     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6083 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6084     # Suppress warning on non-X11 platforms
6085     if test -n "$MOZ_X11"; then
6086         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6087     fi
6088     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6091 dnl Do not build gio with libxul based apps
6092 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6093     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6096 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6097     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6098     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6101 dnl This might be temporary: build tridentprofile only on Windows
6102 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6103     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6104     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6107 dnl cookie must be built before tridentprofile. put it at list's end.
6108 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6109   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6110   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6113 dnl xforms requires xtf and schema-validation
6114 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6115     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6116     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6118 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
6119     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
6120     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6123 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6124     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6125     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6128 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6129     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6130     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6133 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6134     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6135     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6138 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6139     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6140     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6143 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6144     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6145     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6148 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6149     AC_MSG_WARN([spellcheck is no longer an extension.])
6150     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6153 dnl Remove dupes
6154 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6156 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6157 dnl when trying to build a non-existent extension.
6158 for extension in $MOZ_EXTENSIONS; do
6159     if test ! -d "${srcdir}/extensions/${extension}"; then
6160         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6161     fi
6162 done
6165 dnl ========================================================
6166 dnl Image decoders
6167 dnl ========================================================
6168 case "$MOZ_WIDGET_TOOLKIT" in
6169 beos|windows|os2|mac|cocoa)
6170     ;;
6172     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
6173        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6174     fi
6175     ;;
6176 esac
6178 MOZ_ARG_ENABLE_STRING(image-decoders,
6179 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
6180                           Enable specific image decoders],
6181 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6182     if test "$option" = "yes" || test "$option" = "all"; then
6183         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6184     elif test "$option" = "no" || test "$option" = "none"; then
6185         MOZ_IMG_DECODERS=""
6186     elif test "$option" = "default"; then
6187         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6188     elif test `echo "$option" | grep -c \^-` != 0; then
6189         option=`echo $option | sed 's/^-//'`
6190         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6191     else
6192         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6193     fi
6194 done],
6195     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6197 dnl Dupes are removed in the encoder section because it will also add decoders
6199 dnl ========================================================
6200 dnl Image encoders
6201 dnl ========================================================
6202 MOZ_ARG_ENABLE_STRING(image-encoders,
6203 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
6204                           Enable specific image encoders],
6205 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6206     if test "$option" = "yes" || test "$option" = "all"; then
6207         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6208     elif test "$option" = "no" || test "$option" = "none"; then
6209         MOZ_IMG_ENCODERS=""
6210         addencoder=""
6211     elif test "$option" = "default"; then
6212         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6213     elif test `echo "$option" | grep -c \^-` != 0; then
6214         option=`echo $option | sed 's/^-//'`
6215         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6216     else
6217         addencoder="$option"
6218     fi
6219     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6220 done],
6221     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6223 dnl Remove dupes
6224 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6225 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6227 dnl ========================================================
6228 dnl MathML on by default
6229 dnl ========================================================
6230 MOZ_ARG_DISABLE_BOOL(mathml,
6231 [  --disable-mathml        Disable MathML support],
6232     MOZ_MATHML=,
6233     MOZ_MATHML=1 )
6234 if test "$MOZ_MATHML"; then
6235   AC_DEFINE(MOZ_MATHML)
6238 dnl ========================================================
6239 dnl SVG
6240 dnl ========================================================
6241 MOZ_ARG_DISABLE_BOOL(svg,
6242 [  --disable-svg            Disable SVG support],
6243     MOZ_SVG=,
6244     MOZ_SVG=1 )
6245 if test -n "$MOZ_SVG"; then
6246   AC_DEFINE(MOZ_SVG)
6249 dnl ========================================================
6250 dnl SMIL
6251 dnl ========================================================
6252 MOZ_SMIL=1
6253 MOZ_ARG_DISABLE_BOOL(smil,
6254 [  --disable-smil           Disable SMIL animation support],
6255     MOZ_SMIL=,
6256     MOZ_SMIL=1 )
6257 # Automatically disable SMIL if SVG is disabled
6258 if test -z "$MOZ_SVG"; then
6259   MOZ_SMIL=
6261 if test -n "$MOZ_SMIL"; then
6262   AC_DEFINE(MOZ_SMIL)
6265 dnl ========================================================
6266 dnl Build Freetype in the tree
6267 dnl ========================================================
6268 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6269 [  --enable-tree-freetype         Enable Tree FreeType],
6270     MOZ_TREE_FREETYPE=1,
6271     MOZ_TREE_FREETYPE= )
6272 if test -n "$MOZ_TREE_FREETYPE"; then
6273    AC_DEFINE(MOZ_TREE_FREETYPE)
6274    AC_SUBST(MOZ_TREE_FREETYPE)
6275    MOZ_ENABLE_CAIRO_FT=1       
6276    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6277    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6278    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6279    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6280    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6281    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6282    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6283    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6284    AC_SUBST(CAIRO_FT_CFLAGS)
6288 dnl ========================================================
6289 dnl Installer
6290 dnl ========================================================
6291 case "$target_os" in
6292     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6293         MOZ_INSTALLER=1
6294         ;;
6295 esac
6297 MOZ_ARG_DISABLE_BOOL(installer,
6298 [  --disable-installer     Disable building of installer],
6299     MOZ_INSTALLER=,
6300     MOZ_INSTALLER=1 )
6301 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6302     # Disable installer for Windows builds that use the new toolkit if NSIS
6303     # isn't in the path.
6304     MOZ_PATH_PROGS(MAKENSIS, makensis)
6305     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
6306         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
6307     fi
6308     # The Windows build for NSIS requires the iconv command line utility to
6309     # convert the charset of the locale files.
6310     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6311     if test -z "$HOST_ICONV"; then
6312         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6313     fi
6316 # Automatically disable installer if xpinstall isn't built
6317 if test -z "$MOZ_XPINSTALL"; then
6318     MOZ_INSTALLER=
6320 AC_SUBST(MOZ_INSTALLER)
6322 AC_MSG_CHECKING([for tar archiver])
6323 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6324 if test -z "$TAR"; then
6325     AC_MSG_ERROR([no tar archiver found in \$PATH])
6327 AC_MSG_RESULT([$TAR])
6328 AC_SUBST(TAR)
6330 AC_MSG_CHECKING([for wget])
6331 AC_CHECK_PROGS(WGET, wget, "")
6332 AC_MSG_RESULT([$WGET])
6333 AC_SUBST(WGET)
6335 dnl ========================================================
6336 dnl Updater
6337 dnl ========================================================
6339 MOZ_ARG_DISABLE_BOOL(updater,
6340 [  --disable-updater       Disable building of updater],
6341     MOZ_UPDATER=,
6342     MOZ_UPDATER=1 )
6343 AC_SUBST(MOZ_UPDATER)
6345 # app update channel is 'default' when not supplied.
6346 MOZ_ARG_ENABLE_STRING([update-channel],
6347 [  --enable-update-channel=CHANNEL
6348                            Select application update channel (default=default)],
6349     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6351 if test -z "$MOZ_UPDATE_CHANNEL"; then
6352     MOZ_UPDATE_CHANNEL=default
6354 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6356 # tools/update-packaging is not checked out by default.
6357 MOZ_ARG_ENABLE_BOOL(update-packaging,
6358 [  --enable-update-packaging
6359                            Enable tools/update-packaging],
6360     MOZ_UPDATE_PACKAGING=1,
6361     MOZ_UPDATE_PACKAGING= )
6362 AC_SUBST(MOZ_UPDATE_PACKAGING)
6364 dnl ========================================================
6365 dnl ActiveX
6366 dnl ========================================================
6368 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6369 [  --disable-xpconnect-idispatch
6370                           Disable building of xpconnect support for IDispatch
6371                           (win32 only)],
6372     XPC_IDISPATCH_SUPPORT=,
6373     XPC_IDISPATCH_SUPPORT=1)
6374 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6376 MOZ_ARG_DISABLE_BOOL(activex,
6377 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6378     MOZ_NO_ACTIVEX_SUPPORT=1,
6379     MOZ_NO_ACTIVEX_SUPPORT= )
6380 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6382 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6383 [  --enable-activex-scripting
6384                           Enable building of ActiveX scripting support (win32)],
6385     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6386     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6387 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6389 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6390 then
6391     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6394 if test "$COMPILE_ENVIRONMENT" = "1"; then
6395 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6396 case "$target" in
6397 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6398     if test "$ac_cv_header_atlbase_h" = "no"; then
6399         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.])
6400     fi
6401     ;;
6402 esac
6406 dnl ========================================================
6407 dnl leaky
6408 dnl ========================================================
6409 MOZ_ARG_ENABLE_BOOL(leaky,
6410 [  --enable-leaky          Build leaky memory tool],
6411     MOZ_LEAKY=1,
6412     MOZ_LEAKY=)
6415 dnl ========================================================
6416 dnl xpctools
6417 dnl ========================================================
6418 MOZ_ARG_ENABLE_BOOL(xpctools,
6419 [  --enable-xpctools       Build JS profiling tool],
6420     MOZ_XPCTOOLS=1,
6421     MOZ_XPCTOOLS= )
6424 dnl ========================================================
6425 dnl build the tests by default
6426 dnl ========================================================
6427 MOZ_ARG_DISABLE_BOOL(tests,
6428 [  --disable-tests         Do not build test libraries & programs],
6429     ENABLE_TESTS=,
6430     ENABLE_TESTS=1 )
6432 dnl ========================================================
6433 dnl parental controls (for Windows Vista)
6434 dnl ========================================================
6435 MOZ_ARG_DISABLE_BOOL(parental-controls,
6436 [  --disable-parental-controls
6437                            Do not build parental controls],
6438    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6439    MOZ_DISABLE_PARENTAL_CONTROLS=)
6440 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6441     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6444 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6446 dnl ========================================================
6447 dnl =
6448 dnl = Module specific options
6449 dnl =
6450 dnl ========================================================
6451 MOZ_ARG_HEADER(Individual module options)
6453 dnl ========================================================
6454 dnl = Disable feed handling components
6455 dnl ========================================================
6456 MOZ_ARG_DISABLE_BOOL(feeds,
6457 [  --disable-feeds        Disable feed handling and processing components],
6458     MOZ_FEEDS=,
6459     MOZ_FEEDS=1 )
6460 if test -n "$MOZ_FEEDS"; then
6461     AC_DEFINE(MOZ_FEEDS)
6462 else
6463     if test "$MOZ_BUILD_APP" = "browser"; then
6464         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6465     fi
6468 dnl ========================================================
6469 dnl = Enable mozStorage
6470 dnl ========================================================
6471 dnl Implicitly enabled by default if building calendar or places
6472 MOZ_ARG_ENABLE_BOOL(storage,
6473 [  --enable-storage        Enable mozStorage module and related components],
6474     MOZ_STORAGE=1,
6475     MOZ_STORAGE= )
6476 if test -n "$MOZ_STORAGE"; then
6477     AC_DEFINE(MOZ_STORAGE)
6480 dnl ========================================================
6481 dnl Check for sqlite
6482 dnl ========================================================
6484 MOZ_NATIVE_SQLITE=
6485 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6486 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6487 MOZ_NATIVE_SQLITE=1,
6488 MOZ_NATIVE_SQLITE= )
6490 if test -z "$MOZ_NATIVE_SQLITE"
6491 then
6492     SQLITE_CFLAGS=
6493     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6494 else
6495     dnl ============================
6496     dnl === SQLite Version check ===
6497     dnl ============================
6498     dnl Check to see if the system SQLite package is new enough.
6499     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6501     dnl ==================================
6502     dnl === SQLITE_SECURE_DELETE check ===
6503     dnl ==================================
6504     dnl Check to see if the system SQLite package is compiled with
6505     dnl SQLITE_SECURE_DELETE enabled.
6506     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6507     _SAVE_CFLAGS="$CFLAGS"
6508     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6509     _SAVE_LIBS="$LIBS"
6510     LIBS="$LIBS $SQLITE_LIBS"
6511     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6512         AC_TRY_RUN([
6513             #include "sqlite3.h"
6515             int main(int argc, char **argv){
6516               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6517             }],
6518             ac_cv_sqlite_secure_delete=yes,
6519             ac_cv_sqlite_secure_delete=no,
6520             ac_cv_sqlite_secure_delete=no
6521         )
6522     ])
6523     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6524     CFLAGS="$_SAVE_CFLAGS"
6525     LIBS="$_SAVE_LIBS"
6526     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6527         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6528     fi
6530     dnl ===============================
6531     dnl === SQLITE_THREADSAFE check ===
6532     dnl ===============================
6533     dnl Check to see if the system SQLite package is compiled with
6534     dnl SQLITE_THREADSAFE enabled.
6535     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6536     _SAVE_CFLAGS="$CFLAGS"
6537     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6538     _SAVE_LIBS="$LIBS"
6539     LIBS="$LIBS $SQLITE_LIBS"
6540     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6541         AC_TRY_RUN([
6542             #include "sqlite3.h"
6544             int main(int argc, char **argv){
6545               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6546             }],
6547             ac_cv_sqlite_threadsafe=yes,
6548             ac_cv_sqlite_threadsafe=no,
6549             ac_cv_sqlite_threadsafe=no
6550         )
6551     ])
6552     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6553     CFLAGS="$_SAVE_CFLAGS"
6554     LIBS="$_SAVE_LIBS"
6555     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6556         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6557     fi
6559     dnl ================================
6560     dnl === SQLITE_ENABLE_FTS3 check ===
6561     dnl ================================
6562     dnl check to see if the system SQLite package is compiled with
6563     dnl SQLITE_THREADSAFE enabled.
6564     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6565     _SAVE_CFLAGS="$CFLAGS"
6566     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6567     _SAVE_LIBS="$LIBS"
6568     LIBS="$LIBS $SQLITE_LIBS"
6569     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6570         AC_TRY_RUN([
6571             #include "sqlite3.h"
6573             int main(int argc, char **argv){
6574               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6575             }],
6576             ac_cv_sqlite_enable_fts3=yes,
6577             ac_cv_sqlite_enable_fts3=no,
6578             ac_cv_sqlite_enable_fts3=no
6579         )
6580     ])
6581     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6582     CFLAGS="$_SAVE_CFLAGS"
6583     LIBS="$_SAVE_LIBS"
6584     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6585         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6586     fi
6589 AC_SUBST(MOZ_NATIVE_SQLITE)
6591 dnl ========================================================
6592 dnl = Enable help viewer (off by default)
6593 dnl ========================================================
6594 if test -n "$MOZ_HELP_VIEWER"; then
6595      dnl Do this if defined in confvars.sh
6596      AC_DEFINE(MOZ_HELP_VIEWER)
6599 dnl ========================================================
6600 dnl = Enable safe browsing (anti-phishing)
6601 dnl ========================================================
6602 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6603 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6604     MOZ_SAFE_BROWSING=1,
6605     MOZ_SAFE_BROWSING= )
6606 if test -n "$MOZ_SAFE_BROWSING"; then
6607     AC_DEFINE(MOZ_SAFE_BROWSING)
6609 AC_SUBST(MOZ_SAFE_BROWSING)
6611 dnl ========================================================
6612 dnl = Enable faststart component
6613 dnl ========================================================
6614 MOZ_ARG_ENABLE_BOOL(faststart,
6615 [  --enable-faststart            Enable the faststart component],
6616     MOZ_FASTSTART=1,
6617     MOZ_FASTSTART= )
6618 if test -n "$MOZ_FASTSTART"; then
6619     AC_DEFINE(MOZ_FASTSTART)
6621 AC_SUBST(MOZ_FASTSTART)
6623 dnl ========================================================
6624 dnl = Enable url-classifier
6625 dnl ========================================================
6626 dnl Implicitly enabled by default if building with safe-browsing
6627 if test -n "$MOZ_SAFE_BROWSING"; then
6628     MOZ_URL_CLASSIFIER=1
6630 MOZ_ARG_ENABLE_BOOL(url-classifier,
6631 [  --enable-url-classifier        Enable url classifier module],
6632     MOZ_URL_CLASSIFIER=1,
6633     MOZ_URL_CLASSIFIER= )
6634 if test -n "$MOZ_URL_CLASSIFIER"; then
6635     AC_DEFINE(MOZ_URL_CLASSIFIER)
6637 AC_SUBST(MOZ_URL_CLASSIFIER)
6639 dnl ========================================================
6640 dnl = Disable zipwriter
6641 dnl ========================================================
6642 MOZ_ARG_DISABLE_BOOL(zipwriter,
6643 [  --disable-zipwriter             Disable zipwriter component],
6644     MOZ_ZIPWRITER=,
6645     MOZ_ZIPWRITER=1 )
6646 AC_SUBST(MOZ_ZIPWRITER)
6648 dnl ========================================================
6649 dnl = Disable libconic
6650 dnl ========================================================
6651 MOZ_ENABLE_LIBCONIC=1
6652 MOZ_ARG_DISABLE_BOOL(libconic,
6653 [  --disable-libconic              Disable libconic],
6654     MOZ_ENABLE_LIBCONIC=,
6655     MOZ_ENABLE_LIBCONIC=1 )
6657 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6658     PKG_CHECK_MODULES(LIBCONIC, conic,
6659                       MOZ_ENABLE_LIBCONIC=1,
6660                       MOZ_ENABLE_LIBCONIC=)
6662 if test "$MOZ_ENABLE_LIBCONIC"; then
6663     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6666 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6667 AC_SUBST(LIBCONIC_CFLAGS)
6668 AC_SUBST(LIBCONIC_LIBS)
6670 dnl ========================================================
6671 dnl = Maemo checks
6672 dnl ========================================================
6674 MAEMO_SDK_TARGET_VER=-1
6676 MOZ_ARG_WITH_STRING(maemo-version,
6677 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6678                         Maemo SDK Version],
6679   MAEMO_SDK_TARGET_VER=$withval)
6681 case "$MAEMO_SDK_TARGET_VER" in
6683     MOZ_PLATFORM_MAEMO=5
6684     ;;
6687     MOZ_PLATFORM_MAEMO=6
6688     ;;
6691     dnl We aren't compiling for Maemo, move on.
6692     ;;
6694     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6695     ;;
6696 esac
6698 if test $MOZ_PLATFORM_MAEMO; then
6699    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6701    if test -z "$MOZ_ENABLE_DBUS"; then
6702        AC_MSG_ERROR([DBus is required when building for Maemo])
6703    fi
6705    MOZ_GFX_OPTIMIZE_MOBILE=1
6706    MOZ_WEBGL_GLX=
6707    MOZ_MAEMO_LIBLOCATION=
6709    if test $MOZ_PLATFORM_MAEMO = 5; then
6710       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6711       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6712                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6713       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6714                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6716       AC_SUBST(XCOMPOSITE_LIBS)
6718       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6719       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6720       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6721       if test -z "$_LIB_FOUND"; then
6722          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6723       fi
6726       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6727       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6728       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6729       if test -z "$_LIB_FOUND"; then
6730          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6731       fi
6733       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6734       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6735       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6736       if test -z "$_LIB_FOUND"; then
6737          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6738       fi
6740    fi
6742    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6743    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6744    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6745    if test "$_LIB_FOUND"; then
6746       MOZ_MAEMO_LIBLOCATION=1
6747       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6748    else
6749       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6750    fi
6751    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6753    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6754    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6757 dnl ========================================================
6758 dnl = faststripe theme
6759 dnl ========================================================
6760 MOZ_ARG_ENABLE_BOOL(faststripe,
6761 [  --enable-faststripe  Use faststripe theme],
6762     MOZ_THEME_FASTSTRIPE=1,
6763     MOZ_THEME_FASTSTRIPE= )
6764 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6766 dnl ========================================================
6767 dnl =
6768 dnl = Feature options that require extra sources to be pulled
6769 dnl =
6770 dnl ========================================================
6771 dnl MOZ_ARG_HEADER(Features that require extra sources)
6773 dnl ========================================================
6774 dnl =
6775 dnl = Debugging Options
6776 dnl = 
6777 dnl ========================================================
6778 MOZ_ARG_HEADER(Debugging and Optimizations)
6780 dnl ========================================================
6781 dnl = Disable building with debug info.
6782 dnl = Debugging is OFF by default
6783 dnl ========================================================
6784 if test -z "$MOZ_DEBUG_FLAGS"
6785 then
6786     case "$target" in
6787     *-irix*)
6788         if test "$GNU_CC"; then
6789             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6790             case "$GCC_VERSION" in
6791             2.95.*)
6792                 MOZ_DEBUG_FLAGS=""
6793                 ;;
6794             *)
6795                 MOZ_DEBUG_FLAGS="-g"
6796                 ;;
6797             esac
6798         else
6799             MOZ_DEBUG_FLAGS="-g"
6800         fi
6801         ;;
6802     *)
6803         MOZ_DEBUG_FLAGS="-g"
6804         ;;
6805     esac
6808 MOZ_ARG_ENABLE_STRING(debug,
6809 [  --enable-debug[=DBG]    Enable building with developer debug info
6810                            (using compiler flags DBG)],
6811 [ if test "$enableval" != "no"; then
6812     MOZ_DEBUG=1
6813     if test -n "$enableval" -a "$enableval" != "yes"; then
6814         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6815         _MOZ_DEBUG_FLAGS_SET=1
6816     fi
6817   else
6818     MOZ_DEBUG=
6819   fi ],
6820   MOZ_DEBUG=)
6822 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6823  case "${target_os}" in
6824     beos*)
6825         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6826         ;;
6827     msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6828         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6829         ;;
6830     *) 
6831         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6832         ;;
6833   esac
6834 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6836 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6838 if test -n "$MOZ_DEBUG"; then
6839     AC_MSG_CHECKING([for valid debug flags])
6840     _SAVE_CFLAGS=$CFLAGS
6841     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6842     AC_TRY_COMPILE([#include <stdio.h>], 
6843         [printf("Hello World\n");],
6844         _results=yes,
6845         _results=no)
6846     AC_MSG_RESULT([$_results])
6847     if test "$_results" = "no"; then
6848         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6849     fi
6850     CFLAGS=$_SAVE_CFLAGS
6853 dnl ========================================================
6854 dnl enable mobile optimizations
6855 dnl ========================================================
6856 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6857 [  --enable-mobile-optimize   Enable mobile optimizations],
6858     MOZ_GFX_OPTIMIZE_MOBILE=1)
6860 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6862 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6863     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6866 dnl ========================================================
6867 dnl = Enable code optimization. ON by default.
6868 dnl ========================================================
6869 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6870         MOZ_OPTIMIZE_FLAGS="-O"
6873 MOZ_ARG_ENABLE_STRING(optimize,
6874 [  --disable-optimize      Disable compiler optimization
6875   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6876 [ if test "$enableval" != "no"; then
6877     MOZ_OPTIMIZE=1
6878     if test -n "$enableval" && test "$enableval" != "yes"; then
6879         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6880         MOZ_OPTIMIZE=2
6881     fi
6882 else
6883     MOZ_OPTIMIZE=
6884 fi ], MOZ_OPTIMIZE=1)
6886 if test "$COMPILE_ENVIRONMENT"; then
6887 if test -n "$MOZ_OPTIMIZE"; then
6888     AC_MSG_CHECKING([for valid optimization flags])
6889     _SAVE_CFLAGS=$CFLAGS
6890     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6891     AC_TRY_COMPILE([#include <stdio.h>], 
6892         [printf("Hello World\n");],
6893         _results=yes,
6894         _results=no)
6895     AC_MSG_RESULT([$_results])
6896     if test "$_results" = "no"; then
6897         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6898     fi
6899     CFLAGS=$_SAVE_CFLAGS
6901 fi # COMPILE_ENVIRONMENT
6903 AC_SUBST(MOZ_OPTIMIZE)
6904 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6905 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6906 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6908 dnl ========================================================
6909 dnl = (Deprecated) generation of debugger info for specific modules
6910 dnl ========================================================
6911 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6912 [  --enable-debugger-info-modules
6913                           Enable/disable debugger info for specific modules],
6914 [ if test "$enableval" != "no"; then
6915     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
6916     MOZ_DEBUG_SYMBOLS=1
6917   fi ])
6919 dnl ========================================================
6920 dnl = Enable generation of debug symbols
6921 dnl ========================================================
6922 MOZ_ARG_ENABLE_STRING(debug-symbols,
6923 [  --enable-debug-symbols[=DBG]    Enable debugging symbols
6924                                    (using compiler flags DBG)],
6925 [ if test "$enableval" != "no"; then
6926       MOZ_DEBUG_SYMBOLS=1
6927       if test -n "$enableval" -a "$enableval" != "yes"; then
6928           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6929               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6930           else
6931               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6932           fi
6933       fi
6934   fi ])
6936 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6937     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6938     export MOZ_DEBUG_SYMBOLS
6941 dnl ========================================================
6942 dnl Disable runtime logging checks
6943 dnl ========================================================
6944 MOZ_ARG_DISABLE_BOOL(logging,
6945 [  --disable-logging       Disable logging facilities],
6946     NS_DISABLE_LOGGING=1,
6947     NS_DISABLE_LOGGING= )
6948 if test "$NS_DISABLE_LOGGING"; then
6949     AC_DEFINE(NS_DISABLE_LOGGING)
6950 else
6951     AC_DEFINE(MOZ_LOGGING)
6954 dnl ========================================================
6955 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6956 dnl ========================================================
6957 _ENABLE_LOGREFCNT=42
6958 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6959 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6960     _ENABLE_LOGREFCNT=1,
6961     _ENABLE_LOGREFCNT= )
6962 if test "$_ENABLE_LOGREFCNT" = "1"; then
6963     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6964 elif test -z "$_ENABLE_LOGREFCNT"; then
6965     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6968 dnl ========================================================
6969 dnl = Enable trace malloc
6970 dnl ========================================================
6971 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6972 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6973 [  --enable-trace-malloc   Enable malloc tracing],
6974     NS_TRACE_MALLOC=1,
6975     NS_TRACE_MALLOC= )
6976 if test "$NS_TRACE_MALLOC"; then
6977   # Please, Mr. Linker Man, don't take away our symbol names
6978   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6979   USE_ELF_DYNSTR_GC=
6980   AC_DEFINE(NS_TRACE_MALLOC)
6982 AC_SUBST(NS_TRACE_MALLOC)
6984 dnl ========================================================
6985 dnl = Enable jemalloc
6986 dnl ========================================================
6987 MOZ_ARG_ENABLE_BOOL(jemalloc,
6988 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6989     MOZ_MEMORY=1,
6990     MOZ_MEMORY=)
6992 if test "$NS_TRACE_MALLOC"; then
6993     MOZ_MEMORY=
6996 if test "$MOZ_MEMORY"; then
6998   dnl Don't try to run compiler tests on Windows  
6999   if test "$OS_ARCH" = "WINNT"; then
7000     if test -z "$HAVE_64BIT_OS"; then
7001       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7002     else
7003       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7004     fi
7005   else
7006     AC_CHECK_SIZEOF([int *], [4])
7007     case "${ac_cv_sizeof_int_p}" in
7008     4)
7009       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7010       ;;
7011     8)
7012       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7013       ;;
7014     *)
7015       AC_MSG_ERROR([Unexpected pointer size])
7016       ;;
7017     esac
7018   fi
7020   AC_DEFINE(MOZ_MEMORY)
7021   if test "x$MOZ_DEBUG" = "x1"; then
7022     AC_DEFINE(MOZ_MEMORY_DEBUG)
7023   fi
7024   dnl The generic feature tests that determine how to compute ncpus are long and
7025   dnl complicated.  Therefore, simply define special cpp variables for the
7026   dnl platforms we have special knowledge of.
7027   case "${target_os}" in
7028   darwin*)
7029     AC_DEFINE(MOZ_MEMORY_DARWIN)
7030     ;;
7031   *freebsd*)
7032     AC_DEFINE(MOZ_MEMORY_BSD)
7033     ;;
7034   *linux*)
7035     AC_DEFINE(MOZ_MEMORY_LINUX)
7036     ;;
7037   netbsd*)
7038     AC_DEFINE(MOZ_MEMORY_BSD)
7039     ;;
7040   solaris*)
7041     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7042     ;;
7043   msvc*|mks*|cygwin*|mingw*)
7044     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7045     dnl This is sort of awful. Will revisit if we add support for more versions
7046     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7047         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7048     fi
7049     if test -z "$WIN32_CRT_SRC_DIR"; then
7050       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7051         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).])
7052       else
7053         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7054       fi
7055     fi
7056     dnl cpu check
7057     case "${target_cpu}" in
7058     i*86)
7059       _WIN32_CRT_CPU=intel
7060       ;;
7061     *)
7062       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7063       ;;
7064     esac
7066     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7067       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7068     fi
7069     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7070     _objdir_win=`pwd -W`
7071     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$_WIN32_CRT_CPU"
7072     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7073     dnl Also pass this to NSPR/NSS
7074     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7075     export DLLFLAGS
7076     ;;
7077   *wince)
7078     AC_DEFINE(MOZ_MEMORY_WINCE)
7079     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7080     if test -z "$WINCE_WINDOWS_MOBILE"; then
7081       AC_DEFINE(MOZ_MEMORY_WINCE6)
7082     fi
7083     ;;
7084   *winmo)
7085     AC_DEFINE(MOZ_MEMORY_WINCE)
7086     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7087     ;;
7088   *)
7089     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7090     ;;
7091   esac
7093   if test "$OS_ARCH" != "Darwin"; then
7094     dnl NB: this must be kept in sync with jemalloc.h
7095     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7096     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7097     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7098   fi
7100 AC_SUBST(MOZ_MEMORY)
7101 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7102 AC_SUBST(WIN32_CRT_SRC_DIR)
7103 dnl Need to set this for make because NSS doesn't have configure
7104 AC_SUBST(DLLFLAGS)
7106 dnl ========================================================
7107 dnl = Use malloc wrapper lib
7108 dnl ========================================================
7109 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7110 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7111     _WRAP_MALLOC=1,
7112     _WRAP_MALLOC= )
7114 if test -n "$_WRAP_MALLOC"; then
7115     if test "$GNU_CC"; then
7116     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"
7117     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
7118     fi
7121 dnl ========================================================
7122 dnl = Location of malloc wrapper lib
7123 dnl ========================================================
7124 MOZ_ARG_WITH_STRING(wrap-malloc,
7125 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7126     WRAP_MALLOC_LIB=$withval)
7128 dnl ========================================================
7129 dnl = Use TraceVis
7130 dnl ========================================================
7131 MOZ_ARG_ENABLE_BOOL(tracevis,
7132 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7133     MOZ_TRACEVIS=1,
7134     MOZ_TRACEVIS= )
7135 if test -n "$MOZ_TRACEVIS"; then
7136     AC_DEFINE(MOZ_TRACEVIS)
7139 dnl ========================================================
7140 dnl = Use GCTimer
7141 dnl ========================================================
7142 MOZ_ARG_ENABLE_BOOL(gctimer,
7143 [  --enable-gctimer       Enable GC timer (default=no)],
7144     MOZ_GCTIMER=1,
7145     MOZ_GCTIMER= )
7146 if test -n "$MOZ_GCTIMER"; then
7147     AC_DEFINE(MOZ_GCTIMER)
7150 dnl ========================================================
7151 dnl = Use Valgrind
7152 dnl ========================================================
7153 MOZ_ARG_ENABLE_BOOL(valgrind,
7154 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7155     MOZ_VALGRIND=1,
7156     MOZ_VALGRIND= )
7157 if test -n "$MOZ_VALGRIND"; then
7158     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7159         AC_MSG_ERROR(
7160             [--enable-valgrind specified but Valgrind is not installed]))
7161     AC_DEFINE(MOZ_VALGRIND)
7164 dnl ========================================================
7165 dnl jprof
7166 dnl ========================================================
7167 MOZ_ARG_ENABLE_BOOL(jprof,
7168 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
7169     MOZ_JPROF=1,
7170     MOZ_JPROF= )
7171 if test -n "$MOZ_JPROF"; then
7172     AC_DEFINE(MOZ_JPROF)
7175 dnl ========================================================
7176 dnl shark
7177 dnl ========================================================
7178 MOZ_ARG_ENABLE_BOOL(shark,
7179 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
7180     MOZ_SHARK=1,
7181     MOZ_SHARK= )
7182 if test -n "$MOZ_SHARK"; then
7183     AC_DEFINE(MOZ_SHARK)
7186 dnl ========================================================
7187 dnl callgrind
7188 dnl ========================================================
7189 MOZ_ARG_ENABLE_BOOL(callgrind,
7190 [  --enable-callgrind      Enable callgrind profiling],
7191     MOZ_CALLGRIND=1,
7192     MOZ_CALLGRIND= )
7193 if test -n "$MOZ_CALLGRIND"; then
7194     AC_DEFINE(MOZ_CALLGRIND)
7197 dnl ========================================================
7198 dnl vtune
7199 dnl ========================================================
7200 MOZ_ARG_ENABLE_BOOL(vtune,
7201 [  --enable-vtune          Enable vtune profiling],
7202     MOZ_VTUNE=1,
7203     MOZ_VTUNE= )
7204 if test -n "$MOZ_VTUNE"; then
7205     AC_DEFINE(MOZ_VTUNE)
7208 dnl ========================================================
7209 dnl Zealous JavaScript GC
7210 dnl ========================================================
7211 MOZ_ARG_ENABLE_BOOL(gczeal,
7212 [  --enable-gczeal          Enable zealous JavaScript GCing],
7213     JS_GC_ZEAL=1,
7214     JS_GC_ZEAL= )
7215 if test -n "$JS_GC_ZEAL"; then
7216     AC_DEFINE(JS_GC_ZEAL)
7219 dnl ========================================================
7220 dnl = Enable static checking using gcc-dehydra
7221 dnl ========================================================
7223 MOZ_ARG_WITH_STRING(static-checking,
7224 [  --with-static-checking=path/to/gcc_dehydra.so
7225                             Enable static checking of code using GCC-dehydra],
7226     DEHYDRA_PATH=$withval,
7227     DEHYDRA_PATH= )
7229 if test -n "$DEHYDRA_PATH"; then
7230     if test ! -f "$DEHYDRA_PATH"; then
7231         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7232     fi
7233     AC_DEFINE(NS_STATIC_CHECKING)
7235 AC_SUBST(DEHYDRA_PATH)
7237 dnl ========================================================
7238 dnl = Enable stripping of libs & executables
7239 dnl ========================================================
7240 MOZ_ARG_ENABLE_BOOL(strip,
7241 [  --enable-strip          Enable stripping of libs & executables ],
7242     ENABLE_STRIP=1,
7243     ENABLE_STRIP= )
7245 dnl ========================================================
7246 dnl = Enable stripping of libs & executables when packaging
7247 dnl ========================================================
7248 MOZ_ARG_ENABLE_BOOL(install-strip,
7249 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7250     PKG_SKIP_STRIP= ,
7251     PKG_SKIP_STRIP=1)
7253 dnl ========================================================
7254 dnl = --enable-elf-dynstr-gc
7255 dnl ========================================================
7256 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7257 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7258     USE_ELF_DYNSTR_GC=1,
7259     USE_ELF_DYNSTR_GC= )
7261 dnl ========================================================
7262 dnl = 
7263 dnl = Profiling and Instrumenting
7264 dnl = 
7265 dnl ========================================================
7266 MOZ_ARG_HEADER(Profiling and Instrumenting)
7268 dnl ========================================================
7269 dnl = Enable timeline service, which provides lightweight
7270 dnl = instrumentation of mozilla for performance measurement.
7271 dnl = Timeline is off by default.
7272 dnl ========================================================
7273 MOZ_ARG_ENABLE_BOOL(timeline,
7274 [  --enable-timeline       Enable timeline services ],
7275     MOZ_TIMELINE=1,
7276     MOZ_TIMELINE= )
7277 if test -n "$MOZ_TIMELINE"; then
7278     AC_DEFINE(MOZ_TIMELINE)
7281 dnl ========================================================
7282 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7283 dnl = timing for identifying code bottlenecks 
7284 dnl = NS_FUNCTION_TIMER is off by default.
7285 dnl ========================================================
7286 MOZ_ARG_ENABLE_BOOL(functiontimer,
7287 [  --enable-functiontimer       Enable NS_FUNCTION_TIMER ],
7288     NS_FUNCTION_TIMER=1,
7289     NS_FUNCTION_TIMER= )
7290 if test -n "$NS_FUNCTION_TIMER"; then
7291     AC_DEFINE(NS_FUNCTION_TIMER)
7294 dnl ========================================================
7295 dnl Turn on reflow counting
7296 dnl ========================================================
7297 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7298 [  --enable-reflow-perf    Enable reflow performance tracing],
7299     MOZ_REFLOW_PERF=1,
7300     MOZ_REFLOW_PERF= )
7301 if test -n "$MOZ_REFLOW_PERF"; then
7302     AC_DEFINE(MOZ_REFLOW_PERF)
7305 dnl ========================================================
7306 dnl Enable code size metrics.
7307 dnl ========================================================
7308 MOZ_ARG_ENABLE_BOOL(codesighs,
7309 [  --enable-codesighs      Enable code size analysis tools],
7310     _ENABLE_CODESIGHS=1,
7311     _ENABLE_CODESIGHS= )
7312 if test -n "$_ENABLE_CODESIGHS"; then
7313     if test -d $srcdir/tools/codesighs; then 
7314         MOZ_MAPINFO=1
7315     else
7316         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7317     fi
7320 dnl ========================================================
7321 dnl = Support for Quantify (Windows)
7322 dnl ========================================================
7323 MOZ_ARG_ENABLE_BOOL(quantify,
7324 [  --enable-quantify      Enable Quantify support (Windows only) ],
7325     MOZ_QUANTIFY=1,
7326     MOZ_QUANTIFY= )
7328 dnl ========================================================
7329 dnl = Support for demangling undefined symbols
7330 dnl ========================================================
7331 if test -z "$SKIP_LIBRARY_CHECKS"; then
7332     AC_LANG_SAVE
7333     AC_LANG_CPLUSPLUS
7334     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7335     AC_LANG_RESTORE
7338 # Demangle only for debug or trace-malloc builds
7339 MOZ_DEMANGLE_SYMBOLS=
7340 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7341     MOZ_DEMANGLE_SYMBOLS=1
7342     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7344 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7346 dnl ========================================================
7347 dnl = Support for gcc stack unwinding (from gcc 3.3)
7348 dnl ========================================================
7349 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7350     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7353 dnl ========================================================
7354 dnl =
7355 dnl = Misc. Options
7356 dnl = 
7357 dnl ========================================================
7358 MOZ_ARG_HEADER(Misc. Options)
7360 dnl ========================================================
7361 dnl update xterm title
7362 dnl ========================================================
7363 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7364 [  --enable-xterm-updates  Update XTERM titles with current command.],
7365     MOZ_UPDATE_XTERM=1,
7366     MOZ_UPDATE_XTERM= )
7368 dnl =========================================================
7369 dnl = Chrome format
7370 dnl =========================================================
7371 MOZ_ARG_ENABLE_STRING([chrome-format],
7372 [  --enable-chrome-format=jar|flat|both|symlink
7373                           Select FORMAT of chrome files (default=jar)],
7374     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7376 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7377     MOZ_CHROME_FILE_FORMAT=jar
7380 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7381     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7382     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7383     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
7384     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
7387 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7388    AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7390 dnl ========================================================
7391 dnl = Define default location for MOZILLA_FIVE_HOME
7392 dnl ========================================================
7393 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7394 [  --with-default-mozilla-five-home
7395                           Set the default value for MOZILLA_FIVE_HOME],
7396 [ val=`echo $withval`
7397   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7399 dnl ========================================================
7400 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7401 dnl ========================================================
7402 MOZ_ARG_WITH_STRING(user-appdir,
7403 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7404 [ val=`echo $withval`
7405 if echo "$val" | grep "\/" >/dev/null; then
7406     AC_MSG_ERROR("Homedir must be single relative path.")
7407 else 
7408     MOZ_USER_DIR="$val"
7409 fi])
7411 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7413 dnl ========================================================
7414 dnl = Doxygen configuration
7415 dnl ========================================================
7416 dnl Use commas to specify multiple dirs to this arg
7417 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7418 MOZ_ARG_WITH_STRING(doc-input-dirs,
7419 [  --with-doc-input-dirs=DIRS
7420                           Header/idl dirs to create docs from],
7421 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7422 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7424 dnl Use commas to specify multiple dirs to this arg
7425 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7426 MOZ_ARG_WITH_STRING(doc-include-dirs,
7427 [  --with-doc-include-dirs=DIRS  
7428                           Include dirs to preprocess doc headers],
7429 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7430 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7432 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7433 MOZ_ARG_WITH_STRING(doc-output-dir,
7434 [  --with-doc-output-dir=DIR
7435                           Dir to generate docs into],
7436 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7437 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7439 if test -z "$SKIP_COMPILER_CHECKS"; then
7440 dnl ========================================================
7441 dnl =
7442 dnl = Compiler Options
7443 dnl = 
7444 dnl ========================================================
7445 MOZ_ARG_HEADER(Compiler Options)
7447 dnl ========================================================
7448 dnl Check for gcc -pipe support
7449 dnl ========================================================
7450 AC_MSG_CHECKING([for gcc -pipe support])
7451 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7452     echo '#include <stdio.h>' > dummy-hello.c
7453     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7454     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7455     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7456     if test $? = 0; then
7457         _res_as_stdin="yes"
7458     else
7459         _res_as_stdin="no"
7460     fi
7461     if test "$_res_as_stdin" = "yes"; then
7462         _SAVE_CFLAGS=$CFLAGS
7463         CFLAGS="$CFLAGS -pipe"
7464         AC_TRY_COMPILE( [ #include <stdio.h> ],
7465             [printf("Hello World\n");],
7466             [_res_gcc_pipe="yes"],
7467             [_res_gcc_pipe="no"] )
7468         CFLAGS=$_SAVE_CFLAGS
7469     fi
7470     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7471         _res="yes";
7472         CFLAGS="$CFLAGS -pipe"
7473         CXXFLAGS="$CXXFLAGS -pipe"
7474     else
7475         _res="no"
7476     fi
7477     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7478     AC_MSG_RESULT([$_res])
7479 else
7480     AC_MSG_RESULT([no])
7483 dnl pass -Wno-long-long to the compiler
7484 MOZ_ARG_ENABLE_BOOL(long-long-warning,
7485 [  --enable-long-long-warning 
7486                           Warn about use of non-ANSI long long type],
7487     _IGNORE_LONG_LONG_WARNINGS=,
7488     _IGNORE_LONG_LONG_WARNINGS=1)
7490 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
7491      _SAVE_CFLAGS="$CFLAGS"
7492      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
7493      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
7494      AC_TRY_COMPILE([], [return(0);], 
7495         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7496           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7497           result="yes" ], result="no")
7498      AC_MSG_RESULT([$result])
7499      CFLAGS="$_SAVE_CFLAGS"
7502 dnl ========================================================
7503 dnl Profile guided optimization
7504 dnl ========================================================
7505 dnl Test for profiling options
7506 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7507 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7509 dnl Provide a switch to disable PGO even when called via profiledbuild.
7510 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7511 [  --disable-profile-guided-optimization
7512                            Don't build with PGO even if called via make profiledbuild],
7513 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7514 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7516 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7518 _SAVE_CFLAGS="$CFLAGS"
7519 CFLAGS="$CFLAGS -fprofile-generate"
7521 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7522 AC_TRY_COMPILE([], [return 0;],
7523                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7524                  result="yes" ], result="no")
7525 AC_MSG_RESULT([$result])
7527 if test $result = "yes"; then
7528   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7529   PROFILE_USE_CFLAGS="-fprofile-use"
7530   PROFILE_USE_LDFLAGS="-fprofile-use"
7531 else
7532   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7533   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7534   AC_TRY_COMPILE([], [return 0;],
7535                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7536                    result="yes" ], result="no")
7537   AC_MSG_RESULT([$result])
7538   if test $result = "yes"; then
7539     PROFILE_USE_CFLAGS="-fbranch-probabilities"
7540   fi
7541   # don't really care, this is an old GCC
7542   PROFILE_GEN_LDFLAGS=
7543   PROFILE_USE_LDFLAGS=
7546 CFLAGS="$_SAVE_CFLAGS"
7548 if test -n "$INTEL_CC"; then
7549   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7550   PROFILE_GEN_LDFLAGS=
7551   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7552   PROFILE_USE_LDFLAGS=
7555 dnl Sun Studio on Solaris
7556 if test "$SOLARIS_SUNPRO_CC"; then
7557   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7558   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7559   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7560   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7563 AC_SUBST(PROFILE_GEN_CFLAGS)
7564 AC_SUBST(PROFILE_GEN_LDFLAGS)
7565 AC_SUBST(PROFILE_USE_CFLAGS)
7566 AC_SUBST(PROFILE_USE_LDFLAGS)
7568 AC_LANG_CPLUSPLUS
7570 dnl ========================================================
7571 dnl Test for -pedantic bustage
7572 dnl ========================================================
7573 MOZ_ARG_DISABLE_BOOL(pedantic,
7574 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7575 _PEDANTIC= )
7576 if test "$_PEDANTIC"; then
7577     _SAVE_CXXFLAGS=$CXXFLAGS
7578     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7579     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7580     AC_TRY_COMPILE([$configure_static_assert_macros],
7581                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7582                    result="no", result="yes" )
7583     AC_MSG_RESULT([$result])
7584     CXXFLAGS="$_SAVE_CXXFLAGS"
7586     case "$result" in
7587     no)
7588         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7589         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7590         ;;
7591     yes)
7592         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7593         ;;
7594     esac
7597 dnl ========================================================
7598 dnl Test for correct temporary object destruction order
7599 dnl ========================================================
7600 dnl We want to make sure the compiler follows the C++ spec here as 
7601 dnl xpcom and the string classes depend on it (bug 235381).
7602 AC_MSG_CHECKING([for correct temporary object destruction order])
7603 AC_TRY_RUN([ class A {
7604              public:  A(int& x) : mValue(x) {}
7605                       ~A() { mValue--; }
7606                       operator char**() { return 0; }
7607              private:  int& mValue;
7608              };
7609              void func(char **arg) {}
7610              int m=2;
7611              void test() {
7612                   func(A(m));
7613                   if (m==1) m = 0;
7614              }
7615              int main() {
7616                  test();
7617                  return(m);
7618              }
7619              ],
7620      result="yes", result="no", result="maybe")
7621 AC_MSG_RESULT([$result])
7623 if test "$result" = "no"; then
7624     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7627 dnl ========================================================
7628 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7629 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7630 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7631 dnl ========================================================
7632 _SAVE_CXXFLAGS=$CXXFLAGS
7633 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7634 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7635     ac_nscap_nonconst_opeq_bug,
7636     [AC_TRY_COMPILE([
7637                       template <class T>
7638                       class Pointer
7639                         {
7640                         public:
7641                           T* myPtr;
7642                         };
7643                       
7644                       template <class T, class U>
7645                       int operator==(const Pointer<T>& rhs, U* lhs)
7646                         {
7647                           return rhs.myPtr == lhs;
7648                         }
7649                       
7650                       template <class T, class U>
7651                       int operator==(const Pointer<T>& rhs, const U* lhs)
7652                         {
7653                           return rhs.myPtr == lhs;
7654                         }
7655                     ],
7656                     [
7657                       Pointer<int> foo;
7658                       const int* bar;
7659                       return foo == bar;
7660                     ],
7661                     ac_nscap_nonconst_opeq_bug="no",
7662                     ac_nscap_nonconst_opeq_bug="yes")])
7663 CXXFLAGS="$_SAVE_CXXFLAGS"
7665 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7666     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7668 fi # SKIP_COMPILER_CHECKS
7670 dnl ========================================================
7671 dnl C++ rtti
7672 dnl Should be smarter and check that the compiler does indeed have rtti
7673 dnl ========================================================
7675 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7676 [  --enable-cpp-rtti       Enable C++ RTTI ],
7677 [ _MOZ_USE_RTTI=1 ],
7678 [ _MOZ_USE_RTTI= ])
7680 if test "$_MOZ_USE_RTTI"; then
7681    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7682 else
7683    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7686 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7688 dnl ========================================================
7689 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
7690 dnl Should be smarter and check that the compiler does indeed have exceptions
7691 dnl ========================================================
7692 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7693 [  --enable-cpp-exceptions Enable C++ exceptions ],
7694 [ _MOZ_CPP_EXCEPTIONS=1 ],
7695 [ _MOZ_CPP_EXCEPTIONS= ])
7697 if test "$_MOZ_CPP_EXCEPTIONS"; then
7698     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7699     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
7700 else
7701     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7704 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7706 # Irix & OSF native compilers do not like exception declarations 
7707 # when exceptions are disabled
7708 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7709     AC_DEFINE(CPP_THROW_NEW, [])
7710 else
7711     AC_DEFINE(CPP_THROW_NEW, [throw()])
7713 AC_LANG_C
7715 dnl ========================================================
7716 dnl =
7717 dnl = Build depencency options
7718 dnl =
7719 dnl ========================================================
7720 MOZ_ARG_HEADER(Build dependencies)
7722 dnl ========================================================
7723 dnl = Do not auto generate dependency info
7724 dnl ========================================================
7725 MOZ_AUTO_DEPS=1
7726 MOZ_ARG_DISABLE_BOOL(auto-deps,
7727 [  --disable-auto-deps     Do not automatically generate dependency info],
7728     MOZ_AUTO_DEPS=,
7729     MOZ_AUTO_DEPS=1)
7731 if test -n "$MOZ_AUTO_DEPS"; then
7732 dnl ========================================================
7733 dnl = Use mkdepend instead of $CC -MD for dependency generation
7734 dnl ========================================================
7735 _cpp_md_flag=
7736 MOZ_ARG_DISABLE_BOOL(md,
7737 [  --disable-md            Do not use compiler-based dependencies ],
7738   [_cpp_md_flag=],
7739   [_cpp_md_flag=1],
7740   [dnl Default is to turn on -MD if using GNU-compatible compilers
7741    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7742      _cpp_md_flag=1
7743    fi
7744   dnl Default is to use -xM if using Sun Studio on Solaris
7745    if test "$SOLARIS_SUNPRO_CC"; then
7746      _cpp_md_flag=1
7747    fi])
7748 if test "$_cpp_md_flag"; then
7749   COMPILER_DEPEND=1
7750   if test "$OS_ARCH" = "OpenVMS"; then
7751     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7752   else
7753     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7754   fi
7755   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7756   if test "$SOLARIS_SUNPRO_CC"; then
7757     _DEPEND_CFLAGS=
7758   fi
7759 else
7760   COMPILER_DEPEND=
7761   dnl Don't override this for MSVC
7762   if test -z "$_WIN32_MSVC"; then
7763     _USE_CPP_INCLUDE_FLAG=
7764     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7765     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7766   fi
7768 fi # MOZ_AUTO_DEPS
7769 MDDEPDIR='.deps'
7770 AC_SUBST(MOZ_AUTO_DEPS)
7771 AC_SUBST(COMPILER_DEPEND)
7772 AC_SUBST(MDDEPDIR)
7775 dnl ========================================================
7776 dnl =
7777 dnl = Static Build Options
7778 dnl =
7779 dnl ========================================================
7780 MOZ_ARG_HEADER(Static build options)
7782 MOZ_ARG_ENABLE_BOOL(static,
7783 [  --enable-static         Enable building of internal static libs],
7784     BUILD_STATIC_LIBS=1,
7785     BUILD_STATIC_LIBS=)
7787 MOZ_ARG_ENABLE_BOOL(libxul,
7788 [  --enable-libxul         Enable building of libxul],
7789     MOZ_ENABLE_LIBXUL=1,
7790     MOZ_ENABLE_LIBXUL=)
7792 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7793         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7796 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7797         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7800 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
7801     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
7804 AC_SUBST(LIBXUL_LIBS)
7806 if test -n "$MOZ_ENABLE_LIBXUL"; then
7807     XPCOM_LIBS="$LIBXUL_LIBS"
7808     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7809 else
7810     if test -n "$BUILD_STATIC_LIBS"; then
7811         AC_DEFINE(MOZ_STATIC_BUILD)
7812     fi
7813     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7816 dnl ========================================================
7817 dnl =
7818 dnl = Standalone module options
7819 dnl = 
7820 dnl ========================================================
7821 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7823 dnl Check for GLib and libIDL.
7824 dnl ========================================================
7825 case "$target_os" in
7826 msvc*|mks*|cygwin*|mingw*|wince*|winmo*)
7827     SKIP_IDL_CHECK="yes"
7828     ;;
7830     SKIP_IDL_CHECK="no"
7831     ;;
7832 esac
7834 if test -z "$COMPILE_ENVIRONMENT"; then
7835     SKIP_IDL_CHECK="yes"
7838 dnl = Allow users to disable libIDL checking for standalone modules
7839 MOZ_ARG_WITHOUT_BOOL(libIDL,
7840 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7841         SKIP_IDL_CHECK="yes")
7843 if test "$SKIP_IDL_CHECK" = "no"
7844 then
7845     _LIBIDL_FOUND=
7846     if test "$MACOS_SDK_DIR"; then 
7847       dnl xpidl, and therefore libIDL, is only needed on the build host.
7848       dnl Don't build it against the SDK, as that causes problems.
7849       _MACSAVE_CFLAGS="$CFLAGS"
7850       _MACSAVE_LIBS="$LIBS"
7851       _MACSAVE_LDFLAGS="$LDFLAGS"
7852       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7853       changequote(,)
7854       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"`
7855       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7856       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7857       changequote([,])
7858       unset NEXT_ROOT
7859     fi
7861     if test "$MOZ_ENABLE_GTK2"; then
7862         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7863     fi
7864     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7865     dnl to either libIDL1 or libIDL2.
7866     if test -z "$_LIBIDL_FOUND"; then
7867         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7868         if test -z "$_LIBIDL_FOUND"; then
7869             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7870         fi
7871     fi
7872     dnl
7873     dnl If we don't have a libIDL config program & not cross-compiling, 
7874     dnl     look for orbit-config instead.
7875     dnl
7876     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7877         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7878         if test -n "$ORBIT_CONFIG"; then
7879             AC_MSG_CHECKING([for ORBit libIDL usability])
7880                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7881             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7882             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7883             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7884             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7885             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7886             LIBIDL_CONFIG=
7887             _SAVE_CFLAGS="$CFLAGS"
7888             _SAVE_LIBS="$LIBS"
7889             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7890             LIBS="$LIBIDL_LIBS $LIBS"
7891             AC_TRY_RUN([
7892 #include <stdlib.h>
7893 #include <libIDL/IDL.h>
7894 int main() {
7895   char *s;
7896   s=strdup(IDL_get_libver_string());
7897   if(s==NULL) {
7898     exit(1);
7899   }
7900   exit(0);
7902             ], [_LIBIDL_FOUND=1
7903                 result="yes"],
7904                [LIBIDL_CFLAGS=
7905                 LIBIDL_LIBS=
7906                 result="no"],
7907                [_LIBIDL_FOUND=1
7908                 result="maybe"] )
7909             AC_MSG_RESULT($result)
7910             CFLAGS="$_SAVE_CFLAGS"
7911             LIBS="$_SAVE_LIBS"
7912         fi
7913     fi
7914     if test -z "$_LIBIDL_FOUND"; then
7915         AC_MSG_ERROR([libIDL not found.
7916         libIDL $LIBIDL_VERSION or higher is required.])
7917     fi
7918     if test "$MACOS_SDK_DIR"; then
7919       CFLAGS="$_MACSAVE_CFLAGS"
7920       LIBS="$_MACSAVE_LIBS"
7921       LDFLAGS="$_MACSAVE_LDFLAGS"
7922       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7923         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7924       fi
7925     fi
7928 if test -n "$CROSS_COMPILE"; then
7929      if test -z "$HOST_LIBIDL_CONFIG"; then
7930         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7931     fi
7932     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7933         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7934         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7935     else
7936         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7937         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7938     fi
7941 if test -z "$SKIP_PATH_CHECKS"; then
7942 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7943     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7944         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7945     else
7946         AM_PATH_GLIB(${GLIB_VERSION})
7947     fi
7951 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7952     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7955 AC_SUBST(LIBIDL_CFLAGS)
7956 AC_SUBST(LIBIDL_LIBS)
7957 AC_SUBST(STATIC_LIBIDL)
7958 AC_SUBST(GLIB_CFLAGS)
7959 AC_SUBST(GLIB_LIBS)
7960 AC_SUBST(GLIB_GMODULE_LIBS)
7961 AC_SUBST(HOST_LIBIDL_CONFIG)
7962 AC_SUBST(HOST_LIBIDL_CFLAGS)
7963 AC_SUBST(HOST_LIBIDL_LIBS)
7965 dnl ========================================================
7966 dnl Check for cairo
7967 dnl ========================================================
7968 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7970 MOZ_TREE_CAIRO=1
7971 MOZ_ARG_ENABLE_BOOL(system-cairo,
7972 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7973 MOZ_TREE_CAIRO=,
7974 MOZ_TREE_CAIRO=1 )
7976 # Check for headers defining standard int types.
7977 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7979 if test "$MOZ_TREE_CAIRO"; then
7980     AC_DEFINE(MOZ_TREE_CAIRO)
7982     # For now we assume that we will have a uint64_t available through
7983     # one of the above headers or mozstdint.h.
7984     AC_DEFINE(HAVE_UINT64_T)
7986     # Define macros for cairo-features.h
7987     if test "$MOZ_X11"; then
7988         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7989         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7990         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7991         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7992         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7993         MOZ_ENABLE_CAIRO_FT=1
7994         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7995     fi
7996     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7997         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7998     fi
7999     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8000         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8001         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8002         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8003     fi
8004     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8005         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8006         if test -z "$WINCE"; then
8007             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8008             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8009                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8010                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8011                 MOZ_ENABLE_D2D_SURFACE=1
8012                 MOZ_ENABLE_DWRITE_FONT=1
8013             else
8014                 WIN32_DWRITE_FONT_FEATURE=
8015                 WIN32_D2D_SURFACE_FEATURE=
8016             fi
8017         else
8018             WIN32_FONT_FEATURE=
8019             WIN32_DWRITE_FONT_FEATURE=
8020             WIN32_D2D_SURFACE_FEATURE=
8021         fi
8023         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
8024         if test -z "$HAS_DDRAW"; then
8025             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.])
8026             DDRAW_SURFACE_FEATURE=
8027         else
8028             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
8029         fi
8031         if test -z "$OGLES_SDK_DIR"; then
8032             OGLES_SURFACE_FEATURE=
8033         else
8034             AC_TRY_COMPILE([
8035               #include <EGL/egl.h>
8036               #include <EGL/eglext.h>
8037               #include <GLES2/gl2.h>
8038               #include <GLES2/gl2ext.h>
8039             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
8040             if test -z "$HAS_OGLES"; then
8041               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
8042               OGLES_SURFACE_FEATURE=
8043             else
8044               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
8045             fi
8046         fi
8048         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8049     fi
8050     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8051         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8052         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8053         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8054         MOZ_ENABLE_CAIRO_FT=1
8055         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8056         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8057     fi
8058     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8059         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8060         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8061         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8062         MOZ_ENABLE_CAIRO_FT=1
8063     fi
8064     if test "$USE_FC_FREETYPE"; then
8065         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8066     fi
8067     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8068     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8069     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8070     AC_SUBST(CAIRO_FT_CFLAGS)
8071     AC_SUBST(HAS_OGLES)
8073     if test "$MOZ_DEBUG"; then
8074       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8075     else
8076       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8077     fi
8079     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8081     AC_SUBST(PS_SURFACE_FEATURE)
8082     AC_SUBST(PDF_SURFACE_FEATURE)
8083     AC_SUBST(SVG_SURFACE_FEATURE)
8084     AC_SUBST(XLIB_SURFACE_FEATURE)
8085     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8086     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8087     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8088     AC_SUBST(XCB_SURFACE_FEATURE)
8089     AC_SUBST(WIN32_SURFACE_FEATURE)
8090     AC_SUBST(DDRAW_SURFACE_FEATURE)
8091     AC_SUBST(OGLES_SURFACE_FEATURE)    
8092     AC_SUBST(OS2_SURFACE_FEATURE)
8093     AC_SUBST(BEOS_SURFACE_FEATURE)
8094     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8095     AC_SUBST(FT_FONT_FEATURE)
8096     AC_SUBST(FC_FONT_FEATURE)
8097     AC_SUBST(WIN32_FONT_FEATURE)
8098     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8099     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8100     AC_SUBST(QUARTZ_FONT_FEATURE)
8101     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8102     AC_SUBST(QT_SURFACE_FEATURE)
8104     if test "$_WIN32_MSVC"; then
8105         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
8106     else
8107         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"
8109         if test "$MOZ_X11"; then
8110             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8111         fi
8112     fi
8114     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8115     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8117 else
8118    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8119    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8120    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8121    if test "$MOZ_X11"; then
8122         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8123         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8124         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8125    fi
8128 AC_SUBST(MOZ_TREE_CAIRO)
8129 AC_SUBST(MOZ_CAIRO_CFLAGS)
8130 AC_SUBST(MOZ_CAIRO_LIBS)
8132 dnl qcms
8133 dnl ========================================================
8135 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8136 AC_SUBST(QCMS_LIBS)
8138 dnl ========================================================
8139 dnl disable xul
8140 dnl ========================================================
8141 MOZ_ARG_DISABLE_BOOL(xul,
8142 [  --disable-xul           Disable XUL],
8143     MOZ_XUL= )
8144 if test "$MOZ_XUL"; then
8145   AC_DEFINE(MOZ_XUL)
8146 else
8147   dnl remove extensions that require XUL
8148   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8151 AC_SUBST(MOZ_XUL)
8153 dnl ========================================================
8154 dnl disable profile locking
8155 dnl   do no use this in applications that can have more than
8156 dnl   one process accessing the profile directory.
8157 dnl ========================================================
8158 MOZ_ARG_DISABLE_BOOL(profilelocking,
8159 [  --disable-profilelocking           Disable profile locking],
8160     MOZ_PROFILELOCKING=,
8161     MOZ_PROFILELOCKING=1 )
8162 if test "$MOZ_PROFILELOCKING"; then
8163   AC_DEFINE(MOZ_PROFILELOCKING)
8166 dnl ========================================================
8167 dnl disable rdf services
8168 dnl ========================================================
8169 MOZ_ARG_DISABLE_BOOL(rdf,
8170 [  --disable-rdf           Disable RDF],
8171     MOZ_RDF= )
8172 if test "$MOZ_RDF"; then
8173   AC_DEFINE(MOZ_RDF)
8176 AC_SUBST(MOZ_RDF)
8178 dnl ========================================================
8179 dnl necko configuration options
8180 dnl ========================================================
8183 dnl option to disable various necko protocols
8185 MOZ_ARG_ENABLE_STRING(necko-protocols,
8186 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8187                           Enable/disable specific protocol handlers],
8188 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8189     if test "$option" = "yes" || test "$option" = "all"; then
8190         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8191     elif test "$option" = "no" || test "$option" = "none"; then
8192         NECKO_PROTOCOLS=""
8193     elif test "$option" = "default"; then
8194         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8195     elif test `echo "$option" | grep -c \^-` != 0; then
8196         option=`echo $option | sed 's/^-//'`
8197         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8198     else
8199         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8200     fi
8201 done],
8202     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8203 dnl Remove dupes
8204 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8205 AC_SUBST(NECKO_PROTOCOLS)
8206 for p in $NECKO_PROTOCOLS; do
8207     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8208 done
8211 dnl option to disable necko's disk cache
8213 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8214 [  --disable-necko-disk-cache
8215                           Disable necko disk cache],
8216     NECKO_DISK_CACHE=,
8217     NECKO_DISK_CACHE=1)
8218 AC_SUBST(NECKO_DISK_CACHE)
8219 if test "$NECKO_DISK_CACHE"; then
8220     AC_DEFINE(NECKO_DISK_CACHE)
8224 dnl option to disable necko's wifi scanner
8226 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8227 [  --disable-necko-wifi   Disable necko wifi scanner],
8228     NECKO_WIFI=,
8229     NECKO_WIFI=1
8232 if test "$OS_ARCH" = "OS2"; then
8233   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8234   NECKO_WIFI=
8236 if test "$NECKO_WIFI" -a \
8237         "$OS_ARCH" != "Linux" -a \
8238         "$OS_ARCH" != "Darwin" -a \
8239         "$OS_ARCH" != "SunOS" -a \
8240         "$OS_ARCH" != "WINNT" -a \
8241         "$OS_ARCH" != "WINCE"; then
8242   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8245 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8246 then
8247   AC_CHECK_HEADER([iwlib.h])
8248   if test "$ac_cv_header_iwlib_h" != "yes"; then
8249     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])
8250   fi
8253 if test "$NECKO_WIFI"; then
8254   AC_DEFINE(NECKO_WIFI)
8256 AC_SUBST(NECKO_WIFI)
8259 dnl option to disable cookies
8261 MOZ_ARG_DISABLE_BOOL(cookies,
8262 [  --disable-cookies       Disable cookie support],
8263     NECKO_COOKIES=,
8264     NECKO_COOKIES=1)
8265 AC_SUBST(NECKO_COOKIES)
8266 if test "$NECKO_COOKIES"; then
8267     AC_DEFINE(NECKO_COOKIES)
8271 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8273 MOZ_ARG_DISABLE_BOOL(ctypes,
8274 [  --disable-ctypes        Disable js-ctypes],
8275     BUILD_CTYPES=,
8276     BUILD_CTYPES=1)
8277 AC_SUBST(BUILD_CTYPES)
8278 if test "$BUILD_CTYPES"; then
8279   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8280     # Disable ctypes for arm/wince.
8281     BUILD_CTYPES=
8282   else
8283     AC_DEFINE(BUILD_CTYPES)
8284   fi
8287 dnl NECKO_ configuration options are not global
8288 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8290 dnl Only build Mork if it's required
8291 AC_SUBST(MOZ_MORK)
8292 if test "$MOZ_MORK"; then
8293   AC_DEFINE(MOZ_MORK)
8296 dnl Build the lightweight Mork reader if required
8297 AC_SUBST(MOZ_MORKREADER)
8298 if test "$MOZ_MORKREADER"; then
8299   AC_DEFINE(MOZ_MORKREADER)
8302 dnl Build Places if required
8303 if test "$MOZ_PLACES"; then
8304   AC_DEFINE(MOZ_PLACES)
8307 dnl ========================================================
8308 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8309     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8312 dnl ========================================================
8313 dnl =
8314 dnl = Maintainer debug option (no --enable equivalent)
8315 dnl =
8316 dnl ========================================================
8318 AC_SUBST(AR)
8319 AC_SUBST(AR_FLAGS)
8320 AC_SUBST(AR_LIST)
8321 AC_SUBST(AR_EXTRACT)
8322 AC_SUBST(AR_DELETE)
8323 AC_SUBST(AS)
8324 AC_SUBST(ASFLAGS)
8325 AC_SUBST(AS_DASH_C_FLAG)
8326 AC_SUBST(LD)
8327 AC_SUBST(RC)
8328 AC_SUBST(RCFLAGS)
8329 AC_SUBST(WINDRES)
8330 AC_SUBST(IMPLIB)
8331 AC_SUBST(FILTER)
8332 AC_SUBST(BIN_FLAGS)
8333 AC_SUBST(NS_USE_NATIVE)
8334 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8335 AC_SUBST(MOZ_UPDATE_XTERM)
8336 AC_SUBST(MINIMO)
8337 AC_SUBST(MOZ_PLATFORM_MAEMO)
8338 AC_SUBST(MOZ_AUTH_EXTENSION)
8339 AC_SUBST(MOZ_MATHML)
8340 AC_SUBST(MOZ_PERMISSIONS)
8341 AC_SUBST(MOZ_XTF)
8342 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8343 AC_SUBST(MOZ_PREF_EXTENSIONS)
8344 AC_SUBST(MOZ_SVG)
8345 AC_SUBST(MOZ_SMIL)
8346 AC_SUBST(MOZ_XSLT_STANDALONE)
8347 AC_SUBST(MOZ_JS_LIBS)
8348 AC_SUBST(MOZ_PSM)
8349 AC_SUBST(MOZ_DEBUG)
8350 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8351 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8352 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8353 AC_SUBST(MOZ_DEBUG_FLAGS)
8354 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8355 AC_SUBST(WARNINGS_AS_ERRORS)
8356 AC_SUBST(MOZ_EXTENSIONS)
8357 AC_SUBST(MOZ_IMG_DECODERS)
8358 AC_SUBST(MOZ_IMG_ENCODERS)
8359 AC_SUBST(MOZ_JSDEBUGGER)
8360 AC_SUBST(MOZ_PLUGINS)
8361 AC_SUBST(MOZ_LOG_REFCNT)
8362 AC_SUBST(MOZ_LEAKY)
8363 AC_SUBST(MOZ_JPROF)
8364 AC_SUBST(MOZ_SHARK)
8365 AC_SUBST(MOZ_CALLGRIND)
8366 AC_SUBST(MOZ_VTUNE)
8367 AC_SUBST(MOZ_XPCTOOLS)
8368 AC_SUBST(MOZ_JSLOADER)
8369 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8370 AC_SUBST(MOZ_QUANTIFY)
8371 AC_SUBST(LIBICONV)
8372 AC_SUBST(MOZ_PLACES)
8373 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8374 AC_SUBST(MOZ_STORAGE)
8375 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8376 AC_SUBST(MOZ_FEEDS)
8377 AC_SUBST(NS_PRINTING)
8378 AC_SUBST(MOZ_WEBGL)
8379 AC_SUBST(MOZ_HELP_VIEWER)
8381 AC_SUBST(MOZ_JAVAXPCOM)
8382 AC_SUBST(JAVA_INCLUDE_PATH)
8383 AC_SUBST(JAVA)
8384 AC_SUBST(JAVAC)
8385 AC_SUBST(JAR)
8387 AC_SUBST(MOZ_PROFILELOCKING)
8389 AC_SUBST(HAVE_XIE)
8390 AC_SUBST(MOZ_XIE_LIBS)
8391 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8393 AC_SUBST(BUILD_STATIC_LIBS)
8394 AC_SUBST(MOZ_ENABLE_LIBXUL)
8395 AC_SUBST(ENABLE_TESTS)
8396 AC_SUBST(IBMBIDI)
8397 AC_SUBST(MOZ_UNIVERSALCHARDET)
8398 AC_SUBST(ACCESSIBILITY)
8399 AC_SUBST(MOZ_XPINSTALL)
8400 AC_SUBST(MOZ_VIEW_SOURCE)
8401 AC_SUBST(MOZ_SPELLCHECK)
8402 AC_SUBST(MOZ_USER_DIR)
8403 AC_SUBST(MOZ_CRASHREPORTER)
8405 AC_SUBST(ENABLE_STRIP)
8406 AC_SUBST(PKG_SKIP_STRIP)
8407 AC_SUBST(USE_ELF_DYNSTR_GC)
8408 AC_SUBST(INCREMENTAL_LINKER)
8409 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8410 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8412 AC_SUBST(MOZ_FIX_LINK_PATHS)
8413 AC_SUBST(XPCOM_LIBS)
8414 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8415 AC_SUBST(XPCOM_GLUE_LDOPTS)
8416 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8418 AC_SUBST(USE_DEPENDENT_LIBS)
8420 AC_SUBST(MOZ_BUILD_ROOT)
8421 AC_SUBST(MOZ_OS2_TOOLS)
8422 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8424 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8425 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8426 AC_SUBST(MOZ_TIMELINE)
8427 AC_SUBST(OGLES_SDK_DIR)
8429 AC_SUBST(MOZ_APP_NAME)
8430 AC_SUBST(MOZ_APP_DISPLAYNAME)
8431 AC_SUBST(MOZ_APP_VERSION)
8432 AC_SUBST(MOZ_APP_UA_EXTRA)
8433 AC_SUBST(FIREFOX_VERSION)
8435 AC_SUBST(MOZ_PKG_SPECIAL)
8437 AC_SUBST(MOZILLA_OFFICIAL)
8439 dnl win32 options
8440 AC_SUBST(MOZ_MAPINFO)
8441 AC_SUBST(MOZ_BROWSE_INFO)
8442 AC_SUBST(MOZ_TOOLS_DIR)
8443 AC_SUBST(CYGWIN_WRAPPER)
8444 AC_SUBST(AS_PERL)
8445 AC_SUBST(WIN32_REDIST_DIR)
8446 AC_SUBST(PYTHON)
8448 AC_SUBST(WINCE)
8449 AC_SUBST(WINCE_SDK_DIR)
8450 AC_SUBST(WINCE_WINDOWS_MOBILE)
8452 dnl Echo the CFLAGS to remove extra whitespace.
8453 CFLAGS=`echo \
8454         $_WARNINGS_CFLAGS \
8455         $CFLAGS`
8457 CXXFLAGS=`echo \
8458         $_MOZ_RTTI_FLAGS \
8459         $_MOZ_EXCEPTIONS_FLAGS \
8460         $_WARNINGS_CXXFLAGS \
8461         $CXXFLAGS`
8463 COMPILE_CFLAGS=`echo \
8464     $_DEFINES_CFLAGS \
8465         $_DEPEND_CFLAGS \
8466     $COMPILE_CFLAGS`
8468 COMPILE_CXXFLAGS=`echo \
8469     $_DEFINES_CXXFLAGS \
8470         $_DEPEND_CFLAGS \
8471     $COMPILE_CXXFLAGS`
8473 AC_SUBST(SYSTEM_MAKEDEPEND)
8474 AC_SUBST(SYSTEM_LIBXUL)
8475 AC_SUBST(SYSTEM_JPEG)
8476 AC_SUBST(SYSTEM_PNG)
8477 AC_SUBST(SYSTEM_ZLIB)
8478 AC_SUBST(SYSTEM_BZ2)
8480 AC_SUBST(JPEG_CFLAGS)
8481 AC_SUBST(JPEG_LIBS)
8482 AC_SUBST(ZLIB_CFLAGS)
8483 AC_SUBST(ZLIB_LIBS)
8484 AC_SUBST(BZ2_CFLAGS)
8485 AC_SUBST(BZ2_LIBS)
8486 AC_SUBST(PNG_CFLAGS)
8487 AC_SUBST(PNG_LIBS)
8489 AC_SUBST(MOZ_JPEG_CFLAGS)
8490 AC_SUBST(MOZ_JPEG_LIBS)
8491 AC_SUBST(MOZ_ZLIB_CFLAGS)
8492 AC_SUBST(MOZ_ZLIB_LIBS)
8493 AC_SUBST(MOZ_BZ2_CFLAGS)
8494 AC_SUBST(MOZ_BZ2_LIBS)
8495 AC_SUBST(MOZ_PNG_CFLAGS)
8496 AC_SUBST(MOZ_PNG_LIBS)
8498 AC_SUBST(NSPR_CFLAGS)
8499 AC_SUBST(NSPR_LIBS)
8500 AC_SUBST(MOZ_NATIVE_NSPR)
8502 AC_SUBST(NSS_CFLAGS)
8503 AC_SUBST(NSS_LIBS)
8504 AC_SUBST(NSS_DEP_LIBS)
8505 AC_SUBST(MOZ_NATIVE_NSS)
8506 AC_SUBST(NSS_DISABLE_DBM)
8508 AC_SUBST(CFLAGS)
8509 AC_SUBST(CXXFLAGS)
8510 AC_SUBST(CPPFLAGS)
8511 AC_SUBST(COMPILE_CFLAGS)
8512 AC_SUBST(COMPILE_CXXFLAGS)
8513 AC_SUBST(LDFLAGS)
8514 AC_SUBST(LIBS)
8515 AC_SUBST(CROSS_COMPILE)
8516 AC_SUBST(WCHAR_CFLAGS)
8518 AC_SUBST(HOST_CC)
8519 AC_SUBST(HOST_CXX)
8520 AC_SUBST(HOST_CFLAGS)
8521 AC_SUBST(HOST_CXXFLAGS)
8522 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8523 AC_SUBST(HOST_AR)
8524 AC_SUBST(HOST_AR_FLAGS)
8525 AC_SUBST(HOST_LD)
8526 AC_SUBST(HOST_RANLIB)
8527 AC_SUBST(HOST_NSPR_MDCPUCFG)
8528 AC_SUBST(HOST_BIN_SUFFIX)
8529 AC_SUBST(HOST_OS_ARCH)
8531 AC_SUBST(TARGET_CPU)
8532 AC_SUBST(TARGET_VENDOR)
8533 AC_SUBST(TARGET_OS)
8534 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8535 AC_SUBST(TARGET_MD_ARCH)
8536 AC_SUBST(TARGET_XPCOM_ABI)
8537 AC_SUBST(OS_TARGET)
8538 AC_SUBST(OS_ARCH)
8539 AC_SUBST(OS_RELEASE)
8540 AC_SUBST(OS_TEST)
8542 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8543 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8545 AC_SUBST(WRAP_MALLOC_CFLAGS)
8546 AC_SUBST(WRAP_MALLOC_LIB)
8547 AC_SUBST(MKSHLIB)
8548 AC_SUBST(MKCSHLIB)
8549 AC_SUBST(MKSHLIB_FORCE_ALL)
8550 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8551 AC_SUBST(DSO_CFLAGS)
8552 AC_SUBST(DSO_PIC_CFLAGS)
8553 AC_SUBST(DSO_LDOPTS)
8554 AC_SUBST(LIB_PREFIX)
8555 AC_SUBST(DLL_PREFIX)
8556 AC_SUBST(DLL_SUFFIX)
8557 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8558 AC_SUBST(LIB_SUFFIX)
8559 AC_SUBST(OBJ_SUFFIX)
8560 AC_SUBST(BIN_SUFFIX)
8561 AC_SUBST(ASM_SUFFIX)
8562 AC_SUBST(IMPORT_LIB_SUFFIX)
8563 AC_SUBST(USE_N32)
8564 AC_SUBST(CC_VERSION)
8565 AC_SUBST(CXX_VERSION)
8566 AC_SUBST(MSMANIFEST_TOOL)
8567 AC_SUBST(NS_ENABLE_TSF)
8568 AC_SUBST(MOZ_NSS_PATCH)
8570 if test "$USING_HCC"; then
8571    CC='${topsrcdir}/build/hcc'
8572    CC="$CC '$_OLDCC'"
8573    CXX='${topsrcdir}/build/hcpp'
8574    CXX="$CXX '$_OLDCXX'"
8575    AC_SUBST(CC)
8576    AC_SUBST(CXX)
8579 dnl Check for missing components
8580 if test "$COMPILE_ENVIRONMENT"; then
8581 if test "$MOZ_X11"; then
8582     dnl ====================================================
8583     dnl = Check if X headers exist
8584     dnl ====================================================
8585     _SAVE_CFLAGS=$CFLAGS
8586     CFLAGS="$CFLAGS $XCFLAGS"
8587     AC_TRY_COMPILE([
8588         #include <stdio.h>
8589         #include <stdlib.h>
8590         #include <X11/Xlib.h>
8591         #include <X11/Intrinsic.h>
8592     ],
8593     [
8594         Display *dpy = 0;
8595         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8596             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8597             exit(1);
8598         }
8599     ], [], 
8600     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8601     CFLAGS="$_SAVE_CFLAGS"
8603     if test ! -z "$MISSING_X"; then
8604         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8605     fi
8607 fi # MOZ_X11
8609 dnl Check for headers, etc. needed by WebGL.
8610 if test -n "$MOZ_WEBGL_GLX"; then
8611     AC_CHECK_HEADER(GL/glx.h)
8612     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8613         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8614     fi
8615 fi # MOZ_WEBGL_GLX
8616 fi # COMPILE_ENVIRONMENT
8618 if test "$USE_FC_FREETYPE"; then
8619     if test "$COMPILE_ENVIRONMENT"; then
8620         _SAVE_CPPFLAGS="$CPPFLAGS"
8621         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8622         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
8623             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8624         CPPFLAGS="$_SAVE_CPPFLAGS"
8625     else
8626         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8627     fi
8630 dnl Set various defines and substitutions
8631 dnl ========================================================
8633 if test "$OS_ARCH" = "BeOS"; then
8634   AC_DEFINE(XP_BEOS)
8635 elif test "$OS_ARCH" = "Darwin"; then
8636   AC_DEFINE(XP_UNIX)
8637   AC_DEFINE(UNIX_ASYNC_DNS)
8638 elif test "$OS_ARCH" = "OpenVMS"; then
8639   AC_DEFINE(XP_UNIX)
8640 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8641   AC_DEFINE(XP_UNIX)
8642   AC_DEFINE(UNIX_ASYNC_DNS)
8645 if test "$MOZ_DEBUG"; then
8646     AC_DEFINE(MOZ_REFLOW_PERF)
8647     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8650 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8651     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8652     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8653     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8654     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8655     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8656     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8657     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8658     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8661 dnl ========================================================
8662 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8663 dnl ========================================================
8664 case "$host_os" in
8665 mingw*)
8666     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8667     ;;
8668 cygwin*|msvc*|mks*)
8669     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8670     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8671     CC="\$(CYGWIN_WRAPPER) $CC"
8672     CXX="\$(CYGWIN_WRAPPER) $CXX"
8673     CPP="\$(CYGWIN_WRAPPER) $CPP"
8674     LD="\$(CYGWIN_WRAPPER) $LD"
8675     AS="\$(CYGWIN_WRAPPER) $AS"
8676     RC="\$(CYGWIN_WRAPPER) $RC"
8677     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8678     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8679     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8680     ;;
8681 esac
8683 AC_SUBST(CYGDRIVE_MOUNT)
8684 AC_SUBST(WIN_TOP_SRC)
8686 AC_SUBST(MOZILLA_VERSION)
8688 AC_SUBST(ac_configure_args)
8690 dnl Spit out some output
8691 dnl ========================================================
8693 dnl The following defines are used by xpcom
8694 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8695 CPP_THROW_NEW
8696 HAVE_CPP_2BYTE_WCHAR_T
8697 HAVE_CPP_ACCESS_CHANGING_USING
8698 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8699 HAVE_CPP_BOOL
8700 HAVE_CPP_CHAR16_T
8701 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8702 HAVE_CPP_EXPLICIT
8703 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8704 HAVE_CPP_NAMESPACE_STD
8705 HAVE_CPP_NEW_CASTS
8706 HAVE_CPP_PARTIAL_SPECIALIZATION
8707 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8708 HAVE_CPP_TYPENAME
8709 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8710 HAVE_STATVFS
8711 NEED_CPP_UNUSED_IMPLEMENTATIONS
8712 NEW_H
8713 HAVE_GETPAGESIZE
8714 HAVE_ICONV
8715 HAVE_ICONV_WITH_CONST_INPUT
8716 HAVE_MBRTOWC
8717 HAVE_SYS_MOUNT_H
8718 HAVE_SYS_VFS_H
8719 HAVE_WCRTOMB
8722 AC_CONFIG_HEADER(
8723 netwerk/necko-config.h
8724 xpcom/xpcom-config.h
8725 xpcom/xpcom-private.h
8728 # Save the defines header file before autoconf removes it.
8729 # (Do not add AC_DEFINE calls after this line.)
8730   _CONFIG_TMP=confdefs-tmp.h
8731   _CONFIG_DEFS_H=mozilla-config.h
8733   cat > $_CONFIG_TMP <<\EOF
8734 /* List of defines generated by configure. Included with preprocessor flag,
8735  * -include, to avoid long list of -D defines on the compile command-line.
8736  * Do not edit.
8737  */
8739 #ifndef _MOZILLA_CONFIG_H_
8740 #define _MOZILLA_CONFIG_H_
8743 _EGREP_PATTERN='^#define ('
8744 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8745     for f in $_NON_GLOBAL_ACDEFINES; do
8746         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8747     done
8749 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8751   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8753   cat >> $_CONFIG_TMP <<\EOF
8755 #endif /* _MOZILLA_CONFIG_H_ */
8759   # Only write mozilla-config.h when something changes (or it doesn't exist)
8760   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8761     rm $_CONFIG_TMP
8762   else
8763     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8764     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8766     echo ==== $_CONFIG_DEFS_H =================================
8767     cat $_CONFIG_DEFS_H
8768   fi
8770 dnl Probably shouldn't call this manually but we always want the output of DEFS
8771 rm -f confdefs.h.save
8772 mv confdefs.h confdefs.h.save
8773 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8774 AC_OUTPUT_MAKE_DEFS()
8775 MOZ_DEFINES=$DEFS
8776 AC_SUBST(MOZ_DEFINES)
8777 rm -f confdefs.h
8778 mv confdefs.h.save confdefs.h
8780 dnl Load the list of Makefiles to generate.
8781 dnl   To add new Makefiles, edit allmakefiles.sh.
8782 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8783 . ${srcdir}/allmakefiles.sh
8784 dnl 
8785 dnl Run a perl script to quickly create the makefiles.
8786 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8787 dnl   for the files it cannot handle correctly. This way, config.status
8788 dnl   will handle these files.
8789 dnl If it fails, nothing is set and config.status will run as usual.
8791 dnl This does not change the $MAKEFILES variable.
8793 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8795 if test -z "${AS_PERL}"; then
8796 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8797 else
8798 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8800 . ./conftest.sh
8801 rm conftest.sh
8803 echo $MAKEFILES > unallmakefiles
8805 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8807 AC_OUTPUT($MAKEFILES)
8809 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8810 if test "$CAIRO_FEATURES_H"; then
8811   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8812     echo "$CAIRO_FEATURES_H is unchanged"
8813     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8814   else
8815     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8816   fi
8819 dnl ========================================================
8820 dnl = Setup a nice relatively clean build environment for
8821 dnl = sub-configures.
8822 dnl ========================================================
8823 CC="$_SUBDIR_CC" 
8824 CXX="$_SUBDIR_CXX" 
8825 CFLAGS="$_SUBDIR_CFLAGS" 
8826 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8827 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8828 LDFLAGS="$_SUBDIR_LDFLAGS"
8829 HOST_CC="$_SUBDIR_HOST_CC" 
8830 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8831 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8834 unset MAKEFILES
8835 unset CONFIG_FILES
8837 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8838 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8840 if test -z "$MOZ_NATIVE_NSPR"; then
8841     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8842     if test -z "$MOZ_DEBUG"; then
8843         ac_configure_args="$ac_configure_args --disable-debug"
8844     fi
8845     if test "$MOZ_OPTIMIZE" = "1"; then
8846         ac_configure_args="$ac_configure_args --enable-optimize"
8847     fi
8848     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8849        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8850     fi
8851     if test -n "$HAVE_64BIT_OS"; then
8852         ac_configure_args="$ac_configure_args --enable-64bit"
8853     fi
8854     if test -n "$USE_ARM_KUSER"; then
8855         ac_configure_args="$ac_configure_args --with-arm-kuser"
8856     fi
8857     AC_OUTPUT_SUBDIRS(nsprpub)
8858     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8861 if test -z "$MOZ_NATIVE_NSPR"; then
8862     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8863     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8864     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8865        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8866        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8867        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8868        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8869     fi
8870     rm -f config/autoconf.mk.bak
8873 # Run the SpiderMonkey 'configure' script.
8874 dist=$MOZ_BUILD_ROOT/dist
8875 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8876 ac_configure_args="$ac_configure_args --enable-threadsafe"
8877 if test "$BUILD_CTYPES"; then
8878     # Build js-ctypes on the platforms we can.
8879     ac_configure_args="$ac_configure_args --enable-ctypes"
8881 if test -z "$MOZ_NATIVE_NSPR"; then
8882     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8883     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8885 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8886 ac_configure_args="$ac_configure_args --prefix=$dist"
8887 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8888 if test "$MOZ_MEMORY"; then
8889    ac_configure_args="$ac_configure_args --enable-jemalloc"
8890    if test -n "$MOZ_MEMORY_LDFLAGS"; then
8891      export MOZ_MEMORY_LDFLAGS
8892    fi
8894 AC_OUTPUT_SUBDIRS(js/src)
8895 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8897 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8899 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8900 dnl Needs to be at the end to respect possible changes from NSPR configure
8901 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8902   echo "config/autoconf.mk is unchanged"
8903   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8904 else
8905   rm -f config/autoconf.mk.orig 2> /dev/null