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