Bug 557888 - nsCertAlreadyExists always leaks unused arena, r=kaie
[mozilla-central.git] / configure.in
blobd8f2b86def0b8b2595884425a4744a1acddd646d
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" == "yes"; then
717             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
718                            ac_cv_have_dllimport_exception_bug,
719                 [
720                     AC_LANG_SAVE
721                     AC_LANG_CPLUSPLUS
722                     _SAVE_CXXFLAGS="$CXXFLAGS"
723                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
724                     AC_TRY_LINK([#include <vector>],
725                                 [std::vector<int> v; return v.at(1);],
726                                 ac_cv_have_dllimport_exception_bug="no",
727                                 ac_cv_have_dllimport_exception_bug="yes")
728                     CXXFLAGS="$_SAVE_CXXFLAGS"
729                     AC_LANG_RESTORE
730                 ])
731             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
732                 WRAP_STL_INCLUDES=1
733                 MOZ_MSVC_STL_WRAP__Throw=1
734                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
735             fi
736         else
737             AC_CACHE_CHECK(for overridable _RAISE,
738                            ac_cv_have__RAISE,
739                 [
740                     AC_LANG_SAVE
741                     AC_LANG_CPLUSPLUS
742                     _SAVE_CXXFLAGS="$CXXFLAGS"
743                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
744                     AC_TRY_COMPILE([#include <xstddef>
745                                     #undef _RAISE
746                                     #define _RAISE(x) externallyDefinedFunction((x).what())
747                                     #include <vector>
748                                    ],
749                                    [std::vector<int> v; return v.at(1);],
750                                    ac_cv_have__RAISE="no",
751                                    ac_cv_have__RAISE="yes")
752                     CXXFLAGS="$_SAVE_CXXFLAGS"
753                     AC_LANG_RESTORE
754                 ])
755             if test "$ac_cv_have__RAISE" = "yes"; then
756                 WRAP_STL_INCLUDES=1
757                 MOZ_MSVC_STL_WRAP__RAISE=1
758                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
759             else
760                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
761             fi
762         fi
764         if test "$WRAP_STL_INCLUDES" = "1"; then
765             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
766         fi
767     else
768         # Check w32api version
769         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
770         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
771         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
772         AC_TRY_COMPILE([#include <w32api.h>],
773             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
774                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
775                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
776                 #error "test failed."
777             #endif
778             , [ res=yes ], [ res=no ])
779         AC_MSG_RESULT([$res])
780         if test "$res" != "yes"; then
781             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
782         fi
783         # Check windres version
784         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
785         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
786         AC_MSG_RESULT([$_WINDRES_VERSION])
787         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
788         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
789         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
790         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
791         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
792         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
793         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
794                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
795                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
796                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
797                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
798                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
799         then
800             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
801         fi
803         # Server 2003 is the highest version supported
804         MOZ_WINSDK_MAXVER=0x05020000
805     fi # !GNU_CC
807     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
808     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
809     # Require OS features provided by IE 5.0
810     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
812     # If the maximum version supported by this SDK is lower than the target
813     # version, error out
814     AC_MSG_CHECKING([for Windows SDK being recent enough])
815     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
816         AC_MSG_RESULT("yes")
817     else
818         AC_MSG_RESULT("no")
819         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.])
820     fi
822     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
823     # Definitions matching sdkddkver.h
824     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
825     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
826     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
827     ;;
828 esac
830 dnl Test breaks icc on OS/2 && MSVC
831 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
832     AC_PROG_CC_C_O
833     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
834         USING_HCC=1
835         _OLDCC=$CC
836         _OLDCXX=$CXX
837         CC="${srcdir}/build/hcc '$CC'"
838         CXX="${srcdir}/build/hcpp '$CXX'"
839     fi
842 AC_PROG_CPP
843 AC_PROG_CXXCPP
845 if test -n "$_WIN32_MSVC"; then
846     SKIP_PATH_CHECKS=1
847     SKIP_COMPILER_CHECKS=1
848     SKIP_LIBRARY_CHECKS=1
850     # Since we're skipping compiler and library checks, hard-code
851     # some facts here.
852     case "$target" in
853     *-wince|*-winmo)
854         ;;
855     *)
856         AC_DEFINE(HAVE_IO_H)
857         AC_DEFINE(HAVE_SETBUF)
858         AC_DEFINE(HAVE_ISATTY)
859         ;;
860     esac
863 fi # COMPILE_ENVIRONMENT
865 AC_SUBST(MIDL_FLAGS)
866 AC_SUBST(_MSC_VER)
868 AC_SUBST(GNU_AS)
869 AC_SUBST(GNU_LD)
870 AC_SUBST(GNU_CC)
871 AC_SUBST(GNU_CXX)
872 AC_SUBST(INTEL_CC)
873 AC_SUBST(INTEL_CXX)
875 AC_SUBST(STL_FLAGS)
876 AC_SUBST(WRAP_STL_INCLUDES)
877 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
878 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
880 dnl ========================================================
881 dnl Checks for programs.
882 dnl ========================================================
883 AC_PROG_INSTALL
884 AC_PROG_LN_S
886 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
887 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
888 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
889 _perl_res=$?
890 AC_MSG_RESULT([$_perl_version])
892 if test "$_perl_res" != 0; then
893     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
897 AC_MSG_CHECKING([for full perl installation])
898 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
899 _perl_res=$?
900 if test "$_perl_res" != 0; then
901     AC_MSG_RESULT([no])
902     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
903 else
904     AC_MSG_RESULT([yes])    
907 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.6 python2.5 python2.4 python)
908 if test -z "$PYTHON"; then
909     AC_MSG_ERROR([python was not found in \$PATH])
912 if test -z "$COMPILE_ENVIRONMENT"; then
913     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
915 AC_SUBST(NSINSTALL_BIN)
917 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
918 MOZ_PATH_PROG(WHOAMI, whoami, :)
919 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
920 MOZ_PATH_PROG(UNZIP, unzip, :)
921 MOZ_PATH_PROGS(ZIP, zip)
922 if test -z "$ZIP" || test "$ZIP" = ":"; then
923     AC_MSG_ERROR([zip not found in \$PATH])
925 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
926 MOZ_PATH_PROG(XARGS, xargs)
927 if test -z "$XARGS" || test "$XARGS" = ":"; then
928     AC_MSG_ERROR([xargs not found in \$PATH .])
931 if test "$COMPILE_ENVIRONMENT"; then
933 dnl ========================================================
934 dnl = Mac OS X toolchain support
935 dnl ========================================================
937 case "$target_os" in
938 darwin*)
939     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
940     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
941     dnl the environment and includedir purposes (when using an SDK, below),
942     dnl but remember the full version number for the libdir (SDK).
943     changequote(,)
944     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
945     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
946     changequote([,])
947     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
948         dnl Bug 280479, but this keeps popping up in bug 292530 too because
949         dnl 4.0.0/4061 is the default compiler in Tiger.
950         changequote(,)
951         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
952         changequote([,])
953         if test "$GCC_BUILD" = "4061" ; then
954             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
955 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
956 from building Mozilla. Upgrade to Xcode 2.1 or later.])
957         fi
958     fi
960     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
961     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
962     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
963     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
965     case "$PBBUILD" in
966       *xcodebuild*)
967         changequote(,)
968         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
969         changequote([,])
970         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
971           HAS_XCODE_2_1=1;
972         fi
973       ;;
974     esac
976     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
977     dnl it has moved into /usr/bin.
978     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
979     ;;
980 esac
982 AC_SUBST(GCC_VERSION)
983 AC_SUBST(XCODEBUILD_VERSION)
984 AC_SUBST(HAS_XCODE_2_1)
986 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
987 dnl that a universal binary is being produced.
988 AC_SUBST(UNIVERSAL_BINARY)
990 dnl ========================================================
991 dnl Check for MacOS deployment target version
992 dnl ========================================================
994 MOZ_ARG_ENABLE_STRING(macos-target,
995                       [  --enable-macos-target=VER (default=10.5)
996                           Set the minimum MacOS version needed at runtime],
997                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
999 case "$target" in
1000 *-darwin*)
1001     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1002         dnl Use the specified value
1003         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1004         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1005     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
1006         dnl No value specified on the command line or in the environment,
1007         dnl use architecture minimum.
1008         export MACOSX_DEPLOYMENT_TARGET=10.5
1009     fi
1010     ;;
1011 esac
1013 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1015 dnl ========================================================
1016 dnl = Mac OS X SDK support
1017 dnl ========================================================
1018 MACOS_SDK_DIR=
1019 NEXT_ROOT=
1020 MOZ_ARG_WITH_STRING(macos-sdk,
1021 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
1022     MACOS_SDK_DIR=$withval)
1024 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1025 dnl NEXT_ROOT will be set and exported only if it's needed.
1026 AC_SUBST(MACOS_SDK_DIR)
1027 AC_SUBST(NEXT_ROOT)
1029 if test "$MACOS_SDK_DIR"; then
1030   dnl Sync this section with the ones in NSPR and NSS.
1031   dnl Changes to the cross environment here need to be accounted for in
1032   dnl the libIDL checks (below) and xpidl build.
1034   if test ! -d "$MACOS_SDK_DIR"; then
1035     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1036 specify a valid SDK.  SDKs are installed when the optional cross-development
1037 tools are selected during the Xcode/Developer Tools installation.])
1038   fi
1040   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1041   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1042     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1043   else
1044     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1045     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1047     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1048     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1049     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1051     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1052       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1053       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1054       dnl be ignored and cause warnings when -syslibroot is specified.
1055       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1056       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1057       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1058     fi
1059   fi
1061   AC_LANG_SAVE
1062   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1063   AC_LANG_CPLUSPLUS
1064   AC_TRY_COMPILE([#include <new>
1065                  int main() { return 0; }],
1066    result=yes,
1067    result=no)
1068   AC_LANG_RESTORE
1069   AC_MSG_RESULT($result)
1071   if test "$result" = "no" ; then
1072     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1073   fi
1076 fi # COMPILE_ENVIRONMENT
1078 if test -n "$MAKE"; then
1079   if test `echo $MAKE | grep -c make.py` != 1; then
1080      NOT_PYMAKE=$MAKE
1081   fi
1084 case "$host_os" in
1085 cygwin*|mingw*|mks*|msvc*)
1086     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1087     ;;
1089     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1090     ;;
1091 esac
1092 if test "$GMAKE" = ":"; then
1093    AC_MSG_ERROR([GNU make not found])
1095 AC_SUBST(GMAKE)
1097 if test "$COMPILE_ENVIRONMENT"; then
1099 AC_PATH_XTRA
1101 XCFLAGS="$X_CFLAGS"
1103 fi # COMPILE_ENVIRONMENT
1105 dnl ========================================================
1106 dnl set the defaults first
1107 dnl ========================================================
1108 AS_BIN=$AS
1109 AR_LIST='$(AR) t'
1110 AR_EXTRACT='$(AR) x'
1111 AR_DELETE='$(AR) d'
1112 AS='$(CC)'
1113 AS_DASH_C_FLAG='-c'
1114 DLL_PREFIX=lib
1115 LIB_PREFIX=lib
1116 DLL_SUFFIX=.so
1117 OBJ_SUFFIX=o
1118 LIB_SUFFIX=a
1119 ASM_SUFFIX=s
1120 IMPORT_LIB_SUFFIX=
1121 TARGET_MD_ARCH=unix
1122 DIRENT_INO=d_ino
1123 CYGWIN_WRAPPER=
1124 WIN_TOP_SRC=
1125 MOZ_USER_DIR=".mozilla"
1127 MOZ_JPEG_CFLAGS=
1128 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1129 MOZ_ZLIB_CFLAGS=
1130 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1131 MOZ_BZ2_CFLAGS=
1132 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1133 MOZ_PNG_CFLAGS=
1134 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1136 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1137 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1138 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1139 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1140 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1141 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1142 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1144 MOZ_FS_LAYOUT=unix
1146 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1148 USE_DEPENDENT_LIBS=1
1150 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1152 MOZ_ENABLE_POSTSCRIPT=1 
1154 if test -n "$CROSS_COMPILE"; then
1155     OS_TARGET="${target_os}"
1156     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1157     OS_RELEASE=
1158     case "${target_os}" in
1159         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1160         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1161         gnu*)         OS_ARCH=GNU ;;
1162         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1163         mingw*)       OS_ARCH=WINNT ;;
1164         wince*)       OS_ARCH=WINCE ;;
1165         winmo*)       OS_ARCH=WINCE ;;
1166         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1167     esac
1168 else
1169     OS_TARGET=`uname -s`
1170     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1171     OS_RELEASE=`uname -r`
1174 # Before this used `uname -m` when not cross compiling
1175 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1176 OS_TEST="${target_cpu}"
1178 _COMPILER_PREFIX=
1180 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1182 #######################################################################
1183 # Master "Core Components" macros for getting the OS target           #
1184 #######################################################################
1187 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1188 # cross-compilation.
1192 # Define and override various archtecture-specific variables, including
1193 # HOST_OS_ARCH
1194 # OS_ARCH
1195 # OS_TEST
1196 # OS_TARGET
1197 # OS_RELEASE
1198 # OS_MINOR_RELEASE
1201 case "$HOST_OS_ARCH" in
1202 cygwin*|mingw*|mks*|msvc*)
1203     HOST_OS_ARCH=WINNT
1204     ;;
1205 darwin*)
1206     HOST_OS_ARCH=Darwin
1207     ;;
1208 linux*)
1209     HOST_OS_ARCH=Linux
1210     ;;
1211 solaris*)
1212     HOST_OS_ARCH=SunOS
1213     SOLARIS_SUNPRO_CC=
1214     SOLARIS_SUNPRO_CXX=
1215     if test -z "$GNU_CC"; then
1216         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1217             SOLARIS_SUNPRO_CC=1
1218        fi
1219     fi
1221     if test -z "$GNU_CXX"; then
1222        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1223            SOLARIS_SUNPRO_CXX=1
1224        fi
1225     fi
1226     AC_SUBST(SOLARIS_SUNPRO_CC)
1227     AC_SUBST(SOLARIS_SUNPRO_CXX)
1228     ;;
1229 BSD_386)
1230     HOST_OS_ARCH=BSD
1231     ;;
1232 dgux)
1233     HOST_OS_ARCH=DGUX
1234     ;;
1235 IRIX64)
1236     HOST_OS_ARCH=IRIX
1237     ;;
1238 UNIX_SV)
1239     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1240         HOST_OS_ARCH=NCR
1241     else
1242         HOST_OS_ARCH=UNIXWARE
1243     fi
1244     ;;
1245 ncr)
1246     HOST_OS_ARCH=NCR
1247     ;;
1248 UNIX_SYSTEM_V)
1249     HOST_OS_ARCH=NEC
1250     ;;
1251 OSF1)
1252     ;;
1253 *OpenVMS*)
1254     HOST_OS_ARCH=OpenVMS
1255     ;;
1256 OS_2)
1257     HOST_OS_ARCH=OS2
1258     ;;
1259 QNX)
1260     ;;
1261 SCO_SV)
1262     HOST_OS_ARCH=SCOOS
1263     ;;
1264 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1265     HOST_OS_ARCH=SINIX
1266     ;;
1267 UnixWare)
1268     HOST_OS_ARCH=UNIXWARE
1269     ;;
1270 esac
1272 case "$OS_ARCH" in
1273 WINNT)
1274     if test -z "$CROSS_COMPILE" ; then
1275         OS_TEST=`uname -p`
1276     fi
1277     ;;
1278 Windows_NT)
1280 # If uname -s returns "Windows_NT", we assume that we are using
1281 # the uname.exe in MKS toolkit.
1283 # The -r option of MKS uname only returns the major version number.
1284 # So we need to use its -v option to get the minor version number.
1285 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1287     OS_ARCH=WINNT
1288     OS_TARGET=WINNT
1289     OS_MINOR_RELEASE=`uname -v`
1290     if test "$OS_MINOR_RELEASE" = "00"; then
1291         OS_MINOR_RELEASE=0
1292     fi
1293     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1294     ;;
1295 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1297 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1298 # the uname.exe in the Cygwin tools.
1299 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1300 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1301 # the uname.exe in the GNU-Win32 tools.
1302 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1303 # the uname.exe in the MSYS tools.
1305     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1306     OS_ARCH=WINNT
1307     OS_TARGET=WINNT
1308     ;;
1309 AIX)
1310     OS_RELEASE=`uname -v`.`uname -r`
1311     OS_TEST=${target_cpu}
1312     ;;
1313 BSD_386)
1314     OS_ARCH=BSD
1315     ;;
1316 dgux)
1317     OS_ARCH=DGUX
1318     ;;
1319 IRIX64)
1320     OS_ARCH=IRIX
1321     ;;
1322 UNIX_SV)
1323     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1324         OS_ARCH=NCR
1325     else
1326         OS_ARCH=UNIXWARE
1327         OS_RELEASE=`uname -v`
1328     fi
1329     ;;
1330 ncr)
1331     OS_ARCH=NCR
1332     ;;
1333 UNIX_SYSTEM_V)
1334     OS_ARCH=NEC
1335     ;;
1336 OSF1)
1337     case `uname -v` in
1338     148)
1339         OS_RELEASE=V3.2C
1340         ;;
1341     564)
1342         OS_RELEASE=V4.0B
1343         ;;
1344     878)
1345         OS_RELEASE=V4.0D
1346         ;;
1347     esac
1348     ;;
1349 *OpenVMS*)
1350     OS_ARCH=OpenVMS
1351     OS_RELEASE=`uname -v`
1352     OS_TEST=`uname -p`
1353     ;;
1354 OS_2)
1355     OS_ARCH=OS2
1356     OS_TARGET=OS2
1357     OS_RELEASE=`uname -v`
1358     ;;
1359 QNX)
1360     if test "$OS_TARGET" != "NTO"; then
1361         changequote(,)
1362         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1363         changequote([,])
1364     fi
1365     OS_TEST=x86
1366     ;;
1367 SCO_SV)
1368     OS_ARCH=SCOOS
1369     OS_RELEASE=5.0
1370     ;;
1371 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1372     OS_ARCH=SINIX
1373     OS_TEST=`uname -p`
1374     ;;
1375 UnixWare)
1376     OS_ARCH=UNIXWARE
1377     OS_RELEASE=`uname -v`
1378     ;;
1379 WINCE)
1380     OS_ARCH=WINCE
1381     case "${target_os}" in
1382     *winmo)
1383         OS_TARGET=WINMO
1384         WINCE_WINDOWS_MOBILE=1
1385         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1386         ;;
1387     *)
1388         OS_TARGET=WINCE
1389         ;;
1390     esac
1391     ;;
1392 Darwin)
1393     case "${target_cpu}" in
1394     powerpc*)
1395         OS_TEST=ppc
1396         ;;
1397     i*86*)
1398         OS_TEST=i386 
1399         ;;
1400     x86_64)
1401         OS_TEST=x86_64
1402         ;;
1403     *)
1404         if test -z "$CROSS_COMPILE" ; then
1405             OS_TEST=`uname -p`
1406         fi
1407         ;;
1408     esac
1409     ;;
1410 esac
1412 if test "$OS_ARCH" = "NCR"; then
1413     changequote(,)
1414     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1415     changequote([,])
1418 # Only set CPU_ARCH if we recognize the value of OS_TEST
1420 case "$OS_TEST" in
1421 *86 | i86pc)
1422     CPU_ARCH=x86
1423     ;;
1425 powerpc64 | ppc64)
1426     CPU_ARCH=ppc64
1427     ;;
1429 powerpc | ppc | rs6000)
1430     CPU_ARCH=ppc
1431     ;;
1433 Alpha | alpha | ALPHA)
1434     CPU_ARCH=Alpha
1435     ;;
1437 s390)
1438     CPU_ARCH=s390
1439     ;;
1441 s390x)
1442     CPU_ARCH=s390x
1443     ;;
1445 hppa* | parisc)
1446     CPU_ARCH=hppa
1447     ;;
1449 sun4u | sparc*)
1450     CPU_ARCH=sparc
1451     ;;
1453 x86_64 | ia64)
1454     CPU_ARCH="$OS_TEST"
1455     ;;
1457 arm)
1458     CPU_ARCH=arm
1459     ;;
1460 esac
1462 if test -z "$OS_TARGET"; then
1463     OS_TARGET=$OS_ARCH
1465 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1467 dnl ========================================================
1468 dnl GNU specific defaults
1469 dnl ========================================================
1470 if test "$GNU_CC"; then
1471     # FIXME: Let us build with strict aliasing. bug 414641.
1472     CFLAGS="$CFLAGS -fno-strict-aliasing"
1473     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1474     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1475     DSO_LDOPTS='-shared'
1476     if test "$GCC_USE_GNU_LD"; then
1477         # Don't allow undefined symbols in libraries
1478         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1479     fi
1480     WARNINGS_AS_ERRORS='-Werror'
1481     DSO_CFLAGS=''
1482     DSO_PIC_CFLAGS='-fPIC'
1483     ASFLAGS="$ASFLAGS -fPIC"
1484     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1485     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1486     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1487     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1489     # Turn on GNU specific features
1490     # -Wall - turn on all warnings
1491     # -pedantic - make compiler warn about non-ANSI stuff, and
1492     #             be a little bit stricter
1493     # Warnings slamm took out for now (these were giving more noise than help):
1494     # -Wbad-function-cast - warns when casting a function to a new return type
1495     # -Wshadow - removed because it generates more noise than help --pete
1496     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1497     if test -z "$INTEL_CC"; then
1498        # Don't use -Wcast-align with ICC
1499        case "$CPU_ARCH" in
1500            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1501            hppa | ia64 | sparc | arm)
1502            ;;
1503            *)
1504         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1505            ;;
1506        esac
1507     fi
1509     dnl Turn pedantic on but disable the warnings for long long
1510     _PEDANTIC=1
1512     if test -z "$INTEL_CC"; then
1513       _IGNORE_LONG_LONG_WARNINGS=1
1514       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1515     else
1516       _IGNORE_LONG_LONG_WARNINGS=
1517     fi
1520     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1521     _USE_CPP_INCLUDE_FLAG=1
1522 elif test "$SOLARIS_SUNPRO_CC"; then
1523     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1524     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1526     DSO_LDOPTS='-shared'
1527     if test "$GNU_LD"; then
1528         # Don't allow undefined symbols in libraries
1529         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1530     fi
1532     DSO_CFLAGS=''
1533     if test "$CPU_ARCH" = "sparc"; then
1534         # for Sun Studio on Solaris/SPARC
1535         DSO_PIC_CFLAGS='-xcode=pic32'
1536     else
1537         DSO_PIC_CFLAGS='-KPIC'
1538     fi
1539     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1540 else
1541     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1542     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1544     DSO_LDOPTS='-shared'
1545     if test "$GNU_LD"; then
1546         # Don't allow undefined symbols in libraries
1547         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1548     fi
1550     DSO_CFLAGS=''
1551     DSO_PIC_CFLAGS='-KPIC'
1552     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1555 if test "$GNU_CXX"; then
1556     # FIXME: Let us build with strict aliasing. bug 414641.
1557     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1558     # Turn on GNU specific features
1559     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1560     if test -z "$INTEL_CC"; then
1561        # Don't use -Wcast-align with ICC
1562        case "$CPU_ARCH" in
1563            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1564            hppa | ia64 | sparc | arm)
1565            ;;
1566            *)
1567         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1568            ;;
1569        esac
1570     fi
1572     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1573     _USE_CPP_INCLUDE_FLAG=1
1575     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1576                    ac_has_wno_invalid_offsetof,
1577         [
1578             AC_LANG_SAVE
1579             AC_LANG_CPLUSPLUS
1580             _SAVE_CXXFLAGS="$CXXFLAGS"
1581             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1582             AC_TRY_COMPILE([],
1583                            [return(0);],
1584                            ac_has_wno_invalid_offsetof="yes",
1585                            ac_has_wno_invalid_offsetof="no")
1586             CXXFLAGS="$_SAVE_CXXFLAGS"
1587             AC_LANG_RESTORE
1588         ])
1589     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1590         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1591     fi
1593     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1594                    ac_has_wno_variadic_macros,
1595         [
1596             AC_LANG_SAVE
1597             AC_LANG_CPLUSPLUS
1598             _SAVE_CXXFLAGS="$CXXFLAGS"
1599             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1600             AC_TRY_COMPILE([],
1601                            [return(0);],
1602                            ac_has_wno_variadic_macros="yes",
1603                            ac_has_wno_variadic_macros="no")
1604             CXXFLAGS="$_SAVE_CXXFLAGS"
1605             AC_LANG_RESTORE
1606         ])
1607     if test "$ac_has_wno_variadic_macros" = "yes"; then
1608         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1609     fi
1611     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1612                    ac_has_werror_return_type,
1613         [
1614             AC_LANG_SAVE
1615             AC_LANG_CPLUSPLUS
1616             _SAVE_CXXFLAGS="$CXXFLAGS"
1617             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1618             AC_TRY_COMPILE([],
1619                            [return(0);],
1620                            ac_has_werror_return_type="yes",
1621                            ac_has_werror_return_type="no")
1622             CXXFLAGS="$_SAVE_CXXFLAGS"
1623             AC_LANG_RESTORE
1624         ])
1625     if test "$ac_has_werror_return_type" = "yes"; then
1626         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1627     fi
1629 else
1630     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1633 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1634 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1635 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1636 dnl normal behavior.
1637 dnl ========================================================
1638 MKSHLIB_FORCE_ALL=
1639 MKSHLIB_UNFORCE_ALL=
1641 if test "$COMPILE_ENVIRONMENT"; then
1642 if test "$GNU_CC"; then
1643   AC_MSG_CHECKING(whether ld has archive extraction flags)
1644   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1645    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1646     ac_cv_mkshlib_force_and_unforce="no"
1647     exec 3<&0 <<LOOP_INPUT
1648         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1649         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1650         force="-Wl,-all";              unforce="-Wl,-none"
1651 LOOP_INPUT
1652     while read line
1653     do
1654       eval $line
1655       LDFLAGS=$force
1656       LIBS=$unforce
1657       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1658     done
1659     exec 0<&3 3<&-
1660     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1661    ])
1662   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1663     AC_MSG_RESULT(no)
1664   else
1665     AC_MSG_RESULT(yes)
1666     eval $ac_cv_mkshlib_force_and_unforce
1667     MKSHLIB_FORCE_ALL=$force
1668     MKSHLIB_UNFORCE_ALL=$unforce
1669   fi
1670 fi # GNU_CC
1671 fi # COMPILE_ENVIRONMENT
1673 dnl =================================================================
1674 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1675 dnl which is bad when cross compiling.
1676 dnl =================================================================
1677 if test "$COMPILE_ENVIRONMENT"; then
1678 configure_static_assert_macros='
1679 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1680 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1681 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1684 dnl test that the macros actually work:
1685 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1686 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1687  [AC_LANG_SAVE
1688   AC_LANG_C
1689   ac_cv_static_assertion_macros_work="yes"
1690   AC_TRY_COMPILE([$configure_static_assert_macros],
1691                  [CONFIGURE_STATIC_ASSERT(1)],
1692                  ,
1693                  ac_cv_static_assertion_macros_work="no")
1694   AC_TRY_COMPILE([$configure_static_assert_macros],
1695                  [CONFIGURE_STATIC_ASSERT(0)],
1696                  ac_cv_static_assertion_macros_work="no",
1697                  )
1698   AC_LANG_CPLUSPLUS
1699   AC_TRY_COMPILE([$configure_static_assert_macros],
1700                  [CONFIGURE_STATIC_ASSERT(1)],
1701                  ,
1702                  ac_cv_static_assertion_macros_work="no")
1703   AC_TRY_COMPILE([$configure_static_assert_macros],
1704                  [CONFIGURE_STATIC_ASSERT(0)],
1705                  ac_cv_static_assertion_macros_work="no",
1706                  )
1707   AC_LANG_RESTORE
1708  ])
1709 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1710 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1711     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1713 fi # COMPILE_ENVIRONMENT
1715 dnl ========================================================
1716 dnl Checking for 64-bit OS
1717 dnl ========================================================
1718 if test "$COMPILE_ENVIRONMENT"; then
1719 AC_LANG_SAVE
1720 AC_LANG_C
1721 AC_MSG_CHECKING(for 64-bit OS)
1722 AC_TRY_COMPILE([$configure_static_assert_macros],
1723                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1724                result="yes", result="no")
1725 AC_MSG_RESULT("$result")
1726 if test "$result" = "yes"; then
1727     AC_DEFINE(HAVE_64BIT_OS)
1728     HAVE_64BIT_OS=1
1730 AC_SUBST(HAVE_64BIT_OS)
1731 AC_LANG_RESTORE
1732 fi # COMPILE_ENVIRONMENT
1734 dnl ========================================================
1735 dnl Enable high-memory support on OS/2 by default.
1736 dnl ========================================================
1737 MOZ_OS2_HIGH_MEMORY=1
1738 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1739 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1740     MOZ_OS2_HIGH_MEMORY=,
1741     MOZ_OS2_HIGH_MEMORY=1 )
1742 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1744 dnl ========================================================
1745 dnl System overrides of the defaults for host
1746 dnl ========================================================
1747 case "$host" in
1748 *-beos*)
1749     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1750     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1751     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1752     ;;
1754 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1755     # we need Python 2.5 on Windows
1756     PYTHON_VERSION=2.5
1757     if test -n "$_WIN32_MSVC"; then
1758         HOST_AR=lib
1759         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1760         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1761         HOST_RANLIB='echo ranlib'
1762     else
1763         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1764     fi
1765     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1766     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1767     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1768     HOST_BIN_SUFFIX=.exe
1769     case "$host" in
1770     *mingw*)
1771     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1772         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1773         ;;
1774     *)
1775         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1776         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1777             _pwd=`pwd`
1778             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1779         fi
1780         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1781             AS_PERL=1
1782             PERL="${CYGWIN_WRAPPER} $PERL"
1783         fi
1785         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1786             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1787         fi
1788         ;;
1789     esac
1791     case "${host_cpu}" in
1792     x86_64)
1793         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1794         ;;
1795     esac
1796     ;;
1798 *-darwin*)
1799     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1800     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1801     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1802     ;;
1804 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1805     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1806     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1807     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1808     ;;
1810 *os2*)
1811     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1812     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1813     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1814     HOST_BIN_SUFFIX=.exe
1815     MOZ_FIX_LINK_PATHS=
1816     ;;
1818 *-osf*)
1819     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1820     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1821     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1822     ;;
1825     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1826     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1827     ;;
1828 esac
1830 dnl We require version 2.4 or newer of Python to build,
1831 dnl and 2.5 or newer on Windows.
1832 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1833 changequote(,)
1834 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1835 _python_res=$?
1836 changequote([,])
1837 if test "$_python_res" != 0; then
1838     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1840 AC_MSG_RESULT([yes])
1842 dnl Get mozilla version from central milestone file
1843 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1845 dnl Get version of various core apps from the version files.
1846 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1848 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1849 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1851 dnl ========================================================
1852 dnl System overrides of the defaults for target
1853 dnl ========================================================
1855 case "$target" in
1856 *-aix*)
1857     AC_DEFINE(AIX)
1858     if test ! "$GNU_CC"; then
1859         if test ! "$HAVE_64BIT_OS"; then
1860             # Compiling with Visual Age C++ object model compat is the
1861             # default. To compile with object model ibm, add 
1862             # AIX_OBJMODEL=ibm to .mozconfig.
1863             if test "$AIX_OBJMODEL" = "ibm"; then
1864                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1865             else
1866                 AIX_OBJMODEL=compat
1867             fi
1868         else
1869             AIX_OBJMODEL=compat
1870         fi
1871         AC_SUBST(AIX_OBJMODEL)
1872         DSO_LDOPTS='-qmkshrobj=1'
1873         DSO_CFLAGS='-qflag=w:w'
1874         DSO_PIC_CFLAGS=
1875         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1876         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1877         MOZ_FIX_LINK_PATHS=
1878         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1879         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1880         if test "$COMPILE_ENVIRONMENT"; then
1881             AC_LANG_SAVE
1882             AC_LANG_CPLUSPLUS
1883             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1884             AC_TRY_COMPILE([],
1885                 [#if (__IBMCPP__ < 600)
1886                  #error "Bad compiler"
1887                  #endif],
1888                 _BAD_COMPILER=,_BAD_COMPILER=1)
1889             if test -n "$_BAD_COMPILER"; then
1890                 AC_MSG_RESULT([no])    
1891                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1892             else
1893                 AC_MSG_RESULT([yes])    
1894             fi
1895             AC_LANG_RESTORE
1896             TARGET_COMPILER_ABI="ibmc"
1897             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1898             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1899         fi
1900     fi
1901     case "${target_os}" in
1902     aix4.1*)
1903         DLL_SUFFIX='_shr.a'
1904         ;;
1905     esac
1906     if test "$COMPILE_ENVIRONMENT"; then
1907         AC_CHECK_HEADERS(sys/inttypes.h)
1908     fi
1909     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1910     ;;
1912 *-beos*)
1913     no_x=yes
1914     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1915     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1916     DSO_LDOPTS='-nostart'
1917     TK_LIBS='-lbe -lroot'
1918     LIBS="$LIBS -lbe"
1919     if test "$COMPILE_ENVIRONMENT"; then
1920         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1921         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1922     fi
1923     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1924     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1925     _MOZ_USE_RTTI=1
1926     USE_DEPENDENT_LIBS=
1927     MOZ_USER_DIR="Mozilla"
1928     ;;
1930 *-bsdi*)
1931     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1932     _PEDANTIC=
1933     _IGNORE_LONG_LONG_WARNINGS=
1934     case $OS_RELEASE in
1935         4.*|5.*)
1936             STRIP="$STRIP -d"
1937             ;;
1938         *)
1939             DSO_CFLAGS=''
1940             DSO_LDOPTS='-r'
1941             _WARNINGS_CFLAGS="-Wall"
1942             _WARNINGS_CXXFLAGS="-Wall"
1943             # The test above doesn't work properly, at least on 3.1.
1944             MKSHLIB_FORCE_ALL=''
1945             MKSHLIB_UNFORCE_ALL=''
1946         ;;
1947     esac
1948     ;;
1950 *-darwin*) 
1951     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1952     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1953     MOZ_OPTIMIZE_FLAGS="-O3"
1954     _PEDANTIC=
1955     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1956     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1957     DLL_SUFFIX=".dylib"
1958     DSO_LDOPTS=''
1959     STRIP="$STRIP -x -S"
1960     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1961     MOZ_ENABLE_POSTSCRIPT=
1962     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1963     # The ExceptionHandling framework is needed for Objective-C exception
1964     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1965     # builds.
1966     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1968     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1969     dnl ===================================================================
1970     if test "x$enable_dtrace" = "xyes"; then
1971         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1972     else
1973         dnl check for the presence of the -dead_strip linker flag
1974         AC_MSG_CHECKING([for -dead_strip option to ld])
1975         _SAVE_LDFLAGS=$LDFLAGS
1976         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1977         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1978         if test -n "$_HAVE_DEAD_STRIP" ; then
1979             AC_MSG_RESULT([yes])
1980             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1981         else
1982             AC_MSG_RESULT([no])
1983         fi
1984         
1985         LDFLAGS=$_SAVE_LDFLAGS
1986     fi
1987     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1988     ;;
1990 *-freebsd*)
1991     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1992         DLL_SUFFIX=".so.1.0"
1993         DSO_LDOPTS="-shared"
1994     fi
1995     if test ! "$GNU_CC"; then
1996         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1997     fi
1998 # Can't have force w/o an unforce.
1999 #    # Hack for FreeBSD 2.2
2000 #    if test -z "$MKSHLIB_FORCE_ALL"; then
2001 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
2002 #       MKSHLIB_UNFORCE_ALL=''
2003 #    fi
2004     ;; 
2006 ia64*-hpux*)
2007     DLL_SUFFIX=".so"
2008     if test ! "$GNU_CC"; then
2009        DSO_LDOPTS='-b'
2010        DSO_CFLAGS=""
2011        DSO_PIC_CFLAGS=
2012        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2013        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2014        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2015     else
2016        DSO_LDOPTS='-b -E'
2017        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2018        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2019     fi
2020     MOZ_FIX_LINK_PATHS=
2021     SYSTEM_MAKEDEPEND=
2022     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2023     AC_DEFINE(_LARGEFILE64_SOURCE)
2024     ;;
2026 *-hpux*)
2027     DLL_SUFFIX=".sl"
2028     if test ! "$GNU_CC"; then
2029         DSO_LDOPTS='-b -Wl,+s'
2030         DSO_CFLAGS=""
2031         DSO_PIC_CFLAGS="+Z"
2032         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2033         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2034         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2035     else
2036         DSO_LDOPTS='-b -E +s'
2037         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2038         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2039     fi
2040     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2041     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2042     ;;
2044 *-irix5*)
2045     AC_DEFINE(IRIX)
2046     DSO_LDOPTS='-elf -shared'
2048     if test "$GNU_CC"; then
2049        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2050        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2051        MKSHLIB_FORCE_ALL='-Wl,-all'
2052        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2053        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2054     else
2055        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2056        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2057        MKSHLIB_FORCE_ALL='-all'
2058        MKSHLIB_UNFORCE_ALL='-none'
2059     fi
2060     ;;
2062 *-irix6*)
2063     AC_DEFINE(IRIX)
2064     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2065     dnl compile and link using -n32
2066     USE_N32=1
2067     TARGET_COMPILER_ABI=n32
2068     DSO_LDOPTS='-elf -shared'
2069     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2070     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2071     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2072     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2073     if test "$GNU_CC"; then
2074        MKSHLIB_FORCE_ALL='-Wl,-all'
2075        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2076        _WARNINGS_CFLAGS="-Wall"
2077        _WARNINGS_CXXFLAGS="-Wall"
2078        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2079     else
2080        MKSHLIB_FORCE_ALL='-all'
2081        MKSHLIB_UNFORCE_ALL='-none'
2082            AR_LIST="$AR t"
2083            AR_EXTRACT="$AR x"
2084            AR_DELETE="$AR d"
2085            AR='$(CXX) -ar'
2086            AR_FLAGS='-o $@'
2087        CFLAGS="$CFLAGS -woff 3262 -G 4"
2088        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2089        if test -n "$USE_N32"; then
2090            ASFLAGS="$ASFLAGS -n32"
2091            CFLAGS="$CFLAGS -n32"
2092            CXXFLAGS="$CXXFLAGS -n32"
2093            LDFLAGS="$LDFLAGS -n32"
2094        fi
2095        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2096        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2097        MOZ_FIX_LINK_PATHS=
2098     fi
2099     if test -z "$GNU_CXX"; then
2100       MIPSPRO_CXX=1
2101     fi
2102     ;;
2104 *-*linux*)
2105     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2106     # Similarly for GNU_CXX and INTEL_CXX.
2107     if test "$INTEL_CC" || test "$INTEL_CXX"; then
2108         # -Os has been broken on Intel's C/C++ compilers for quite a
2109         # while; Intel recommends against using it.
2110         MOZ_OPTIMIZE_FLAGS="-O2"
2111         MOZ_DEBUG_FLAGS="-g"
2112     elif test "$GNU_CC" || test "$GNU_CXX"; then
2113         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2114         case $GCC_VERSION in
2115         4.1.*|4.2.*)
2116             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
2117             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2118         esac
2119         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2120         MOZ_DEBUG_FLAGS="-g"
2121     fi
2123     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2125     MOZ_MEMORY=1
2127     case "${target_cpu}" in
2128     alpha*)
2129         CFLAGS="$CFLAGS -mieee"
2130         CXXFLAGS="$CXXFLAGS -mieee"
2131     ;;
2132     i*86)
2133         USE_ELF_DYNSTR_GC=1
2134     ;;
2135     mips*)
2136         MOZ_DEBUG_FLAGS="-g" # We want inlining
2137     ;;
2138     esac
2139     ;;
2141 *-wince*|*-winmo*)
2142     TARGET_COMPILER_ABI=msvc
2143     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2144     _PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
2145     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2146     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2147     AR_LIST="$AR -list"
2148     AR_EXTRACT="$AR -extract"
2149     AR_DELETE="$AR d"
2150     AR_FLAGS='-OUT:"$@"'
2151     MOZ_MEMORY=1
2152     NSS_DISABLE_DBM=1
2153     MOZ_OGG=
2154     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2156     if test "$AS_BIN"; then
2157         AS="$AS_BIN"
2158     fi
2159     DSO_CFLAGS=
2160     DSO_PIC_CFLAGS=
2161     DLL_SUFFIX=.dll
2162     BIN_SUFFIX='.exe'
2163     if test -z "$RC"; then 
2164         RC=rc.exe  
2165     fi
2166     # certain versions of cygwin's makedepend barf on the 
2167     # #include <string> vs -I./dist/include/string issue so don't use it
2168     SYSTEM_MAKEDEPEND=
2170     HOST_CC=cl
2171     HOST_CXX=cl
2172     HOST_LD=link
2173     HOST_AR='lib -OUT:$@'
2174     HOST_RANLIB='echo ranlib'
2175     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2176         
2177         
2178     WARNINGS_AS_ERRORS='-WX'
2179     MOZ_OPTIMIZE_FLAGS='-Ox'
2180     AR_FLAGS='-NOLOGO -OUT:"$@"'
2181     ASM_SUFFIX=asm
2182     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2183     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2184     DLL_PREFIX=
2185     DOXYGEN=:
2186     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2187     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2188     GARBAGE=
2189     IMPORT_LIB_SUFFIX=lib
2190     dnl Need to force-link against mozalloc because it's used in the shunt
2191     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2192     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2193     LIB_PREFIX=
2194     LIB_SUFFIX=lib 
2195     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2196     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2197     MKSHLIB_FORCE_ALL=
2198     MKSHLIB_UNFORCE_ALL=
2199     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2200     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2201     MOZ_DEBUG_FLAGS='-Zi'
2202     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2203     MOZ_FIX_LINK_PATHS=
2204     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2205     OBJ_SUFFIX=obj
2206     RANLIB='echo not_ranlib'
2207     STRIP='echo not_strip'
2208     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2209     UNZIP=unzip
2210     XARGS=xargs
2211     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2212     ZIP=zip
2213     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2214     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2215     STATIC_LIBIDL=1
2216     MOZ_TREE_FREETYPE=1
2218     AC_DEFINE(HAVE_SNPRINTF)
2219     AC_DEFINE(_WINDOWS)
2220     AC_DEFINE(WIN32)
2221     AC_DEFINE(XP_WIN)
2222     AC_DEFINE(XP_WIN32)
2223     AC_DEFINE(HW_THREADS)
2224     AC_DEFINE(STDC_HEADERS)
2225     AC_DEFINE(NEW_H, <new>)
2226     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2227     AC_DEFINE(HAVE_LOCALTIME_R)
2229     TARGET_MD_ARCH=win32
2230     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2231     BIN_SUFFIX='.exe'
2232     MOZ_ENABLE_POSTSCRIPT=
2233     MOZ_USER_DIR="Mozilla"
2235     MOZ_GFX_OPTIMIZE_MOBILE=1
2237     # Sanity check for WINCE_WINDOWS_MOBILE
2238     # XXX disabled until we can fix the mobile tinderbox
2239     ##if test "$WINCE_WINDOWS_MOBILE"; then
2240     ##   AC_CHECK_HEADER(tpcshell.h, [],
2241     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2242     ##fi
2246 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2247     DSO_CFLAGS=
2248     DSO_PIC_CFLAGS=
2249     DLL_SUFFIX=.dll
2250     RC=rc.exe
2251     # certain versions of cygwin's makedepend barf on the 
2252     # #include <string> vs -I./dist/include/string issue so don't use it
2253     SYSTEM_MAKEDEPEND=
2254     if test -n "$GNU_CC"; then
2255         CC="$CC -mno-cygwin"
2256         CXX="$CXX -mno-cygwin"
2257         CPP="$CPP -mno-cygwin"
2258         CFLAGS="$CFLAGS -mms-bitfields"
2259         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2260         DSO_LDOPTS='-shared'
2261         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2262         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2263         RC='$(WINDRES)'
2264         # Use temp file for windres (bug 213281)
2265         RCFLAGS='-O coff --use-temp-file'
2266         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2267         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2268         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2269         MOZ_FIX_LINK_PATHS=
2270         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2271         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2272         DLL_PREFIX=
2273         IMPORT_LIB_SUFFIX=dll.a
2274     else
2275         TARGET_COMPILER_ABI=msvc
2276         HOST_CC='$(CC)'
2277         HOST_CXX='$(CXX)'
2278         HOST_LD='$(LD)'
2279         if test "$AS_BIN"; then
2280             AS="$(basename "$AS_BIN")"
2281         fi
2282         AR='lib -NOLOGO -OUT:"$@"'
2283         AR_FLAGS=
2284         RANLIB='echo not_ranlib'
2285         STRIP='echo not_strip'
2286         XARGS=xargs
2287         ZIP=zip
2288         UNZIP=unzip
2289         DOXYGEN=:
2290         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2291         ASM_SUFFIX=asm
2292         OBJ_SUFFIX=obj
2293         LIB_SUFFIX=lib
2294         DLL_PREFIX=
2295         LIB_PREFIX=
2296         IMPORT_LIB_SUFFIX=lib
2297         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2298         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2299         MKSHLIB_FORCE_ALL=
2300         MKSHLIB_UNFORCE_ALL=
2301         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2302         _USE_CPP_INCLUDE_FLAG=1
2303         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2304         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2305         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2306         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2307         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2308         MOZ_DEBUG_FLAGS='-Zi'
2309         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2310         WARNINGS_AS_ERRORS='-WX'
2311         MOZ_OPTIMIZE_FLAGS='-O1'
2312         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2313         MOZ_FIX_LINK_PATHS=
2314         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2315         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2316         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2317         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2318         if test $_MSC_VER -ge 1400; then
2319             LDFLAGS="$LDFLAGS -NXCOMPAT"
2320             dnl For profile-guided optimization
2321             PROFILE_GEN_CFLAGS="-GL"
2322             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2323             dnl XXX: PGO builds can fail with warnings treated as errors,
2324             dnl specifically "no profile data available" appears to be
2325             dnl treated as an error sometimes. This might be a consequence
2326             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2327             dnl with the linker doing most of the work in the whole-program
2328             dnl optimization/PGO case. I think it's probably a compiler bug,
2329             dnl but we work around it here.
2330             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2331             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2332             dnl Probably also a compiler bug, but what can you do?
2333             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2334             if test -n "$_USE_DYNAMICBASE"; then
2335                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2336             fi
2337         fi
2338     fi
2339     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2340     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2341     AC_DEFINE(HAVE_SNPRINTF)
2342     AC_DEFINE(_WINDOWS)
2343     AC_DEFINE(WIN32)
2344     AC_DEFINE(XP_WIN)
2345     AC_DEFINE(XP_WIN32)
2346     AC_DEFINE(HW_THREADS)
2347     AC_DEFINE(STDC_HEADERS)
2348     AC_DEFINE(NEW_H, <new>)
2349     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2350     TARGET_MD_ARCH=win32
2351     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2352     BIN_SUFFIX='.exe'
2353     MOZ_ENABLE_POSTSCRIPT=
2354     MOZ_USER_DIR="Mozilla"
2356     dnl Hardcode to win95 for now - cls
2357     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2359     dnl set NO_X11 defines here as the general check is skipped on win32
2360     no_x=yes
2361     AC_DEFINE(NO_X11)
2363     dnl MinGW/MSYS doesn't provide or need cygpath
2364     case "$host" in
2365     *-mingw*)
2366         CYGPATH_W=echo
2367         CYGPATH_S=cat
2368         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2369         ;;
2370     *-cygwin*|*-msvc*|*-mks*)
2371         CYGPATH_W="cygpath -a -w"
2372         CYGPATH_S="sed -e s|\\\\|/|g"
2373         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2374         ;;
2375     esac
2376     case "$host" in
2377     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2379     if test -z "$MOZ_TOOLS"; then
2380         AC_MSG_ERROR([MOZ_TOOLS is not set])
2381     fi
2383     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2384     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2385         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2386     fi
2387     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2388     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2389         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2390     fi
2391     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2393     if test -n "$GLIB_PREFIX"; then
2394         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2395         if test "$?" = "0"; then
2396             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2397                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2398             fi
2399             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2400         else
2401             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2402         fi
2403     else
2404         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2405     fi
2406     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2407         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2408     fi
2409     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2410     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2411         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2412     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2413         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2414     else
2415         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2416     fi
2418     if test -n "$LIBIDL_PREFIX"; then
2419         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2420         if test "$?" = "0"; then
2421             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2422                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2423             fi
2424             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2425         else
2426             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2427         fi
2428     else
2429         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2430     fi        
2431     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2432         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2433     fi
2434     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2435     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2436         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2437         STATIC_LIBIDL=1
2438     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2439         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2440     else
2441         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2442     fi
2443     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2444     ;;
2446     *) # else cross-compiling
2447         if test -n "$GLIB_PREFIX"; then
2448             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2449             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2450                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2451             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2452                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2453             else
2454                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2455             fi
2456         fi
2457         if test -n "$LIBIDL_PREFIX"; then
2458             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2459             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2460                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2461                 STATIC_LIBIDL=1
2462             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2463                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2464             else
2465                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2466             fi
2467         fi
2468         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2469         ;;
2470     esac 
2473     case "$host_os" in
2474     cygwin*|msvc*|mks*)
2475         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])
2476         ;;
2478     *)
2479         AC_CHECK_HEADERS(oleacc.idl)
2481         AC_LANG_SAVE
2482         AC_LANG_CPLUSPLUS
2483         AC_CHECK_HEADERS(atlbase.h)
2484         AC_LANG_RESTORE
2485         ;;
2486     esac
2488     case "$target" in
2489     i*86-*)
2490         if test "$HAVE_64BIT_OS"; then
2491             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2492         fi
2494         if test $_MSC_VER -ge 1400; then
2495             LDFLAGS="$LDFLAGS -SAFESEH"
2496         fi
2497         AC_CHECK_HEADERS(mmintrin.h)
2498         AC_DEFINE(_X86_)
2499         ;;
2500     alpha-*)
2501         AC_DEFINE(_ALPHA_)
2502         ;;
2503     mips-*)
2504         AC_DEFINE(_MIPS_)
2505         ;;
2506     x86_64-*)
2507         AC_DEFINE(_AMD64_)
2508         ;;
2509     *)
2510         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2511         ;;
2512     esac
2514     if test "$HAVE_64BIT_OS"; then
2515         AC_DEFINE(_WIN64)
2516     fi
2517     ;;
2519 *-netbsd*)
2520     DSO_CFLAGS=''
2521     CFLAGS="$CFLAGS -Dunix"
2522     CXXFLAGS="$CXXFLAGS -Dunix"
2523     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2524         DLL_SUFFIX=".so"
2525         DSO_PIC_CFLAGS='-fPIC -DPIC'
2526         DSO_LDOPTS='-shared'
2527         BIN_FLAGS='-Wl,--export-dynamic'
2528     else
2529         DSO_PIC_CFLAGS='-fPIC -DPIC'
2530         DLL_SUFFIX=".so.1.0"
2531         DSO_LDOPTS='-shared'
2532     fi
2533     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2534     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2535     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2536     if test "$LIBRUNPATH"; then
2537         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2538     fi
2539     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2540     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2541     ;;
2543 *-nto*) 
2544         AC_DEFINE(NTO)  
2545         AC_DEFINE(_QNX_SOURCE)
2546         AC_DEFINE(_i386)
2547         OS_TARGET=NTO
2548         WARNINGS_AS_ERRORS=''
2549         MOZ_OPTIMIZE_FLAGS="-O"
2550         MOZ_DEBUG_FLAGS="-gstabs"
2551         USE_PTHREADS=1
2552         _PEDANTIC=
2553         LIBS="$LIBS -lsocket -lstdc++"
2554         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2555         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2556         if test "$with_x" != "yes"
2557         then
2558                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2559             TK_CFLAGS='-I/usr/include/photon'
2560                 TK_LIBS='-lph'
2561         fi
2562         case "${target_cpu}" in
2563         ppc*)
2564         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2565         ;;
2566         esac
2567         case "${host_cpu}" in
2568         i*86)
2569         USE_ELF_DYNSTR_GC=1
2570         ;;
2571         esac
2572         ;;
2574 *-openbsd*)
2575     DLL_SUFFIX=".so.1.0"
2576     DSO_CFLAGS=''
2577     DSO_PIC_CFLAGS='-fPIC'
2578     DSO_LDOPTS='-shared -fPIC'
2579     if test "$LIBRUNPATH"; then
2580         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2581     fi
2582     ;;
2584 *-openvms*) 
2585     AC_DEFINE(NO_PW_GECOS)
2586     AC_DEFINE(NO_UDSOCK)
2587     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2588     USE_PTHREADS=1
2589     MKSHLIB_FORCE_ALL='-all'
2590     MKSHLIB_UNFORCE_ALL='-none'
2591     AS='as'
2592     AS_DASH_C_FLAG='-Wc/names=as_is'
2593     AR_FLAGS='c $@'
2594     DSO_LDOPTS='-shared -auto_symvec'
2595     DSO_PIC_CFLAGS=
2596     MOZ_DEBUG_LDFLAGS='-g'
2597     COMPAQ_CXX=1
2598     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2599     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2600     ;;
2603 *-os2*)
2604     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2605     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2606     AC_DEFINE(OS2)
2607     AC_DEFINE(XP_OS2)
2608     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2609     AC_DEFINE(TCPV40HDRS)
2610     DLL_PREFIX=
2611     LIB_PREFIX=
2612     LIB_SUFFIX=lib
2613     BIN_SUFFIX=".exe"
2614     DLL_SUFFIX=".dll"
2615     IMPORT_LIB_SUFFIX=lib
2616     DSO_PIC_CFLAGS=
2617     AR=emxomfar
2618     AR_FLAGS='r $@'
2619     CFLAGS="$CFLAGS -Zomf"
2620     CXXFLAGS="$CXXFLAGS -Zomf"
2621     DSO_LDOPTS='-Zdll'
2622     BIN_FLAGS='-Zlinker /ST:0x100000'
2623     IMPLIB='emximp -o'
2624     FILTER='emxexp -o'
2625     LDFLAGS='-Zmap'
2626     WARNINGS_AS_ERRORS='-Werror'
2627     MOZ_DEBUG_FLAGS="-g -fno-inline"
2628     MOZ_OPTIMIZE_FLAGS="-O2"
2629     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2630     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2631     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2632     TARGET_MD_ARCH=os2
2633     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2634     MOZ_ENABLE_POSTSCRIPT=
2635     RC=rc.exe
2636     RCFLAGS='-n'
2637     MOZ_USER_DIR="Mozilla"
2639     if test "$MOZTOOLS"; then
2640         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2641     else
2642         AC_MSG_ERROR([MOZTOOLS is not set])
2643     fi
2644     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2645         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2646         LDFLAGS="$LDFLAGS -Zhigh-mem"
2647         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2648         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2649     fi
2651     # GCC for OS/2 currently predefines these, but we don't want them
2652     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2653     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2655     AC_CACHE_CHECK(for __declspec(dllexport),
2656         ac_os2_declspec,
2657         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2658                         [return 0;],
2659                         ac_os2_declspec="yes",
2660                         ac_os2_declspec="no")])
2661     if test "$ac_os2_declspec" = "yes"; then
2662         FILTER='true'
2663         MOZ_OS2_USE_DECLSPEC='1'
2664     fi
2665     ;;
2667 alpha*-*-osf*)
2668     if test "$GNU_CC"; then
2669       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2670       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2672     else
2673         MOZ_DEBUG_FLAGS='-g'
2674         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2675         CFLAGS="$CFLAGS -ieee"
2676         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2677         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2678         DSO_CFLAGS=
2679         DSO_PIC_CFLAGS=
2680         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2681         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2682         MKSHLIB_FORCE_ALL='-all'
2683         MKSHLIB_UNFORCE_ALL='-none'
2684         dnl Might fix the libxpcom.so breakage on this platform as well....
2685         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2686         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2687     fi
2688     if test -z "$GNU_CXX"; then
2689       COMPAQ_CXX=1
2690     fi
2691     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2692     ;;
2694 *-qnx*) 
2695     DIRENT_INO=d_stat.st_ino
2696     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2697     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2698     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2699     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2700     AC_DEFINE(STDC_HEADERS)
2701     if test "$no_x" = "yes"; then
2702             _PLATFORM_DEFAULT_TOOLKIT='photon'
2703             TK_CFLAGS='-I/usr/nto/include/photon'
2704             TK_LIBS='-lphoton -lphrender'
2705     fi
2706     ;;
2708 *-sco*) 
2709     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2710     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2711     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2712     if test ! "$GNU_CC"; then
2713        DSO_LDOPTS='-G'
2714     fi
2715     ;;
2717 *-solaris*) 
2718     AC_DEFINE(SOLARIS)
2719     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2720     SYSTEM_MAKEDEPEND=
2721     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2722     # libraries one level up (e.g. libnspr4.so)
2723     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2724     MOZ_MEMORY=1
2725     if test "$SOLARIS_SUNPRO_CC"; then
2726        LIBS="-lCrun -lCstd $LIBS"
2727        NS_USE_NATIVE=1
2728        MOZ_FIX_LINK_PATHS=
2729        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2730        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2731        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath"
2732        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2733        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2734        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2735        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2736            _SAVE_LDFLAGS=$LDFLAGS
2737            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2738            AC_TRY_LINK([#include <stdio.h>],
2739                        [printf("Hello World\n");],
2740                        ,
2741                        [LDFLAGS=$_SAVE_LDFLAGS])
2742        fi
2743        WARNINGS_AS_ERRORS='-Werror'
2744        MOZ_OPTIMIZE_FLAGS="-xO4"
2745        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2746        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2747        MKSHLIB_FORCE_ALL='-z allextract'
2748        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2749        DSO_LDOPTS='-G -z muldefs'
2750        AR_LIST="$AR t"
2751        AR_EXTRACT="$AR x"
2752        AR_DELETE="$AR d"
2753        AR='$(CXX) -xar'
2754        AR_FLAGS='-o $@'
2755        AS='/usr/ccs/bin/as'
2756        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2757        AS_DASH_C_FLAG=''
2758        TARGET_COMPILER_ABI="sunc"
2759        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2760        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2761        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2762        AC_LANG_SAVE
2763        AC_LANG_CPLUSPLUS
2764        AC_TRY_COMPILE([],
2765            [#if (__SUNPRO_CC < 0x590)
2766            #error "Denied"
2767            #endif],
2768            _BAD_COMPILER=,_BAD_COMPILER=1)
2769         if test -n "$_BAD_COMPILER"; then
2770             _res="no"
2771             AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2772         else
2773             _res="yes"
2774         fi
2775         AC_MSG_RESULT([$_res])
2776         AC_LANG_RESTORE
2777     else
2778        ASFLAGS="$ASFLAGS -fPIC"
2779        DSO_LDOPTS='-G'
2780        _WARNINGS_CFLAGS=''
2781        _WARNINGS_CXXFLAGS=''
2782        if test "$OS_RELEASE" = "5.3"; then
2783           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2784        fi
2785     fi
2786     if test "$OS_RELEASE" = "5.5.1"; then
2787        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2788     fi
2789     ;;
2791 *-sunos*) 
2792     DSO_LDOPTS='-Bdynamic'
2793     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2794     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2795     AC_DEFINE(SUNOS4)
2796     AC_DEFINE(SPRINTF_RETURNS_STRING)
2797     case "$(target_os)" in
2798     sunos4.1*)
2799         DLL_SUFFIX='.so.1.0'
2800         ;;
2801     esac
2802     ;;
2804 *-sysv4.2uw7*) 
2805         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2806     ;;
2808 *-os2*)
2809     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2810     ;;
2812 esac
2814 dnl Only one oddball right now (QNX), but this gives us flexibility
2815 dnl if any other platforms need to override this in the future.
2816 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2818 dnl ========================================================
2819 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2820 dnl by now will not have any way to link most binaries (tests
2821 dnl as well as viewer, apprunner, etc.), because some symbols
2822 dnl will be left out of the "composite" .so's by ld as unneeded.
2823 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2824 dnl they can link in the static libs that provide the missing
2825 dnl symbols.
2826 dnl ========================================================
2827 NO_LD_ARCHIVE_FLAGS=
2828 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2829     NO_LD_ARCHIVE_FLAGS=1
2831 case "$target" in
2832 *-os2*)
2833     NO_LD_ARCHIVE_FLAGS=
2834     ;;
2835 *-aix4.3*|*-aix5*)
2836     NO_LD_ARCHIVE_FLAGS=
2837     ;;
2838 *-openvms*)
2839     NO_LD_ARCHIVE_FLAGS=
2840     ;;
2841 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2842     if test -z "$GNU_CC"; then
2843         NO_LD_ARCHIVE_FLAGS=
2844     fi
2845     ;;
2846 esac
2847 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2849 dnl ========================================================
2850 dnl = Flags to strip unused symbols from .so components
2851 dnl ========================================================
2852 case "$target" in
2853     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2854         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2855         ;;
2856     *-solaris*)
2857         if test -z "$GNU_CC"; then
2858          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2859         else
2860          if test -z "$GCC_USE_GNU_LD"; then
2861           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2862          else
2863           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2864          fi
2865         fi
2866         ;;
2867     *-nto*) 
2868         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2869         ;;
2870     *-darwin*)
2871         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2872         ;;
2873     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2874         if test -n "$GNU_CC"; then
2875            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2876         fi
2877         ;;
2878 esac
2880 if test -z "$COMPILE_ENVIRONMENT"; then
2881     SKIP_COMPILER_CHECKS=1
2882     SKIP_LIBRARY_CHECKS=1
2885 if test -z "$SKIP_COMPILER_CHECKS"; then
2886 dnl Checks for typedefs, structures, and compiler characteristics.
2887 dnl ========================================================
2888 AC_LANG_C
2889 AC_HEADER_STDC
2890 AC_C_CONST
2891 AC_TYPE_MODE_T
2892 AC_TYPE_OFF_T
2893 AC_TYPE_PID_T
2894 AC_TYPE_SIZE_T
2895 AC_MSG_CHECKING(for __stdcall)
2896 AC_CACHE_VAL(ac_cv___stdcall,
2897  [AC_TRY_COMPILE([],
2898                  [void foo(); void __stdcall foo();],
2899                  [ac_cv___stdcall=true],
2900                  [ac_cv___stdcall=false])])
2901 if test "$ac_cv___stdcall" = true ; then
2902   AC_DEFINE(HAVE_STDCALL)
2903   AC_MSG_RESULT(yes)
2904 else
2905   AC_MSG_RESULT(no)
2907 AC_MSG_CHECKING(for ssize_t)
2908 AC_CACHE_VAL(ac_cv_type_ssize_t,
2909  [AC_TRY_COMPILE([#include <stdio.h>
2910                   #include <sys/types.h>],
2911                  [ssize_t foo = 0;],
2912                  [ac_cv_type_ssize_t=true],
2913                  [ac_cv_type_ssize_t=false])])
2914 if test "$ac_cv_type_ssize_t" = true ; then
2915   AC_DEFINE(HAVE_SSIZE_T)
2916   AC_MSG_RESULT(yes)
2917 else
2918   AC_MSG_RESULT(no)
2920 AC_STRUCT_ST_BLKSIZE
2921 AC_MSG_CHECKING(for siginfo_t)
2922 AC_CACHE_VAL(ac_cv_siginfo_t,
2923  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2924                   #include <signal.h>],
2925                  [siginfo_t* info;],
2926                  [ac_cv_siginfo_t=true],
2927                  [ac_cv_siginfo_t=false])])
2928 if test "$ac_cv_siginfo_t" = true ; then
2929   AC_DEFINE(HAVE_SIGINFO_T)
2930   AC_MSG_RESULT(yes)
2931 else
2932   AC_MSG_RESULT(no)
2935 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2936 dnl ========================================================
2937 AC_MSG_CHECKING(for int16_t)
2938 AC_CACHE_VAL(ac_cv_int16_t,
2939  [AC_TRY_COMPILE([#include <stdio.h>
2940                   #include <sys/types.h>],
2941                  [int16_t foo = 0;],
2942                  [ac_cv_int16_t=true],
2943                  [ac_cv_int16_t=false])])
2944 if test "$ac_cv_int16_t" = true ; then
2945   AC_DEFINE(HAVE_INT16_T)
2946   AC_MSG_RESULT(yes)
2947 else
2948   AC_MSG_RESULT(no)
2950 AC_MSG_CHECKING(for int32_t)
2951 AC_CACHE_VAL(ac_cv_int32_t,
2952  [AC_TRY_COMPILE([#include <stdio.h>
2953                   #include <sys/types.h>],
2954                  [int32_t foo = 0;],
2955                  [ac_cv_int32_t=true],
2956                  [ac_cv_int32_t=false])])
2957 if test "$ac_cv_int32_t" = true ; then
2958   AC_DEFINE(HAVE_INT32_T)
2959   AC_MSG_RESULT(yes)
2960 else
2961   AC_MSG_RESULT(no)
2963 AC_MSG_CHECKING(for int64_t)
2964 AC_CACHE_VAL(ac_cv_int64_t,
2965  [AC_TRY_COMPILE([#include <stdio.h>
2966                   #include <sys/types.h>],
2967                  [int64_t foo = 0;],
2968                  [ac_cv_int64_t=true],
2969                  [ac_cv_int64_t=false])])
2970 if test "$ac_cv_int64_t" = true ; then
2971   AC_DEFINE(HAVE_INT64_T)
2972   AC_MSG_RESULT(yes)
2973 else
2974   AC_MSG_RESULT(no)
2976 AC_MSG_CHECKING(for int64)
2977 AC_CACHE_VAL(ac_cv_int64,
2978  [AC_TRY_COMPILE([#include <stdio.h>
2979                   #include <sys/types.h>],
2980                  [int64 foo = 0;],
2981                  [ac_cv_int64=true],
2982                  [ac_cv_int64=false])])
2983 if test "$ac_cv_int64" = true ; then
2984   AC_DEFINE(HAVE_INT64)
2985   AC_MSG_RESULT(yes)
2986 else
2987   AC_MSG_RESULT(no)
2989 AC_MSG_CHECKING(for uint)
2990 AC_CACHE_VAL(ac_cv_uint,
2991  [AC_TRY_COMPILE([#include <stdio.h>
2992                   #include <sys/types.h>],
2993                  [uint foo = 0;],
2994                  [ac_cv_uint=true],
2995                  [ac_cv_uint=false])])
2996 if test "$ac_cv_uint" = true ; then
2997   AC_DEFINE(HAVE_UINT)
2998   AC_MSG_RESULT(yes)
2999 else
3000   AC_MSG_RESULT(no)
3002 AC_MSG_CHECKING(for uint_t)
3003 AC_CACHE_VAL(ac_cv_uint_t,
3004  [AC_TRY_COMPILE([#include <stdio.h>
3005                   #include <sys/types.h>],
3006                  [uint_t foo = 0;],
3007                  [ac_cv_uint_t=true],
3008                  [ac_cv_uint_t=false])])
3009 if test "$ac_cv_uint_t" = true ; then
3010   AC_DEFINE(HAVE_UINT_T)
3011   AC_MSG_RESULT(yes)
3012 else
3013   AC_MSG_RESULT(no)
3015 AC_MSG_CHECKING(for uint16_t)
3016 AC_CACHE_VAL(ac_cv_uint16_t,
3017  [AC_TRY_COMPILE([#include <stdio.h>
3018                   #include <sys/types.h>],
3019                  [uint16_t foo = 0;],
3020                  [ac_cv_uint16_t=true],
3021                  [ac_cv_uint16_t=false])])
3022 if test "$ac_cv_uint16_t" = true ; then
3023   AC_DEFINE(HAVE_UINT16_T)
3024   AC_MSG_RESULT(yes)
3025 else
3026   AC_MSG_RESULT(no)
3029 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3030 dnl are defined when compiling C++ but not C.  Since the result of this
3031 dnl test is used only in C++, do it in C++.
3032 AC_LANG_CPLUSPLUS
3034 AC_MSG_CHECKING(for uname.domainname)
3035 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3036     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3037         [ struct utsname *res; char *domain; 
3038             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3039         [ac_cv_have_uname_domainname_field=true],
3040         [ac_cv_have_uname_domainname_field=false])])
3042 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3043     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3044     AC_MSG_RESULT(yes)
3045 else
3046     AC_MSG_RESULT(no)
3049 AC_MSG_CHECKING(for uname.__domainname)
3050 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3051     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3052         [ struct utsname *res; char *domain; 
3053             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3054         [ac_cv_have_uname_us_domainname_field=true],
3055         [ac_cv_have_uname_us_domainname_field=false])])
3057 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3058     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3059     AC_MSG_RESULT(yes)
3060 else
3061     AC_MSG_RESULT(no)
3064 AC_LANG_CPLUSPLUS
3066 dnl Check for usable char16_t (2 bytes, unsigned)
3067 dnl (we might not need the unsignedness check anymore)
3068 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3069     ac_cv_have_usable_char16_t,
3070     [AC_TRY_COMPILE([$configure_static_assert_macros],
3071                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3072                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3073                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3074                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3075                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3076                     ac_cv_have_usable_char16_t="yes",
3077                     ac_cv_have_usable_char16_t="no")])
3078 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3079     AC_DEFINE(HAVE_CPP_CHAR16_T)
3080     HAVE_CPP_CHAR16_T=1
3083 dnl Check for usable wchar_t (2 bytes, unsigned)
3084 dnl (we really don't need the unsignedness check anymore)
3085 dnl ========================================================
3087 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3088     ac_cv_have_usable_wchar_v2,
3089     [AC_TRY_COMPILE([#include <stddef.h>
3090                      $configure_static_assert_macros],
3091                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3092                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3093                     ac_cv_have_usable_wchar_v2="yes",
3094                     ac_cv_have_usable_wchar_v2="no")])
3095 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3096     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3097     HAVE_CPP_2BYTE_WCHAR_T=1
3098 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3099 dnl This is really gcc-only
3100 dnl Do this test using CXX only since some versions of gcc
3101 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3102 dnl only have short-wchar support for c++.
3103 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3105     _SAVE_CXXFLAGS=$CXXFLAGS
3106     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3108     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3109         ac_cv_have_usable_wchar_option_v2,
3110         [AC_TRY_LINK([#include <stddef.h>
3111                       $configure_static_assert_macros],
3112                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3113                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3114                      ac_cv_have_usable_wchar_option_v2="yes",
3115                      ac_cv_have_usable_wchar_option_v2="no")])
3117     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3118         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3119         HAVE_CPP_2BYTE_WCHAR_T=1
3120         WCHAR_CFLAGS="-fshort-wchar"
3121     else    
3122         CXXFLAGS=$_SAVE_CXXFLAGS
3123     fi
3126 AC_LANG_C
3128 dnl Check for .hidden assembler directive and visibility attribute.
3129 dnl Borrowed from glibc configure.in
3130 dnl ===============================================================
3131 if test "$GNU_CC"; then
3132   AC_CACHE_CHECK(for visibility(hidden) attribute,
3133                  ac_cv_visibility_hidden,
3134                  [cat > conftest.c <<EOF
3135                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3137                   ac_cv_visibility_hidden=no
3138                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3139                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3140                       ac_cv_visibility_hidden=yes
3141                     fi
3142                   fi
3143                   rm -f conftest.[cs]
3144                  ])
3145   if test "$ac_cv_visibility_hidden" = "yes"; then
3146     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3148     AC_CACHE_CHECK(for visibility(default) attribute,
3149                    ac_cv_visibility_default,
3150                    [cat > conftest.c <<EOF
3151                     int foo __attribute__ ((visibility ("default"))) = 1;
3153                     ac_cv_visibility_default=no
3154                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3155                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3156                         ac_cv_visibility_default=yes
3157                       fi
3158                     fi
3159                     rm -f conftest.[cs]
3160                    ])
3161     if test "$ac_cv_visibility_default" = "yes"; then
3162       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3164       AC_CACHE_CHECK(for visibility pragma support,
3165                      ac_cv_visibility_pragma,
3166                      [cat > conftest.c <<EOF
3167 #pragma GCC visibility push(hidden)
3168                       int foo_hidden = 1;
3169 #pragma GCC visibility push(default)
3170                       int foo_default = 1;
3172                       ac_cv_visibility_pragma=no
3173                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3174                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3175                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3176                             ac_cv_visibility_pragma=yes
3177                           fi
3178                         fi
3179                       fi
3180                       rm -f conftest.[cs]
3181                     ])
3182       if test "$ac_cv_visibility_pragma" = "yes"; then
3183         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3184                        ac_cv_have_visibility_class_bug,
3185                        [cat > conftest.c <<EOF
3186 #pragma GCC visibility push(hidden)
3187 struct __attribute__ ((visibility ("default"))) TestStruct {
3188   static void Init();
3190 __attribute__ ((visibility ("default"))) void TestFunc() {
3191   TestStruct::Init();
3194                        ac_cv_have_visibility_class_bug=no
3195                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3196                          ac_cv_have_visibility_class_bug=yes
3197                        else
3198                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3199                            ac_cv_have_visibility_class_bug=yes
3200                          fi
3201                        fi
3202                        rm -rf conftest.{c,S}
3203                        ])
3205         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3206                        ac_cv_have_visibility_builtin_bug,
3207                        [cat > conftest.c <<EOF
3208 #pragma GCC visibility push(hidden)
3209 #pragma GCC visibility push(default)
3210 #include <string.h>
3211 #pragma GCC visibility pop
3213 __attribute__ ((visibility ("default"))) void Func() {
3214   char c[[100]];
3215   memset(c, 0, sizeof(c));
3218                        ac_cv_have_visibility_builtin_bug=no
3219                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3220                          ac_cv_have_visibility_builtin_bug=yes
3221                        else
3222                          if test `grep -c "@PLT" conftest.S` = 0; then
3223                            ac_cv_visibility_builtin_bug=yes
3224                          fi
3225                        fi
3226                        rm -f conftest.{c,S}
3227                        ])
3228         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3229                 "$ac_cv_have_visibility_class_bug" = "no"; then
3230           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3231           WRAP_SYSTEM_INCLUDES=1
3232           STL_FLAGS='-I$(DIST)/stl_wrappers'
3233           WRAP_STL_INCLUDES=1
3234         else
3235           VISIBILITY_FLAGS='-fvisibility=hidden'
3236         fi # have visibility pragma bug
3237       fi   # have visibility pragma
3238     fi     # have visibility(default) attribute
3239   fi       # have visibility(hidden) attribute
3240 fi         # GNU_CC
3242 # visibility hidden flag for Sun Studio on Solaris
3243 if test "$SOLARIS_SUNPRO_CC"; then
3244 VISIBILITY_FLAGS='-xldscope=hidden'
3245 fi         # Sun Studio on Solaris
3247 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3248 AC_SUBST(VISIBILITY_FLAGS)
3250 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3251 dnl ========================================================
3252 if test "$GNU_CC"; then
3253   CFLAGS_save="${CFLAGS}"
3254   CFLAGS="${CFLAGS} -Werror"
3255   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3256                  ac_cv_force_align_arg_pointer,
3257                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3258                                  [],
3259                                  ac_cv_force_align_arg_pointer="yes",
3260                                  ac_cv_force_align_arg_pointer="no")])
3261   CFLAGS="${CFLAGS_save}"
3262   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3263     HAVE_GCC_ALIGN_ARG_POINTER=1
3264   else
3265     HAVE_GCC_ALIGN_ARG_POINTER=
3266   fi
3268 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3270 dnl Checks for header files.
3271 dnl ========================================================
3272 AC_HEADER_DIRENT
3273 case "$target_os" in
3274 freebsd*)
3275 # for stuff like -lXshm
3276     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3277     ;;
3278 esac
3279 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3280 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3281 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3282 AC_CHECK_HEADERS(malloc.h)
3283 AC_CHECK_HEADERS(X11/XKBlib.h)
3284 AC_CHECK_HEADERS(io.h)
3286 dnl These are all the places some variant of statfs can be hiding.
3287 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3289 dnl Quota support
3290 AC_CHECK_HEADERS(sys/quota.h)
3292 dnl Try for MMX support
3293 dnl NB - later gcc versions require -mmmx for this header to be successfully
3294 dnl included (or another option which implies it, such as -march=pentium-mmx)
3295 AC_CHECK_HEADERS(mmintrin.h)
3297 dnl Check whether the compiler supports the new-style C++ standard
3298 dnl library headers (i.e. <new>) or needs the old "new.h"
3299 AC_LANG_CPLUSPLUS
3300 NEW_H=new.h
3301 AC_CHECK_HEADER(new, [NEW_H=new])
3302 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3303 AC_LANG_C
3305 AC_ARG_ENABLE(dtrace,
3306               [  --enable-dtrace         build with dtrace support if available (default=no)],
3307               [enable_dtrace="yes"],)
3308 if test "x$enable_dtrace" = "xyes"; then
3309   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3310   if test -n "$HAVE_DTRACE"; then
3311       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3312   else
3313       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3314   fi
3316 AC_SUBST(HAVE_DTRACE)
3318 case $target in
3319 *-aix4.3*|*-aix5*)
3320         ;;
3322         AC_CHECK_HEADERS(sys/cdefs.h)
3323         ;;
3324 esac
3326 dnl Checks for libraries.
3327 dnl ========================================================
3328 case $target in
3329 *-hpux11.*)
3330         ;;
3332         AC_CHECK_LIB(c_r, gethostbyname_r)
3333         ;;
3334 esac
3336 dnl We don't want to link with libdl even if it's present on OS X, since
3337 dnl it's not used and not part of the default installation.
3338 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3339 dnl We don't want to link against libm or libpthread on Darwin since
3340 dnl they both are just symlinks to libSystem and explicitly linking
3341 dnl against libSystem causes issues when debugging (see bug 299601).
3342 case $target in
3343 *-darwin*)
3344     ;;
3345 *-beos*)
3346     ;;
3347 *-os2*)
3348     ;;
3350     AC_CHECK_LIB(m, atan)
3351     AC_CHECK_LIB(dl, dlopen,
3352     AC_CHECK_HEADER(dlfcn.h, 
3353         LIBS="-ldl $LIBS"
3354         AC_DEFINE(HAVE_LIBDL)))
3355     ;;
3356 esac
3358 _SAVE_CFLAGS="$CFLAGS"
3359 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3360 AC_CHECK_FUNCS(dladdr)
3361 CFLAGS="$_SAVE_CFLAGS"
3363 if test ! "$GNU_CXX"; then
3365     case $target in
3366     *-aix*)
3367         AC_CHECK_LIB(C_r, demangle)
3368         ;;
3369      *)
3370         AC_CHECK_LIB(C, demangle)
3371         ;;
3372      esac
3375 dnl OS/2 has socket in libc.
3376 case $target in
3377 *-os2*)
3378     ;;
3380     AC_CHECK_LIB(socket, socket)
3381 esac
3383 dnl ========================================================
3384 dnl Check whether we can compile code for Core Text
3385 dnl (available on Mac OS X 10.5 or later)
3386 dnl ========================================================
3387 case "$target" in
3388 *-darwin*)
3389   AC_MSG_CHECKING([for Core Text])
3390   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3391                  [CTLineRef lineRef;],
3392                   ac_cv_have_core_text="yes",
3393                   ac_cv_have_core_text="no")
3394   AC_MSG_RESULT([$ac_cv_have_core_text])
3396   if test "$ac_cv_have_core_text" = "no"; then
3397     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3398   fi
3399   ;;
3400 esac
3402 XLDFLAGS="$X_LIBS"
3403 XLIBS="$X_EXTRA_LIBS"
3405 dnl ========================================================
3406 dnl Checks for X libraries.
3407 dnl Ordering is important.
3408 dnl Xt is dependent upon SM as of X11R6
3409 dnl ========================================================
3410 if test "$no_x" = "yes"; then
3411     AC_DEFINE(NO_X11)
3412 else
3413     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3414         XLIBS="-lX11 $XLIBS"
3415         _SAVE_LDFLAGS="$LDFLAGS"
3416         LDFLAGS="$XLDFLAGS $LDFLAGS"
3417         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3418                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3419         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3420                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3421      
3422         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3423         unset ac_cv_lib_Xt_XtFree
3424             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3425             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3426         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3427                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3428         ])
3430     # AIX needs the motif library linked before libXt to prevent
3431     # crashes in plugins linked against Motif - Bug #98892
3432     case "${target_os}" in
3433     aix*)
3434         XT_LIBS="-lXm $XT_LIBS"
3435         ;;
3436     esac
3438     dnl ========================================================
3439     dnl = Check for XShm
3440     dnl ========================================================
3441     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3442         $XLIBS $XEXT_LIBS)
3443     AC_CHECK_HEADER(X11/extensions/XShm.h)
3444     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3445         test -n "$_HAVE_XSHM_XEXT"; then
3446         AC_DEFINE(HAVE_XSHM)
3447     fi
3449     dnl ========================================================
3450     dnl = Check for XIE
3451     dnl ========================================================
3452     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3453         $XLIBS $XEXT_LIBS)
3454     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3456     if test "$MOZ_XIE_LIBS"; then
3457         dnl ====================================================
3458         dnl = If XIE is present and is desired, turn it on
3459         dnl ====================================================
3460         case $target in
3461             *-hpux*)
3462                 ;;
3463             *)
3464                 HAVE_XIE=1
3465                 ;;
3466         esac
3467     fi
3469         LDFLAGS="$_SAVE_LDFLAGS"
3471     dnl ========================================================
3472     dnl = Check for freetype2 and its functionality
3473     dnl ========================================================
3474     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3476     if test "$_HAVE_FREETYPE2"; then
3477         _SAVE_LIBS="$LIBS"
3478         _SAVE_CFLAGS="$CFLAGS"
3479         LIBS="$LIBS $FT2_LIBS"
3480         CFLAGS="$CFLAGS $FT2_CFLAGS"
3482         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3483             ac_cv_member_FT_Bitmap_Size_y_ppem,
3484             [AC_TRY_COMPILE([#include <ft2build.h>
3485                              #include FT_FREETYPE_H],
3486                             [FT_Bitmap_Size s;
3487                              if (sizeof s.y_ppem) return 0;
3488                              return 1],
3489                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3490                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3491         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3492             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3493         else
3494             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3495         fi
3496         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3497                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3498                            [FT_Bitmap_Size structure includes y_ppem field])
3500         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3502         LIBS="$_SAVE_LIBS"
3503         CFLAGS="$_SAVE_CFLAGS"
3504     fi
3506 fi # $no_x
3508 AC_SUBST(XCFLAGS)
3509 AC_SUBST(XLDFLAGS)
3510 AC_SUBST(XLIBS)
3511 AC_SUBST(XEXT_LIBS)
3512 AC_SUBST(XT_LIBS)
3514 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3515 AC_TRY_COMPILE([],
3516                [asm("uqadd8 r1, r1, r2");],
3517                result="yes", result="no")
3518 AC_MSG_RESULT("$result")
3519 if test "$result" = "yes"; then
3520     AC_DEFINE(HAVE_ARM_SIMD)
3521     HAVE_ARM_SIMD=1
3523 AC_SUBST(HAVE_ARM_SIMD)
3525 AC_MSG_CHECKING(for ARM NEON support in compiler)
3526 _SAVE_CFLAGS="$CFLAGS"
3527 if test "$GNU_CC"; then
3528   # gcc needs -mfpu=neon to recognize NEON instructions
3529   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3531 AC_TRY_COMPILE([],
3532                [asm("vadd.i8 d0, d0, d0");],
3533                result="yes", result="no")
3534 AC_MSG_RESULT("$result")
3535 if test "$result" = "yes"; then
3536     AC_DEFINE(HAVE_ARM_NEON)
3537     HAVE_ARM_NEON=1
3539 CFLAGS="$_SAVE_CFLAGS"
3540 AC_SUBST(HAVE_ARM_NEON)
3542 dnl ========================================================
3543 dnl = pthread support
3544 dnl = Start by checking whether the system support pthreads
3545 dnl ========================================================
3546 case "$target_os" in
3547 darwin*)
3548     USE_PTHREADS=1
3549     ;;
3551     MOZ_CHECK_PTHREADS(pthreads,
3552         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3553         MOZ_CHECK_PTHREADS(pthread,
3554             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3555             MOZ_CHECK_PTHREADS(c_r,
3556                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3557                 MOZ_CHECK_PTHREADS(c,
3558                     USE_PTHREADS=1
3559                 )
3560             )
3561         )
3562     )
3563     ;;
3564 esac
3566 dnl ========================================================
3567 dnl Check the command line for --with-pthreads 
3568 dnl ========================================================
3569 MOZ_ARG_WITH_BOOL(pthreads,
3570 [  --with-pthreads         Force use of system pthread library with NSPR ],
3571 [ if test "$USE_PTHREADS"x = x; then
3572     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3573 fi],
3574     USE_PTHREADS=
3575     _PTHREAD_LDFLAGS=
3578 dnl ========================================================
3579 dnl Do the platform specific pthread hackery
3580 dnl ========================================================
3581 if test "$USE_PTHREADS"x != x
3582 then
3583         dnl
3584         dnl See if -pthread is supported.
3585         dnl
3586         rm -f conftest*
3587         ac_cv_have_dash_pthread=no
3588         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3589         echo 'int main() { return 0; }' | cat > conftest.c
3590         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3591         if test $? -eq 0; then
3592                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3593                         ac_cv_have_dash_pthread=yes
3594                 case "$target_os" in
3595                 freebsd*)
3596 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3597                 ;;
3598                 *)
3599                             CFLAGS="$CFLAGS -pthread"
3600                             CXXFLAGS="$CXXFLAGS -pthread"
3601                 ;;
3602                 esac
3603                 fi
3604         fi
3605         rm -f conftest*
3606     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3608         dnl
3609         dnl See if -pthreads is supported.
3610         dnl
3611     ac_cv_have_dash_pthreads=no
3612     if test "$ac_cv_have_dash_pthread" = "no"; then
3613             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3614         echo 'int main() { return 0; }' | cat > conftest.c
3615             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3616         if test $? -eq 0; then
3617                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3618                             ac_cv_have_dash_pthreads=yes
3619                             CFLAGS="$CFLAGS -pthreads"
3620                             CXXFLAGS="$CXXFLAGS -pthreads"
3621                     fi
3622             fi
3623             rm -f conftest*
3624         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3625     fi
3627         case "$target" in
3628             *-*-freebsd*)
3629                         AC_DEFINE(_REENTRANT)
3630                         AC_DEFINE(_THREAD_SAFE)
3631                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3632                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3633                                 _PTHREAD_LDFLAGS="-pthread"
3634                         else
3635                                 _PTHREAD_LDFLAGS="-lc_r"
3636                         fi
3637                         ;;
3639             *-*-openbsd*|*-*-bsdi*)
3640                         AC_DEFINE(_REENTRANT)
3641                         AC_DEFINE(_THREAD_SAFE)
3642                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3643                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3644                 _PTHREAD_LDFLAGS="-pthread"
3645                         fi
3646                         ;;
3648             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3649                         AC_DEFINE(_REENTRANT) 
3650                         ;;
3652             *-*-nto*) 
3653                         AC_DEFINE(_REENTRANT) 
3654                         ;;
3656             *-aix4.3*|*-aix5*)
3657                         AC_DEFINE(_REENTRANT) 
3658                         ;;
3660             *-hpux11.*)
3661                         AC_DEFINE(_REENTRANT) 
3662                         ;;
3664             alpha*-*-osf*)
3665                         AC_DEFINE(_REENTRANT)
3666                         ;;
3668             *-*-solaris*) 
3669                         AC_DEFINE(_REENTRANT)
3670                         if test "$SOLARIS_SUNPRO_CC"; then
3671                                 CFLAGS="$CFLAGS -mt" 
3672                                 CXXFLAGS="$CXXFLAGS -mt" 
3673                         fi
3674                         ;;
3675         esac
3676     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3679 dnl ========================================================
3680 dnl See if mmap sees writes
3681 dnl For cross compiling, just define it as no, which is a safe default
3682 dnl ========================================================
3683 AC_MSG_CHECKING(whether mmap() sees write()s)
3685 changequote(,)
3686 mmap_test_prog='
3687     #include <stdlib.h>
3688     #include <unistd.h>
3689     #include <sys/mman.h>
3690     #include <sys/types.h>
3691     #include <sys/stat.h>
3692     #include <fcntl.h>
3694     char fname[] = "conftest.file";
3695     char zbuff[1024]; /* Fractional page is probably worst case */
3697     int main() {
3698         char *map;
3699         int fd;
3700         int i;
3701         unlink(fname);
3702         fd = open(fname, O_RDWR | O_CREAT, 0660);
3703         if(fd<0) return 1;
3704         unlink(fname);
3705         write(fd, zbuff, sizeof(zbuff));
3706         lseek(fd, 0, SEEK_SET);
3707         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3708         if(map==(char*)-1) return 2;
3709         for(i=0; fname[i]; i++) {
3710             int rc = write(fd, &fname[i], 1);
3711             if(map[i]!=fname[i]) return 4;
3712         }
3713         return 0;
3714     }
3716 changequote([,])
3718 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3720 AC_MSG_RESULT("$result")
3722 if test "$result" = "no"; then
3723     AC_DEFINE(MMAP_MISSES_WRITES)
3727 dnl Checks for library functions.
3728 dnl ========================================================
3729 AC_PROG_GCC_TRADITIONAL
3730 AC_FUNC_MEMCMP
3731 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3732 AC_CHECK_FUNCS(flockfile getpagesize)
3733 AC_CHECK_FUNCS(localtime_r strtok_r)
3735 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3736 _SAVE_LDFLAGS=$LDFLAGS
3737 LDFLAGS="$LDFLAGS -lrt"
3738 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3739                ac_cv_have_clock_monotonic,
3740                [AC_TRY_LINK([#include <time.h>],
3741                             [ struct timespec ts;
3742                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3743                             ac_cv_have_clock_monotonic=yes,
3744                             ac_cv_have_clock_monotonic=no)])
3745 LDFLAGS=$_SAVE_LDFLAGS
3746 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3747     HAVE_CLOCK_MONOTONIC=1
3748     REALTIME_LIBS=-lrt
3749     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3750     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3751     AC_SUBST(REALTIME_LIBS)
3754 dnl check for wcrtomb/mbrtowc
3755 dnl =======================================================================
3756 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3757 AC_LANG_SAVE
3758 AC_LANG_CPLUSPLUS
3759 AC_CACHE_CHECK(for wcrtomb,
3760     ac_cv_have_wcrtomb,
3761     [AC_TRY_LINK([#include <wchar.h>],
3762                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3763                  ac_cv_have_wcrtomb="yes",
3764                  ac_cv_have_wcrtomb="no")])
3765 if test "$ac_cv_have_wcrtomb" = "yes"; then
3766     AC_DEFINE(HAVE_WCRTOMB)
3768 AC_CACHE_CHECK(for mbrtowc,
3769     ac_cv_have_mbrtowc,
3770     [AC_TRY_LINK([#include <wchar.h>],
3771                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3772                  ac_cv_have_mbrtowc="yes",
3773                  ac_cv_have_mbrtowc="no")])
3774 if test "$ac_cv_have_mbrtowc" = "yes"; then
3775     AC_DEFINE(HAVE_MBRTOWC)
3777 AC_LANG_RESTORE
3780 AC_CACHE_CHECK(
3781     [for res_ninit()],
3782     ac_cv_func_res_ninit,
3783     [AC_TRY_LINK([
3784         #ifdef linux
3785         #define _BSD_SOURCE 1
3786         #endif
3787         #include <resolv.h>
3788         ],
3789         [int foo = res_ninit(&_res);],
3790         [ac_cv_func_res_ninit=yes],
3791         [ac_cv_func_res_ninit=no])
3792     ])
3794 if test "$ac_cv_func_res_ninit" = "yes"; then
3795     AC_DEFINE(HAVE_RES_NINIT)
3796 dnl must add the link line we do something as foolish as this... dougt
3797 dnl else
3798 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3799 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3802 AC_LANG_CPLUSPLUS
3803 AC_CACHE_CHECK(
3804     [for gnu_get_libc_version()],
3805     ac_cv_func_gnu_get_libc_version,
3806     [AC_TRY_LINK([
3807         #ifdef HAVE_GNU_LIBC_VERSION_H
3808         #include <gnu/libc-version.h>
3809         #endif
3810         ],
3811         [const char *glibc_version = gnu_get_libc_version();],
3812         [ac_cv_func_gnu_get_libc_version=yes],
3813         [ac_cv_func_gnu_get_libc_version=no] 
3814         )]
3815     )
3817 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3818     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3821 case $target_os in
3822     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3823         ;;
3824     *)
3825     
3826 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3827     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3828         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3829 _SAVE_LIBS=$LIBS
3830 LIBS="$LIBS $_ICONV_LIBS"
3831 AC_CACHE_CHECK(
3832     [for iconv()],
3833     ac_cv_func_iconv,
3834     [AC_TRY_LINK([
3835         #include <stdlib.h>
3836         #include <iconv.h>
3837         ],
3838         [
3839             iconv_t h = iconv_open("", "");
3840             iconv(h, NULL, NULL, NULL, NULL);
3841             iconv_close(h);
3842         ],
3843         [ac_cv_func_iconv=yes],
3844         [ac_cv_func_iconv=no] 
3845         )]
3846     )
3847 if test "$ac_cv_func_iconv" = "yes"; then
3848     AC_DEFINE(HAVE_ICONV)
3849     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3850     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3851     LIBICONV="$_ICONV_LIBS"
3852     AC_CACHE_CHECK(
3853         [for iconv() with const input],
3854         ac_cv_func_const_iconv,
3855         [AC_TRY_COMPILE([
3856             #include <stdlib.h>
3857             #include <iconv.h>
3858             ],
3859             [
3860                 const char *input = "testing";
3861                 iconv_t h = iconv_open("", "");
3862                 iconv(h, &input, NULL, NULL, NULL);
3863                 iconv_close(h);
3864             ],
3865             [ac_cv_func_const_iconv=yes],
3866             [ac_cv_func_const_iconv=no] 
3867             )]
3868         )
3869     if test "$ac_cv_func_const_iconv" = "yes"; then
3870         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3871     fi
3873 LIBS=$_SAVE_LIBS
3875     ;;
3876 esac
3878 AM_LANGINFO_CODESET
3880 AC_LANG_C
3882 dnl **********************
3883 dnl *** va_copy checks ***
3884 dnl **********************
3885 dnl we currently check for all three va_copy possibilities, so we get
3886 dnl all results in config.log for bug reports.
3887 AC_MSG_CHECKING(for an implementation of va_copy())
3888 AC_CACHE_VAL(ac_cv_va_copy,[
3889     AC_TRY_RUN([
3890         #include <stdarg.h>
3891         void f (int i, ...) {
3892             va_list args1, args2;
3893             va_start (args1, i);
3894             va_copy (args2, args1);
3895             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3896                 exit (1);
3897             va_end (args1); va_end (args2);
3898         }
3899         int main() { f (0, 42); return 0; }],
3900         ac_cv_va_copy=yes,
3901         ac_cv_va_copy=no,
3902         ac_cv_va_copy=no
3903     )
3905 AC_MSG_RESULT($ac_cv_va_copy)
3906 AC_MSG_CHECKING(for an implementation of __va_copy())
3907 AC_CACHE_VAL(ac_cv___va_copy,[
3908     AC_TRY_RUN([
3909         #include <stdarg.h>
3910         void f (int i, ...) {
3911             va_list args1, args2;
3912             va_start (args1, i);
3913             __va_copy (args2, args1);
3914             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3915                 exit (1);
3916             va_end (args1); va_end (args2);
3917         }
3918         int main() { f (0, 42); return 0; }],
3919         ac_cv___va_copy=yes,
3920         ac_cv___va_copy=no,
3921         ac_cv___va_copy=no
3922     )
3924 AC_MSG_RESULT($ac_cv___va_copy)
3925 AC_MSG_CHECKING(whether va_lists can be copied by value)
3926 AC_CACHE_VAL(ac_cv_va_val_copy,[
3927     AC_TRY_RUN([
3928         #include <stdarg.h>
3929         void f (int i, ...) {
3930             va_list args1, args2;
3931             va_start (args1, i);
3932             args2 = args1;
3933             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3934                 exit (1);
3935             va_end (args1); va_end (args2);
3936         }
3937         int main() { f (0, 42); return 0; }],
3938         ac_cv_va_val_copy=yes,
3939         ac_cv_va_val_copy=no,
3940         ac_cv_va_val_copy=yes
3941     )
3943 if test "x$ac_cv_va_copy" = "xyes"; then
3944     AC_DEFINE(VA_COPY, va_copy)
3945     AC_DEFINE(HAVE_VA_COPY)
3946 elif test "x$ac_cv___va_copy" = "xyes"; then
3947     AC_DEFINE(VA_COPY, __va_copy)
3948     AC_DEFINE(HAVE_VA_COPY)
3951 if test "x$ac_cv_va_val_copy" = "xno"; then
3952    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3954 AC_MSG_RESULT($ac_cv_va_val_copy)
3956 dnl Check for dll-challenged libc's.
3957 dnl This check is apparently only needed for Linux.
3958 case "$target" in
3959         *-linux*)
3960             dnl ===================================================================
3961             _curdir=`pwd`
3962             export _curdir
3963             rm -rf conftest* _conftest
3964             mkdir _conftest
3965             cat >> conftest.C <<\EOF
3966 #include <stdio.h>
3967 #include <link.h>
3968 #include <dlfcn.h>
3969 #ifdef _dl_loaded
3970 void __dump_link_map(void) {
3971   struct link_map *map = _dl_loaded;
3972   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3974 int main() {
3975   dlopen("./conftest1.so",RTLD_LAZY);
3976   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3977   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3978   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3979   __dump_link_map();
3981 #else
3982 /* _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).*/
3983 int main() { printf("./conftest1.so\n"); }
3984 #endif
3987             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3989             cat >> conftest1.C <<\EOF
3990 #include <stdio.h>
3991 void foo(void) {printf("foo in dll called\n");}
3993             ${CXX-g++} -fPIC -c -g conftest1.C
3994             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3995             ${CXX-g++} -g conftest.C -o conftest -ldl
3996             cp -f conftest1.so conftest _conftest
3997             cd _conftest
3998             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3999             then
4000                 echo
4001                 echo "*** Your libc has a bug that can result in loading the same dynamic"
4002                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
4003                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
4004                 echo "*** will be excessive memory usage at runtime."
4005                 echo
4006             fi
4007             cd ${_curdir}
4008             rm -rf conftest* _conftest
4009             dnl ===================================================================
4010             ;;
4011 esac
4013 dnl ===================================================================
4014 dnl ========================================================
4015 dnl By default, turn rtti and exceptions off on g++/egcs
4016 dnl ========================================================
4017 if test "$GNU_CXX"; then
4019   AC_MSG_CHECKING(for C++ exceptions flag)
4021   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
4022   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
4023   [echo "int main() { return 0; }" | cat > conftest.C
4025   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
4027   if egrep "warning.*renamed" conftest.out >/dev/null; then
4028     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
4029   else
4030     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
4031   fi
4033   rm -f conftest*])
4035   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
4036   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
4037   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
4040 dnl ========================================================
4041 dnl Put your C++ language/feature checks below
4042 dnl ========================================================
4043 AC_LANG_CPLUSPLUS
4045 ARM_ABI_PREFIX=
4046 HAVE_GCC3_ABI=
4047 if test "$GNU_CC"; then
4048   if test "$CPU_ARCH" = "arm" ; then
4049     AC_CACHE_CHECK(for ARM EABI,
4050         ac_cv_gcc_arm_eabi,
4051         [AC_TRY_COMPILE([],
4052                         [
4053 #if defined(__ARM_EABI__)
4054   return 0;
4055 #else
4056 #error Not ARM EABI.
4057 #endif
4058                         ],
4059                         ac_cv_gcc_arm_eabi="yes",
4060                         ac_cv_gcc_arm_eabi="no")])
4061     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4062         HAVE_ARM_EABI=1
4063         ARM_ABI_PREFIX=eabi-
4064     else
4065         ARM_ABI_PREFIX=oabi-
4066     fi
4067   fi
4069   AC_CACHE_CHECK(for gcc 3.0 ABI,
4070       ac_cv_gcc_three_abi,
4071       [AC_TRY_COMPILE([],
4072                       [
4073 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4074   return 0;
4075 #else
4076 #error Not gcc3.
4077 #endif
4078                       ],
4079                       ac_cv_gcc_three_abi="yes",
4080                       ac_cv_gcc_three_abi="no")])
4081   if test "$ac_cv_gcc_three_abi" = "yes"; then
4082       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4083       HAVE_GCC3_ABI=1
4084   else
4085       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4086   fi
4088 AC_SUBST(HAVE_GCC3_ABI)
4091 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4092                ac_cv_cpp_explicit,
4093                [AC_TRY_COMPILE(class X {
4094                                public: explicit X(int i) : i_(i) {}
4095                                private: int i_;
4096                                };,
4097                                X x(3);,
4098                                ac_cv_cpp_explicit=yes,
4099                                ac_cv_cpp_explicit=no)])
4100 if test "$ac_cv_cpp_explicit" = yes ; then
4101    AC_DEFINE(HAVE_CPP_EXPLICIT)
4104 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4105                ac_cv_cpp_typename,
4106                [AC_TRY_COMPILE(class param {
4107                                public:
4108                                    typedef unsigned long num_type;
4109                                };
4111                                template <class T> class tplt {
4112                                public:
4113                                    typedef typename T::num_type t_num_type;
4114                                    t_num_type foo(typename T::num_type num) {
4115                                        return num;
4116                                    }
4117                                };,
4118                                tplt<param> A;
4119                                A.foo(0);,
4120                                ac_cv_cpp_typename=yes,
4121                                ac_cv_cpp_typename=no)])
4122 if test "$ac_cv_cpp_typename" = yes ; then
4123    AC_DEFINE(HAVE_CPP_TYPENAME)
4126 dnl Check for support of modern template specialization syntax
4127 dnl Test code and requirement from scc@netscape.com.
4128 dnl Autoconf cut-and-paste job by waterson@netscape.com
4129 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4130                ac_cv_cpp_modern_specialize_template_syntax,
4131                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4132                                class Y {};
4133                                template <> struct X<Y> { double a; };,
4134                                X<int> int_x;
4135                                X<Y> y_x;,
4136                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4137                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4138 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4139   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4143 dnl Some compilers support only full specialization, and some don't.
4144 AC_CACHE_CHECK(whether partial template specialization works,
4145                ac_cv_cpp_partial_specialization,
4146                [AC_TRY_COMPILE(template <class T> class Foo {};
4147                                template <class T> class Foo<T*> {};,
4148                                return 0;,
4149                                ac_cv_cpp_partial_specialization=yes,
4150                                ac_cv_cpp_partial_specialization=no)])
4151 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4152   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4155 dnl Some compilers have limited support for operators with templates;
4156 dnl specifically, it is necessary to define derived operators when a base
4157 dnl class's operator declaration should suffice.
4158 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4159                ac_cv_need_derived_template_operators,
4160                [AC_TRY_COMPILE([template <class T> class Base { };
4161                                 template <class T>
4162                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4163                                 template <class T> class Derived : public Base<T> { };],
4164                                [Derived<char> a, b;
4165                                 Base<char> c = a + b;
4166                                 return 0;],
4167                                ac_cv_need_derived_template_operators=no,
4168                                ac_cv_need_derived_template_operators=yes)])
4169 if test "$ac_cv_need_derived_template_operators" = yes ; then
4170   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4174 dnl Some compilers have trouble detecting that a template class
4175 dnl that derives from another template is actually an instance
4176 dnl of the base class. This test checks for that.
4177 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4178                ac_cv_need_cpp_template_cast_to_base,
4179                [AC_TRY_COMPILE([template <class T> class Base { };
4180                                 template <class T> class Derived : public Base<T> { };
4181                                 template <class T> int foo(const Base<T>&) { return 0; }],
4182                                [Derived<char> bar; return foo(bar);],
4183                                ac_cv_need_cpp_template_cast_to_base=no,
4184                                ac_cv_need_cpp_template_cast_to_base=yes)])
4185 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4186   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4189 dnl Some compilers have trouble resolving the ambiguity between two
4190 dnl functions whose arguments differ only by cv-qualifications.
4191 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4192                ac_cv_can_resolve_const_ambiguity,
4193                [AC_TRY_COMPILE([
4194                                 template <class T> class ptrClass {
4195                                   public: T* ptr;
4196                                 };
4198                                 template <class T> T* a(ptrClass<T> *arg) {
4199                                   return arg->ptr;
4200                                 }
4202                                 template <class T>
4203                                 const T* a(const ptrClass<T> *arg) {
4204                                   return arg->ptr;
4205                                 }
4206                                ],
4207                                [ ptrClass<int> i;
4208                                  a(&i); ],
4209                                ac_cv_can_resolve_const_ambiguity=yes,
4210                                ac_cv_can_resolve_const_ambiguity=no)])
4211 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4212   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4216 dnl We don't do exceptions on unix.  The only reason this used to be here
4217 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4218 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4219 dnl So im commenting this out until someone writes some artificial 
4220 dnl intelligence to detect not only if the compiler has exceptions, but if 
4221 dnl they are enabled as well.
4222 dnl 
4223 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4224 dnl                ac_cv_cpp_exceptions,
4225 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4226 dnl                                static void F() { throw X(); },
4227 dnl                                try { F(); } catch(X & e) { },
4228 dnl                                ac_cv_cpp_exceptions=yes,
4229 dnl                                ac_cv_cpp_exceptions=no)])
4230 dnl if test $ac_cv_cpp_exceptions = yes ; then
4231 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4232 dnl fi
4234 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4235 dnl supports it well enough to allow us to use it to change access, but not
4236 dnl to resolve ambiguity. The next two tests determine how well the |using|
4237 dnl keyword is supported.
4239 dnl Check to see if we can change access with |using|.  Test both a
4240 dnl legal and an illegal example.
4241 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4242                ac_cv_cpp_access_changing_using2,
4243                [AC_TRY_COMPILE(
4244                    class A { protected: int foo() { return 0; } };
4245                    class B : public A { public: using A::foo; };,
4246                    B b; return b.foo();,
4247                    [AC_TRY_COMPILE(
4248                        class A { public: int foo() { return 1; } };
4249                        class B : public A { private: using A::foo; };,
4250                        B b; return b.foo();,
4251                        ac_cv_cpp_access_changing_using2=no,
4252                        ac_cv_cpp_access_changing_using2=yes)],
4253                    ac_cv_cpp_access_changing_using2=no)])
4254 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4255    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4258 dnl Check to see if we can resolve ambiguity with |using|.
4259 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4260                ac_cv_cpp_ambiguity_resolving_using,
4261                [AC_TRY_COMPILE(class X { 
4262                                  public: int go(const X&) {return 3;}
4263                                          int jo(const X&) {return 3;}
4264                                };
4265                                class Y : public X {
4266                                  public:  int go(int) {return 2;}
4267                                           int jo(int) {return 2;}
4268                                           using X::jo;
4269                                  private: using X::go;
4270                                };,
4271                                X x; Y y; y.jo(x);,
4272                                ac_cv_cpp_ambiguity_resolving_using=yes,
4273                                ac_cv_cpp_ambiguity_resolving_using=no)])
4274 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4275    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4278 dnl Check to see if the |std| namespace is supported. If so, we'll want
4279 dnl to qualify any standard library calls with "std::" to ensure that
4280 dnl those functions can be resolved.
4281 AC_CACHE_CHECK(for \"std::\" namespace,
4282                ac_cv_cpp_namespace_std,
4283                [AC_TRY_COMPILE([#include <algorithm>],
4284                                [return std::min(0, 1);],
4285                                ac_cv_cpp_namespace_std=yes,
4286                                ac_cv_cpp_namespace_std=no)])
4287 if test "$ac_cv_cpp_namespace_std" = yes ; then
4288    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4291 dnl Older compilers are overly ambitious with respect to using the standard
4292 dnl template library's |operator!=()| when |operator==()| is defined. In
4293 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4294 dnl ambiguity at compile-time. This test checks for that case.
4295 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4296                ac_cv_cpp_unambiguous_std_notequal,
4297                [AC_TRY_COMPILE([#include <algorithm>
4298                                 struct T1 {};
4299                                 int operator==(const T1&, const T1&) { return 0; }
4300                                 int operator!=(const T1&, const T1&) { return 0; }],
4301                                [T1 a,b; return a != b;],
4302                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4303                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4304 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4305   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4309 AC_CACHE_CHECK(for C++ reinterpret_cast,
4310                ac_cv_cpp_reinterpret_cast,
4311                [AC_TRY_COMPILE(struct X { int i; };
4312                                struct Y { int i; };,
4313                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4314                                ac_cv_cpp_reinterpret_cast=yes,
4315                                ac_cv_cpp_reinterpret_cast=no)])
4316 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4317    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4320 dnl See if a dynamic_cast to void* gives the most derived object.
4321 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4322                ac_cv_cpp_dynamic_cast_void_ptr,
4323                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4324                             class Y { int j; public: virtual ~Y() { } };
4325                             class Z : public X, public Y { int k; };
4327                             int main() {
4328                                  Z mdo;
4329                                  X *subx = (X*)&mdo;
4330                                  Y *suby = (Y*)&mdo;
4331                                  return !((((void*)&mdo != (void*)subx) &&
4332                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4333                                           (((void*)&mdo != (void*)suby) &&
4334                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4335                             }],
4336                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4337                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4338                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4339 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4340    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4344 dnl note that this one is reversed - if the test fails, then
4345 dnl we require implementations of unused virtual methods. Which
4346 dnl really blows because it means we'll have useless vtable
4347 dnl bloat.
4348 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4349                ac_cv_cpp_unused_required,
4350                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4351                                X x;,
4352                                ac_cv_cpp_unused_required=no,
4353                                ac_cv_cpp_unused_required=yes)])
4354 if test "$ac_cv_cpp_unused_required" = yes ; then
4355    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4359 dnl Some compilers have trouble comparing a constant reference to a templatized
4360 dnl class to zero, and require an explicit operator==() to be defined that takes
4361 dnl an int. This test separates the strong from the weak.
4363 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4364                ac_cv_trouble_comparing_to_zero,
4365                [AC_TRY_COMPILE([#include <algorithm>
4366                                 template <class T> class Foo {};
4367                                 class T2;
4368                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4369                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4370                                [Foo<int> f; return (0 != f);],
4371                                ac_cv_trouble_comparing_to_zero=no,
4372                                ac_cv_trouble_comparing_to_zero=yes)])
4373 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4374   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4377 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4378 _SAVE_LDFLAGS=$LDFLAGS
4379 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4380 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4381                ac_cv_thread_keyword,
4382                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4383                             [return tlsIsMainThread;],
4384                             ac_cv_thread_keyword=yes,
4385                             ac_cv_thread_keyword=no)])
4386 LDFLAGS=$_SAVE_LDFLAGS
4387 if test "$ac_cv_thread_keyword" = yes; then
4388   # mips builds fail with TLS variables because of a binutils bug.
4389   # See bug 528687
4390   case "${target_cpu}" in
4391     mips*)
4392       :
4393       ;;
4394     *)
4395       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4396       ;;
4397   esac
4400 dnl Check for the existence of various allocation headers/functions
4402 MALLOC_H=
4403 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4404 if test "$MALLOC_H" = ""; then
4405   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4406   if test "$MALLOC_H" = ""; then
4407     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4408   fi
4410 if test "$MALLOC_H" != ""; then
4411    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4414 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4415 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4417 dnl See if compiler supports some gcc-style attributes
4419 AC_CACHE_CHECK(for __attribute__((always_inline)),
4420                ac_cv_attribute_always_inline,
4421                [AC_TRY_COMPILE([],
4422                                [inline void f(void) __attribute__((always_inline));],
4423                                ac_cv_attribute_always_inline=yes,
4424                                ac_cv_attribute_always_inline=no)])
4426 AC_CACHE_CHECK(for __attribute__((malloc)),
4427                ac_cv_attribute_malloc,
4428                [AC_TRY_COMPILE([],
4429                                [void* f(int) __attribute__((malloc));],
4430                                ac_cv_attribute_malloc=yes,
4431                                ac_cv_attribute_malloc=no)])
4433 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4434                ac_cv_attribute_warn_unused,
4435                [AC_TRY_COMPILE([],
4436                                [int f(void) __attribute__((warn_unused_result));],
4437                                ac_cv_attribute_warn_unused=yes,
4438                                ac_cv_attribute_warn_unused=no)])
4440 AC_CACHE_CHECK(for __attribute__((noreturn)),
4441                ac_cv_attribute_noreturn,
4442                [AC_TRY_COMPILE([],
4443                                [void f(void) __attribute__((noreturn));],
4444                                ac_cv_attribute_noreturn=yes,
4445                                ac_cv_attribute_noreturn=no)])
4447 dnl End of C++ language/feature checks
4448 AC_LANG_C
4450 dnl ========================================================
4451 dnl =  Internationalization checks
4452 dnl ========================================================
4454 dnl Internationalization and Locale support is different
4455 dnl on various UNIX platforms.  Checks for specific i18n
4456 dnl features go here.
4458 dnl check for LC_MESSAGES
4459 AC_CACHE_CHECK(for LC_MESSAGES,
4460                 ac_cv_i18n_lc_messages,
4461                 [AC_TRY_COMPILE([#include <locale.h>],
4462                                 [int category = LC_MESSAGES;],
4463                                 ac_cv_i18n_lc_messages=yes,
4464                                 ac_cv_i18n_lc_messages=no)])
4465 if test "$ac_cv_i18n_lc_messages" = yes; then
4466    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4467 fi      
4469 fi # SKIP_COMPILER_CHECKS
4471 TARGET_XPCOM_ABI=
4472 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4473     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4476 dnl Mozilla specific options
4477 dnl ========================================================
4478 dnl The macros used for command line options
4479 dnl are defined in build/autoconf/altoptions.m4.
4481 dnl If the compiler supports these attributes, define them as
4482 dnl convenience macros.
4483 if test "$ac_cv_attribute_always_inline" = yes ; then
4484   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4485 else
4486   AC_DEFINE(NS_ALWAYS_INLINE,)
4489 if test "$ac_cv_attribute_malloc" = yes ; then
4490   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4491 else
4492   AC_DEFINE(NS_ATTR_MALLOC,)
4495 if test "$ac_cv_attribute_warn_unused" = yes ; then
4496   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4497 else
4498   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4501 if test "$ac_cv_attribute_noreturn" = yes ; then
4502   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4503 else
4504   AC_DEFINE(NS_NORETURN,)
4507 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4508 dnl features that Windows actually does support.
4510 if test -n "$SKIP_COMPILER_CHECKS"; then
4511    dnl Windows has malloc.h
4512    AC_DEFINE(MALLOC_H, [<malloc.h>])
4513    AC_DEFINE(HAVE_FORCEINLINE)
4514 fi # SKIP_COMPILER_CHECKS
4516 dnl ========================================================
4517 dnl =
4518 dnl = Check for external package dependencies
4519 dnl =
4520 dnl ========================================================
4521 MOZ_ARG_HEADER(External Packages)
4523 MOZ_ENABLE_LIBXUL=1
4525 MOZ_ARG_WITH_STRING(libxul-sdk,
4526 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4527   LIBXUL_SDK_DIR=$withval)
4529 if test "$LIBXUL_SDK_DIR" = "yes"; then
4530     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4531 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4532     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4534     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4535         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4536     fi
4538     MOZ_ENABLE_LIBXUL=1
4540 AC_SUBST(LIBXUL_SDK)
4542 if test -n "$LIBXUL_SDK"; then
4543     LIBXUL_DIST="$LIBXUL_SDK"
4544 else
4545     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4547 AC_SUBST(LIBXUL_DIST)
4549 SYSTEM_LIBXUL=
4551 MOZ_ARG_WITH_BOOL(system-libxul,
4552 [  --with-system-libxul   Use system installed libxul SDK],
4553     SYSTEM_LIBXUL=1)
4555 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4556     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4559 dnl ========================================================
4560 dnl = If NSPR was not detected in the system, 
4561 dnl = use the one in the source tree (mozilla/nsprpub)
4562 dnl ========================================================
4563 MOZ_ARG_WITH_BOOL(system-nspr,
4564 [  --with-system-nspr      Use system installed NSPR],
4565     _USE_SYSTEM_NSPR=1 )
4567 if test -n "$_USE_SYSTEM_NSPR"; then
4568     AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4571 if test -n "$MOZ_NATIVE_NSPR"; then
4572     _SAVE_CFLAGS=$CFLAGS
4573     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4574     AC_TRY_COMPILE([#include "prlog.h"],
4575                 [#ifndef PR_STATIC_ASSERT
4576                  #error PR_STATIC_ASSERT not defined
4577                  #endif],
4578                 [MOZ_NATIVE_NSPR=1],
4579                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4580     CFLAGS=$_SAVE_CFLAGS
4581 else
4582     if test "$OS_ARCH" = "WINCE"; then
4583         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4584         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4585     elif test "$OS_ARCH" = "WINNT"; then
4586         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4587         if test -n "$GNU_CC"; then
4588             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4589         else
4590             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4591         fi
4592     else
4593         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4594         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4595     fi
4598 dnl system libevent Support
4599 dnl ========================================================
4600 MOZ_ARG_WITH_STRING(system-libevent,
4601 [  --with-system-libevent=[PFX]
4602                           Use system libevent [installed at prefix PFX]],
4603     LIBEVENT_DIR=$withval)
4605 _SAVE_CFLAGS=$CFLAGS
4606 _SAVE_LDFLAGS=$LDFLAGS
4607 _SAVE_LIBS=$LIBS
4608 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4609     MOZ_NATIVE_LIBEVENT=
4610 else
4611     if test "${LIBEVENT_DIR}" = "yes"; then
4612         LIBEVENT_DIR=/usr
4613     fi
4614     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4615     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4616     AC_CHECK_HEADER(event.h,
4617                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4618                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4619                      fi],
4620                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4621     AC_CHECK_LIB(event, event_init,
4622                  [MOZ_NATIVE_LIBEVENT=1
4623                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4624                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4625                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4627 CFLAGS=$_SAVE_CFLAGS
4628 LDFLAGS=$_SAVE_LDFLAGS
4629 LIBS=$_SAVE_LIBS
4631 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4632 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4633 AC_SUBST(MOZ_LIBEVENT_LIBS)
4635 dnl ========================================================
4636 dnl = If NSS was not detected in the system, 
4637 dnl = use the one in the source tree (mozilla/security/nss)
4638 dnl ========================================================
4640 MOZ_ARG_WITH_BOOL(system-nss,
4641 [  --with-system-nss      Use system installed NSS],
4642     _USE_SYSTEM_NSS=1 )
4644 if test -n "$_USE_SYSTEM_NSS"; then
4645     AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4648 if test -n "$MOZ_NATIVE_NSS"; then
4649    NSS_LIBS="$NSS_LIBS -lcrmf"
4650 else
4651    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4652    NSS_DEP_LIBS="\
4653         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4654         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4655         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4656         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4657         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4659    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4660        NSS_LIBS="\
4661         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4662         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4663         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4664         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4665         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4666    else
4667        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4668    fi
4671 if test -z "$SKIP_LIBRARY_CHECKS"; then
4672 dnl system JPEG support
4673 dnl ========================================================
4674 MOZ_ARG_WITH_STRING(system-jpeg,
4675 [  --with-system-jpeg[=PFX]
4676                           Use system libjpeg [installed at prefix PFX]],
4677     JPEG_DIR=$withval)
4679 _SAVE_CFLAGS=$CFLAGS
4680 _SAVE_LDFLAGS=$LDFLAGS
4681 _SAVE_LIBS=$LIBS
4682 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4683     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4684     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4686 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4687     SYSTEM_JPEG=
4688 else
4689     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4692 if test "$SYSTEM_JPEG" = 1; then
4693     LIBS="$JPEG_LIBS $LIBS"
4694     AC_TRY_COMPILE([ #include <stdio.h>
4695                      #include <sys/types.h>
4696                      #include <jpeglib.h> ],
4697                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4698                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4699                      #endif ],
4700                    SYSTEM_JPEG=1,
4701                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4702 fi 
4703 CFLAGS=$_SAVE_CFLAGS
4704 LDFLAGS=$_SAVE_LDFLAGS
4705 LIBS=$_SAVE_LIBS
4707 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4708     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4709     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4712 dnl system ZLIB support
4713 dnl ========================================================
4714 MOZ_ARG_WITH_STRING(system-zlib,
4715 [  --with-system-zlib[=PFX]
4716                           Use system libz [installed at prefix PFX]],
4717     ZLIB_DIR=$withval)
4719 _SAVE_CFLAGS=$CFLAGS
4720 _SAVE_LDFLAGS=$LDFLAGS
4721 _SAVE_LIBS=$LIBS
4722 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4723     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4724     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4726 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4727     SYSTEM_ZLIB=
4728 else
4729     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4730         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4732 if test "$SYSTEM_ZLIB" = 1; then
4733     LIBS="$ZLIB_LIBS $LIBS"
4734     AC_TRY_COMPILE([ #include <stdio.h>
4735                      #include <string.h>
4736                      #include <zlib.h> ],
4737                    [ #if ZLIB_VERNUM < $MOZZLIB 
4738                      #error "Insufficient zlib version ($MOZZLIB required)."
4739                      #endif ],
4740                    SYSTEM_ZLIB=1,
4741                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4743 CFLAGS=$_SAVE_CFLAGS
4744 LDFLAGS=$_SAVE_LDFLAGS
4745 LIBS=$_SAVE_LIBS
4747 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4748     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4749     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4752 dnl system BZIP2 Support
4753 dnl ========================================================
4754 MOZ_ARG_WITH_STRING(system-bz2,
4755 [  --with-system-bz2[=PFX]
4756                           Use system libbz2 [installed at prefix PFX]],
4757     BZ2_DIR=$withval)
4759 _SAVE_CFLAGS=$CFLAGS
4760 _SAVE_LDFLAGS=$LDFLAGS
4761 _SAVE_LIBS=$LIBS
4762 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4763     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4764     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4766 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4767     SYSTEM_BZ2=
4768 else
4769     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4770         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4772 CFLAGS=$_SAVE_CFLAGS
4773 LDFLAGS=$_SAVE_LDFLAGS
4774 LIBS=$_SAVE_LIBS
4776 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4777     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4778     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4781 dnl system PNG Support
4782 dnl ========================================================
4783 MOZ_ARG_WITH_STRING(system-png, 
4784 [  --with-system-png[=PFX]
4785                           Use system libpng [installed at prefix PFX]],
4786     PNG_DIR=$withval)
4788 _SAVE_CFLAGS=$CFLAGS
4789 _SAVE_LDFLAGS=$LDFLAGS
4790 _SAVE_LIBS=$LIBS
4791 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4792 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4793 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4794     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4795     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4797 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4798     SYSTEM_PNG=
4799 else
4800     _SAVE_PNG_LIBS=$PNG_LIBS
4801     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4802                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4803                  $PNG_LIBS)
4804     AC_CHECK_LIB(png, png_get_acTL, ,
4805                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4806                  $_SAVE_PNG_LIBS)
4808 if test "$SYSTEM_PNG" = 1; then
4809     LIBS="$PNG_LIBS $LIBS"
4810     AC_TRY_COMPILE([ #include <stdio.h>
4811                      #include <sys/types.h>
4812                      #include <png.h> ],
4813                    [ #if PNG_LIBPNG_VER < $MOZPNG
4814                      #error "Insufficient libpng version ($MOZPNG required)."
4815                      #endif
4816                      #ifndef PNG_UINT_31_MAX
4817                      #error "Insufficient libpng version."
4818                      #endif ],
4819                    SYSTEM_PNG=1,
4820                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4822 CFLAGS=$_SAVE_CFLAGS
4823 LDFLAGS=$_SAVE_LDFLAGS
4824 LIBS=$_SAVE_LIBS
4826 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4827     PNG_CFLAGS="-I${PNG_DIR}/include"
4828     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4831 fi # SKIP_LIBRARY_CHECKS
4833 dnl system HunSpell Support
4834 dnl ========================================================
4835 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4836 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4837     SYSTEM_HUNSPELL=1 )
4839 if test -n "$SYSTEM_HUNSPELL"; then
4840     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4843 AC_SUBST(SYSTEM_HUNSPELL)
4845 dnl ========================================================
4846 dnl Java SDK support
4847 dnl ========================================================
4848 JAVA_INCLUDE_PATH=
4849 MOZ_ARG_WITH_STRING(java-include-path,
4850 [  --with-java-include-path=dir   Location of Java SDK headers],
4851     JAVA_INCLUDE_PATH=$withval)
4853 JAVA_BIN_PATH=
4854 MOZ_ARG_WITH_STRING(java-bin-path,
4855 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4856     JAVA_BIN_PATH=$withval)
4858 dnl ========================================================
4859 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4860 dnl their usage and use them in spidermonkey.
4861 dnl ========================================================
4862 MOZ_ARG_WITH_BOOL(arm-kuser,
4863 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4864     USE_ARM_KUSER=1,
4865     USE_ARM_KUSER=)
4866 if test -n "$USE_ARM_KUSER"; then
4867    AC_DEFINE(USE_ARM_KUSER)
4870 dnl ========================================================
4871 dnl =
4872 dnl = Application
4873 dnl =
4874 dnl ========================================================
4876 MOZ_ARG_HEADER(Application)
4878 BUILD_STATIC_LIBS=
4879 ENABLE_TESTS=1
4880 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4881 MOZ_BRANDING_DIRECTORY=
4882 MOZ_OFFICIAL_BRANDING=
4883 MOZ_FEEDS=1
4884 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4885 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4886 MOZ_IPC=1
4887 MOZ_JAVAXPCOM=
4888 MOZ_JSDEBUGGER=1
4889 MOZ_JSLOADER=1
4890 MOZ_MATHML=1
4891 MOZ_MORK=
4892 MOZ_MORKREADER=1
4893 MOZ_AUTH_EXTENSION=1
4894 MOZ_NO_ACTIVEX_SUPPORT=1
4895 MOZ_NO_INSPECTOR_APIS=
4896 MOZ_NO_FAST_LOAD=
4897 MOZ_OGG=1
4898 MOZ_SYDNEYAUDIO=
4899 MOZ_WAVE=1
4900 MOZ_MEDIA=
4901 MOZ_PANGO=1
4902 MOZ_PERMISSIONS=1
4903 MOZ_PLACES=1
4904 MOZ_PLAINTEXT_EDITOR_ONLY=
4905 MOZ_PLUGINS=1
4906 MOZ_PREF_EXTENSIONS=1
4907 MOZ_PROFILELOCKING=1
4908 MOZ_PSM=1
4909 MOZ_RDF=1
4910 MOZ_REFLOW_PERF=
4911 MOZ_SAFE_BROWSING=
4912 MOZ_FASTSTART=
4913 MOZ_HELP_VIEWER=
4914 MOZ_SPELLCHECK=1
4915 MOZ_SPLASHSCREEN=
4916 MOZ_STORAGE=1
4917 MOZ_SVG=1
4918 MOZ_TIMELINE=
4919 MOZ_TOOLKIT_SEARCH=1
4920 MOZ_UI_LOCALE=en-US
4921 MOZ_UNIVERSALCHARDET=1
4922 MOZ_URL_CLASSIFIER=
4923 MOZ_USE_NATIVE_UCONV=
4924 MOZ_VIEW_SOURCE=1
4925 MOZ_XPINSTALL=1
4926 MOZ_XSLT_STANDALONE=
4927 MOZ_XTF=1
4928 MOZ_XUL=1
4929 MOZ_ZIPWRITER=1
4930 NS_PRINTING=1
4931 NECKO_WIFI=1
4932 NECKO_COOKIES=1
4933 NECKO_DISK_CACHE=1
4934 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4935 BUILD_CTYPES=1
4936 XPC_IDISPATCH_SUPPORT=
4939 case "$target_os" in
4940 darwin*|*wince*|*winmo*)
4941     ACCESSIBILITY=
4942     ;;
4944     ACCESSIBILITY=1
4945     ;;
4946 esac
4948 case "$target_os" in
4949     msvc*|mks*|cygwin*|mingw*)
4950         NS_ENABLE_TSF=1
4951         if test -z "$GNU_CC"; then 
4952             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4953                 NS_ENABLE_TSF=
4954             fi
4955             XPC_IDISPATCH_SUPPORT=1
4956             MOZ_NO_ACTIVEX_SUPPORT=
4957         fi
4958         if test -n "$NS_ENABLE_TSF"; then
4959             AC_DEFINE(NS_ENABLE_TSF)
4960         fi
4961         ;;
4962 esac
4964 MOZ_ARG_ENABLE_STRING(application,
4965 [  --enable-application=APP
4966                           Options include:
4967                             browser (Firefox)
4968                             xulrunner
4969                             content/xslt (Standalone Transformiix XSLT)
4970                             netwerk (Standalone Necko)
4971                             tools/update-packaging (AUS-related packaging tools)
4972                             standalone (use this for standalone
4973                               xpcom/xpconnect or to manually drive a build)],
4974 [ MOZ_BUILD_APP=$enableval ] )
4976 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4977 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4978   XULRUNNER_STUB_NAME=$withval)
4980 if test -z "$XULRUNNER_STUB_NAME"; then
4981   case "$target_os" in
4982   darwin*)
4983     XULRUNNER_STUB_NAME=xulrunner
4984     ;;
4985   *)
4986     XULRUNNER_STUB_NAME=xulrunner-stub
4987   esac
4989 AC_SUBST(XULRUNNER_STUB_NAME)
4991 if test -z "$MOZ_BUILD_APP"; then
4992   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4993 else
4994   # We have a valid application only if it has a build.mk file in its top
4995   # directory.
4996   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4997     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4998   fi
5001 # Allow the application to influence configure with a confvars.sh script.
5003 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5004 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5005   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5006   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5007 else
5008   AC_MSG_RESULT([no])
5011 # Now is a good time to test for logic errors, define mismatches, etc.
5012 case "$MOZ_BUILD_APP" in
5013 xulrunner)
5014   if test "$LIBXUL_SDK"; then
5015     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5016   fi
5017   ;;
5018 esac
5020 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5021 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5022 # MOZ_BUILD_APP.
5023 case "$MOZ_BUILD_APP" in
5024 browser)
5025   AC_DEFINE(MOZ_PHOENIX)
5026   ;;
5028 xulrunner)
5029   AC_DEFINE(MOZ_XULRUNNER)
5030   ;;
5032 content/xslt)
5033   AC_DEFINE(TX_EXE)
5034   ;;
5036 standalone) 
5037   MOZ_APP_NAME=mozilla
5038   MOZ_APP_DISPLAYNAME=Mozilla
5039   MOZ_APP_VERSION=$MOZILLA_VERSION
5040   ;;
5042 esac
5044 AC_SUBST(MOZ_BUILD_APP)
5045 AC_SUBST(MOZ_PHOENIX)
5046 AC_SUBST(MOZ_XULRUNNER)
5048 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5050 dnl ========================================================
5051 dnl = 
5052 dnl = Toolkit Options
5053 dnl = 
5054 dnl ========================================================
5055 MOZ_ARG_HEADER(Toolkit Options)
5057     dnl ========================================================
5058     dnl = Select the default toolkit
5059     dnl ========================================================
5060         MOZ_ARG_ENABLE_STRING(default-toolkit,
5061         [  --enable-default-toolkit=TK
5062                           Select default toolkit
5063                           Platform specific defaults:
5064                             BeOS - cairo-beos
5065                             Mac OS X - cairo-cocoa
5066                             Neutrino/QNX - photon
5067                             OS/2 - cairo-os2
5068                             Win32/WinCE - cairo-windows
5069                             Gtk2 with DirectFB - cairo-gtk2-dfb
5070                             * - cairo-gtk2
5071                             * - cairo-qt],
5072     [ _DEFAULT_TOOLKIT=$enableval ],
5073     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5075     if test "$_DEFAULT_TOOLKIT" = "photon" \
5076         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5077         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5078         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5079         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5080         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5081         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5082         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5083         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
5084     then
5085         dnl nglayout only supports building with one toolkit,
5086         dnl so ignore everything after the first comma (",").
5087         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5088     else
5089         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5090     fi
5092 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
5094 dnl ========================================================
5095 dnl = Enable the toolkit as needed                         =
5096 dnl ========================================================
5098 case "$MOZ_WIDGET_TOOLKIT" in
5099 photon)
5100         MOZ_ENABLE_PHOTON=1
5101         AC_DEFINE(MOZ_WIDGET_PHOTON)
5102     ;;
5104 cairo-windows)
5105     MOZ_WIDGET_TOOLKIT=windows
5106     MOZ_WEBGL=1
5107     case "${target}" in
5108     *-wince*)
5109         NS_PRINTING=
5110         ;;
5111     esac
5112     ;;
5114 cairo-gtk2|cairo-gtk2-x11)
5115     MOZ_WIDGET_TOOLKIT=gtk2
5116     MOZ_ENABLE_GTK2=1
5117     MOZ_ENABLE_XREMOTE=1
5118     MOZ_WEBGL=1
5119     MOZ_WEBGL_GLX=1
5121     AC_DEFINE(MOZ_X11)
5122     MOZ_X11=1
5123     USE_FC_FREETYPE=1
5125     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5126     TK_LIBS='$(MOZ_GTK2_LIBS)'
5127     AC_DEFINE(MOZ_WIDGET_GTK2)
5128     ;;
5130 cairo-gtk2-dfb)
5131     MOZ_WIDGET_TOOLKIT=gtk2
5132     MOZ_ENABLE_GTK2=1
5133     MOZ_WEBGL=
5135     AC_DEFINE(MOZ_DFB)
5136     MOZ_DFB=1
5138     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5139     TK_LIBS='$(MOZ_GTK2_LIBS)'
5140     AC_DEFINE(MOZ_WIDGET_GTK2)
5141     if test "$no_x" != "yes"; then
5142         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5143         no_x=yes
5144     fi
5145     ;;
5147 cairo-qt)
5148     MOZ_WIDGET_TOOLKIT=qt
5149     MOZ_ENABLE_QT=1
5150     MOZ_ENABLE_XREMOTE=1
5151     MOZ_WEBGL=1
5152     MOZ_WEBGL_GLX=1
5153     USE_ELF_DYNSTR_GC=
5154     NS_PRINTING=
5156     AC_DEFINE(MOZ_X11)
5157     MOZ_X11=1
5158     USE_FC_FREETYPE=1
5160     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5161     TK_LIBS='$(MOZ_QT_LIBS)'
5162     AC_DEFINE(MOZ_WIDGET_QT)
5163     ;;
5165 cairo-beos)
5166     MOZ_WIDGET_TOOLKIT=beos
5167     USE_FC_FREETYPE=1
5168     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5169     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5170     ;;
5172 cairo-os2)
5173     MOZ_WIDGET_TOOLKIT=os2
5174     USE_FC_FREETYPE=1
5175     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5176     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5177     ;;
5179 cairo-cocoa)
5180     MOZ_WIDGET_TOOLKIT=cocoa
5181     AC_DEFINE(MOZ_WIDGET_COCOA)
5182     MOZ_USER_DIR="Mozilla"
5183     AC_DEFINE(XP_MACOSX)
5184     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5185     TK_CFLAGS="-DNO_X11"
5186     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5187     CFLAGS="$CFLAGS $TK_CFLAGS"
5188     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5189     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5190     MOZ_FS_LAYOUT=bundle
5191     MOZ_WEBGL=1
5192     ;;
5193 esac
5195 if test "$MOZ_ENABLE_XREMOTE"; then
5196     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5199 if test "$COMPILE_ENVIRONMENT"; then
5200   if test "$MOZ_ENABLE_GTK2"; then
5201     if test "$MOZ_X11"; then
5202       GDK_PACKAGES=gdk-x11-2.0
5203     elif test "$MOZ_DFB"; then
5204       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5205       GDK_PACKAGES=directfb
5206     fi
5208     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5209   fi
5211 fi # COMPILE_ENVIRONMENT
5213 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
5214 AC_SUBST(MOZ_FS_LAYOUT)
5216 dnl ========================================================
5217 dnl = startup-notification support module
5218 dnl ========================================================
5220 if test "$MOZ_ENABLE_GTK2"
5221 then
5222     MOZ_ENABLE_STARTUP_NOTIFICATION=
5224     MOZ_ARG_ENABLE_BOOL(startup-notification,
5225     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
5226         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5227         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5228     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5229     then
5230         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5231                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5232         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5233             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5234             then
5235                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5236             fi
5237             MOZ_ENABLE_STARTUP_NOTIFICATION=
5238         ])
5239     fi
5241     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5242         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5243     fi
5245     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5247 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5248 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5249 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5251 dnl ========================================================
5252 dnl = QT support
5253 dnl ========================================================
5254 if test "$MOZ_ENABLE_QT"
5255 then
5256     MOZ_ARG_WITH_STRING(qtdir,
5257     [  --with-qtdir=\$dir       Specify Qt directory ],
5258     [ QTDIR=$withval])
5260     if test -z "$QTDIR"; then
5261         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5262         AC_CHECK_PROGS(HOST_MOC, moc, "")
5263     else
5264         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5266         MOZ_QT_CFLAGS="-DQT_SHARED"
5267         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5268         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5269         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5270         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5271         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5272         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5273         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5274         HOST_MOC="$QTDIR/bin/moc"
5275     fi
5276     if test -z "$HOST_MOC"; then
5277         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5278 incorrect])
5279     fi
5280     MOC=$HOST_MOC
5283 AC_SUBST(GTK_CONFIG)
5284 AC_SUBST(TK_CFLAGS)
5285 AC_SUBST(TK_LIBS)
5287 AC_SUBST(MOZ_ENABLE_GTK2)
5288 AC_SUBST(MOZ_ENABLE_PHOTON)
5289 AC_SUBST(MOZ_ENABLE_QT)
5290 AC_SUBST(MOZ_ENABLE_XREMOTE)
5291 AC_SUBST(MOZ_GTK2_CFLAGS)
5292 AC_SUBST(MOZ_GTK2_LIBS)
5293 AC_SUBST(MOZ_QT_CFLAGS)
5294 AC_SUBST(MOZ_QT_LIBS)
5296 AC_SUBST(MOC)
5298 AC_SUBST(MOZ_DFB)
5299 AC_SUBST(MOZ_X11)
5301 dnl ========================================================
5302 dnl =
5303 dnl = Components & Features
5304 dnl = 
5305 dnl ========================================================
5306 MOZ_ARG_HEADER(Components and Features)
5308 dnl ========================================================
5309 dnl = Localization
5310 dnl ========================================================
5311 MOZ_ARG_ENABLE_STRING(ui-locale,
5312 [  --enable-ui-locale=ab-CD
5313                           Select the user interface locale (default: en-US)],
5314     MOZ_UI_LOCALE=$enableval )
5315 AC_SUBST(MOZ_UI_LOCALE)
5317 dnl ========================================================
5318 dnl = Trademarked Branding 
5319 dnl ========================================================
5320 MOZ_ARG_ENABLE_BOOL(official-branding,
5321 [  --enable-official-branding Enable Official mozilla.org Branding
5322                           Do not distribute builds with
5323                           --enable-official-branding unless you have
5324                           permission to use trademarks per
5325                           http://www.mozilla.org/foundation/trademarks/ .],
5327   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5328     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5329   else
5330     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5331     MOZ_OFFICIAL_BRANDING=1
5332   fi
5333 ], MOZ_OFFICIAL_BRANDING=)
5335 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5336 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5337   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5340 MOZ_ARG_WITH_STRING(branding,
5341 [  --with-branding=dir    Use branding from the specified directory.],
5342     MOZ_BRANDING_DIRECTORY=$withval)
5344 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5345 if test -z "$REAL_BRANDING_DIRECTORY"; then
5346   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5349 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5350   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5353 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5355 dnl ========================================================
5356 dnl = Distribution ID
5357 dnl ========================================================
5358 MOZ_ARG_WITH_STRING(distribution-id,
5359 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
5360 [ val=`echo $withval`
5361     MOZ_DISTRIBUTION_ID="$val"])
5363 if test -z "$MOZ_DISTRIBUTION_ID"; then
5364    MOZ_DISTRIBUTION_ID="org.mozilla"
5367 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5368 AC_SUBST(MOZ_DISTRIBUTION_ID)
5371 dnl ========================================================
5372 dnl complex text support off by default
5373 dnl ========================================================
5374 MOZ_ARG_DISABLE_BOOL(pango,
5375 [  --disable-pango Disable usage of Pango ],
5376     MOZ_PANGO=,
5377     MOZ_PANGO=1)
5379 dnl ========================================================
5380 dnl = Pango
5381 dnl ========================================================
5382 if test "$MOZ_ENABLE_GTK2"
5383 then
5384     AC_SUBST(MOZ_PANGO)
5386     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5388     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5389     AC_SUBST(MOZ_PANGO_CFLAGS)
5390     AC_SUBST(MOZ_PANGO_LIBS)
5391     if test "$MOZ_PANGO"
5392     then
5393         AC_DEFINE(MOZ_PANGO)
5394     else
5395         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5396         AC_SUBST(FT2_CFLAGS)
5397         AC_SUBST(FT2_LIBS)
5398     fi
5401 if test "$MOZ_ENABLE_QT"
5402 then
5403     if test "$MOZ_PANGO"
5404     then
5405         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5406         [
5407             AC_SUBST(MOZ_PANGO_CFLAGS)
5408             AC_SUBST(MOZ_PANGO_LIBS)
5409             AC_DEFINE(MOZ_PANGO)
5410         ],
5411         [
5412             echo "Pango library not found, will use FT2 font engine"
5413             MOZ_PANGO=
5414         ])
5415     fi
5416     AC_SUBST(MOZ_PANGO)
5419 dnl ========================================================
5420 dnl = GnomeVFS, GIO and GConf support module
5421 dnl ========================================================
5423 if test "$MOZ_X11"
5424 then
5425     dnl build the gnomevfs extension by default only when the
5426     dnl GTK2 toolkit is in use.
5427     if test "$MOZ_ENABLE_GTK2"
5428     then
5429         MOZ_ENABLE_GNOMEVFS=1
5430         MOZ_ENABLE_GCONF=1
5431     fi
5433     dnl ========================================================
5434     dnl = GnomeVFS support module
5435     dnl ========================================================
5436     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5437     [  --disable-gnomevfs      Disable GnomeVFS support ],
5438         MOZ_ENABLE_GNOMEVFS=,
5439         MOZ_ENABLE_GNOMEVFS=force)
5441     if test "$MOZ_ENABLE_GNOMEVFS"
5442     then
5443         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5444             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5445             MOZ_ENABLE_GNOMEVFS=1
5446             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5447         ],[
5448             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5449             then
5450                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5451             fi
5452             MOZ_ENABLE_GNOMEVFS=
5453         ])
5454     else
5455         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5456             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5457               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5458             ])
5459         fi
5460     fi
5462     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5463     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5464     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5466     dnl ========================================================
5467     dnl = GIO support module
5468     dnl ========================================================
5469     MOZ_ARG_ENABLE_BOOL(gio,
5470     [  --enable-gio            Enable GIO support (default: disabled)],
5471         MOZ_ENABLE_GIO=force,
5472         MOZ_ENABLE_GIO=)
5474     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5475     then
5476         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5477             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5478             MOZ_ENABLE_GIO=1
5479             AC_DEFINE(MOZ_ENABLE_GIO)
5480         ],[
5481             if test "$MOZ_ENABLE_GIO" = "force"
5482             then
5483                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5484             fi
5485             MOZ_ENABLE_GIO=
5486         ])
5487     fi
5489     AC_SUBST(MOZ_ENABLE_GIO)
5490     AC_SUBST(MOZ_GIO_CFLAGS)
5491     AC_SUBST(MOZ_GIO_LIBS)
5492    
5493     dnl ========================================================
5494     dnl = GConf support module
5495     dnl ========================================================
5496     if test "$MOZ_ENABLE_GCONF"
5497     then
5498         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5499             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5500             MOZ_ENABLE_GCONF=1
5501         ],[
5502             if test "$MOZ_ENABLE_GCONF" = "force"
5503             then
5504                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5505             fi
5506             MOZ_ENABLE_GCONF=
5507         ])
5508     fi
5510     if test "$MOZ_ENABLE_GCONF"; then
5511         AC_DEFINE(MOZ_ENABLE_GCONF)
5512     fi
5514     AC_SUBST(MOZ_ENABLE_GCONF)
5515     AC_SUBST(MOZ_GCONF_CFLAGS)
5516     AC_SUBST(MOZ_GCONF_LIBS)
5519 dnl ========================================================
5520 dnl = libnotify support
5521 dnl ========================================================
5523 if test "$MOZ_ENABLE_GTK2"
5524 then
5525     MOZ_ENABLE_LIBNOTIFY=1
5527     MOZ_ARG_DISABLE_BOOL(libnotify,
5528     [  --disable-libnotify       Disable libnotify support ],
5529     MOZ_ENABLE_LIBNOTIFY=,
5530     MOZ_ENABLE_LIBNOTIFY=1)
5532     if test "$MOZ_ENABLE_LIBNOTIFY"
5533     then
5534         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5535     fi
5538 if test -z "$SKIP_LIBRARY_CHECKS"
5539 then
5540     if test "$MOZ_ENABLE_GTK2"
5541     then
5542         if test "$MOZ_ENABLE_LIBNOTIFY"
5543         then
5544             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5545         fi
5546     fi
5548 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5549 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5550 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5552 dnl ========================================================
5553 dnl = GNOME component (mozgnome)
5554 dnl ========================================================
5556 # The GNOME component is built if one of 
5557 # gnome-vfs, gio, gconf or libnotify is available.
5558 if test "$MOZ_ENABLE_GCONF" || \
5559    test "$MOZ_ENABLE_GNOMEVFS" || \
5560    test "$MOZ_ENABLE_GIO" || \
5561    test "$MOZ_ENABLE_LIBNOTIFY"; then
5562     MOZ_ENABLE_GNOME_COMPONENT=1
5563 else
5564     MOZ_ENABLE_GNOME_COMPONENT=
5566 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5568 dnl ========================================================
5569 dnl = libgnomeui support module
5570 dnl ========================================================
5572 if test "$MOZ_ENABLE_GTK2"
5573 then
5574     MOZ_ENABLE_GNOMEUI=1
5576     MOZ_ARG_DISABLE_BOOL(gnomeui,
5577     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5578         MOZ_ENABLE_GNOMEUI=,
5579         MOZ_ENABLE_GNOMEUI=force)
5581     if test "$MOZ_ENABLE_GNOMEUI"
5582     then
5583         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5584         [
5585             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5586             MOZ_ENABLE_GNOMEUI=1
5587         ],[
5588             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5589             then
5590                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5591             fi
5592             MOZ_ENABLE_GNOMEUI=
5593         ])
5594     fi
5596     if test "$MOZ_ENABLE_GNOMEUI"; then
5597         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5598     fi
5601 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5602 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5603 AC_SUBST(MOZ_GNOMEUI_LIBS)
5605 dnl ========================================================
5606 dnl = dbus support
5607 dnl ========================================================
5609 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5610 then
5611     MOZ_ENABLE_DBUS=1
5613     MOZ_ARG_DISABLE_BOOL(dbus,
5614     [  --disable-dbus       Disable dbus support ],
5615         MOZ_ENABLE_DBUS=,
5616         MOZ_ENABLE_DBUS=1)
5618     if test "$MOZ_ENABLE_DBUS"
5619     then
5620         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5621         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5622         AC_DEFINE(MOZ_ENABLE_DBUS)
5623     fi
5625 AC_SUBST(MOZ_ENABLE_DBUS)
5626 AC_SUBST(MOZ_DBUS_CFLAGS)
5627 AC_SUBST(MOZ_DBUS_LIBS)
5628 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5629 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5631 dnl ========================================================
5632 dnl = Build Personal Security Manager
5633 dnl ========================================================
5634 MOZ_ARG_DISABLE_BOOL(crypto,
5635 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5636     MOZ_PSM=,
5637     MOZ_PSM=1 )
5639 dnl ========================================================
5640 dnl = JS Debugger XPCOM component (js/jsd)
5641 dnl ========================================================
5642 MOZ_ARG_DISABLE_BOOL(jsd,
5643 [  --disable-jsd           Disable JavaScript debug library],
5644     MOZ_JSDEBUGGER=,
5645     MOZ_JSDEBUGGER=1)
5648 dnl ========================================================
5649 dnl = Disable IPC support for tabs and plugins
5650 dnl ========================================================
5651 case "${target}" in
5652 powerpc-apple-darwin*)
5653     MOZ_IPC=
5654     ;;
5655 *-wince*)
5656     MOZ_IPC=
5657     ;;
5658 esac
5660 MOZ_ARG_DISABLE_BOOL(ipc,
5661 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5662     MOZ_IPC=,
5663     MOZ_IPC=1)
5665 if test -n "$MOZ_IPC"; then
5666     AC_DEFINE(MOZ_IPC)
5669 AC_SUBST(MOZ_IPC)
5671 dnl ========================================================
5672 dnl = Enable IPDL's "expensive" unit tests
5673 dnl ========================================================
5674 MOZ_IPDL_TESTS=
5676 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5677 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5678     MOZ_IPDL_TESTS=1,
5679     MOZ_IPDL_TESTS=)
5681 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5682     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5685 if test -n "$MOZ_IPDL_TESTS"; then
5686     AC_DEFINE(MOZ_IPDL_TESTS)
5689 AC_SUBST(MOZ_IPDL_TESTS)
5691 dnl ========================================================
5692 dnl = Disable plugin support
5693 dnl ========================================================
5694 MOZ_ARG_DISABLE_BOOL(plugins,
5695 [  --disable-plugins       Disable plugins support],
5696     MOZ_PLUGINS=,
5697     MOZ_PLUGINS=1)
5699 dnl ========================================================
5700 dnl = Disable building dbm
5701 dnl ========================================================
5702 MOZ_ARG_DISABLE_BOOL(dbm,
5703 [  --disable-dbm       Disable building dbm],
5704     NSS_DISABLE_DBM=1,
5705     NSS_DISABLE_DBM=)
5707 dnl bi-directional support always on
5708 IBMBIDI=1
5709 AC_DEFINE(IBMBIDI)
5711 dnl ========================================================
5712 dnl view source support on by default
5713 dnl ========================================================
5714 if test "$MOZ_VIEW_SOURCE"; then
5715     AC_DEFINE(MOZ_VIEW_SOURCE)
5718 dnl ========================================================
5719 dnl accessibility support on by default on all platforms 
5720 dnl except OS X.
5721 dnl ========================================================
5722 MOZ_ARG_DISABLE_BOOL(accessibility,
5723 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5724     ACCESSIBILITY=,
5725     ACCESSIBILITY=1 )
5726 if test "$ACCESSIBILITY"; then
5727     AC_DEFINE(ACCESSIBILITY)
5730 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5731 case "$target" in
5732 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5733     if test "$ac_cv_header_atlbase_h" = "no"; then
5734         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.])
5735     fi
5736     if test "$ac_cv_header_oleacc_idl" = "no"; then
5737         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.])
5738     fi
5739     ;;
5740 esac
5743 dnl ========================================================
5744 dnl xpinstall support on by default
5745 dnl ========================================================
5746 MOZ_ARG_DISABLE_BOOL(xpinstall,
5747 [  --disable-xpinstall     Disable xpinstall support],
5748     MOZ_XPINSTALL=,
5749     MOZ_XPINSTALL=1 )
5750 if test "$MOZ_XPINSTALL"; then
5751     AC_DEFINE(MOZ_XPINSTALL)
5754 dnl ========================================================
5755 dnl xpcom js loader support on by default
5756 dnl ========================================================
5757 if test "$MOZ_JSLOADER"; then
5758     AC_DEFINE(MOZ_JSLOADER)
5761 dnl ========================================================
5762 dnl Disable printing
5763 dnl ========================================================
5764 MOZ_ARG_DISABLE_BOOL(printing,
5765 [  --disable-printing  Disable printing support],
5766     NS_PRINTING=,
5767     NS_PRINTING=1 )
5769 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5770     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5771     NS_PRINTING=
5774 if test "$NS_PRINTING"; then
5775     AC_DEFINE(NS_PRINTING)
5776     AC_DEFINE(NS_PRINT_PREVIEW)
5779 dnl ========================================================
5780 dnl use native unicode converters
5781 dnl ========================================================
5782 MOZ_ARG_ENABLE_BOOL(native-uconv,
5783 [  --enable-native-uconv   Enable iconv support],
5784     MOZ_USE_NATIVE_UCONV=1,
5785     MOZ_USE_NATIVE_UCONV= )
5786 if test "$MOZ_USE_NATIVE_UCONV"; then
5787     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5789 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5790     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5794 dnl ========================================================
5795 dnl Libeditor can be build as plaintext-only,
5796 dnl or as a full html and text editing component.
5797 dnl We build both by default.
5798 dnl ========================================================
5799 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5800 [  --enable-plaintext-editor-only
5801                           Allow only plaintext editing],
5802     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5803     MOZ_PLAINTEXT_EDITOR_ONLY= )
5804 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5805 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5807 dnl ========================================================
5808 dnl = Disable Fast Load
5809 dnl ========================================================
5810 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5811 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5812     MOZ_NO_FAST_LOAD=1,
5813     MOZ_NO_FAST_LOAD=)
5815 AC_SUBST(MOZ_NO_FAST_LOAD)
5817 if test -n "$MOZ_NO_FAST_LOAD"; then
5818     AC_DEFINE(MOZ_NO_FAST_LOAD)
5821 dnl ========================================================
5822 dnl = Disable Ogg Codecs
5823 dnl ========================================================
5824 MOZ_ARG_DISABLE_BOOL(ogg,
5825 [  --disable-ogg           Disable Ogg Codec support],
5826     MOZ_OGG=,
5827     MOZ_OGG=1)
5829 AC_SUBST(MOZ_OGG)
5831 if test -n "$MOZ_OGG"; then
5832     AC_DEFINE(MOZ_OGG)
5833     MOZ_SYDNEYAUDIO=1
5834     MOZ_MEDIA=1
5836     dnl Checks for __attribute__(aligned()) directive
5837     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5838         [ac_cv_c_attribute_aligned],
5839         [ac_cv_c_attribute_aligned=0
5840          CFLAGS_save="${CFLAGS}"
5841          CFLAGS="${CFLAGS} -Werror"
5842          for ac_cv_c_attr_align_try in 64 32 16 8; do
5843            echo "trying $ac_cv_c_attr_align_try"
5844            AC_TRY_COMPILE([],
5845                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5846                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5847            if test "$ac_cv_c_attribute_aligned" != 0; then
5848              break;
5849            fi
5850          done
5851            CFLAGS="${CFLAGS_save}"])
5852     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5853       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5854                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5855     fi
5858 dnl ========================================================
5859 dnl = Disable Wave decoder support
5860 dnl ========================================================
5861 MOZ_ARG_DISABLE_BOOL(wave,
5862 [  --disable-wave          Disable Wave decoder support],
5863     MOZ_WAVE=,
5864     MOZ_WAVE=1)
5866 AC_SUBST(MOZ_WAVE)
5868 if test -n "$MOZ_WAVE"; then
5869     AC_DEFINE(MOZ_WAVE)
5870     MOZ_SYDNEYAUDIO=1
5871     MOZ_MEDIA=1
5874 dnl ========================================================
5875 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5876 dnl ========================================================
5878 AC_SUBST(MOZ_SYDNEYAUDIO)
5880 if test -n "$MOZ_SYDNEYAUDIO"; then
5881     AC_DEFINE(MOZ_SYDNEYAUDIO)
5884 AC_SUBST(MOZ_MEDIA)
5886 if test -n "$MOZ_MEDIA"; then
5887     AC_DEFINE(MOZ_MEDIA)
5890 dnl ========================================================
5891 dnl = Check alsa availability on Linux if using sydneyaudio
5892 dnl ========================================================
5894 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5895 if test -n "$MOZ_SYDNEYAUDIO"; then
5896    case "$target_os" in
5897 linux*)
5898       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5899          [echo "$MOZ_ALSA_PKG_ERRORS"
5900           AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux.  Disable with --disable-ogg --disable-wave.])])
5901       ;;
5902    esac
5904 AC_SUBST(MOZ_ALSA_LIBS)
5906 dnl ========================================================
5907 dnl Splashscreen
5908 dnl ========================================================
5909 AC_ARG_ENABLE(splashscreen,
5910               [  --enable-splashscreen   display splashscreen while loading (default=no)],
5911               [enable_splash="yes"],[enable_splash=""])
5912 if test "x$enable_splash" = "xyes"; then
5913   MOZ_SPLASHSCREEN=1
5914   AC_DEFINE(MOZ_SPLASHSCREEN)
5916 AC_SUBST(MOZ_SPLASHSCREEN)
5918 dnl ========================================================
5919 dnl Permissions System
5920 dnl ========================================================
5921 MOZ_ARG_DISABLE_BOOL(permissions,
5922 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5923     MOZ_PERMISSIONS=,
5924     MOZ_PERMISSIONS=1
5927 dnl ========================================================
5928 dnl NegotiateAuth
5929 dnl ========================================================
5930 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5931 [  --disable-negotiateauth Disable GSS-API negotiation ],
5932     MOZ_AUTH_EXTENSION=,
5933     MOZ_AUTH_EXTENSION=1 )
5935 dnl ========================================================
5936 dnl XTF
5937 dnl ========================================================
5938 MOZ_ARG_DISABLE_BOOL(xtf,
5939 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5940     MOZ_XTF=,
5941     MOZ_XTF=1 )
5942 if test "$MOZ_XTF"; then
5943   AC_DEFINE(MOZ_XTF)
5946 dnl ========================================================
5947 dnl Pref extensions (autoconfig and system-pref)
5948 dnl ========================================================
5949 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5950 [  --disable-pref-extensions
5951                           Disable pref extensions such as autoconfig and
5952                           system-pref],
5953   MOZ_PREF_EXTENSIONS=,
5954   MOZ_PREF_EXTENSIONS=1 )
5956 dnl ========================================================
5957 dnl = Universalchardet
5958 dnl ========================================================
5959 MOZ_ARG_DISABLE_BOOL(universalchardet,
5960 [  --disable-universalchardet
5961                           Disable universal encoding detection],
5962   MOZ_UNIVERSALCHARDET=,
5963   MOZ_UNIVERSALCHARDET=1 )
5965 dnl ========================================================
5966 dnl JavaXPCOM
5967 dnl ========================================================
5968 case "${target}" in
5969 *-wince*)
5970     MOZ_JAVAXPCOM=
5971     ;;
5972 esac
5974 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5975 [  --enable-javaxpcom
5976                           Enable Java-XPCOM bridge],
5977     MOZ_JAVAXPCOM=1,
5978     MOZ_JAVAXPCOM= )
5980 if test -n "${MOZ_JAVAXPCOM}"; then
5981   case "$host_os" in
5982     cygwin*|msvc*|mks*)
5983       if test -n "$JAVA_HOME"; then
5984         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5985       fi
5986       ;;
5987     *mingw*)
5988       if test -n "$JAVA_HOME"; then
5989         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5990       fi
5991       ;;
5992   esac
5994   if test -n "${JAVA_INCLUDE_PATH}"; then
5995     dnl Make sure jni.h exists in the given include path.
5996     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5997       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5998     fi
5999   else
6000     case "$target_os" in
6001       darwin*)
6002         dnl Default to java system location
6003         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6004         ;;
6005       *)
6006         dnl Try $JAVA_HOME
6007         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6008         ;;
6009     esac
6010     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6011       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.])
6012     fi
6013   fi
6015   if test -n "${JAVA_BIN_PATH}"; then
6016     dnl Look for javac and jar in the specified path.
6017     JAVA_PATH="$JAVA_BIN_PATH"
6018   else
6019     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6020     JAVA_PATH="$JAVA_HOME/bin:$PATH"
6021   fi
6023   MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6024   MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6025   MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6026   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
6027     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.])
6028   fi
6031 dnl ========================================================
6032 dnl = Breakpad crash reporting (on by default on supported platforms)
6033 dnl ========================================================
6035 case $target in
6036 i?86-*-mingw*)
6037   MOZ_CRASHREPORTER=1
6038   ;;
6039 i?86-apple-darwin*|powerpc-apple-darwin*)
6040   MOZ_CRASHREPORTER=1
6041   ;;
6042 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6043   MOZ_CRASHREPORTER=1
6044   ;;
6045 *solaris*)
6046   MOZ_CRASHREPORTER=1
6047   ;;
6048 esac
6050 MOZ_ARG_DISABLE_BOOL(crashreporter,
6051 [  --disable-crashreporter          Disable breakpad crash reporting],
6052     MOZ_CRASHREPORTER=,
6053     MOZ_CRASHREPORTER=1)
6055 if test -n "$MOZ_CRASHREPORTER"; then
6056    AC_DEFINE(MOZ_CRASHREPORTER)
6058   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
6059     test -z "$SKIP_LIBRARY_CHECKS"; then
6060     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6061     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6062     AC_SUBST(MOZ_GTHREAD_LIBS)
6064     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.])])
6065   fi
6068 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6069 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
6070 [ val=`echo $withval | sed 's/[^0-9]//g'`
6071     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6073 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6074    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6076 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6078 dnl ========================================================
6079 dnl = Enable compilation of specific extension modules
6080 dnl ========================================================
6082 MOZ_ARG_ENABLE_STRING(extensions,
6083 [  --enable-extensions     Enable extensions],
6084 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6085     if test "$option" = "yes" || test "$option" = "all"; then
6086         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6087     elif test "$option" = "no" || test "$option" = "none"; then
6088         MOZ_EXTENSIONS=""
6089     elif test "$option" = "default"; then
6090         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6091     elif test `echo "$option" | grep -c \^-` != 0; then
6092         option=`echo $option | sed 's/^-//'`
6093         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6094     else
6095         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6096     fi
6097 done],
6098     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6100 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6101     # Suppress warning on non-X11 platforms
6102     if test -n "$MOZ_X11"; then
6103         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6104     fi
6105     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6108 dnl Do not build gnomevfs with libxul based apps
6109 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6110     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6113 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6114     # Suppress warning on non-X11 platforms
6115     if test -n "$MOZ_X11"; then
6116         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6117     fi
6118     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6121 dnl Do not build gio with libxul based apps
6122 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6123     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6126 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6127     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6128     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6131 dnl This might be temporary: build tridentprofile only on Windows
6132 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6133     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6134     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6137 dnl cookie must be built before tridentprofile. put it at list's end.
6138 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6139   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6140   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6143 dnl xforms requires xtf and schema-validation
6144 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6145     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6146     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6148 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
6149     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
6150     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6153 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6154     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6155     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6158 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6159     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6160     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6163 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6164     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6165     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6168 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6169     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6170     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6173 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6174     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6175     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6178 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6179     AC_MSG_WARN([spellcheck is no longer an extension.])
6180     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6183 dnl Remove dupes
6184 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6186 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6187 dnl when trying to build a non-existent extension.
6188 for extension in $MOZ_EXTENSIONS; do
6189     if test ! -d "${srcdir}/extensions/${extension}"; then
6190         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6191     fi
6192 done
6195 dnl ========================================================
6196 dnl Image decoders
6197 dnl ========================================================
6198 case "$MOZ_WIDGET_TOOLKIT" in
6199 beos|windows|os2|mac|cocoa)
6200     ;;
6202     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
6203        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6204     fi
6205     ;;
6206 esac
6208 MOZ_ARG_ENABLE_STRING(image-decoders,
6209 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
6210                           Enable specific image decoders],
6211 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6212     if test "$option" = "yes" || test "$option" = "all"; then
6213         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6214     elif test "$option" = "no" || test "$option" = "none"; then
6215         MOZ_IMG_DECODERS=""
6216     elif test "$option" = "default"; then
6217         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6218     elif test `echo "$option" | grep -c \^-` != 0; then
6219         option=`echo $option | sed 's/^-//'`
6220         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6221     else
6222         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6223     fi
6224 done],
6225     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6227 dnl Dupes are removed in the encoder section because it will also add decoders
6229 dnl ========================================================
6230 dnl Image encoders
6231 dnl ========================================================
6232 MOZ_ARG_ENABLE_STRING(image-encoders,
6233 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
6234                           Enable specific image encoders],
6235 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6236     if test "$option" = "yes" || test "$option" = "all"; then
6237         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6238     elif test "$option" = "no" || test "$option" = "none"; then
6239         MOZ_IMG_ENCODERS=""
6240         addencoder=""
6241     elif test "$option" = "default"; then
6242         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6243     elif test `echo "$option" | grep -c \^-` != 0; then
6244         option=`echo $option | sed 's/^-//'`
6245         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6246     else
6247         addencoder="$option"
6248     fi
6249     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6250 done],
6251     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6253 dnl Remove dupes
6254 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6255 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6257 dnl ========================================================
6258 dnl MathML on by default
6259 dnl ========================================================
6260 MOZ_ARG_DISABLE_BOOL(mathml,
6261 [  --disable-mathml        Disable MathML support],
6262     MOZ_MATHML=,
6263     MOZ_MATHML=1 )
6264 if test "$MOZ_MATHML"; then
6265   AC_DEFINE(MOZ_MATHML)
6268 dnl ========================================================
6269 dnl SVG
6270 dnl ========================================================
6271 MOZ_ARG_DISABLE_BOOL(svg,
6272 [  --disable-svg            Disable SVG support],
6273     MOZ_SVG=,
6274     MOZ_SVG=1 )
6275 if test -n "$MOZ_SVG"; then
6276   AC_DEFINE(MOZ_SVG)
6279 dnl ========================================================
6280 dnl SMIL
6281 dnl ========================================================
6282 MOZ_SMIL=1
6283 MOZ_ARG_DISABLE_BOOL(smil,
6284 [  --disable-smil           Disable SMIL animation support],
6285     MOZ_SMIL=,
6286     MOZ_SMIL=1 )
6287 # Automatically disable SMIL if SVG is disabled
6288 if test -z "$MOZ_SVG"; then
6289   MOZ_SMIL=
6291 if test -n "$MOZ_SMIL"; then
6292   AC_DEFINE(MOZ_SMIL)
6295 dnl ========================================================
6296 dnl Build Freetype in the tree
6297 dnl ========================================================
6298 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6299 [  --enable-tree-freetype         Enable Tree FreeType],
6300     MOZ_TREE_FREETYPE=1,
6301     MOZ_TREE_FREETYPE= )
6302 if test -n "$MOZ_TREE_FREETYPE"; then
6303    AC_DEFINE(MOZ_TREE_FREETYPE)
6304    AC_SUBST(MOZ_TREE_FREETYPE)
6305    MOZ_ENABLE_CAIRO_FT=1       
6306    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6307    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6308    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6309    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6310    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6311    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6312    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6313    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6314    AC_SUBST(CAIRO_FT_CFLAGS)
6318 dnl ========================================================
6319 dnl Installer
6320 dnl ========================================================
6321 case "$target_os" in
6322     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6323         MOZ_INSTALLER=1
6324         ;;
6325 esac
6327 MOZ_ARG_DISABLE_BOOL(installer,
6328 [  --disable-installer     Disable building of installer],
6329     MOZ_INSTALLER=,
6330     MOZ_INSTALLER=1 )
6331 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6332     # Disable installer for Windows builds that use the new toolkit if NSIS
6333     # isn't in the path.
6334     MOZ_PATH_PROGS(MAKENSIS, makensis)
6335     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
6336         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
6337     fi
6338     # The Windows build for NSIS requires the iconv command line utility to
6339     # convert the charset of the locale files.
6340     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6341     if test -z "$HOST_ICONV"; then
6342         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6343     fi
6346 # Automatically disable installer if xpinstall isn't built
6347 if test -z "$MOZ_XPINSTALL"; then
6348     MOZ_INSTALLER=
6350 AC_SUBST(MOZ_INSTALLER)
6352 AC_MSG_CHECKING([for tar archiver])
6353 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6354 if test -z "$TAR"; then
6355     AC_MSG_ERROR([no tar archiver found in \$PATH])
6357 AC_MSG_RESULT([$TAR])
6358 AC_SUBST(TAR)
6360 AC_MSG_CHECKING([for wget])
6361 AC_CHECK_PROGS(WGET, wget, "")
6362 AC_MSG_RESULT([$WGET])
6363 AC_SUBST(WGET)
6365 dnl ========================================================
6366 dnl Updater
6367 dnl ========================================================
6369 MOZ_ARG_DISABLE_BOOL(updater,
6370 [  --disable-updater       Disable building of updater],
6371     MOZ_UPDATER=,
6372     MOZ_UPDATER=1 )
6373 AC_SUBST(MOZ_UPDATER)
6375 # app update channel is 'default' when not supplied.
6376 MOZ_ARG_ENABLE_STRING([update-channel],
6377 [  --enable-update-channel=CHANNEL
6378                            Select application update channel (default=default)],
6379     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6381 if test -z "$MOZ_UPDATE_CHANNEL"; then
6382     MOZ_UPDATE_CHANNEL=default
6384 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6386 # tools/update-packaging is not checked out by default.
6387 MOZ_ARG_ENABLE_BOOL(update-packaging,
6388 [  --enable-update-packaging
6389                            Enable tools/update-packaging],
6390     MOZ_UPDATE_PACKAGING=1,
6391     MOZ_UPDATE_PACKAGING= )
6392 AC_SUBST(MOZ_UPDATE_PACKAGING)
6394 dnl ========================================================
6395 dnl ActiveX
6396 dnl ========================================================
6398 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6399 [  --disable-xpconnect-idispatch
6400                           Disable building of xpconnect support for IDispatch
6401                           (win32 only)],
6402     XPC_IDISPATCH_SUPPORT=,
6403     XPC_IDISPATCH_SUPPORT=1)
6404 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6406 MOZ_ARG_DISABLE_BOOL(activex,
6407 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6408     MOZ_NO_ACTIVEX_SUPPORT=1,
6409     MOZ_NO_ACTIVEX_SUPPORT= )
6410 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6412 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6413 [  --enable-activex-scripting
6414                           Enable building of ActiveX scripting support (win32)],
6415     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6416     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6417 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6419 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6420 then
6421     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6424 if test "$COMPILE_ENVIRONMENT" = "1"; then
6425 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6426 case "$target" in
6427 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6428     if test "$ac_cv_header_atlbase_h" = "no"; then
6429         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.])
6430     fi
6431     ;;
6432 esac
6436 dnl ========================================================
6437 dnl leaky
6438 dnl ========================================================
6439 MOZ_ARG_ENABLE_BOOL(leaky,
6440 [  --enable-leaky          Build leaky memory tool],
6441     MOZ_LEAKY=1,
6442     MOZ_LEAKY=)
6445 dnl ========================================================
6446 dnl xpctools
6447 dnl ========================================================
6448 MOZ_ARG_ENABLE_BOOL(xpctools,
6449 [  --enable-xpctools       Build JS profiling tool],
6450     MOZ_XPCTOOLS=1,
6451     MOZ_XPCTOOLS= )
6454 dnl ========================================================
6455 dnl build the tests by default
6456 dnl ========================================================
6457 MOZ_ARG_DISABLE_BOOL(tests,
6458 [  --disable-tests         Do not build test libraries & programs],
6459     ENABLE_TESTS=,
6460     ENABLE_TESTS=1 )
6462 dnl ========================================================
6463 dnl parental controls (for Windows Vista)
6464 dnl ========================================================
6465 MOZ_ARG_DISABLE_BOOL(parental-controls,
6466 [  --disable-parental-controls
6467                            Do not build parental controls],
6468    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6469    MOZ_DISABLE_PARENTAL_CONTROLS=)
6470 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6471     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6474 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6476 dnl ========================================================
6477 dnl =
6478 dnl = Module specific options
6479 dnl =
6480 dnl ========================================================
6481 MOZ_ARG_HEADER(Individual module options)
6483 dnl ========================================================
6484 dnl = Disable feed handling components
6485 dnl ========================================================
6486 MOZ_ARG_DISABLE_BOOL(feeds,
6487 [  --disable-feeds        Disable feed handling and processing components],
6488     MOZ_FEEDS=,
6489     MOZ_FEEDS=1 )
6490 if test -n "$MOZ_FEEDS"; then
6491     AC_DEFINE(MOZ_FEEDS)
6492 else
6493     if test "$MOZ_BUILD_APP" = "browser"; then
6494         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6495     fi
6498 dnl ========================================================
6499 dnl = Enable mozStorage
6500 dnl ========================================================
6501 dnl Implicitly enabled by default if building calendar or places
6502 MOZ_ARG_ENABLE_BOOL(storage,
6503 [  --enable-storage        Enable mozStorage module and related components],
6504     MOZ_STORAGE=1,
6505     MOZ_STORAGE= )
6506 if test -n "$MOZ_STORAGE"; then
6507     AC_DEFINE(MOZ_STORAGE)
6510 dnl ========================================================
6511 dnl Check for sqlite
6512 dnl ========================================================
6514 MOZ_NATIVE_SQLITE=
6515 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6516 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6517 MOZ_NATIVE_SQLITE=1,
6518 MOZ_NATIVE_SQLITE= )
6520 if test -z "$MOZ_NATIVE_SQLITE"
6521 then
6522     SQLITE_CFLAGS=
6523     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6524 else
6525     dnl ============================
6526     dnl === SQLite Version check ===
6527     dnl ============================
6528     dnl Check to see if the system SQLite package is new enough.
6529     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6531     dnl ==================================
6532     dnl === SQLITE_SECURE_DELETE check ===
6533     dnl ==================================
6534     dnl Check to see if the system SQLite package is compiled with
6535     dnl SQLITE_SECURE_DELETE enabled.
6536     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6537     _SAVE_CFLAGS="$CFLAGS"
6538     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6539     _SAVE_LIBS="$LIBS"
6540     LIBS="$LIBS $SQLITE_LIBS"
6541     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6542         AC_TRY_RUN([
6543             #include "sqlite3.h"
6545             int main(int argc, char **argv){
6546               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6547             }],
6548             ac_cv_sqlite_secure_delete=yes,
6549             ac_cv_sqlite_secure_delete=no,
6550             ac_cv_sqlite_secure_delete=no
6551         )
6552     ])
6553     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6554     CFLAGS="$_SAVE_CFLAGS"
6555     LIBS="$_SAVE_LIBS"
6556     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6557         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6558     fi
6560     dnl ===============================
6561     dnl === SQLITE_THREADSAFE check ===
6562     dnl ===============================
6563     dnl Check to see if the system SQLite package is compiled with
6564     dnl SQLITE_THREADSAFE enabled.
6565     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6566     _SAVE_CFLAGS="$CFLAGS"
6567     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6568     _SAVE_LIBS="$LIBS"
6569     LIBS="$LIBS $SQLITE_LIBS"
6570     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6571         AC_TRY_RUN([
6572             #include "sqlite3.h"
6574             int main(int argc, char **argv){
6575               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6576             }],
6577             ac_cv_sqlite_threadsafe=yes,
6578             ac_cv_sqlite_threadsafe=no,
6579             ac_cv_sqlite_threadsafe=no
6580         )
6581     ])
6582     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6583     CFLAGS="$_SAVE_CFLAGS"
6584     LIBS="$_SAVE_LIBS"
6585     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6586         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6587     fi
6589     dnl ================================
6590     dnl === SQLITE_ENABLE_FTS3 check ===
6591     dnl ================================
6592     dnl check to see if the system SQLite package is compiled with
6593     dnl SQLITE_THREADSAFE enabled.
6594     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6595     _SAVE_CFLAGS="$CFLAGS"
6596     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6597     _SAVE_LIBS="$LIBS"
6598     LIBS="$LIBS $SQLITE_LIBS"
6599     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6600         AC_TRY_RUN([
6601             #include "sqlite3.h"
6603             int main(int argc, char **argv){
6604               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6605             }],
6606             ac_cv_sqlite_enable_fts3=yes,
6607             ac_cv_sqlite_enable_fts3=no,
6608             ac_cv_sqlite_enable_fts3=no
6609         )
6610     ])
6611     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6612     CFLAGS="$_SAVE_CFLAGS"
6613     LIBS="$_SAVE_LIBS"
6614     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6615         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6616     fi
6619 AC_SUBST(MOZ_NATIVE_SQLITE)
6621 dnl ========================================================
6622 dnl = Enable help viewer (off by default)
6623 dnl ========================================================
6624 if test -n "$MOZ_HELP_VIEWER"; then
6625      dnl Do this if defined in confvars.sh
6626      AC_DEFINE(MOZ_HELP_VIEWER)
6629 dnl ========================================================
6630 dnl = Enable safe browsing (anti-phishing)
6631 dnl ========================================================
6632 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6633 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6634     MOZ_SAFE_BROWSING=1,
6635     MOZ_SAFE_BROWSING= )
6636 if test -n "$MOZ_SAFE_BROWSING"; then
6637     AC_DEFINE(MOZ_SAFE_BROWSING)
6639 AC_SUBST(MOZ_SAFE_BROWSING)
6641 dnl ========================================================
6642 dnl = Enable faststart component
6643 dnl ========================================================
6644 MOZ_ARG_ENABLE_BOOL(faststart,
6645 [  --enable-faststart            Enable the faststart component],
6646     MOZ_FASTSTART=1,
6647     MOZ_FASTSTART= )
6648 if test -n "$MOZ_FASTSTART"; then
6649     AC_DEFINE(MOZ_FASTSTART)
6651 AC_SUBST(MOZ_FASTSTART)
6653 dnl ========================================================
6654 dnl = Enable url-classifier
6655 dnl ========================================================
6656 dnl Implicitly enabled by default if building with safe-browsing
6657 if test -n "$MOZ_SAFE_BROWSING"; then
6658     MOZ_URL_CLASSIFIER=1
6660 MOZ_ARG_ENABLE_BOOL(url-classifier,
6661 [  --enable-url-classifier        Enable url classifier module],
6662     MOZ_URL_CLASSIFIER=1,
6663     MOZ_URL_CLASSIFIER= )
6664 if test -n "$MOZ_URL_CLASSIFIER"; then
6665     AC_DEFINE(MOZ_URL_CLASSIFIER)
6667 AC_SUBST(MOZ_URL_CLASSIFIER)
6669 dnl ========================================================
6670 dnl = Disable zipwriter
6671 dnl ========================================================
6672 MOZ_ARG_DISABLE_BOOL(zipwriter,
6673 [  --disable-zipwriter             Disable zipwriter component],
6674     MOZ_ZIPWRITER=,
6675     MOZ_ZIPWRITER=1 )
6676 AC_SUBST(MOZ_ZIPWRITER)
6678 dnl ========================================================
6679 dnl = Disable libconic
6680 dnl ========================================================
6681 MOZ_ENABLE_LIBCONIC=1
6682 MOZ_ARG_DISABLE_BOOL(libconic,
6683 [  --disable-libconic              Disable libconic],
6684     MOZ_ENABLE_LIBCONIC=,
6685     MOZ_ENABLE_LIBCONIC=1 )
6687 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6688     PKG_CHECK_MODULES(LIBCONIC, conic,
6689                       MOZ_ENABLE_LIBCONIC=1,
6690                       MOZ_ENABLE_LIBCONIC=)
6692 if test "$MOZ_ENABLE_LIBCONIC"; then
6693     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6696 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6697 AC_SUBST(LIBCONIC_CFLAGS)
6698 AC_SUBST(LIBCONIC_LIBS)
6700 dnl ========================================================
6701 dnl = Maemo checks
6702 dnl ========================================================
6704 MAEMO_SDK_TARGET_VER=-1
6706 MOZ_ARG_WITH_STRING(maemo-version,
6707 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6708                         Maemo SDK Version],
6709   MAEMO_SDK_TARGET_VER=$withval)
6711 case "$MAEMO_SDK_TARGET_VER" in
6713     MOZ_PLATFORM_MAEMO=5
6714     ;;
6717     MOZ_PLATFORM_MAEMO=6
6718     ;;
6721     dnl We aren't compiling for Maemo, move on.
6722     ;;
6724     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6725     ;;
6726 esac
6728 if test $MOZ_PLATFORM_MAEMO; then
6729    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6731    if test -z "$MOZ_ENABLE_DBUS"; then
6732        AC_MSG_ERROR([DBus is required when building for Maemo])
6733    fi
6735    MOZ_GFX_OPTIMIZE_MOBILE=1
6736    MOZ_WEBGL_GLX=
6737    MOZ_MAEMO_LIBLOCATION=
6739    if test $MOZ_PLATFORM_MAEMO = 5; then
6740       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6741       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6742                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6743       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6744                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6746       AC_SUBST(XCOMPOSITE_LIBS)
6748       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6749       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6750       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6751       if test -z "$_LIB_FOUND"; then
6752          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6753       fi
6756       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6757       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6758       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6759       if test -z "$_LIB_FOUND"; then
6760          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6761       fi
6763       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6764       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6765       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6766       if test -z "$_LIB_FOUND"; then
6767          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6768       fi
6770    fi
6772    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6773    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6774    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6775    if test "$_LIB_FOUND"; then
6776       MOZ_MAEMO_LIBLOCATION=1
6777       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6778    else
6779       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6780    fi
6781    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6783    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6784    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6787 dnl ========================================================
6788 dnl = faststripe theme
6789 dnl ========================================================
6790 MOZ_ARG_ENABLE_BOOL(faststripe,
6791 [  --enable-faststripe  Use faststripe theme],
6792     MOZ_THEME_FASTSTRIPE=1,
6793     MOZ_THEME_FASTSTRIPE= )
6794 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6796 dnl ========================================================
6797 dnl =
6798 dnl = Feature options that require extra sources to be pulled
6799 dnl =
6800 dnl ========================================================
6801 dnl MOZ_ARG_HEADER(Features that require extra sources)
6803 dnl ========================================================
6804 dnl =
6805 dnl = Debugging Options
6806 dnl = 
6807 dnl ========================================================
6808 MOZ_ARG_HEADER(Debugging and Optimizations)
6810 dnl ========================================================
6811 dnl = Disable building with debug info.
6812 dnl = Debugging is OFF by default
6813 dnl ========================================================
6814 if test -z "$MOZ_DEBUG_FLAGS"
6815 then
6816     case "$target" in
6817     *-irix*)
6818         if test "$GNU_CC"; then
6819             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6820             case "$GCC_VERSION" in
6821             2.95.*)
6822                 MOZ_DEBUG_FLAGS=""
6823                 ;;
6824             *)
6825                 MOZ_DEBUG_FLAGS="-g"
6826                 ;;
6827             esac
6828         else
6829             MOZ_DEBUG_FLAGS="-g"
6830         fi
6831         ;;
6832     *)
6833         MOZ_DEBUG_FLAGS="-g"
6834         ;;
6835     esac
6838 MOZ_ARG_ENABLE_STRING(debug,
6839 [  --enable-debug[=DBG]    Enable building with developer debug info
6840                            (using compiler flags DBG)],
6841 [ if test "$enableval" != "no"; then
6842     MOZ_DEBUG=1
6843     if test -n "$enableval" -a "$enableval" != "yes"; then
6844         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6845         _MOZ_DEBUG_FLAGS_SET=1
6846     fi
6847   else
6848     MOZ_DEBUG=
6849   fi ],
6850   MOZ_DEBUG=)
6852 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6853  case "${target_os}" in
6854     beos*)
6855         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6856         ;;
6857     msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6858         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6859         ;;
6860     *) 
6861         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6862         ;;
6863   esac
6864 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6866 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6868 if test -n "$MOZ_DEBUG"; then
6869     AC_MSG_CHECKING([for valid debug flags])
6870     _SAVE_CFLAGS=$CFLAGS
6871     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6872     AC_TRY_COMPILE([#include <stdio.h>], 
6873         [printf("Hello World\n");],
6874         _results=yes,
6875         _results=no)
6876     AC_MSG_RESULT([$_results])
6877     if test "$_results" = "no"; then
6878         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6879     fi
6880     CFLAGS=$_SAVE_CFLAGS
6883 dnl ========================================================
6884 dnl enable mobile optimizations
6885 dnl ========================================================
6886 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6887 [  --enable-mobile-optimize   Enable mobile optimizations],
6888     MOZ_GFX_OPTIMIZE_MOBILE=1)
6890 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6892 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6893     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6896 dnl ========================================================
6897 dnl = Enable code optimization. ON by default.
6898 dnl ========================================================
6899 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6900         MOZ_OPTIMIZE_FLAGS="-O"
6903 MOZ_ARG_ENABLE_STRING(optimize,
6904 [  --disable-optimize      Disable compiler optimization
6905   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6906 [ if test "$enableval" != "no"; then
6907     MOZ_OPTIMIZE=1
6908     if test -n "$enableval" && test "$enableval" != "yes"; then
6909         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6910         MOZ_OPTIMIZE=2
6911     fi
6912 else
6913     MOZ_OPTIMIZE=
6914 fi ], MOZ_OPTIMIZE=1)
6916 if test "$COMPILE_ENVIRONMENT"; then
6917 if test -n "$MOZ_OPTIMIZE"; then
6918     AC_MSG_CHECKING([for valid optimization flags])
6919     _SAVE_CFLAGS=$CFLAGS
6920     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6921     AC_TRY_COMPILE([#include <stdio.h>], 
6922         [printf("Hello World\n");],
6923         _results=yes,
6924         _results=no)
6925     AC_MSG_RESULT([$_results])
6926     if test "$_results" = "no"; then
6927         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6928     fi
6929     CFLAGS=$_SAVE_CFLAGS
6931 fi # COMPILE_ENVIRONMENT
6933 AC_SUBST(MOZ_OPTIMIZE)
6934 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6935 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6936 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6938 dnl ========================================================
6939 dnl = (Deprecated) generation of debugger info for specific modules
6940 dnl ========================================================
6941 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6942 [  --enable-debugger-info-modules
6943                           Enable/disable debugger info for specific modules],
6944 [ if test "$enableval" != "no"; then
6945     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
6946     MOZ_DEBUG_SYMBOLS=1
6947   fi ])
6949 dnl ========================================================
6950 dnl = Enable generation of debug symbols
6951 dnl ========================================================
6952 MOZ_ARG_ENABLE_STRING(debug-symbols,
6953 [  --enable-debug-symbols[=DBG]    Enable debugging symbols
6954                                    (using compiler flags DBG)],
6955 [ if test "$enableval" != "no"; then
6956       MOZ_DEBUG_SYMBOLS=1
6957       if test -n "$enableval" -a "$enableval" != "yes"; then
6958           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6959               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6960           else
6961               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6962           fi
6963       fi
6964   fi ])
6966 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6967     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6968     export MOZ_DEBUG_SYMBOLS
6971 dnl ========================================================
6972 dnl Disable runtime logging checks
6973 dnl ========================================================
6974 MOZ_ARG_DISABLE_BOOL(logging,
6975 [  --disable-logging       Disable logging facilities],
6976     NS_DISABLE_LOGGING=1,
6977     NS_DISABLE_LOGGING= )
6978 if test "$NS_DISABLE_LOGGING"; then
6979     AC_DEFINE(NS_DISABLE_LOGGING)
6980 else
6981     AC_DEFINE(MOZ_LOGGING)
6984 dnl ========================================================
6985 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6986 dnl ========================================================
6987 _ENABLE_LOGREFCNT=42
6988 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6989 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6990     _ENABLE_LOGREFCNT=1,
6991     _ENABLE_LOGREFCNT= )
6992 if test "$_ENABLE_LOGREFCNT" = "1"; then
6993     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6994 elif test -z "$_ENABLE_LOGREFCNT"; then
6995     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6998 dnl ========================================================
6999 dnl = Enable trace malloc
7000 dnl ========================================================
7001 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7002 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7003 [  --enable-trace-malloc   Enable malloc tracing],
7004     NS_TRACE_MALLOC=1,
7005     NS_TRACE_MALLOC= )
7006 if test "$NS_TRACE_MALLOC"; then
7007   # Please, Mr. Linker Man, don't take away our symbol names
7008   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7009   USE_ELF_DYNSTR_GC=
7010   AC_DEFINE(NS_TRACE_MALLOC)
7012 AC_SUBST(NS_TRACE_MALLOC)
7014 dnl ========================================================
7015 dnl = Enable jemalloc
7016 dnl ========================================================
7017 MOZ_ARG_ENABLE_BOOL(jemalloc,
7018 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7019     MOZ_MEMORY=1,
7020     MOZ_MEMORY=)
7022 if test "$NS_TRACE_MALLOC"; then
7023     MOZ_MEMORY=
7026 if test "$MOZ_MEMORY"; then
7028   dnl Don't try to run compiler tests on Windows  
7029   if test "$OS_ARCH" = "WINNT"; then
7030     if test -z "$HAVE_64BIT_OS"; then
7031       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7032     else
7033       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7034     fi
7035   else
7036     AC_CHECK_SIZEOF([int *], [4])
7037     case "${ac_cv_sizeof_int_p}" in
7038     4)
7039       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7040       ;;
7041     8)
7042       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7043       ;;
7044     *)
7045       AC_MSG_ERROR([Unexpected pointer size])
7046       ;;
7047     esac
7048   fi
7050   AC_DEFINE(MOZ_MEMORY)
7051   if test "x$MOZ_DEBUG" = "x1"; then
7052     AC_DEFINE(MOZ_MEMORY_DEBUG)
7053   fi
7054   dnl The generic feature tests that determine how to compute ncpus are long and
7055   dnl complicated.  Therefore, simply define special cpp variables for the
7056   dnl platforms we have special knowledge of.
7057   case "${target_os}" in
7058   darwin*)
7059     AC_DEFINE(MOZ_MEMORY_DARWIN)
7060     ;;
7061   *freebsd*)
7062     AC_DEFINE(MOZ_MEMORY_BSD)
7063     ;;
7064   *linux*)
7065     AC_DEFINE(MOZ_MEMORY_LINUX)
7066     ;;
7067   netbsd*)
7068     AC_DEFINE(MOZ_MEMORY_BSD)
7069     ;;
7070   solaris*)
7071     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7072     ;;
7073   msvc*|mks*|cygwin*|mingw*)
7074     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7075     dnl This is sort of awful. Will revisit if we add support for more versions
7076     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7077         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7078     fi
7079     if test -z "$WIN32_CRT_SRC_DIR"; then
7080       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7081         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).])
7082       else
7083         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7084       fi
7085     fi
7086     dnl cpu check
7087     case "${target_cpu}" in
7088     i*86)
7089       _WIN32_CRT_CPU=intel
7090       ;;
7091     *)
7092       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7093       ;;
7094     esac
7096     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7097       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7098     fi
7099     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7100     _objdir_win=`pwd -W`
7101     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$_WIN32_CRT_CPU"
7102     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7103     dnl Also pass this to NSPR/NSS
7104     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7105     export DLLFLAGS
7106     ;;
7107   *wince)
7108     AC_DEFINE(MOZ_MEMORY_WINCE)
7109     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7110     if test -z "$WINCE_WINDOWS_MOBILE"; then
7111       AC_DEFINE(MOZ_MEMORY_WINCE6)
7112     fi
7113     ;;
7114   *winmo)
7115     AC_DEFINE(MOZ_MEMORY_WINCE)
7116     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7117     ;;
7118   *)
7119     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7120     ;;
7121   esac
7123   if test "$OS_ARCH" != "Darwin"; then
7124     dnl NB: this must be kept in sync with jemalloc.h
7125     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7126     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7127     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7128   fi
7130 AC_SUBST(MOZ_MEMORY)
7131 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7132 AC_SUBST(WIN32_CRT_SRC_DIR)
7133 dnl Need to set this for make because NSS doesn't have configure
7134 AC_SUBST(DLLFLAGS)
7136 dnl ========================================================
7137 dnl = Use malloc wrapper lib
7138 dnl ========================================================
7139 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7140 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7141     _WRAP_MALLOC=1,
7142     _WRAP_MALLOC= )
7144 if test -n "$_WRAP_MALLOC"; then
7145     if test "$GNU_CC"; then
7146     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"
7147     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
7148     fi
7151 dnl ========================================================
7152 dnl = Location of malloc wrapper lib
7153 dnl ========================================================
7154 MOZ_ARG_WITH_STRING(wrap-malloc,
7155 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7156     WRAP_MALLOC_LIB=$withval)
7158 dnl ========================================================
7159 dnl = Use TraceVis
7160 dnl ========================================================
7161 MOZ_ARG_ENABLE_BOOL(tracevis,
7162 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7163     MOZ_TRACEVIS=1,
7164     MOZ_TRACEVIS= )
7165 if test -n "$MOZ_TRACEVIS"; then
7166     AC_DEFINE(MOZ_TRACEVIS)
7169 dnl ========================================================
7170 dnl = Use GCTimer
7171 dnl ========================================================
7172 MOZ_ARG_ENABLE_BOOL(gctimer,
7173 [  --enable-gctimer       Enable GC timer (default=no)],
7174     MOZ_GCTIMER=1,
7175     MOZ_GCTIMER= )
7176 if test -n "$MOZ_GCTIMER"; then
7177     AC_DEFINE(MOZ_GCTIMER)
7180 dnl ========================================================
7181 dnl = Use Valgrind
7182 dnl ========================================================
7183 MOZ_ARG_ENABLE_BOOL(valgrind,
7184 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7185     MOZ_VALGRIND=1,
7186     MOZ_VALGRIND= )
7187 if test -n "$MOZ_VALGRIND"; then
7188     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7189         AC_MSG_ERROR(
7190             [--enable-valgrind specified but Valgrind is not installed]))
7191     AC_DEFINE(MOZ_VALGRIND)
7194 dnl ========================================================
7195 dnl jprof
7196 dnl ========================================================
7197 MOZ_ARG_ENABLE_BOOL(jprof,
7198 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
7199     MOZ_JPROF=1,
7200     MOZ_JPROF= )
7201 if test -n "$MOZ_JPROF"; then
7202     AC_DEFINE(MOZ_JPROF)
7205 dnl ========================================================
7206 dnl shark
7207 dnl ========================================================
7208 MOZ_ARG_ENABLE_BOOL(shark,
7209 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
7210     MOZ_SHARK=1,
7211     MOZ_SHARK= )
7212 if test -n "$MOZ_SHARK"; then
7213     AC_DEFINE(MOZ_SHARK)
7216 dnl ========================================================
7217 dnl callgrind
7218 dnl ========================================================
7219 MOZ_ARG_ENABLE_BOOL(callgrind,
7220 [  --enable-callgrind      Enable callgrind profiling],
7221     MOZ_CALLGRIND=1,
7222     MOZ_CALLGRIND= )
7223 if test -n "$MOZ_CALLGRIND"; then
7224     AC_DEFINE(MOZ_CALLGRIND)
7227 dnl ========================================================
7228 dnl vtune
7229 dnl ========================================================
7230 MOZ_ARG_ENABLE_BOOL(vtune,
7231 [  --enable-vtune          Enable vtune profiling],
7232     MOZ_VTUNE=1,
7233     MOZ_VTUNE= )
7234 if test -n "$MOZ_VTUNE"; then
7235     AC_DEFINE(MOZ_VTUNE)
7238 dnl ========================================================
7239 dnl Zealous JavaScript GC
7240 dnl ========================================================
7241 MOZ_ARG_ENABLE_BOOL(gczeal,
7242 [  --enable-gczeal          Enable zealous JavaScript GCing],
7243     JS_GC_ZEAL=1,
7244     JS_GC_ZEAL= )
7245 if test -n "$JS_GC_ZEAL"; then
7246     AC_DEFINE(JS_GC_ZEAL)
7249 dnl ========================================================
7250 dnl = Enable static checking using gcc-dehydra
7251 dnl ========================================================
7253 MOZ_ARG_WITH_STRING(static-checking,
7254 [  --with-static-checking=path/to/gcc_dehydra.so
7255                             Enable static checking of code using GCC-dehydra],
7256     DEHYDRA_PATH=$withval,
7257     DEHYDRA_PATH= )
7259 if test -n "$DEHYDRA_PATH"; then
7260     if test ! -f "$DEHYDRA_PATH"; then
7261         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7262     fi
7263     AC_DEFINE(NS_STATIC_CHECKING)
7265 AC_SUBST(DEHYDRA_PATH)
7267 dnl ========================================================
7268 dnl = Enable stripping of libs & executables
7269 dnl ========================================================
7270 MOZ_ARG_ENABLE_BOOL(strip,
7271 [  --enable-strip          Enable stripping of libs & executables ],
7272     ENABLE_STRIP=1,
7273     ENABLE_STRIP= )
7275 dnl ========================================================
7276 dnl = Enable stripping of libs & executables when packaging
7277 dnl ========================================================
7278 MOZ_ARG_ENABLE_BOOL(install-strip,
7279 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7280     PKG_SKIP_STRIP= ,
7281     PKG_SKIP_STRIP=1)
7283 dnl ========================================================
7284 dnl = --enable-elf-dynstr-gc
7285 dnl ========================================================
7286 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7287 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7288     USE_ELF_DYNSTR_GC=1,
7289     USE_ELF_DYNSTR_GC= )
7291 dnl ========================================================
7292 dnl = 
7293 dnl = Profiling and Instrumenting
7294 dnl = 
7295 dnl ========================================================
7296 MOZ_ARG_HEADER(Profiling and Instrumenting)
7298 dnl ========================================================
7299 dnl = Enable timeline service, which provides lightweight
7300 dnl = instrumentation of mozilla for performance measurement.
7301 dnl = Timeline is off by default.
7302 dnl ========================================================
7303 MOZ_ARG_ENABLE_BOOL(timeline,
7304 [  --enable-timeline       Enable timeline services ],
7305     MOZ_TIMELINE=1,
7306     MOZ_TIMELINE= )
7307 if test -n "$MOZ_TIMELINE"; then
7308     AC_DEFINE(MOZ_TIMELINE)
7311 dnl ========================================================
7312 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7313 dnl = timing for identifying code bottlenecks 
7314 dnl = NS_FUNCTION_TIMER is off by default.
7315 dnl ========================================================
7316 MOZ_ARG_ENABLE_BOOL(functiontimer,
7317 [  --enable-functiontimer       Enable NS_FUNCTION_TIMER ],
7318     NS_FUNCTION_TIMER=1,
7319     NS_FUNCTION_TIMER= )
7320 if test -n "$NS_FUNCTION_TIMER"; then
7321     AC_DEFINE(NS_FUNCTION_TIMER)
7324 dnl ========================================================
7325 dnl Turn on reflow counting
7326 dnl ========================================================
7327 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7328 [  --enable-reflow-perf    Enable reflow performance tracing],
7329     MOZ_REFLOW_PERF=1,
7330     MOZ_REFLOW_PERF= )
7331 if test -n "$MOZ_REFLOW_PERF"; then
7332     AC_DEFINE(MOZ_REFLOW_PERF)
7335 dnl ========================================================
7336 dnl Enable code size metrics.
7337 dnl ========================================================
7338 MOZ_ARG_ENABLE_BOOL(codesighs,
7339 [  --enable-codesighs      Enable code size analysis tools],
7340     _ENABLE_CODESIGHS=1,
7341     _ENABLE_CODESIGHS= )
7342 if test -n "$_ENABLE_CODESIGHS"; then
7343     if test -d $srcdir/tools/codesighs; then 
7344         MOZ_MAPINFO=1
7345     else
7346         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7347     fi
7350 dnl ========================================================
7351 dnl = Support for Quantify (Windows)
7352 dnl ========================================================
7353 MOZ_ARG_ENABLE_BOOL(quantify,
7354 [  --enable-quantify      Enable Quantify support (Windows only) ],
7355     MOZ_QUANTIFY=1,
7356     MOZ_QUANTIFY= )
7358 dnl ========================================================
7359 dnl = Support for demangling undefined symbols
7360 dnl ========================================================
7361 if test -z "$SKIP_LIBRARY_CHECKS"; then
7362     AC_LANG_SAVE
7363     AC_LANG_CPLUSPLUS
7364     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7365     AC_LANG_RESTORE
7368 # Demangle only for debug or trace-malloc builds
7369 MOZ_DEMANGLE_SYMBOLS=
7370 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7371     MOZ_DEMANGLE_SYMBOLS=1
7372     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7374 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7376 dnl ========================================================
7377 dnl = Support for gcc stack unwinding (from gcc 3.3)
7378 dnl ========================================================
7379 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7380     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7383 dnl ========================================================
7384 dnl =
7385 dnl = Misc. Options
7386 dnl = 
7387 dnl ========================================================
7388 MOZ_ARG_HEADER(Misc. Options)
7390 dnl ========================================================
7391 dnl update xterm title
7392 dnl ========================================================
7393 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7394 [  --enable-xterm-updates  Update XTERM titles with current command.],
7395     MOZ_UPDATE_XTERM=1,
7396     MOZ_UPDATE_XTERM= )
7398 dnl =========================================================
7399 dnl = Chrome format
7400 dnl =========================================================
7401 MOZ_ARG_ENABLE_STRING([chrome-format],
7402 [  --enable-chrome-format=jar|flat|both|symlink
7403                           Select FORMAT of chrome files (default=jar)],
7404     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7406 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7407     MOZ_CHROME_FILE_FORMAT=jar
7410 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7411     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7412     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7413     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
7414     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
7417 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7418    AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7420 dnl ========================================================
7421 dnl = Define default location for MOZILLA_FIVE_HOME
7422 dnl ========================================================
7423 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7424 [  --with-default-mozilla-five-home
7425                           Set the default value for MOZILLA_FIVE_HOME],
7426 [ val=`echo $withval`
7427   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7429 dnl ========================================================
7430 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7431 dnl ========================================================
7432 MOZ_ARG_WITH_STRING(user-appdir,
7433 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7434 [ val=`echo $withval`
7435 if echo "$val" | grep "\/" >/dev/null; then
7436     AC_MSG_ERROR("Homedir must be single relative path.")
7437 else 
7438     MOZ_USER_DIR="$val"
7439 fi])
7441 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7443 dnl ========================================================
7444 dnl = Doxygen configuration
7445 dnl ========================================================
7446 dnl Use commas to specify multiple dirs to this arg
7447 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7448 MOZ_ARG_WITH_STRING(doc-input-dirs,
7449 [  --with-doc-input-dirs=DIRS
7450                           Header/idl dirs to create docs from],
7451 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7452 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7454 dnl Use commas to specify multiple dirs to this arg
7455 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7456 MOZ_ARG_WITH_STRING(doc-include-dirs,
7457 [  --with-doc-include-dirs=DIRS  
7458                           Include dirs to preprocess doc headers],
7459 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7460 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7462 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7463 MOZ_ARG_WITH_STRING(doc-output-dir,
7464 [  --with-doc-output-dir=DIR
7465                           Dir to generate docs into],
7466 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7467 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7469 if test -z "$SKIP_COMPILER_CHECKS"; then
7470 dnl ========================================================
7471 dnl =
7472 dnl = Compiler Options
7473 dnl = 
7474 dnl ========================================================
7475 MOZ_ARG_HEADER(Compiler Options)
7477 dnl ========================================================
7478 dnl Check for gcc -pipe support
7479 dnl ========================================================
7480 AC_MSG_CHECKING([for gcc -pipe support])
7481 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7482     echo '#include <stdio.h>' > dummy-hello.c
7483     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7484     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7485     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7486     if test $? = 0; then
7487         _res_as_stdin="yes"
7488     else
7489         _res_as_stdin="no"
7490     fi
7491     if test "$_res_as_stdin" = "yes"; then
7492         _SAVE_CFLAGS=$CFLAGS
7493         CFLAGS="$CFLAGS -pipe"
7494         AC_TRY_COMPILE( [ #include <stdio.h> ],
7495             [printf("Hello World\n");],
7496             [_res_gcc_pipe="yes"],
7497             [_res_gcc_pipe="no"] )
7498         CFLAGS=$_SAVE_CFLAGS
7499     fi
7500     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7501         _res="yes";
7502         CFLAGS="$CFLAGS -pipe"
7503         CXXFLAGS="$CXXFLAGS -pipe"
7504     else
7505         _res="no"
7506     fi
7507     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7508     AC_MSG_RESULT([$_res])
7509 else
7510     AC_MSG_RESULT([no])
7513 dnl pass -Wno-long-long to the compiler
7514 MOZ_ARG_ENABLE_BOOL(long-long-warning,
7515 [  --enable-long-long-warning 
7516                           Warn about use of non-ANSI long long type],
7517     _IGNORE_LONG_LONG_WARNINGS=,
7518     _IGNORE_LONG_LONG_WARNINGS=1)
7520 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
7521      _SAVE_CFLAGS="$CFLAGS"
7522      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
7523      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
7524      AC_TRY_COMPILE([], [return(0);], 
7525         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7526           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7527           result="yes" ], result="no")
7528      AC_MSG_RESULT([$result])
7529      CFLAGS="$_SAVE_CFLAGS"
7532 dnl ========================================================
7533 dnl Profile guided optimization
7534 dnl ========================================================
7535 dnl Test for profiling options
7536 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7537 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7539 dnl Provide a switch to disable PGO even when called via profiledbuild.
7540 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7541 [  --disable-profile-guided-optimization
7542                            Don't build with PGO even if called via make profiledbuild],
7543 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7544 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7546 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7548 _SAVE_CFLAGS="$CFLAGS"
7549 CFLAGS="$CFLAGS -fprofile-generate"
7551 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7552 AC_TRY_COMPILE([], [return 0;],
7553                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7554                  result="yes" ], result="no")
7555 AC_MSG_RESULT([$result])
7557 if test $result = "yes"; then
7558   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7559   PROFILE_USE_CFLAGS="-fprofile-use"
7560   PROFILE_USE_LDFLAGS="-fprofile-use"
7561 else
7562   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7563   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7564   AC_TRY_COMPILE([], [return 0;],
7565                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7566                    result="yes" ], result="no")
7567   AC_MSG_RESULT([$result])
7568   if test $result = "yes"; then
7569     PROFILE_USE_CFLAGS="-fbranch-probabilities"
7570   fi
7571   # don't really care, this is an old GCC
7572   PROFILE_GEN_LDFLAGS=
7573   PROFILE_USE_LDFLAGS=
7576 CFLAGS="$_SAVE_CFLAGS"
7578 if test -n "$INTEL_CC"; then
7579   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7580   PROFILE_GEN_LDFLAGS=
7581   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7582   PROFILE_USE_LDFLAGS=
7585 dnl Sun Studio on Solaris
7586 if test "$SOLARIS_SUNPRO_CC"; then
7587   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7588   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7589   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7590   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7593 AC_SUBST(PROFILE_GEN_CFLAGS)
7594 AC_SUBST(PROFILE_GEN_LDFLAGS)
7595 AC_SUBST(PROFILE_USE_CFLAGS)
7596 AC_SUBST(PROFILE_USE_LDFLAGS)
7598 AC_LANG_CPLUSPLUS
7600 dnl ========================================================
7601 dnl Test for -pedantic bustage
7602 dnl ========================================================
7603 MOZ_ARG_DISABLE_BOOL(pedantic,
7604 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7605 _PEDANTIC= )
7606 if test "$_PEDANTIC"; then
7607     _SAVE_CXXFLAGS=$CXXFLAGS
7608     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7609     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7610     AC_TRY_COMPILE([$configure_static_assert_macros],
7611                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7612                    result="no", result="yes" )
7613     AC_MSG_RESULT([$result])
7614     CXXFLAGS="$_SAVE_CXXFLAGS"
7616     case "$result" in
7617     no)
7618         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7619         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7620         ;;
7621     yes)
7622         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7623         ;;
7624     esac
7627 dnl ========================================================
7628 dnl Test for correct temporary object destruction order
7629 dnl ========================================================
7630 dnl We want to make sure the compiler follows the C++ spec here as 
7631 dnl xpcom and the string classes depend on it (bug 235381).
7632 AC_MSG_CHECKING([for correct temporary object destruction order])
7633 AC_TRY_RUN([ class A {
7634              public:  A(int& x) : mValue(x) {}
7635                       ~A() { mValue--; }
7636                       operator char**() { return 0; }
7637              private:  int& mValue;
7638              };
7639              void func(char **arg) {}
7640              int m=2;
7641              void test() {
7642                   func(A(m));
7643                   if (m==1) m = 0;
7644              }
7645              int main() {
7646                  test();
7647                  return(m);
7648              }
7649              ],
7650      result="yes", result="no", result="maybe")
7651 AC_MSG_RESULT([$result])
7653 if test "$result" = "no"; then
7654     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7657 dnl ========================================================
7658 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7659 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7660 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7661 dnl ========================================================
7662 _SAVE_CXXFLAGS=$CXXFLAGS
7663 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7664 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7665     ac_nscap_nonconst_opeq_bug,
7666     [AC_TRY_COMPILE([
7667                       template <class T>
7668                       class Pointer
7669                         {
7670                         public:
7671                           T* myPtr;
7672                         };
7673                       
7674                       template <class T, class U>
7675                       int operator==(const Pointer<T>& rhs, U* lhs)
7676                         {
7677                           return rhs.myPtr == lhs;
7678                         }
7679                       
7680                       template <class T, class U>
7681                       int operator==(const Pointer<T>& rhs, const U* lhs)
7682                         {
7683                           return rhs.myPtr == lhs;
7684                         }
7685                     ],
7686                     [
7687                       Pointer<int> foo;
7688                       const int* bar;
7689                       return foo == bar;
7690                     ],
7691                     ac_nscap_nonconst_opeq_bug="no",
7692                     ac_nscap_nonconst_opeq_bug="yes")])
7693 CXXFLAGS="$_SAVE_CXXFLAGS"
7695 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7696     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7698 fi # SKIP_COMPILER_CHECKS
7700 dnl ========================================================
7701 dnl C++ rtti
7702 dnl Should be smarter and check that the compiler does indeed have rtti
7703 dnl ========================================================
7705 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7706 [  --enable-cpp-rtti       Enable C++ RTTI ],
7707 [ _MOZ_USE_RTTI=1 ],
7708 [ _MOZ_USE_RTTI= ])
7710 if test "$_MOZ_USE_RTTI"; then
7711    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7712 else
7713    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7716 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7718 dnl ========================================================
7719 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
7720 dnl Should be smarter and check that the compiler does indeed have exceptions
7721 dnl ========================================================
7722 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7723 [  --enable-cpp-exceptions Enable C++ exceptions ],
7724 [ _MOZ_CPP_EXCEPTIONS=1 ],
7725 [ _MOZ_CPP_EXCEPTIONS= ])
7727 if test "$_MOZ_CPP_EXCEPTIONS"; then
7728     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7729     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
7730 else
7731     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7734 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7736 # Irix & OSF native compilers do not like exception declarations 
7737 # when exceptions are disabled
7738 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7739     AC_DEFINE(CPP_THROW_NEW, [])
7740 else
7741     AC_DEFINE(CPP_THROW_NEW, [throw()])
7743 AC_LANG_C
7745 dnl ========================================================
7746 dnl =
7747 dnl = Build depencency options
7748 dnl =
7749 dnl ========================================================
7750 MOZ_ARG_HEADER(Build dependencies)
7752 dnl ========================================================
7753 dnl = Do not auto generate dependency info
7754 dnl ========================================================
7755 MOZ_AUTO_DEPS=1
7756 MOZ_ARG_DISABLE_BOOL(auto-deps,
7757 [  --disable-auto-deps     Do not automatically generate dependency info],
7758     MOZ_AUTO_DEPS=,
7759     MOZ_AUTO_DEPS=1)
7761 if test -n "$MOZ_AUTO_DEPS"; then
7762 dnl ========================================================
7763 dnl = Use mkdepend instead of $CC -MD for dependency generation
7764 dnl ========================================================
7765 _cpp_md_flag=
7766 MOZ_ARG_DISABLE_BOOL(md,
7767 [  --disable-md            Do not use compiler-based dependencies ],
7768   [_cpp_md_flag=],
7769   [_cpp_md_flag=1],
7770   [dnl Default is to turn on -MD if using GNU-compatible compilers
7771    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7772      _cpp_md_flag=1
7773    fi
7774   dnl Default is to use -xM if using Sun Studio on Solaris
7775    if test "$SOLARIS_SUNPRO_CC"; then
7776      _cpp_md_flag=1
7777    fi])
7778 if test "$_cpp_md_flag"; then
7779   COMPILER_DEPEND=1
7780   if test "$OS_ARCH" = "OpenVMS"; then
7781     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7782   else
7783     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7784   fi
7785   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7786   if test "$SOLARIS_SUNPRO_CC"; then
7787     _DEPEND_CFLAGS=
7788   fi
7789 else
7790   COMPILER_DEPEND=
7791   dnl Don't override this for MSVC
7792   if test -z "$_WIN32_MSVC"; then
7793     _USE_CPP_INCLUDE_FLAG=
7794     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7795     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7796   fi
7798 fi # MOZ_AUTO_DEPS
7799 MDDEPDIR='.deps'
7800 AC_SUBST(MOZ_AUTO_DEPS)
7801 AC_SUBST(COMPILER_DEPEND)
7802 AC_SUBST(MDDEPDIR)
7805 dnl ========================================================
7806 dnl =
7807 dnl = Static Build Options
7808 dnl =
7809 dnl ========================================================
7810 MOZ_ARG_HEADER(Static build options)
7812 MOZ_ARG_ENABLE_BOOL(static,
7813 [  --enable-static         Enable building of internal static libs],
7814     BUILD_STATIC_LIBS=1,
7815     BUILD_STATIC_LIBS=)
7817 MOZ_ARG_ENABLE_BOOL(libxul,
7818 [  --enable-libxul         Enable building of libxul],
7819     MOZ_ENABLE_LIBXUL=1,
7820     MOZ_ENABLE_LIBXUL=)
7822 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7823         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7826 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7827         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7830 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
7831     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
7834 AC_SUBST(LIBXUL_LIBS)
7836 if test -n "$MOZ_ENABLE_LIBXUL"; then
7837     XPCOM_LIBS="$LIBXUL_LIBS"
7838     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7839 else
7840     if test -n "$BUILD_STATIC_LIBS"; then
7841         AC_DEFINE(MOZ_STATIC_BUILD)
7842     fi
7843     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7846 dnl ========================================================
7847 dnl =
7848 dnl = Standalone module options
7849 dnl = 
7850 dnl ========================================================
7851 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7853 dnl Check for GLib and libIDL.
7854 dnl ========================================================
7855 case "$target_os" in
7856 msvc*|mks*|cygwin*|mingw*|wince*|winmo*)
7857     SKIP_IDL_CHECK="yes"
7858     ;;
7860     SKIP_IDL_CHECK="no"
7861     ;;
7862 esac
7864 if test -z "$COMPILE_ENVIRONMENT"; then
7865     SKIP_IDL_CHECK="yes"
7868 dnl = Allow users to disable libIDL checking for standalone modules
7869 MOZ_ARG_WITHOUT_BOOL(libIDL,
7870 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7871         SKIP_IDL_CHECK="yes")
7873 if test "$SKIP_IDL_CHECK" = "no"
7874 then
7875     _LIBIDL_FOUND=
7876     if test "$MACOS_SDK_DIR"; then 
7877       dnl xpidl, and therefore libIDL, is only needed on the build host.
7878       dnl Don't build it against the SDK, as that causes problems.
7879       _MACSAVE_CFLAGS="$CFLAGS"
7880       _MACSAVE_LIBS="$LIBS"
7881       _MACSAVE_LDFLAGS="$LDFLAGS"
7882       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7883       changequote(,)
7884       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"`
7885       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7886       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7887       changequote([,])
7888       unset NEXT_ROOT
7889     fi
7891     if test "$MOZ_ENABLE_GTK2"; then
7892         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7893     fi
7894     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7895     dnl to either libIDL1 or libIDL2.
7896     if test -z "$_LIBIDL_FOUND"; then
7897         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7898         if test -z "$_LIBIDL_FOUND"; then
7899             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7900         fi
7901     fi
7902     dnl
7903     dnl If we don't have a libIDL config program & not cross-compiling, 
7904     dnl     look for orbit-config instead.
7905     dnl
7906     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7907         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7908         if test -n "$ORBIT_CONFIG"; then
7909             AC_MSG_CHECKING([for ORBit libIDL usability])
7910                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7911             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7912             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7913             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7914             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7915             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7916             LIBIDL_CONFIG=
7917             _SAVE_CFLAGS="$CFLAGS"
7918             _SAVE_LIBS="$LIBS"
7919             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7920             LIBS="$LIBIDL_LIBS $LIBS"
7921             AC_TRY_RUN([
7922 #include <stdlib.h>
7923 #include <libIDL/IDL.h>
7924 int main() {
7925   char *s;
7926   s=strdup(IDL_get_libver_string());
7927   if(s==NULL) {
7928     exit(1);
7929   }
7930   exit(0);
7932             ], [_LIBIDL_FOUND=1
7933                 result="yes"],
7934                [LIBIDL_CFLAGS=
7935                 LIBIDL_LIBS=
7936                 result="no"],
7937                [_LIBIDL_FOUND=1
7938                 result="maybe"] )
7939             AC_MSG_RESULT($result)
7940             CFLAGS="$_SAVE_CFLAGS"
7941             LIBS="$_SAVE_LIBS"
7942         fi
7943     fi
7944     if test -z "$_LIBIDL_FOUND"; then
7945         AC_MSG_ERROR([libIDL not found.
7946         libIDL $LIBIDL_VERSION or higher is required.])
7947     fi
7948     if test "$MACOS_SDK_DIR"; then
7949       CFLAGS="$_MACSAVE_CFLAGS"
7950       LIBS="$_MACSAVE_LIBS"
7951       LDFLAGS="$_MACSAVE_LDFLAGS"
7952       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7953         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7954       fi
7955     fi
7958 if test -n "$CROSS_COMPILE"; then
7959      if test -z "$HOST_LIBIDL_CONFIG"; then
7960         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7961     fi
7962     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7963         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7964         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7965     else
7966         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7967         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7968     fi
7971 if test -z "$SKIP_PATH_CHECKS"; then
7972 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7973     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7974         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7975     else
7976         AM_PATH_GLIB(${GLIB_VERSION})
7977     fi
7981 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7982     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7985 AC_SUBST(LIBIDL_CFLAGS)
7986 AC_SUBST(LIBIDL_LIBS)
7987 AC_SUBST(STATIC_LIBIDL)
7988 AC_SUBST(GLIB_CFLAGS)
7989 AC_SUBST(GLIB_LIBS)
7990 AC_SUBST(GLIB_GMODULE_LIBS)
7991 AC_SUBST(HOST_LIBIDL_CONFIG)
7992 AC_SUBST(HOST_LIBIDL_CFLAGS)
7993 AC_SUBST(HOST_LIBIDL_LIBS)
7995 dnl ========================================================
7996 dnl Check for cairo
7997 dnl ========================================================
7998 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8000 MOZ_TREE_CAIRO=1
8001 MOZ_ARG_ENABLE_BOOL(system-cairo,
8002 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8003 MOZ_TREE_CAIRO=,
8004 MOZ_TREE_CAIRO=1 )
8006 # Check for headers defining standard int types.
8007 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8009 if test "$MOZ_TREE_CAIRO"; then
8010     AC_DEFINE(MOZ_TREE_CAIRO)
8012     # For now we assume that we will have a uint64_t available through
8013     # one of the above headers or mozstdint.h.
8014     AC_DEFINE(HAVE_UINT64_T)
8016     # Define macros for cairo-features.h
8017     if test "$MOZ_X11"; then
8018         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8019         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8020         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8021         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8022         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8023         MOZ_ENABLE_CAIRO_FT=1
8024         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8025     fi
8026     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8027         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8028     fi
8029     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8030         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8031         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8032         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8033     fi
8034     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8035         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8036         if test -z "$WINCE"; then
8037             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8038             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8039                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8040                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8041                 MOZ_ENABLE_D2D_SURFACE=1
8042                 MOZ_ENABLE_DWRITE_FONT=1
8043             else
8044                 WIN32_DWRITE_FONT_FEATURE=
8045                 WIN32_D2D_SURFACE_FEATURE=
8046             fi
8047         else
8048             WIN32_FONT_FEATURE=
8049             WIN32_DWRITE_FONT_FEATURE=
8050             WIN32_D2D_SURFACE_FEATURE=
8051         fi
8053         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
8054         if test -z "$HAS_DDRAW"; then
8055             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.])
8056             DDRAW_SURFACE_FEATURE=
8057         else
8058             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
8059         fi
8061         if test -z "$OGLES_SDK_DIR"; then
8062             OGLES_SURFACE_FEATURE=
8063         else
8064             AC_TRY_COMPILE([
8065               #include <EGL/egl.h>
8066               #include <EGL/eglext.h>
8067               #include <GLES2/gl2.h>
8068               #include <GLES2/gl2ext.h>
8069             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
8070             if test -z "$HAS_OGLES"; then
8071               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
8072               OGLES_SURFACE_FEATURE=
8073             else
8074               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
8075             fi
8076         fi
8078         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8079     fi
8080     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8081         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8082         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8083         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8084         MOZ_ENABLE_CAIRO_FT=1
8085         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8086         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8087     fi
8088     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8089         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8090         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8091         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8092         MOZ_ENABLE_CAIRO_FT=1
8093     fi
8094     if test "$USE_FC_FREETYPE"; then
8095         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8096     fi
8097     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8098     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8099     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8100     AC_SUBST(CAIRO_FT_CFLAGS)
8101     AC_SUBST(HAS_OGLES)
8103     if test "$MOZ_DEBUG"; then
8104       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8105     else
8106       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8107     fi
8109     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8111     AC_SUBST(PS_SURFACE_FEATURE)
8112     AC_SUBST(PDF_SURFACE_FEATURE)
8113     AC_SUBST(SVG_SURFACE_FEATURE)
8114     AC_SUBST(XLIB_SURFACE_FEATURE)
8115     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8116     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8117     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8118     AC_SUBST(XCB_SURFACE_FEATURE)
8119     AC_SUBST(WIN32_SURFACE_FEATURE)
8120     AC_SUBST(DDRAW_SURFACE_FEATURE)
8121     AC_SUBST(OGLES_SURFACE_FEATURE)    
8122     AC_SUBST(OS2_SURFACE_FEATURE)
8123     AC_SUBST(BEOS_SURFACE_FEATURE)
8124     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8125     AC_SUBST(FT_FONT_FEATURE)
8126     AC_SUBST(FC_FONT_FEATURE)
8127     AC_SUBST(WIN32_FONT_FEATURE)
8128     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8129     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8130     AC_SUBST(QUARTZ_FONT_FEATURE)
8131     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8132     AC_SUBST(QT_SURFACE_FEATURE)
8134     if test "$_WIN32_MSVC"; then
8135         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
8136     else
8137         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"
8139         if test "$MOZ_X11"; then
8140             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8141         fi
8142     fi
8144     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8145     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8147 else
8148    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8149    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8150    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8151    if test "$MOZ_X11"; then
8152         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8153         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8154         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8155    fi
8158 AC_SUBST(MOZ_TREE_CAIRO)
8159 AC_SUBST(MOZ_CAIRO_CFLAGS)
8160 AC_SUBST(MOZ_CAIRO_LIBS)
8162 dnl qcms
8163 dnl ========================================================
8165 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8166 AC_SUBST(QCMS_LIBS)
8168 dnl ========================================================
8169 dnl disable xul
8170 dnl ========================================================
8171 MOZ_ARG_DISABLE_BOOL(xul,
8172 [  --disable-xul           Disable XUL],
8173     MOZ_XUL= )
8174 if test "$MOZ_XUL"; then
8175   AC_DEFINE(MOZ_XUL)
8176 else
8177   dnl remove extensions that require XUL
8178   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8181 AC_SUBST(MOZ_XUL)
8183 dnl ========================================================
8184 dnl disable profile locking
8185 dnl   do no use this in applications that can have more than
8186 dnl   one process accessing the profile directory.
8187 dnl ========================================================
8188 MOZ_ARG_DISABLE_BOOL(profilelocking,
8189 [  --disable-profilelocking           Disable profile locking],
8190     MOZ_PROFILELOCKING=,
8191     MOZ_PROFILELOCKING=1 )
8192 if test "$MOZ_PROFILELOCKING"; then
8193   AC_DEFINE(MOZ_PROFILELOCKING)
8196 dnl ========================================================
8197 dnl disable rdf services
8198 dnl ========================================================
8199 MOZ_ARG_DISABLE_BOOL(rdf,
8200 [  --disable-rdf           Disable RDF],
8201     MOZ_RDF= )
8202 if test "$MOZ_RDF"; then
8203   AC_DEFINE(MOZ_RDF)
8206 AC_SUBST(MOZ_RDF)
8208 dnl ========================================================
8209 dnl necko configuration options
8210 dnl ========================================================
8213 dnl option to disable various necko protocols
8215 MOZ_ARG_ENABLE_STRING(necko-protocols,
8216 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8217                           Enable/disable specific protocol handlers],
8218 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8219     if test "$option" = "yes" || test "$option" = "all"; then
8220         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8221     elif test "$option" = "no" || test "$option" = "none"; then
8222         NECKO_PROTOCOLS=""
8223     elif test "$option" = "default"; then
8224         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8225     elif test `echo "$option" | grep -c \^-` != 0; then
8226         option=`echo $option | sed 's/^-//'`
8227         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8228     else
8229         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8230     fi
8231 done],
8232     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8233 dnl Remove dupes
8234 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8235 AC_SUBST(NECKO_PROTOCOLS)
8236 for p in $NECKO_PROTOCOLS; do
8237     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8238 done
8241 dnl option to disable necko's disk cache
8243 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8244 [  --disable-necko-disk-cache
8245                           Disable necko disk cache],
8246     NECKO_DISK_CACHE=,
8247     NECKO_DISK_CACHE=1)
8248 AC_SUBST(NECKO_DISK_CACHE)
8249 if test "$NECKO_DISK_CACHE"; then
8250     AC_DEFINE(NECKO_DISK_CACHE)
8254 dnl option to disable necko's wifi scanner
8256 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8257 [  --disable-necko-wifi   Disable necko wifi scanner],
8258     NECKO_WIFI=,
8259     NECKO_WIFI=1
8262 if test "$OS_ARCH" = "OS2"; then
8263   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8264   NECKO_WIFI=
8266 if test "$NECKO_WIFI" -a \
8267         "$OS_ARCH" != "Linux" -a \
8268         "$OS_ARCH" != "Darwin" -a \
8269         "$OS_ARCH" != "SunOS" -a \
8270         "$OS_ARCH" != "WINNT" -a \
8271         "$OS_ARCH" != "WINCE"; then
8272   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8275 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8276 then
8277   AC_CHECK_HEADER([iwlib.h])
8278   if test "$ac_cv_header_iwlib_h" != "yes"; then
8279     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])
8280   fi
8283 if test "$NECKO_WIFI"; then
8284   AC_DEFINE(NECKO_WIFI)
8286 AC_SUBST(NECKO_WIFI)
8289 dnl option to disable cookies
8291 MOZ_ARG_DISABLE_BOOL(cookies,
8292 [  --disable-cookies       Disable cookie support],
8293     NECKO_COOKIES=,
8294     NECKO_COOKIES=1)
8295 AC_SUBST(NECKO_COOKIES)
8296 if test "$NECKO_COOKIES"; then
8297     AC_DEFINE(NECKO_COOKIES)
8301 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8303 MOZ_ARG_DISABLE_BOOL(ctypes,
8304 [  --disable-ctypes        Disable js-ctypes],
8305     BUILD_CTYPES=,
8306     BUILD_CTYPES=1)
8307 AC_SUBST(BUILD_CTYPES)
8308 if test "$BUILD_CTYPES"; then
8309   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8310     # Disable ctypes for arm/wince.
8311     BUILD_CTYPES=
8312   else
8313     AC_DEFINE(BUILD_CTYPES)
8314   fi
8317 dnl NECKO_ configuration options are not global
8318 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8320 dnl Only build Mork if it's required
8321 AC_SUBST(MOZ_MORK)
8322 if test "$MOZ_MORK"; then
8323   AC_DEFINE(MOZ_MORK)
8326 dnl Build the lightweight Mork reader if required
8327 AC_SUBST(MOZ_MORKREADER)
8328 if test "$MOZ_MORKREADER"; then
8329   AC_DEFINE(MOZ_MORKREADER)
8332 dnl Build Places if required
8333 if test "$MOZ_PLACES"; then
8334   AC_DEFINE(MOZ_PLACES)
8337 dnl ========================================================
8338 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8339     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8342 dnl ========================================================
8343 dnl =
8344 dnl = Maintainer debug option (no --enable equivalent)
8345 dnl =
8346 dnl ========================================================
8348 AC_SUBST(AR)
8349 AC_SUBST(AR_FLAGS)
8350 AC_SUBST(AR_LIST)
8351 AC_SUBST(AR_EXTRACT)
8352 AC_SUBST(AR_DELETE)
8353 AC_SUBST(AS)
8354 AC_SUBST(ASFLAGS)
8355 AC_SUBST(AS_DASH_C_FLAG)
8356 AC_SUBST(LD)
8357 AC_SUBST(RC)
8358 AC_SUBST(RCFLAGS)
8359 AC_SUBST(WINDRES)
8360 AC_SUBST(IMPLIB)
8361 AC_SUBST(FILTER)
8362 AC_SUBST(BIN_FLAGS)
8363 AC_SUBST(NS_USE_NATIVE)
8364 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8365 AC_SUBST(MOZ_UPDATE_XTERM)
8366 AC_SUBST(MINIMO)
8367 AC_SUBST(MOZ_PLATFORM_MAEMO)
8368 AC_SUBST(MOZ_AUTH_EXTENSION)
8369 AC_SUBST(MOZ_MATHML)
8370 AC_SUBST(MOZ_PERMISSIONS)
8371 AC_SUBST(MOZ_XTF)
8372 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8373 AC_SUBST(MOZ_PREF_EXTENSIONS)
8374 AC_SUBST(MOZ_SVG)
8375 AC_SUBST(MOZ_SMIL)
8376 AC_SUBST(MOZ_XSLT_STANDALONE)
8377 AC_SUBST(MOZ_JS_LIBS)
8378 AC_SUBST(MOZ_PSM)
8379 AC_SUBST(MOZ_DEBUG)
8380 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8381 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8382 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8383 AC_SUBST(MOZ_DEBUG_FLAGS)
8384 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8385 AC_SUBST(WARNINGS_AS_ERRORS)
8386 AC_SUBST(MOZ_EXTENSIONS)
8387 AC_SUBST(MOZ_IMG_DECODERS)
8388 AC_SUBST(MOZ_IMG_ENCODERS)
8389 AC_SUBST(MOZ_JSDEBUGGER)
8390 AC_SUBST(MOZ_PLUGINS)
8391 AC_SUBST(MOZ_LOG_REFCNT)
8392 AC_SUBST(MOZ_LEAKY)
8393 AC_SUBST(MOZ_JPROF)
8394 AC_SUBST(MOZ_SHARK)
8395 AC_SUBST(MOZ_CALLGRIND)
8396 AC_SUBST(MOZ_VTUNE)
8397 AC_SUBST(MOZ_XPCTOOLS)
8398 AC_SUBST(MOZ_JSLOADER)
8399 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8400 AC_SUBST(MOZ_QUANTIFY)
8401 AC_SUBST(LIBICONV)
8402 AC_SUBST(MOZ_PLACES)
8403 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8404 AC_SUBST(MOZ_STORAGE)
8405 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8406 AC_SUBST(MOZ_FEEDS)
8407 AC_SUBST(NS_PRINTING)
8408 AC_SUBST(MOZ_WEBGL)
8409 AC_SUBST(MOZ_HELP_VIEWER)
8411 AC_SUBST(MOZ_JAVAXPCOM)
8412 AC_SUBST(JAVA_INCLUDE_PATH)
8413 AC_SUBST(JAVA)
8414 AC_SUBST(JAVAC)
8415 AC_SUBST(JAR)
8417 AC_SUBST(MOZ_PROFILELOCKING)
8419 AC_SUBST(HAVE_XIE)
8420 AC_SUBST(MOZ_XIE_LIBS)
8421 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8423 AC_SUBST(BUILD_STATIC_LIBS)
8424 AC_SUBST(MOZ_ENABLE_LIBXUL)
8425 AC_SUBST(ENABLE_TESTS)
8426 AC_SUBST(IBMBIDI)
8427 AC_SUBST(MOZ_UNIVERSALCHARDET)
8428 AC_SUBST(ACCESSIBILITY)
8429 AC_SUBST(MOZ_XPINSTALL)
8430 AC_SUBST(MOZ_VIEW_SOURCE)
8431 AC_SUBST(MOZ_SPELLCHECK)
8432 AC_SUBST(MOZ_USER_DIR)
8433 AC_SUBST(MOZ_CRASHREPORTER)
8435 AC_SUBST(ENABLE_STRIP)
8436 AC_SUBST(PKG_SKIP_STRIP)
8437 AC_SUBST(USE_ELF_DYNSTR_GC)
8438 AC_SUBST(INCREMENTAL_LINKER)
8439 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8440 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8442 AC_SUBST(MOZ_FIX_LINK_PATHS)
8443 AC_SUBST(XPCOM_LIBS)
8444 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8445 AC_SUBST(XPCOM_GLUE_LDOPTS)
8446 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8448 AC_SUBST(USE_DEPENDENT_LIBS)
8450 AC_SUBST(MOZ_BUILD_ROOT)
8451 AC_SUBST(MOZ_OS2_TOOLS)
8452 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8454 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8455 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8456 AC_SUBST(MOZ_TIMELINE)
8457 AC_SUBST(OGLES_SDK_DIR)
8459 AC_SUBST(MOZ_APP_NAME)
8460 AC_SUBST(MOZ_APP_DISPLAYNAME)
8461 AC_SUBST(MOZ_APP_VERSION)
8462 AC_SUBST(MOZ_APP_UA_EXTRA)
8463 AC_SUBST(FIREFOX_VERSION)
8465 AC_SUBST(MOZ_PKG_SPECIAL)
8467 AC_SUBST(MOZILLA_OFFICIAL)
8469 dnl win32 options
8470 AC_SUBST(MOZ_MAPINFO)
8471 AC_SUBST(MOZ_BROWSE_INFO)
8472 AC_SUBST(MOZ_TOOLS_DIR)
8473 AC_SUBST(CYGWIN_WRAPPER)
8474 AC_SUBST(AS_PERL)
8475 AC_SUBST(WIN32_REDIST_DIR)
8476 AC_SUBST(PYTHON)
8478 AC_SUBST(WINCE)
8479 AC_SUBST(WINCE_SDK_DIR)
8480 AC_SUBST(WINCE_WINDOWS_MOBILE)
8482 dnl Echo the CFLAGS to remove extra whitespace.
8483 CFLAGS=`echo \
8484         $_WARNINGS_CFLAGS \
8485         $CFLAGS`
8487 CXXFLAGS=`echo \
8488         $_MOZ_RTTI_FLAGS \
8489         $_MOZ_EXCEPTIONS_FLAGS \
8490         $_WARNINGS_CXXFLAGS \
8491         $CXXFLAGS`
8493 COMPILE_CFLAGS=`echo \
8494     $_DEFINES_CFLAGS \
8495         $_DEPEND_CFLAGS \
8496     $COMPILE_CFLAGS`
8498 COMPILE_CXXFLAGS=`echo \
8499     $_DEFINES_CXXFLAGS \
8500         $_DEPEND_CFLAGS \
8501     $COMPILE_CXXFLAGS`
8503 AC_SUBST(SYSTEM_MAKEDEPEND)
8504 AC_SUBST(SYSTEM_LIBXUL)
8505 AC_SUBST(SYSTEM_JPEG)
8506 AC_SUBST(SYSTEM_PNG)
8507 AC_SUBST(SYSTEM_ZLIB)
8508 AC_SUBST(SYSTEM_BZ2)
8510 AC_SUBST(JPEG_CFLAGS)
8511 AC_SUBST(JPEG_LIBS)
8512 AC_SUBST(ZLIB_CFLAGS)
8513 AC_SUBST(ZLIB_LIBS)
8514 AC_SUBST(BZ2_CFLAGS)
8515 AC_SUBST(BZ2_LIBS)
8516 AC_SUBST(PNG_CFLAGS)
8517 AC_SUBST(PNG_LIBS)
8519 AC_SUBST(MOZ_JPEG_CFLAGS)
8520 AC_SUBST(MOZ_JPEG_LIBS)
8521 AC_SUBST(MOZ_ZLIB_CFLAGS)
8522 AC_SUBST(MOZ_ZLIB_LIBS)
8523 AC_SUBST(MOZ_BZ2_CFLAGS)
8524 AC_SUBST(MOZ_BZ2_LIBS)
8525 AC_SUBST(MOZ_PNG_CFLAGS)
8526 AC_SUBST(MOZ_PNG_LIBS)
8528 AC_SUBST(NSPR_CFLAGS)
8529 AC_SUBST(NSPR_LIBS)
8530 AC_SUBST(MOZ_NATIVE_NSPR)
8532 AC_SUBST(NSS_CFLAGS)
8533 AC_SUBST(NSS_LIBS)
8534 AC_SUBST(NSS_DEP_LIBS)
8535 AC_SUBST(MOZ_NATIVE_NSS)
8536 AC_SUBST(NSS_DISABLE_DBM)
8538 AC_SUBST(CFLAGS)
8539 AC_SUBST(CXXFLAGS)
8540 AC_SUBST(CPPFLAGS)
8541 AC_SUBST(COMPILE_CFLAGS)
8542 AC_SUBST(COMPILE_CXXFLAGS)
8543 AC_SUBST(LDFLAGS)
8544 AC_SUBST(LIBS)
8545 AC_SUBST(CROSS_COMPILE)
8546 AC_SUBST(WCHAR_CFLAGS)
8548 AC_SUBST(HOST_CC)
8549 AC_SUBST(HOST_CXX)
8550 AC_SUBST(HOST_CFLAGS)
8551 AC_SUBST(HOST_CXXFLAGS)
8552 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8553 AC_SUBST(HOST_AR)
8554 AC_SUBST(HOST_AR_FLAGS)
8555 AC_SUBST(HOST_LD)
8556 AC_SUBST(HOST_RANLIB)
8557 AC_SUBST(HOST_NSPR_MDCPUCFG)
8558 AC_SUBST(HOST_BIN_SUFFIX)
8559 AC_SUBST(HOST_OS_ARCH)
8561 AC_SUBST(TARGET_CPU)
8562 AC_SUBST(TARGET_VENDOR)
8563 AC_SUBST(TARGET_OS)
8564 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8565 AC_SUBST(TARGET_MD_ARCH)
8566 AC_SUBST(TARGET_XPCOM_ABI)
8567 AC_SUBST(OS_TARGET)
8568 AC_SUBST(OS_ARCH)
8569 AC_SUBST(OS_RELEASE)
8570 AC_SUBST(OS_TEST)
8572 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8573 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8575 AC_SUBST(WRAP_MALLOC_CFLAGS)
8576 AC_SUBST(WRAP_MALLOC_LIB)
8577 AC_SUBST(MKSHLIB)
8578 AC_SUBST(MKCSHLIB)
8579 AC_SUBST(MKSHLIB_FORCE_ALL)
8580 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8581 AC_SUBST(DSO_CFLAGS)
8582 AC_SUBST(DSO_PIC_CFLAGS)
8583 AC_SUBST(DSO_LDOPTS)
8584 AC_SUBST(LIB_PREFIX)
8585 AC_SUBST(DLL_PREFIX)
8586 AC_SUBST(DLL_SUFFIX)
8587 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8588 AC_SUBST(LIB_SUFFIX)
8589 AC_SUBST(OBJ_SUFFIX)
8590 AC_SUBST(BIN_SUFFIX)
8591 AC_SUBST(ASM_SUFFIX)
8592 AC_SUBST(IMPORT_LIB_SUFFIX)
8593 AC_SUBST(USE_N32)
8594 AC_SUBST(CC_VERSION)
8595 AC_SUBST(CXX_VERSION)
8596 AC_SUBST(MSMANIFEST_TOOL)
8597 AC_SUBST(NS_ENABLE_TSF)
8598 AC_SUBST(MOZ_NSS_PATCH)
8600 if test "$USING_HCC"; then
8601    CC='${topsrcdir}/build/hcc'
8602    CC="$CC '$_OLDCC'"
8603    CXX='${topsrcdir}/build/hcpp'
8604    CXX="$CXX '$_OLDCXX'"
8605    AC_SUBST(CC)
8606    AC_SUBST(CXX)
8609 dnl Check for missing components
8610 if test "$COMPILE_ENVIRONMENT"; then
8611 if test "$MOZ_X11"; then
8612     dnl ====================================================
8613     dnl = Check if X headers exist
8614     dnl ====================================================
8615     _SAVE_CFLAGS=$CFLAGS
8616     CFLAGS="$CFLAGS $XCFLAGS"
8617     AC_TRY_COMPILE([
8618         #include <stdio.h>
8619         #include <stdlib.h>
8620         #include <X11/Xlib.h>
8621         #include <X11/Intrinsic.h>
8622     ],
8623     [
8624         Display *dpy = 0;
8625         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8626             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8627             exit(1);
8628         }
8629     ], [], 
8630     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8631     CFLAGS="$_SAVE_CFLAGS"
8633     if test ! -z "$MISSING_X"; then
8634         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8635     fi
8637 fi # MOZ_X11
8639 dnl Check for headers, etc. needed by WebGL.
8640 if test -n "$MOZ_WEBGL_GLX"; then
8641     AC_CHECK_HEADER(GL/glx.h)
8642     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8643         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8644     fi
8645 fi # MOZ_WEBGL_GLX
8646 fi # COMPILE_ENVIRONMENT
8648 if test "$USE_FC_FREETYPE"; then
8649     if test "$COMPILE_ENVIRONMENT"; then
8650         _SAVE_CPPFLAGS="$CPPFLAGS"
8651         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8652         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
8653             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8654         CPPFLAGS="$_SAVE_CPPFLAGS"
8655     else
8656         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8657     fi
8660 dnl Set various defines and substitutions
8661 dnl ========================================================
8663 if test "$OS_ARCH" = "BeOS"; then
8664   AC_DEFINE(XP_BEOS)
8665 elif test "$OS_ARCH" = "Darwin"; then
8666   AC_DEFINE(XP_UNIX)
8667   AC_DEFINE(UNIX_ASYNC_DNS)
8668 elif test "$OS_ARCH" = "OpenVMS"; then
8669   AC_DEFINE(XP_UNIX)
8670 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8671   AC_DEFINE(XP_UNIX)
8672   AC_DEFINE(UNIX_ASYNC_DNS)
8675 if test "$MOZ_DEBUG"; then
8676     AC_DEFINE(MOZ_REFLOW_PERF)
8677     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8680 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8681     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8682     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8683     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8684     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8685     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8686     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8687     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8688     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8691 dnl ========================================================
8692 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8693 dnl ========================================================
8694 case "$host_os" in
8695 mingw*)
8696     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8697     ;;
8698 cygwin*|msvc*|mks*)
8699     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8700     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8701     CC="\$(CYGWIN_WRAPPER) $CC"
8702     CXX="\$(CYGWIN_WRAPPER) $CXX"
8703     CPP="\$(CYGWIN_WRAPPER) $CPP"
8704     LD="\$(CYGWIN_WRAPPER) $LD"
8705     AS="\$(CYGWIN_WRAPPER) $AS"
8706     RC="\$(CYGWIN_WRAPPER) $RC"
8707     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8708     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8709     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8710     ;;
8711 esac
8713 AC_SUBST(CYGDRIVE_MOUNT)
8714 AC_SUBST(WIN_TOP_SRC)
8716 AC_SUBST(MOZILLA_VERSION)
8718 AC_SUBST(ac_configure_args)
8720 dnl Spit out some output
8721 dnl ========================================================
8723 dnl The following defines are used by xpcom
8724 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8725 CPP_THROW_NEW
8726 HAVE_CPP_2BYTE_WCHAR_T
8727 HAVE_CPP_ACCESS_CHANGING_USING
8728 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8729 HAVE_CPP_BOOL
8730 HAVE_CPP_CHAR16_T
8731 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8732 HAVE_CPP_EXPLICIT
8733 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8734 HAVE_CPP_NAMESPACE_STD
8735 HAVE_CPP_NEW_CASTS
8736 HAVE_CPP_PARTIAL_SPECIALIZATION
8737 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8738 HAVE_CPP_TYPENAME
8739 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8740 HAVE_STATVFS
8741 NEED_CPP_UNUSED_IMPLEMENTATIONS
8742 NEW_H
8743 HAVE_GETPAGESIZE
8744 HAVE_ICONV
8745 HAVE_ICONV_WITH_CONST_INPUT
8746 HAVE_MBRTOWC
8747 HAVE_SYS_MOUNT_H
8748 HAVE_SYS_VFS_H
8749 HAVE_WCRTOMB
8752 AC_CONFIG_HEADER(
8753 netwerk/necko-config.h
8754 xpcom/xpcom-config.h
8755 xpcom/xpcom-private.h
8758 # Save the defines header file before autoconf removes it.
8759 # (Do not add AC_DEFINE calls after this line.)
8760   _CONFIG_TMP=confdefs-tmp.h
8761   _CONFIG_DEFS_H=mozilla-config.h
8763   cat > $_CONFIG_TMP <<\EOF
8764 /* List of defines generated by configure. Included with preprocessor flag,
8765  * -include, to avoid long list of -D defines on the compile command-line.
8766  * Do not edit.
8767  */
8769 #ifndef _MOZILLA_CONFIG_H_
8770 #define _MOZILLA_CONFIG_H_
8773 _EGREP_PATTERN='^#define ('
8774 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8775     for f in $_NON_GLOBAL_ACDEFINES; do
8776         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8777     done
8779 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8781   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8783   cat >> $_CONFIG_TMP <<\EOF
8785 #endif /* _MOZILLA_CONFIG_H_ */
8789   # Only write mozilla-config.h when something changes (or it doesn't exist)
8790   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8791     rm $_CONFIG_TMP
8792   else
8793     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8794     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8796     echo ==== $_CONFIG_DEFS_H =================================
8797     cat $_CONFIG_DEFS_H
8798   fi
8800 dnl Probably shouldn't call this manually but we always want the output of DEFS
8801 rm -f confdefs.h.save
8802 mv confdefs.h confdefs.h.save
8803 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8804 AC_OUTPUT_MAKE_DEFS()
8805 MOZ_DEFINES=$DEFS
8806 AC_SUBST(MOZ_DEFINES)
8807 rm -f confdefs.h
8808 mv confdefs.h.save confdefs.h
8810 dnl Load the list of Makefiles to generate.
8811 dnl   To add new Makefiles, edit allmakefiles.sh.
8812 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8813 . ${srcdir}/allmakefiles.sh
8814 dnl 
8815 dnl Run a perl script to quickly create the makefiles.
8816 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8817 dnl   for the files it cannot handle correctly. This way, config.status
8818 dnl   will handle these files.
8819 dnl If it fails, nothing is set and config.status will run as usual.
8821 dnl This does not change the $MAKEFILES variable.
8823 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8825 if test -z "${AS_PERL}"; then
8826 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8827 else
8828 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8830 . ./conftest.sh
8831 rm conftest.sh
8833 echo $MAKEFILES > unallmakefiles
8835 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8837 AC_OUTPUT($MAKEFILES)
8839 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8840 if test "$CAIRO_FEATURES_H"; then
8841   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8842     echo "$CAIRO_FEATURES_H is unchanged"
8843     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8844   else
8845     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8846   fi
8849 dnl ========================================================
8850 dnl = Setup a nice relatively clean build environment for
8851 dnl = sub-configures.
8852 dnl ========================================================
8853 CC="$_SUBDIR_CC" 
8854 CXX="$_SUBDIR_CXX" 
8855 CFLAGS="$_SUBDIR_CFLAGS" 
8856 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8857 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8858 LDFLAGS="$_SUBDIR_LDFLAGS"
8859 HOST_CC="$_SUBDIR_HOST_CC" 
8860 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8861 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8864 unset MAKEFILES
8865 unset CONFIG_FILES
8867 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8868 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8870 if test -z "$MOZ_NATIVE_NSPR"; then
8871     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8872     if test -z "$MOZ_DEBUG"; then
8873         ac_configure_args="$ac_configure_args --disable-debug"
8874     fi
8875     if test "$MOZ_OPTIMIZE" = "1"; then
8876         ac_configure_args="$ac_configure_args --enable-optimize"
8877     fi
8878     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8879        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8880     fi
8881     if test -n "$HAVE_64BIT_OS"; then
8882         ac_configure_args="$ac_configure_args --enable-64bit"
8883     fi
8884     if test -n "$USE_ARM_KUSER"; then
8885         ac_configure_args="$ac_configure_args --with-arm-kuser"
8886     fi
8887     AC_OUTPUT_SUBDIRS(nsprpub)
8888     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8891 if test -z "$MOZ_NATIVE_NSPR"; then
8892     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8893     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8894     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8895        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8896        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8897        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8898        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8899     fi
8900     rm -f config/autoconf.mk.bak
8903 # Run the SpiderMonkey 'configure' script.
8904 dist=$MOZ_BUILD_ROOT/dist
8905 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8906 ac_configure_args="$ac_configure_args --enable-threadsafe"
8907 if test "$BUILD_CTYPES"; then
8908     # Build js-ctypes on the platforms we can.
8909     ac_configure_args="$ac_configure_args --enable-ctypes"
8911 if test -z "$MOZ_NATIVE_NSPR"; then
8912     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8913     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8915 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8916 ac_configure_args="$ac_configure_args --prefix=$dist"
8917 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8918 if test "$MOZ_MEMORY"; then
8919    ac_configure_args="$ac_configure_args --enable-jemalloc"
8920    if test -n "$MOZ_MEMORY_LDFLAGS"; then
8921      export MOZ_MEMORY_LDFLAGS
8922    fi
8924 AC_OUTPUT_SUBDIRS(js/src)
8925 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8927 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8929 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8930 dnl Needs to be at the end to respect possible changes from NSPR configure
8931 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8932   echo "config/autoconf.mk is unchanged"
8933   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8934 else
8935   rm -f config/autoconf.mk.orig 2> /dev/null