Bug 424363 - Customize Toolbar ? Restore Default Set uses gtk-refresh instead of...
[wine-gecko.git] / configure.in
blob85b8fb33e6d2c444565471f4c470f0f29201ae29
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 dnl
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
10 dnl
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
14 dnl License.
15 dnl
16 dnl The Original Code is this file as it was released upon August 6, 1998.
17 dnl
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
22 dnl
23 dnl Contributor(s):
24 dnl   Jamie Zawinski <jwz@jwz.org>
25 dnl   gettimeofday args check
26 dnl   Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl   gnomefe update & enable-pthreads
28 dnl   Ramiro Estrugo <ramiro@netscape.com>
29 dnl   X11 makedepend support
30 dnl   Insure support.
31 dnl   Henry Sobotka <sobotka@axess.com>
32 dnl   OS/2 support
33 dnl   Dan Mosedale <dmose@mozilla.org>
34 dnl   LDAP support
35 dnl   Seth Spitzer <sspitzer@netscape.com>
36 dnl   xpctools support
37 dnl   Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl   Howard Chu <hyc@symas.com>
39 dnl   MSYS support
40 dnl   Mark Mentovai <mark@moxienet.com>:
41 dnl   Mac OS X 10.4 support
42 dnl   Giorgio Maone <g.maone@informaction.com>
43 dnl   MSVC l10n compatible version check
44 dnl   Ben Turner <mozilla@songbirdnest.com>
45 dnl
46 dnl Alternatively, the contents of this file may be used under the terms of
47 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
48 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
49 dnl in which case the provisions of the GPL or the LGPL are applicable instead
50 dnl of those above. If you wish to allow use of your version of this file only
51 dnl under the terms of either the GPL or the LGPL, and not to allow others to
52 dnl use your version of this file under the terms of the MPL, indicate your
53 dnl decision by deleting the provisions above and replace them with the notice
54 dnl and other provisions required by the GPL or the LGPL. If you do not delete
55 dnl the provisions above, a recipient may use your version of this file under
56 dnl the terms of any one of the MPL, the GPL or the LGPL.
57 dnl
58 dnl ***** END LICENSE BLOCK *****
60 dnl Process this file with autoconf to produce a configure script.
61 dnl ========================================================
63 AC_PREREQ(2.13)
64 AC_INIT(config/config.mk)
65 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
66 AC_CANONICAL_SYSTEM
67 TARGET_CPU="${target_cpu}"
68 TARGET_VENDOR="${target_vendor}"
69 TARGET_OS="${target_os}"
72 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1` 
73 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
77 dnl =
78 dnl = Don't change the following two lines.  Doing so breaks:
79 dnl =
80 dnl = CFLAGS="-foo" ./configure
81 dnl =
82 dnl ========================================================
83 CFLAGS="${CFLAGS=}"
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
86 LDFLAGS="${LDFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
96 _SUBDIR_CC="$CC"
97 _SUBDIR_CXX="$CXX"
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
110 MOZJPEG=62
111 MOZPNG=10217
112 MOZZLIB=0x1230
113 NSPR_VERSION=4
114 NSS_VERSION=3
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
118 GLIB_VERSION=1.2.0
119 LIBIDL_VERSION=0.6.3
120 PERL_VERSION=5.006
121 LIBART_VERSION=2.3.4
122 CAIRO_VERSION=1.6.0
123 PANGO_VERSION=1.14.0
124 GTK2_VERSION=2.10.0
125 MAKE_VERSION=3.78
126 WINDRES_VERSION=2.14.90
127 W32API_VERSION=3.8
128 GNOMEVFS_VERSION=2.0
129 GNOMEUI_VERSION=2.2.0
130 GCONF_VERSION=1.2.1
131 LIBGNOME_VERSION=2.0
132 STARTUP_NOTIFICATION_VERSION=0.8
133 DBUS_VERSION=0.60
134 LCMS_VERSION=1.17
135 SQLITE_VERSION=3.6.6.2
137 MSMANIFEST_TOOL=
139 dnl Set various checks
140 dnl ========================================================
141 MISSING_X=
142 AC_PROG_AWK
144 dnl Initialize the Pthread test variables early so they can be
145 dnl  overridden by each platform.
146 dnl ========================================================
147 USE_PTHREADS=
148 _PTHREAD_LDFLAGS=""
150 dnl Do not allow a separate objdir build if a srcdir build exists.
151 dnl ==============================================================
152 _topsrcdir=`cd \`dirname $0\`; pwd`
153 _objdir=`pwd`
155 if test "$_topsrcdir" != "$_objdir"
156 then
157   # Check for a couple representative files in the source tree
158   _conflict_files=
159   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
160     if test -f $file; then
161       _conflict_files="$_conflict_files $file"
162     fi
163   done
164   if test "$_conflict_files"; then
165     echo "***"
166     echo "*   Your source tree contains these files:"
167     for file in $_conflict_files; do
168       echo "*         $file"
169     done
170     cat 1>&2 <<-EOF
171         *   This indicates that you previously built in the source tree.
172         *   A source tree build can confuse the separate objdir build.
173         *
174         *   To clean up the source tree:
175         *     1. cd $_topsrcdir
176         *     2. gmake distclean
177         ***
178         EOF
179     exit 1
180     break
181   fi
183 MOZ_BUILD_ROOT=`pwd`
185 dnl Default to MSVC for win32
186 dnl ==============================================================
187 if test -z "$CROSS_COMPILE"; then
188 case "$target" in
189 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
190     MAKE_VERSION=3.79
191     if test -z "$CC"; then CC=cl; fi
192     if test -z "$CXX"; then CXX=cl; fi
193     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
194     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
195     if test -z "$LD"; then LD=link; fi
196     if test -z "$AS"; then AS=ml; fi
197     if test -z "$MIDL"; then MIDL=midl; fi
198     ;;
199 esac
202 COMPILE_ENVIRONMENT=1
203 MOZ_ARG_ENABLE_BOOL(compile-environment,
204 [  --disable-compile-environment
205                            Disable compiler/library checks.],
206     COMPILE_ENVIRONMENT=1,
207     COMPILE_ENVIRONMENT= )
209 MOZ_ARG_WITH_STRING(l10n-base,
210 [  --with-l10n-base=DIR     path to l10n repositories],
211     L10NBASEDIR=$withval)
212 if test ! -z "$L10NBASEDIR"; then
213     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
214         AC_MSG_ERROR([--with-l10n-base must specify a path])
215     elif test -d "$L10NBASEDIR"; then
216         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
217     else
218         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
219     fi
221 AC_SUBST(L10NBASEDIR)
223 dnl ========================================================
224 dnl Checks for compilers.
225 dnl ========================================================
226 dnl Set CROSS_COMPILE in the environment when running configure
227 dnl to use the cross-compile setup for now
228 dnl ========================================================
230 if test "$COMPILE_ENVIRONMENT"; then
232 dnl Do some special WinCE toolchain stuff
233 case "$target" in
234 *wince)
236     MOZ_ARG_WITH_STRING(wince-sdk,
237     [  --with-wince-sdk=WINCE_SDK
238                         The path to the windows mobile sdk],
239     WINCE_SDK=$withval)
241     export WINCE=1
242     mk_add_options WINCE=1
244     echo -----------------------------------------------------------------------------
245     echo Building Windows CE Shunt Library and Tool Chain
246     echo Using SDK in:
247     echo $WINCE_SDK
249     ac_exeext=.exe
251     
252     rm -f $srcdir/build/wince/shunt/include/windows.h
254     echo -n "#define TOPSRCDIR \"" > $srcdir/build/wince/tools/topsrcdir.h
255     echo `cd "$_topsrcdir" && pwd -W | tr '\n' '\"'` >> $srcdir/build/wince/tools/topsrcdir.h
256     make -C $srcdir/build/wince/tools
257     
258     echo "#include \"$WINCE_SDK/windows.h\"" > $srcdir/build/wince/shunt/include/windows.h
259     echo "#define GetProcAddress GetProcAddressA" >> $srcdir/build/wince/shunt/include/windows.h
260     echo -----------------------------------------------------------------------------
262     ;;
263 esac
265 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
266     echo "cross compiling from $host to $target"
267     cross_compiling=yes
269     _SAVE_CC="$CC"
270     _SAVE_CFLAGS="$CFLAGS"
271     _SAVE_LDFLAGS="$LDFLAGS"
273     AC_MSG_CHECKING([for host c compiler])
274     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
275     if test -z "$HOST_CC"; then
276         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
277     fi
278     AC_MSG_RESULT([$HOST_CC])
279     AC_MSG_CHECKING([for host c++ compiler])
280     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
281     if test -z "$HOST_CXX"; then
282         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
283     fi
284     AC_MSG_RESULT([$HOST_CXX])
286     if test -z "$HOST_CFLAGS"; then
287         HOST_CFLAGS="$CFLAGS"
288     fi
289     if test -z "$HOST_CXXFLAGS"; then
290         HOST_CXXFLAGS="$CXXFLAGS"
291     fi
292     if test -z "$HOST_LDFLAGS"; then
293         HOST_LDFLAGS="$LDFLAGS"
294     fi
295     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
296     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
297     CC="$HOST_CC"
298     CFLAGS="$HOST_CFLAGS"
299     LDFLAGS="$HOST_LDFLAGS"
301     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
302     AC_TRY_COMPILE([], [return(0);], 
303         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
304         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
306     CC="$HOST_CXX"
307     CFLAGS="$HOST_CXXFLAGS"
309     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
310     AC_TRY_COMPILE([], [return(0);], 
311         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
312         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
313     
314     CC=$_SAVE_CC
315     CFLAGS=$_SAVE_CFLAGS
316     LDFLAGS=$_SAVE_LDFLAGS
318     case "$build:$target" in
319       powerpc-apple-darwin8*:i?86-apple-darwin*)
320         dnl The Darwin cross compiler doesn't necessarily point itself at a
321         dnl root that has libraries for the proper architecture, it defaults
322         dnl to the system root.  The libraries in the system root on current
323         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
324         dnl checks will fail.  Fake a working SDK in that case.
325         _SAVE_CFLAGS=$CFLAGS
326         _SAVE_CXXFLAGS=$CXXLAGS
327         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
328         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
329         ;;
330     esac
332     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
333     unset ac_cv_prog_CC
334     AC_PROG_CC
335     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
336     unset ac_cv_prog_CXX
337     AC_PROG_CXX
339     case "$build:$target" in
340       powerpc-apple-darwin8*:i?86-apple-darwin*)
341         dnl Revert the changes made above.  From this point on, the target
342         dnl compiler will never be used without applying the SDK to CFLAGS
343         dnl (see --with-macos-sdk below).
344         CFLAGS=$_SAVE_CFLAGS
345         CXXFLAGS=$_SAVE_CXXFLAGS
346         ;;
347     esac
349     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
350     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
351     AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
352     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
353     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
354     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
355     AC_DEFINE(CROSS_COMPILE)
356 else
357     AC_PROG_CC
358     AC_PROG_CXX
359     AC_PROG_RANLIB
360     AC_PATH_PROGS(AS, $AS as, $CC)
361     AC_CHECK_PROGS(AR, ar, :)
362     AC_CHECK_PROGS(LD, ld, :)
363     AC_CHECK_PROGS(STRIP, strip, :)
364     AC_CHECK_PROGS(WINDRES, windres, :)
365     if test -z "$HOST_CC"; then
366         HOST_CC="$CC"
367     fi
368     if test -z "$HOST_CFLAGS"; then
369         HOST_CFLAGS="$CFLAGS"
370     fi
371     if test -z "$HOST_CXX"; then
372         HOST_CXX="$CXX"
373     fi
374     if test -z "$HOST_CXXFLAGS"; then
375         HOST_CXXFLAGS="$CXXFLAGS"
376     fi
377     if test -z "$HOST_LDFLAGS"; then
378         HOST_LDFLAGS="$LDFLAGS"
379     fi
380     if test -z "$HOST_RANLIB"; then
381         HOST_RANLIB="$RANLIB"
382     fi
383     if test -z "$HOST_AR"; then
384        HOST_AR="$AR"
385     fi
388 GNU_AS=
389 GNU_LD=
390 GNU_CC=
391 GNU_CXX=
392 CC_VERSION='N/A'
393 CXX_VERSION='N/A'
394 if test "$GCC" = "yes"; then
395     GNU_CC=1
396     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
398 if test "$GXX" = "yes"; then
399     GNU_CXX=1
400     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
402 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
403     GNU_AS=1
405 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
406     GNU_LD=1
408 if test "$GNU_CC"; then
409     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
410         GCC_USE_GNU_LD=1
411     fi
414 INTEL_CC=
415 INTEL_CXX=
416 if test "$GCC" = yes; then
417    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
418      INTEL_CC=1
419    fi
422 if test "$GXX" = yes; then
423    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
424      INTEL_CXX=1
425    fi
428 dnl Special win32 checks
429 dnl ========================================================
430 case "$target" in
431 *-wince)
432     WINVER=500
433     ;;
435     if test -n "$GNU_CC"; then  
436         WINVER=501
437     else    
438         WINVER=500
439     fi
440     ;;
441 esac
443 MOZ_ARG_WITH_STRING(windows-version,
444 [  --with-windows-version=WINVER
445                           Minimum Windows version (WINVER) to support
446                               400: Windows 95
447                               500: Windows 2000
448                               501: Windows XP],
449   WINVER=$withval)
451 case "$WINVER" in
452 400|500|501)
453     ;;
456     AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
457     ;;
459 esac
461 case "$target" in
462 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
463     if test "$GCC" != "yes"; then
464         # Check to see if we are really running in a msvc environemnt
465         _WIN32_MSVC=1
466         AC_CHECK_PROGS(MIDL, midl)
468         # Make sure compilers are valid
469         CFLAGS="$CFLAGS -TC -nologo"
470         CXXFLAGS="$CXXFLAGS -TP -nologo"
471         AC_LANG_SAVE
472         AC_LANG_C
473         AC_TRY_COMPILE([#include <stdio.h>],
474             [ printf("Hello World\n"); ],,
475             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
477         AC_LANG_CPLUSPLUS
478         AC_TRY_COMPILE([#include <new.h>],
479             [ unsigned *test = new unsigned(42); ],,
480             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
481         AC_LANG_RESTORE
482         
483         changequote(,)
484         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
485         changequote([,])
486         
487         # Determine compiler version
488         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
489         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
490         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
491         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
492         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
493         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
495         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
496         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
498         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
499             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
500         fi
501         if test "$_CC_MAJOR_VERSION" = "12"; then
502             _CC_SUITE=6
503         elif test "$_CC_MAJOR_VERSION" = "13"; then
504             _CC_SUITE=7
505         elif test "$_CC_MAJOR_VERSION" = "14"; then
506             _CC_SUITE=8
507             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
508             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
509             dnl so be very specific here!
510             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
511             if test $_CC_RELEASE -gt 50727; then
512                _USE_DYNAMICBASE=1
513             elif test $_CC_BUILD -ge 762; then
514                _USE_DYNAMICBASE=1
515             fi
516             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
517             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
518         elif test "$_CC_MAJOR_VERSION" = "15"; then
519             _CC_SUITE=9
520             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
521             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
522             _USE_DYNAMICBASE=1
523             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
524             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
525         else
526             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
527         fi
529         _MOZ_RTTI_FLAGS_ON='-GR'
530         _MOZ_RTTI_FLAGS_OFF='-GR-'
531         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
532         _MOZ_EXCEPTIONS_FLAGS_OFF=''
534         if test -n "$WIN32_REDIST_DIR"; then
535             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
536         fi
537         
538         # bug #249782
539         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
540         if test "$_CC_SUITE" -ge "8"; then
541                 changequote(,)
542                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
543                 changequote([,])
545                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
546                 if test -n "$MSMT_TOOL"; then
547                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
548                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
549                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
550                         fi
551                         MSMANIFEST_TOOL=1
552                         unset MSMT_TOOL
553                 else
554                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
555                 fi
556         fi
558         # Check linker version
559         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
560         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
561         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
562             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
563         fi
564         INCREMENTAL_LINKER=1
566         # Check midl version
567         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
568         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
569         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
570         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
571          # Add flags if necessary
572          AC_MSG_CHECKING([for midl flags])
573          if test \( "$_MIDL_MAJOR_VERSION" -gt "6" \) -o \( "$_MIDL_MAJOR_VERSION" = "6" -a "$_MIDL_MINOR_VERSION" -gt "0" \) -o \( "$_MIDL_MAJOR_VERSION" = "6" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" -gt "359" \); then
574              # Starting with MIDL version 6.0.359, the MIDL compiler
575              # generates /Oicf /robust stubs by default, which is not
576              # compatible with versions of Windows older than Win2k.
577              # This switches us back to the old behaviour. When we drop
578              # support for Windows older than Win2k, we should remove
579              # this.
580              MIDL_FLAGS="${MIDL_FLAGS} -no_robust"
581              AC_MSG_RESULT([need -no_robust])
582          else
583              MIDL_FLAGS="${MIDL_FLAGS}"
584              AC_MSG_RESULT([none needed])
585         fi
586         
587         unset _MSVC_VER_FILTER
588         
589     else
590         # Check w32api version
591         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
592         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
593         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
594         AC_TRY_COMPILE([#include <w32api.h>],
595             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
596                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
597                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
598                 #error "test failed."
599             #endif
600             , [ res=yes ], [ res=no ])
601         AC_MSG_RESULT([$res])
602         if test "$res" != "yes"; then
603             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
604         fi
605         # Check windres version
606         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
607         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
608         AC_MSG_RESULT([$_WINDRES_VERSION])
609         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
610         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
611         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
612         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
613         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
614         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
615         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
616                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
617                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
618                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
619                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
620                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
621         then
622             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
623         fi
624     fi # !GNU_CC
626     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
627     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
628     # Require OS features provided by IE 5.0
629     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
630     ;;
631 esac
633 dnl Test breaks icc on OS/2 && MSVC
634 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
635     AC_PROG_CC_C_O
636     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
637         USING_HCC=1
638         _OLDCC=$CC
639         _OLDCXX=$CXX
640         CC="${srcdir}/build/hcc '$CC'"
641         CXX="${srcdir}/build/hcpp '$CXX'"
642     fi
645 AC_PROG_CPP
646 AC_PROG_CXXCPP
648 if test -n "$_WIN32_MSVC"; then
649     SKIP_PATH_CHECKS=1
650     SKIP_COMPILER_CHECKS=1
651     SKIP_LIBRARY_CHECKS=1
654 fi # COMPILE_ENVIRONMENT
656 AC_SUBST(MIDL_FLAGS)
657 AC_SUBST(_MSC_VER)
659 AC_SUBST(GNU_AS)
660 AC_SUBST(GNU_LD)
661 AC_SUBST(GNU_CC)
662 AC_SUBST(GNU_CXX)
663 AC_SUBST(INTEL_CC)
664 AC_SUBST(INTEL_CXX)
666 dnl ========================================================
667 dnl Checks for programs.
668 dnl ========================================================
669 AC_PROG_INSTALL
670 AC_PROG_LN_S
671 AC_PATH_PROGS(PERL, $PERL perl5 perl )
672 if test -z "$PERL" || test "$PERL" = ":"; then
673     AC_MSG_ERROR([perl not found in \$PATH])
676 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
677 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
678 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
679 _perl_res=$?
680 AC_MSG_RESULT([$_perl_version])
682 if test "$_perl_res" != 0; then
683     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
687 AC_MSG_CHECKING([for full perl installation])
688 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
689 _perl_res=$?
690 if test "$_perl_res" != 0; then
691     AC_MSG_RESULT([no])
692     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
693 else
694     AC_MSG_RESULT([yes])    
697 AC_PATH_PROGS(PYTHON, $PYTHON python)
698 if test -z "$PYTHON"; then
699     AC_MSG_ERROR([python was not found in \$PATH])
702 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
703 if test -z "$COMPILE_ENVIRONMENT"; then
704 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
705     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
708 AC_SUBST(NSINSTALL_BIN)
710 AC_PATH_PROG(DOXYGEN, doxygen, :)
711 AC_PATH_PROG(WHOAMI, whoami, :)
712 AC_PATH_PROG(AUTOCONF, autoconf, :)
713 AC_PATH_PROG(UNZIP, unzip, :)
714 AC_PATH_PROGS(ZIP, zip)
715 if test -z "$ZIP" || test "$ZIP" = ":"; then
716     AC_MSG_ERROR([zip not found in \$PATH])
718 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
719 AC_PATH_PROG(XARGS, xargs)
720 if test -z "$XARGS" || test "$XARGS" = ":"; then
721     AC_MSG_ERROR([xargs not found in \$PATH .])
724 if test "$COMPILE_ENVIRONMENT"; then
726 dnl ========================================================
727 dnl = Mac OS X toolchain support
728 dnl ========================================================
730 case "$target_os" in
731 darwin*)
732     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
733     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
734     dnl the environment and includedir purposes (when using an SDK, below),
735     dnl but remember the full version number for the libdir (SDK).
736     changequote(,)
737     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
738     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
739     changequote([,])
740     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
741         dnl Bug 280479, but this keeps popping up in bug 292530 too because
742         dnl 4.0.0/4061 is the default compiler in Tiger.
743         changequote(,)
744         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
745         changequote([,])
746         if test "$GCC_BUILD" = "4061" ; then
747             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
748 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
749 from building Mozilla. Upgrade to Xcode 2.1 or later.])
750         fi
751     fi
753     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
754     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
755     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
756     AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
758     case "$PBBUILD" in
759       *xcodebuild*)
760         changequote(,)
761         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
762         changequote([,])
763         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
764           HAS_XCODE_2_1=1;
765         fi
766       ;;
767     esac
769     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
770     dnl it has moved into /usr/bin.
771     AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
772     ;;
773 esac
775 AC_SUBST(GCC_VERSION)
776 AC_SUBST(XCODEBUILD_VERSION)
777 AC_SUBST(HAS_XCODE_2_1)
779 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
780 dnl that a universal binary is being produced.
781 AC_SUBST(UNIVERSAL_BINARY)
783 dnl ========================================================
784 dnl Check for MacOS deployment target version
785 dnl ========================================================
787 MOZ_ARG_ENABLE_STRING(macos-target,
788                       [  --enable-macos-target=VER (default=10.4)
789                           Set the minimum MacOS version needed at runtime],
790                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
792 case "$target" in
793 *-darwin*)
794     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
795         dnl Use the specified value
796         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
797         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
798     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
799         dnl No value specified on the command line or in the environment,
800         dnl use the lesser of the application's minimum or the architecture's
801         dnl minimum.
802         export MACOSX_DEPLOYMENT_TARGET=10.4
803     fi
804     ;;
805 esac
807 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
809 dnl ========================================================
810 dnl = Mac OS X SDK support
811 dnl ========================================================
812 MACOS_SDK_DIR=
813 NEXT_ROOT=
814 MOZ_ARG_WITH_STRING(macos-sdk,
815 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
816     MACOS_SDK_DIR=$withval)
818 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
819 dnl NEXT_ROOT will be set and exported only if it's needed.
820 AC_SUBST(MACOS_SDK_DIR)
821 AC_SUBST(NEXT_ROOT)
823 if test "$MACOS_SDK_DIR"; then
824   dnl Sync this section with the ones in NSPR and NSS.
825   dnl Changes to the cross environment here need to be accounted for in
826   dnl the libIDL checks (below) and xpidl build.
828   if test ! -d "$MACOS_SDK_DIR"; then
829     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
830 specify a valid SDK.  SDKs are installed when the optional cross-development
831 tools are selected during the Xcode/Developer Tools installation.])
832   fi
834   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
835   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
836     SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include -F${MACOS_SDK_DIR}/System/Library/Frameworks"
837     if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
838       SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
839     fi
840     SDK_CXX_INCLUDE="-I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++ -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/ppc-darwin -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/backward"
842     CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
843     CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
845     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
846     CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
847     CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
849     dnl ld support for -syslibroot is compiler-agnostic, but only available
850     dnl on Tiger.  Although it's possible to switch on the build host's
851     dnl OS release to use ld -syslibroot when available, ld -syslibroot will
852     dnl cause warnings as long as NEXT_ROOT is set.  NEXT_ROOT should be
853     dnl set because both the compiler and linker use it.
854     LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib $LIBS"
855     export NEXT_ROOT=$MACOS_SDK_DIR
857     if test -n "$CROSS_COMPILE" ; then
858       dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
859       dnl the build host.  HOST_CXX is presently unused.
860       HOST_CC="NEXT_ROOT= $HOST_CC"
861       HOST_CXX="NEXT_ROOT= $HOST_CXX"
862     fi
863   else
864     dnl gcc >= 4.0 uses different paths than above, but knows how to find
865     dnl them itself.
866     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
867     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
869     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
870     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
871     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
873     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
874       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
875       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
876       dnl be ignored and cause warnings when -syslibroot is specified.
877       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
878       dnl the -isysroot it receives, so this is only needed with 4.0.0.
879       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
880     fi
881   fi
883   AC_LANG_SAVE
884   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
885   AC_LANG_CPLUSPLUS
886   AC_TRY_COMPILE([#include <new>
887                  int main() { return 0; }],
888    result=yes,
889    result=no)
890   AC_LANG_RESTORE
891   AC_MSG_RESULT($result)
893   if test "$result" = "no" ; then
894     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
895   fi
898 fi # COMPILE_ENVIRONMENT
900 dnl Be sure the make we use is GNU make.
901 dnl on win32, gmake.exe is the generally the wrong version
902 case "$host_os" in
903 cygwin*|mingw*|mks*|msvc*)
904     AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
905     ;;
907     AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
908     ;;
909 esac
910 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
911 if test ! "$_make_try"
912 then
913         echo
914         echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
915         echo
916         exit 1
918 dnl Now exit if version if < MAKE_VERSION
919 rm -f dummy.mk
920 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
921 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
922 rm -f dummy.mk
923 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
924 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
925 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
926 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
927 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
928    test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
929         "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
930    AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
932 AC_SUBST(MAKE)
934 if test "$COMPILE_ENVIRONMENT"; then
936 AC_PATH_XTRA
938 dnl Check in X11 include directory too.
939 if test "$no_x" != "yes"; then
940     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
943 XCFLAGS="$X_CFLAGS"
945 fi # COMPILE_ENVIRONMENT
947 dnl ========================================================
948 dnl set the defaults first
949 dnl ========================================================
950 AS_BIN=$AS
951 AR_FLAGS='cr $@'
952 AR_LIST='$(AR) t'
953 AR_EXTRACT='$(AR) x'
954 AR_DELETE='$(AR) d'
955 AS='$(CC)'
956 AS_DASH_C_FLAG='-c'
957 DLL_PREFIX=lib
958 LIB_PREFIX=lib
959 DLL_SUFFIX=.so
960 OBJ_SUFFIX=o
961 LIB_SUFFIX=a
962 ASM_SUFFIX=s
963 IMPORT_LIB_SUFFIX=
964 TARGET_MD_ARCH=unix
965 DIRENT_INO=d_ino
966 CYGWIN_WRAPPER=
967 WIN_TOP_SRC=
968 MOZ_USER_DIR=".mozilla"
969 HOST_AR='$(AR)'
970 HOST_AR_FLAGS='$(AR_FLAGS)'
972 MOZ_JPEG_CFLAGS=
973 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
974 MOZ_ZLIB_CFLAGS=
975 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
976 MOZ_BZ2_CFLAGS=
977 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
978 MOZ_PNG_CFLAGS=
979 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
981 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
982 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
983 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(PREFIX)/lib'
984 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
985 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
986 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
987 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
989 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
990 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
992 USE_DEPENDENT_LIBS=1
994 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
995 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
997 MOZ_ENABLE_POSTSCRIPT=1 
999 if test -n "$CROSS_COMPILE"; then
1000     OS_TARGET="${target_os}"
1001     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1002     OS_RELEASE=
1003     case "${target_os}" in
1004         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1005         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1006         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1007         mingw*)       OS_ARCH=WINNT ;;
1008         wince*)       OS_ARCH=WINCE ;;
1009         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1010     esac
1011 else
1012     OS_TARGET=`uname -s`
1013     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1014     OS_RELEASE=`uname -r`
1017 # Before this used `uname -m` when not cross compiling
1018 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1019 OS_TEST="${target_cpu}"
1021 _COMPILER_PREFIX=
1023 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1025 #######################################################################
1026 # Master "Core Components" macros for getting the OS target           #
1027 #######################################################################
1030 # Note: OS_TARGET should be specified on the command line for gmake.
1031 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
1032 # The difference between the Win95 target and the WinNT target is that
1033 # the WinNT target uses Windows NT specific features not available
1034 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
1035 # at lesser performance (the Win95 target uses threads; the WinNT target
1036 # uses fibers).
1038 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1039 # cross-compilation.
1043 # The following hack allows one to build on a WIN95 machine (as if
1044 # s/he were cross-compiling on a WINNT host for a WIN95 target).
1045 # It also accomodates for MKS's uname.exe.  If you never intend
1046 # to do development on a WIN95 machine, you don't need this hack.
1048 case "$OS_ARCH" in
1049 WIN95)
1050     OS_ARCH=WINNT
1051     OS_TARGET=WIN95
1052     ;;
1053 Windows_95)
1054     OS_ARCH=Windows_NT
1055     OS_TARGET=WIN95
1056     ;;
1057 Windows_98)
1058     OS_ARCH=Windows_NT
1059     OS_TARGET=WIN95
1060     ;;
1061 CYGWIN_9*|CYGWIN_ME*)
1062     OS_ARCH='CYGWIN_NT-4.0'
1063     OS_TARGET=WIN95
1064     ;;
1065 esac
1068 # Define and override various archtecture-specific variables, including
1069 # HOST_OS_ARCH
1070 # OS_ARCH
1071 # OS_TEST
1072 # OS_TARGET
1073 # OS_RELEASE
1074 # OS_MINOR_RELEASE
1077 case "$HOST_OS_ARCH" in
1078 cygwin*|mingw*|mks*|msvc*)
1079     HOST_OS_ARCH=WINNT
1080     ;;
1081 linux*)
1082     HOST_OS_ARCH=Linux
1083     ;;
1084 solaris*)
1085     HOST_OS_ARCH=SunOS
1086     ;;
1087 BSD_386)
1088     HOST_OS_ARCH=BSD
1089     ;;
1090 dgux)
1091     HOST_OS_ARCH=DGUX
1092     ;;
1093 IRIX64)
1094     HOST_OS_ARCH=IRIX
1095     ;;
1096 UNIX_SV)
1097     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1098         HOST_OS_ARCH=NCR
1099     else
1100         HOST_OS_ARCH=UNIXWARE
1101     fi
1102     ;;
1103 ncr)
1104     HOST_OS_ARCH=NCR
1105     ;;
1106 UNIX_SYSTEM_V)
1107     HOST_OS_ARCH=NEC
1108     ;;
1109 OSF1)
1110     ;;
1111 *OpenVMS*)
1112     HOST_OS_ARCH=OpenVMS
1113     ;;
1114 OS_2)
1115     HOST_OS_ARCH=OS2
1116     ;;
1117 QNX)
1118     ;;
1119 SCO_SV)
1120     HOST_OS_ARCH=SCOOS
1121     ;;
1122 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1123     HOST_OS_ARCH=SINIX
1124     ;;
1125 UnixWare)
1126     HOST_OS_ARCH=UNIXWARE
1127     ;;
1128 esac
1130 case "$OS_ARCH" in
1131 WINNT)
1132     OS_TEST=`uname -p`
1133     ;;
1134 Windows_NT)
1136 # If uname -s returns "Windows_NT", we assume that we are using
1137 # the uname.exe in MKS toolkit.
1139 # The -r option of MKS uname only returns the major version number.
1140 # So we need to use its -v option to get the minor version number.
1141 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1143     OS_ARCH=WINNT
1144     OS_TARGET=WINNT
1145     OS_MINOR_RELEASE=`uname -v`
1146     if test "$OS_MINOR_RELEASE" = "00"; then
1147         OS_MINOR_RELEASE=0
1148     fi
1149     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1150     ;;
1151 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1153 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1154 # the uname.exe in the Cygwin tools.
1155 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1156 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1157 # the uname.exe in the GNU-Win32 tools.
1158 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1159 # the uname.exe in the MSYS tools.
1161     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1162     OS_ARCH=WINNT
1163     OS_TARGET=WINNT
1164     ;;
1165 AIX)
1166     OS_RELEASE=`uname -v`.`uname -r`
1167     OS_TEST=${target_cpu}
1168     ;;
1169 BSD_386)
1170     OS_ARCH=BSD
1171     ;;
1172 dgux)
1173     OS_ARCH=DGUX
1174     ;;
1175 IRIX64)
1176     OS_ARCH=IRIX
1177     ;;
1178 UNIX_SV)
1179     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1180         OS_ARCH=NCR
1181     else
1182         OS_ARCH=UNIXWARE
1183         OS_RELEASE=`uname -v`
1184     fi
1185     ;;
1186 ncr)
1187     OS_ARCH=NCR
1188     ;;
1189 UNIX_SYSTEM_V)
1190     OS_ARCH=NEC
1191     ;;
1192 OSF1)
1193     case `uname -v` in
1194     148)
1195         OS_RELEASE=V3.2C
1196         ;;
1197     564)
1198         OS_RELEASE=V4.0B
1199         ;;
1200     878)
1201         OS_RELEASE=V4.0D
1202         ;;
1203     esac
1204     ;;
1205 *OpenVMS*)
1206     OS_ARCH=OpenVMS
1207     OS_RELEASE=`uname -v`
1208     OS_TEST=`uname -p`
1209     ;;
1210 OS_2)
1211     OS_ARCH=OS2
1212     OS_TARGET=OS2
1213     OS_RELEASE=`uname -v`
1214     ;;
1215 QNX)
1216     if test "$OS_TARGET" != "NTO"; then
1217         changequote(,)
1218         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1219         changequote([,])
1220     fi
1221     OS_TEST=x86
1222     ;;
1223 SCO_SV)
1224     OS_ARCH=SCOOS
1225     OS_RELEASE=5.0
1226     ;;
1227 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1228     OS_ARCH=SINIX
1229     OS_TEST=`uname -p`
1230     ;;
1231 UnixWare)
1232     OS_ARCH=UNIXWARE
1233     OS_RELEASE=`uname -v`
1234     ;;
1235 WINCE)
1236     OS_ARCH=WINCE
1237     OS_TARGET=WINCE
1238     ;;
1239 Darwin)
1240     case "${target_cpu}" in
1241     powerpc*)
1242         OS_TEST=ppc
1243         ;;
1244     i*86*)
1245         OS_TEST=i386 
1246         ;;
1247     *)
1248         if test -z "$CROSS_COMPILE" ; then
1249             OS_TEST=`uname -p`
1250         fi
1251         ;;
1252     esac
1253     ;;
1254 esac
1256 if test "$OS_ARCH" = "NCR"; then
1257     changequote(,)
1258     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1259     changequote([,])
1262 # Only set CPU_ARCH if we recognize the value of OS_TEST
1264 case "$OS_TEST" in
1265 *86 | i86pc)
1266     CPU_ARCH=x86
1267     ;;
1269 powerpc* | ppc | rs6000)
1270     CPU_ARCH=ppc
1271     ;;
1273 Alpha | alpha | ALPHA)
1274     CPU_ARCH=Alpha
1275     ;;
1277 hppa* | parisc)
1278     CPU_ARCH=hppa
1279     ;;
1281 sun4u | sparc*)
1282     CPU_ARCH=sparc
1283     ;;
1285 x86_64 | ia64)
1286     CPU_ARCH="$OS_TEST"
1287     ;;
1288 esac
1290 if test -z "$OS_TARGET"; then
1291     OS_TARGET=$OS_ARCH
1293 if test "$OS_TARGET" = "WIN95"; then
1294     OS_RELEASE="4.0"
1296 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1298 dnl ========================================================
1299 dnl GNU specific defaults
1300 dnl ========================================================
1301 if test "$GNU_CC"; then
1302     # FIXME: Let us build with strict aliasing. bug 414641.
1303     CFLAGS="$CFLAGS -fno-strict-aliasing"
1304     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1305     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1306     DSO_LDOPTS='-shared'
1307     if test "$GCC_USE_GNU_LD"; then
1308         # Don't allow undefined symbols in libraries
1309         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1310     fi
1311     WARNINGS_AS_ERRORS='-Werror'
1312     DSO_CFLAGS=''
1313     DSO_PIC_CFLAGS='-fPIC'
1314     ASFLAGS="$ASFLAGS -fPIC"
1315     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1316     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1317     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1318     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1320     # Turn on GNU specific features
1321     # -Wall - turn on all warnings
1322     # -pedantic - make compiler warn about non-ANSI stuff, and
1323     #             be a little bit stricter
1324     # Warnings slamm took out for now (these were giving more noise than help):
1325     # -Wbad-function-cast - warns when casting a function to a new return type
1326     # -Wshadow - removed because it generates more noise than help --pete
1327     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1328     if test -z "$INTEL_CC"; then
1329        # Don't use -Wcast-align with ICC
1330        case "$CPU_ARCH" in
1331            # And don't use it on hppa, ia64, sparc, since it's noisy there
1332            hppa | ia64 | sparc)
1333            ;;
1334            *)
1335         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1336            ;;
1337        esac
1338     fi
1340     dnl Turn pedantic on but disable the warnings for long long
1341     _PEDANTIC=1
1343     if test -z "$INTEL_CC"; then
1344       _IGNORE_LONG_LONG_WARNINGS=1
1345       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1346     else
1347       _IGNORE_LONG_LONG_WARNINGS=
1348     fi
1351     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1352     _USE_CPP_INCLUDE_FLAG=1
1353 else
1354     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1355     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1357     DSO_LDOPTS='-shared'
1358     if test "$GNU_LD"; then
1359         # Don't allow undefined symbols in libraries
1360         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1361     fi
1363     DSO_CFLAGS=''
1364     DSO_PIC_CFLAGS='-KPIC'
1365     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1368 if test "$GNU_CXX"; then
1369     # FIXME: Let us build with strict aliasing. bug 414641.
1370     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1371     # Turn on GNU specific features
1372     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1373     if test -z "$INTEL_CC"; then
1374        # Don't use -Wcast-align with ICC
1375        case "$CPU_ARCH" in
1376            # And don't use it on hppa, ia64, sparc, since it's noisy there
1377            hppa | ia64 | sparc)
1378            ;;
1379            *)
1380         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1381            ;;
1382        esac
1383     fi
1385     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1386     _USE_CPP_INCLUDE_FLAG=1
1388     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1389                    ac_has_wno_invalid_offsetof,
1390         [
1391             AC_LANG_SAVE
1392             AC_LANG_CPLUSPLUS
1393             _SAVE_CXXFLAGS="$CXXFLAGS"
1394             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1395             AC_TRY_COMPILE([],
1396                            [return(0);],
1397                            ac_has_wno_invalid_offsetof="yes",
1398                            ac_has_wno_invalid_offsetof="no")
1399             CXXFLAGS="$_SAVE_CXXFLAGS"
1400             AC_LANG_RESTORE
1401         ])
1402     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1403         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1404     fi
1405 else
1406     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1409 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1410 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1411 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1412 dnl normal behavior.
1413 dnl ========================================================
1414 MKSHLIB_FORCE_ALL=
1415 MKSHLIB_UNFORCE_ALL=
1417 if test "$COMPILE_ENVIRONMENT"; then
1418 if test "$GNU_CC"; then
1419   AC_MSG_CHECKING(whether ld has archive extraction flags)
1420   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1421    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1422     ac_cv_mkshlib_force_and_unforce="no"
1423     exec 3<&0 <<LOOP_INPUT
1424         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1425         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1426         force="-Wl,-all";              unforce="-Wl,-none"
1427 LOOP_INPUT
1428     while read line
1429     do
1430       eval $line
1431       LDFLAGS=$force
1432       LIBS=$unforce
1433       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1434     done
1435     exec 0<&3 3<&-
1436     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1437    ])
1438   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1439     AC_MSG_RESULT(no)
1440   else
1441     AC_MSG_RESULT(yes)
1442     eval $ac_cv_mkshlib_force_and_unforce
1443     MKSHLIB_FORCE_ALL=$force
1444     MKSHLIB_UNFORCE_ALL=$unforce
1445   fi
1446 fi # GNU_CC
1447 fi # COMPILE_ENVIRONMENT
1449 dnl =================================================================
1450 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1451 dnl which is bad when cross compiling.
1452 dnl =================================================================
1453 if test "$COMPILE_ENVIRONMENT"; then
1454 configure_static_assert_macros='
1455 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1456 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1457 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1460 dnl test that the macros actually work:
1461 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1462 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1463  [AC_LANG_SAVE
1464   AC_LANG_C
1465   ac_cv_static_assertion_macros_work="yes"
1466   AC_TRY_COMPILE([$configure_static_assert_macros],
1467                  [CONFIGURE_STATIC_ASSERT(1)],
1468                  ,
1469                  ac_cv_static_assertion_macros_work="no")
1470   AC_TRY_COMPILE([$configure_static_assert_macros],
1471                  [CONFIGURE_STATIC_ASSERT(0)],
1472                  ac_cv_static_assertion_macros_work="no",
1473                  )
1474   AC_LANG_CPLUSPLUS
1475   AC_TRY_COMPILE([$configure_static_assert_macros],
1476                  [CONFIGURE_STATIC_ASSERT(1)],
1477                  ,
1478                  ac_cv_static_assertion_macros_work="no")
1479   AC_TRY_COMPILE([$configure_static_assert_macros],
1480                  [CONFIGURE_STATIC_ASSERT(0)],
1481                  ac_cv_static_assertion_macros_work="no",
1482                  )
1483   AC_LANG_RESTORE
1484  ])
1485 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1486 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1487     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1489 fi # COMPILE_ENVIRONMENT
1491 dnl ========================================================
1492 dnl Checking for 64-bit OS
1493 dnl ========================================================
1494 if test "$COMPILE_ENVIRONMENT"; then
1495 AC_LANG_SAVE
1496 AC_LANG_C
1497 AC_MSG_CHECKING(for 64-bit OS)
1498 AC_TRY_COMPILE([$configure_static_assert_macros],
1499                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1500                result="yes", result="no")
1501 AC_MSG_RESULT("$result")
1502 if test "$result" = "yes"; then
1503     AC_DEFINE(HAVE_64BIT_OS)
1504     HAVE_64BIT_OS=1
1506 AC_SUBST(HAVE_64BIT_OS)
1507 AC_LANG_RESTORE
1508 fi # COMPILE_ENVIRONMENT
1510 dnl ========================================================
1511 dnl Enable high-memory support on OS/2 by default.
1512 dnl ========================================================
1513 MOZ_OS2_HIGH_MEMORY=1
1514 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1515 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1516     MOZ_OS2_HIGH_MEMORY=,
1517     MOZ_OS2_HIGH_MEMORY=1 )
1518 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1520 dnl ========================================================
1521 dnl System overrides of the defaults for host
1522 dnl ========================================================
1523 case "$host" in
1524 *-beos*)
1525     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1526     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1527     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1528     ;;
1530 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1531     if test -n "$_WIN32_MSVC"; then
1532         HOST_AR=lib
1533         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1534         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1535         HOST_RANLIB='echo ranlib'
1536     else
1537         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1538     fi
1539     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1540     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1541     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1542     HOST_BIN_SUFFIX=.exe
1543     case "$host" in
1544     *mingw*)
1545     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1546         ;;
1547     *)
1548         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1549         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1550             _pwd=`pwd`
1551             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1552         fi
1553         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1554             AS_PERL=1
1555             PERL="${CYGWIN_WRAPPER} $PERL"
1556         fi
1558         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1559             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1560         fi
1561         ;;
1562     esac
1563     ;;
1565 *-darwin*)
1566     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1567     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1568     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1569     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1570     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1571     ;;
1573 *-linux*|*-kfreebsd*-gnu)
1574     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1575     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1576     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1577     ;;
1579 *os2*)
1580     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1581     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1582     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1583     HOST_BIN_SUFFIX=.exe
1584     MOZ_FIX_LINK_PATHS=
1585     ;;
1587 *-osf*)
1588     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1589     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1590     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1591     ;;
1594     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1595     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1596     ;;
1597 esac
1599 dnl Get mozilla version from central milestone file
1600 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1602 dnl Get version of various core apps from the version files.
1603 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1605 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1606 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1608 dnl ========================================================
1609 dnl System overrides of the defaults for target
1610 dnl ========================================================
1612 case "$target" in
1613 *-aix*)
1614     AC_DEFINE(AIX)
1615     if test ! "$GNU_CC"; then
1616         if test ! "$HAVE_64BIT_OS"; then
1617             # Compiling with Visual Age C++ object model compat is the
1618             # default. To compile with object model ibm, add 
1619             # AIX_OBJMODEL=ibm to .mozconfig.
1620             if test "$AIX_OBJMODEL" = "ibm"; then
1621                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1622             else
1623                 AIX_OBJMODEL=compat
1624             fi
1625         else
1626             AIX_OBJMODEL=compat
1627         fi
1628         AC_SUBST(AIX_OBJMODEL)
1629         DSO_LDOPTS='-qmkshrobj=1'
1630         DSO_CFLAGS='-qflag=w:w'
1631         DSO_PIC_CFLAGS=
1632         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1633         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1634         MOZ_FIX_LINK_PATHS=
1635         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1636         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1637         if test "$COMPILE_ENVIRONMENT"; then
1638             AC_LANG_SAVE
1639             AC_LANG_CPLUSPLUS
1640             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1641             AC_TRY_COMPILE([],
1642                 [#if (__IBMCPP__ < 600)
1643                  #error "Bad compiler"
1644                  #endif],
1645                 _BAD_COMPILER=,_BAD_COMPILER=1)
1646             if test -n "$_BAD_COMPILER"; then
1647                 AC_MSG_RESULT([no])    
1648                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1649             else
1650                 AC_MSG_RESULT([yes])    
1651             fi
1652             AC_LANG_RESTORE
1653             TARGET_COMPILER_ABI="ibmc"
1654             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1655             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1656         fi
1657     fi
1658     case "${target_os}" in
1659     aix4.1*)
1660         DLL_SUFFIX='_shr.a'
1661         ;;
1662     esac
1663     if test "$COMPILE_ENVIRONMENT"; then
1664         AC_CHECK_HEADERS(sys/inttypes.h)
1665     fi
1666     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1667     ;;
1669 *-beos*)
1670     no_x=yes
1671     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1672     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1673     DSO_LDOPTS='-nostart'
1674     TK_LIBS='-lbe -lroot'
1675     LIBS="$LIBS -lbe"
1676     if test "$COMPILE_ENVIRONMENT"; then
1677         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1678         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1679     fi
1680     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1681     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1682     _MOZ_USE_RTTI=1
1683     USE_DEPENDENT_LIBS=
1684     MOZ_USER_DIR="Mozilla"
1685     ;;
1687 *-bsdi*)
1688     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1689     _PEDANTIC=
1690     _IGNORE_LONG_LONG_WARNINGS=
1691     case $OS_RELEASE in
1692         4.*|5.*)
1693             STRIP="$STRIP -d"
1694             ;;
1695         *)
1696             DSO_CFLAGS=''
1697             DSO_LDOPTS='-r'
1698             _WARNINGS_CFLAGS="-Wall"
1699             _WARNINGS_CXXFLAGS="-Wall"
1700             # The test above doesn't work properly, at least on 3.1.
1701             MKSHLIB_FORCE_ALL=''
1702             MKSHLIB_UNFORCE_ALL=''
1703         ;;
1704     esac
1705     ;;
1707 *-darwin*) 
1708     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1709     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1710     MOZ_OPTIMIZE_FLAGS="-O2"
1711     _PEDANTIC=
1712     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1713     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1714     DLL_SUFFIX=".dylib"
1715     DSO_LDOPTS=''
1716     STRIP="$STRIP -x -S"
1717     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1718     MOZ_ENABLE_POSTSCRIPT=
1719     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1720     LDFLAGS="$LDFLAGS -framework Cocoa"
1721     # The ExceptionHandling framework is needed for Objective-C exception
1722     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1723     # builds.
1724     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1725     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1726     MACOSX=1
1728     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1729     dnl ===================================================================
1730     if test "x$enable_dtrace" = "xyes"; then
1731         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1732     else
1733         dnl check for the presence of the -dead_strip linker flag
1734         AC_MSG_CHECKING([for -dead_strip option to ld])
1735         _SAVE_LDFLAGS=$LDFLAGS
1736         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1737         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1738         if test -n "$_HAVE_DEAD_STRIP" ; then
1739             AC_MSG_RESULT([yes])
1740             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1741         else
1742             AC_MSG_RESULT([no])
1743         fi
1744         
1745         LDFLAGS=$_SAVE_LDFLAGS
1746     fi
1747     ;;
1749 *-freebsd*)
1750     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1751         DLL_SUFFIX=".so.1.0"
1752         DSO_LDOPTS="-shared"
1753     fi
1754     if test ! "$GNU_CC"; then
1755         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1756     fi
1757 # Can't have force w/o an unforce.
1758 #    # Hack for FreeBSD 2.2
1759 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1760 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1761 #       MKSHLIB_UNFORCE_ALL=''
1762 #    fi
1763     ;; 
1765 *-hpux*)
1766     DLL_SUFFIX=".sl"
1767     if test ! "$GNU_CC"; then
1768         DSO_LDOPTS='-b -Wl,+s'
1769         DSO_CFLAGS=""
1770         DSO_PIC_CFLAGS="+Z"
1771         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1772         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1773         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1774     else
1775         DSO_LDOPTS='-b -E +s'
1776         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1777         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1778     fi
1779     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1780     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1781     ;;
1783 *-irix5*)
1784     AC_DEFINE(IRIX)
1785     DSO_LDOPTS='-elf -shared'
1787     if test "$GNU_CC"; then
1788        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1789        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1790        MKSHLIB_FORCE_ALL='-Wl,-all'
1791        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1792        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1793     else
1794        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1795        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1796        MKSHLIB_FORCE_ALL='-all'
1797        MKSHLIB_UNFORCE_ALL='-none'
1798     fi
1799     ;;
1801 *-irix6*)
1802     AC_DEFINE(IRIX)
1803     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1804     dnl compile and link using -n32
1805     USE_N32=1
1806     TARGET_COMPILER_ABI=n32
1807     DSO_LDOPTS='-elf -shared'
1808     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1809     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1810     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1811     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1812     if test "$GNU_CC"; then
1813        MKSHLIB_FORCE_ALL='-Wl,-all'
1814        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1815        _WARNINGS_CFLAGS="-Wall"
1816        _WARNINGS_CXXFLAGS="-Wall"
1817        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1818     else
1819        MKSHLIB_FORCE_ALL='-all'
1820        MKSHLIB_UNFORCE_ALL='-none'
1821            AR_LIST="$AR t"
1822            AR_EXTRACT="$AR x"
1823            AR_DELETE="$AR d"
1824            AR='$(CXX) -ar'
1825            AR_FLAGS='-o $@'
1826        CFLAGS="$CFLAGS -woff 3262 -G 4"
1827        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1828        if test -n "$USE_N32"; then
1829            ASFLAGS="$ASFLAGS -n32"
1830            CFLAGS="$CFLAGS -n32"
1831            CXXFLAGS="$CXXFLAGS -n32"
1832            LDFLAGS="$LDFLAGS -n32"
1833        fi
1834        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1835        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1836        MOZ_FIX_LINK_PATHS=
1837     fi
1838     if test -z "$GNU_CXX"; then
1839       MIPSPRO_CXX=1
1840     fi
1841     ;;
1843 *-*linux*)
1844     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1845     # Similarly for GNU_CXX and INTEL_CXX.
1846     if test "$INTEL_CC" || test "$INTEL_CXX"; then
1847         # -Os has been broken on Intel's C/C++ compilers for quite a
1848         # while; Intel recommends against using it.
1849         MOZ_OPTIMIZE_FLAGS="-O2"
1850         MOZ_DEBUG_FLAGS="-g -fno-inline"
1851     elif test "$GNU_CC" || test "$GNU_CXX"; then
1852         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1853         case $GCC_VERSION in
1854         4.1.*|4.2.*)
1855             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1856             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1857         esac
1858         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1859         MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1860                                           # and that combo is not yet good at
1861                                           # debugging inlined functions (even
1862                                           # when using DWARF2 as the debugging
1863                                           # format)
1864     fi
1866     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1868     MOZ_MEMORY=1
1870     case "${target_cpu}" in
1871     alpha*)
1872         CFLAGS="$CFLAGS -mieee"
1873         CXXFLAGS="$CXXFLAGS -mieee"
1874     ;;
1875     i*86)
1876         USE_ELF_DYNSTR_GC=1
1877         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1878     ;;
1879     mips*)
1880         MOZ_DEBUG_FLAGS="-g" # We want inlining
1881     ;;
1882     esac
1883     ;;
1885 *-wince*)
1887     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1888     AR_LIST="$AR -list"
1889     AR_EXTRACT="$AR -extract"
1890     AR_DELETE="$AR d"
1891     AR_FLAGS='-OUT:"$@"'
1893     if test -z "$AS_BIN"; then
1894         AS="$AS_BIN"
1895     fi
1896     DSO_CFLAGS=
1897     DSO_PIC_CFLAGS=
1898     DLL_SUFFIX=.dll
1899     BIN_SUFFIX='.exe'
1900     if test -z "$RC"; then 
1901         RC=rc.exe  
1902     fi
1903     # certain versions of cygwin's makedepend barf on the 
1904     # #include <string> vs -I./dist/include/string issue so don't use it
1905     SYSTEM_MAKEDEPEND=
1907     HOST_CC=cl
1908     HOST_CXX=cl
1909     HOST_LD=link
1910     HOST_AR='lib -OUT:$@'
1911     HOST_RANLIB='echo ranlib'
1912     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1913         
1914         
1915     WARNINGS_AS_ERRORS='-WX'
1916         MOZ_OPTIMIZE_FLAGS='-O1'
1917     AR_FLAGS='-NOLOGO -OUT:"$@"'
1918     ASM_SUFFIX=asm
1919     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1920     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1921     DLL_PREFIX=
1922     DOXYGEN=:
1923     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1924     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1925     GARBAGE=
1926     IMPORT_LIB_SUFFIX=lib
1927     LIBS="$LIBS"
1928     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1929     LIB_PREFIX=
1930     LIB_SUFFIX=lib 
1931     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1932     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1933     MKSHLIB_FORCE_ALL=
1934     MKSHLIB_UNFORCE_ALL=
1935     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1936     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1937     MOZ_DEBUG_FLAGS='-Zi'
1938     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1939     MOZ_FIX_LINK_PATHS=
1940     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1941     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1942     OBJ_SUFFIX=obj
1943     RANLIB='echo not_ranlib'
1944     STRIP='echo not_strip'
1945     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1946     UNZIP=unzip
1947     XARGS=xargs
1948     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1949     ZIP=zip
1950     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1951     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1952     STATIC_LIBIDL=1
1954     AC_DEFINE(HAVE_SNPRINTF)
1955     AC_DEFINE(_WINDOWS)
1956     AC_DEFINE(_WIN32)
1957     AC_DEFINE(WIN32)
1958     AC_DEFINE(XP_WIN)
1959     AC_DEFINE(XP_WIN32)
1960     AC_DEFINE(HW_THREADS)
1961     AC_DEFINE(STDC_HEADERS)
1962     AC_DEFINE(NEW_H, <new>)
1963     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1965     TARGET_MD_ARCH=win32
1966     _PLATFORM_DEFAULT_TOOLKIT='windows'
1967     BIN_SUFFIX='.exe'
1968     USE_SHORT_LIBNAME=1
1969     MOZ_ENABLE_POSTSCRIPT=
1970     MOZ_USER_DIR="Mozilla"
1974 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1975     DSO_CFLAGS=
1976     DSO_PIC_CFLAGS=
1977     DLL_SUFFIX=.dll
1978     RC=rc.exe
1979     # certain versions of cygwin's makedepend barf on the 
1980     # #include <string> vs -I./dist/include/string issue so don't use it
1981     SYSTEM_MAKEDEPEND=
1982     if test -n "$GNU_CC"; then
1983         CC="$CC -mno-cygwin"
1984         CXX="$CXX -mno-cygwin"
1985         CPP="$CPP -mno-cygwin"
1986         CFLAGS="$CFLAGS -mms-bitfields"
1987         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1988         DSO_LDOPTS='-shared'
1989         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1990         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1991         RC='$(WINDRES)'
1992         # Use temp file for windres (bug 213281)
1993         RCFLAGS='-O coff --use-temp-file'
1994         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1995         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1996         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1997         MOZ_FIX_LINK_PATHS=
1998         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1999         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
2000         DLL_PREFIX=
2001         IMPORT_LIB_SUFFIX=dll.a
2002     else
2003         TARGET_COMPILER_ABI=msvc
2004         HOST_CC='$(CC)'
2005         HOST_CXX='$(CXX)'
2006         HOST_LD='$(LD)'
2007         AR='lib -NOLOGO -OUT:"$@"'
2008         AR_FLAGS=
2009         RANLIB='echo not_ranlib'
2010         STRIP='echo not_strip'
2011         XARGS=xargs
2012         ZIP=zip
2013         UNZIP=unzip
2014         DOXYGEN=:
2015         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2016         OBJ_SUFFIX=obj
2017         LIB_SUFFIX=lib
2018         DLL_PREFIX=
2019         LIB_PREFIX=
2020         IMPORT_LIB_SUFFIX=lib
2021         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2022         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2023         MKSHLIB_FORCE_ALL=
2024         MKSHLIB_UNFORCE_ALL=
2025         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2026         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2027         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2028         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2029         MOZ_DEBUG_FLAGS='-Zi'
2030         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2031         WARNINGS_AS_ERRORS='-WX'
2032         MOZ_OPTIMIZE_FLAGS='-O1'
2033         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2034         MOZ_FIX_LINK_PATHS=
2035         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2036         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2037         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2038         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2039         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2040         if test $_MSC_VER -ge 1400; then
2041             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2042             dnl For profile-guided optimization
2043             PROFILE_GEN_CFLAGS="-GL"
2044             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2045             dnl XXX: PGO builds can fail with warnings treated as errors,
2046             dnl specifically "no profile data available" appears to be
2047             dnl treated as an error sometimes. This might be a consequence
2048             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2049             dnl with the linker doing most of the work in the whole-program
2050             dnl optimization/PGO case. I think it's probably a compiler bug,
2051             dnl but we work around it here.
2052             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2053             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2054             dnl Probably also a compiler bug, but what can you do?
2055             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2056             if test -n "$_USE_DYNAMICBASE"; then
2057                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2058             fi
2059         fi
2060     fi
2061     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2062     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2063     AC_DEFINE(HAVE_SNPRINTF)
2064     AC_DEFINE(_WINDOWS)
2065     AC_DEFINE(_WIN32)
2066     AC_DEFINE(WIN32)
2067     AC_DEFINE(XP_WIN)
2068     AC_DEFINE(XP_WIN32)
2069     AC_DEFINE(HW_THREADS)
2070     AC_DEFINE(STDC_HEADERS)
2071     AC_DEFINE(NEW_H, <new>)
2072     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2073     TARGET_MD_ARCH=win32
2074     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2075     BIN_SUFFIX='.exe'
2076     USE_SHORT_LIBNAME=1
2077     MOZ_ENABLE_POSTSCRIPT=
2078     MOZ_USER_DIR="Mozilla"
2080     dnl Hardcode to win95 for now - cls
2081     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2083     dnl set NO_X11 defines here as the general check is skipped on win32
2084     no_x=yes
2085     AC_DEFINE(NO_X11)
2087     dnl MinGW/MSYS doesn't provide or need cygpath
2088     case "$host" in
2089     *-mingw*)
2090         CYGPATH_W=echo
2091         CYGPATH_S=cat
2092         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2093         ;;
2094     *-cygwin*|*-msvc*|*-mks*)
2095         CYGPATH_W="cygpath -a -w"
2096         CYGPATH_S="sed -e s|\\\\|/|g"
2097         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2098         ;;
2099     esac
2100     case "$host" in
2101     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2103     if test -z "$MOZ_TOOLS"; then
2104         AC_MSG_ERROR([MOZ_TOOLS is not set])
2105     fi
2107     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2108     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2109         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2110     fi
2111     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2112         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2113     fi
2114     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2116     if test -n "$GLIB_PREFIX"; then
2117         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2118         if test "$?" = "0"; then
2119             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2120                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2121             fi
2122             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2123         else
2124             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2125         fi
2126     else
2127         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2128     fi
2129     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2130         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2131     fi
2132     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2133     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2134         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2135     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2136         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2137     else
2138         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2139     fi
2141     if test -n "$LIBIDL_PREFIX"; then
2142         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2143         if test "$?" = "0"; then
2144             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2145                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2146             fi
2147             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2148         else
2149             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2150         fi
2151     else
2152         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2153     fi        
2154     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2155         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2156     fi
2157     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2158     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2159         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2160         STATIC_LIBIDL=1
2161     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2162         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2163     else
2164         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2165     fi
2166     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2167     ;;
2169     *) # else cross-compiling
2170         if test -n "$GLIB_PREFIX"; then
2171             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2172             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2173                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2174             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2175                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2176             else
2177                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2178             fi
2179         fi
2180         if test -n "$LIBIDL_PREFIX"; then
2181             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2182             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2183                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2184                 STATIC_LIBIDL=1
2185             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2186                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2187             else
2188                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2189             fi
2190         fi
2191         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2192         ;;
2193     esac 
2196     case "$host_os" in
2197     cygwin*|msvc*|mks*)
2198         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])
2199         ;;
2201     *)
2202         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2204         AC_LANG_SAVE
2205         AC_LANG_CPLUSPLUS
2206         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2207         AC_LANG_RESTORE
2208         ;;
2209     esac
2211     case "$target" in
2212     i*86-*)
2213         AC_DEFINE(_X86_)
2214         ;;
2215     alpha-*)
2216         AC_DEFINE(_ALPHA_)
2217         ;;
2218     mips-*)
2219         AC_DEFINE(_MIPS_)
2220         ;;
2221     *)
2222         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2223         ;;
2224     esac
2225     ;;
2227 *-netbsd*)
2228     DSO_CFLAGS=''
2229     CFLAGS="$CFLAGS -Dunix"
2230     CXXFLAGS="$CXXFLAGS -Dunix"
2231     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2232         DLL_SUFFIX=".so"
2233         DSO_PIC_CFLAGS='-fPIC -DPIC'
2234         DSO_LDOPTS='-shared'
2235         BIN_FLAGS='-Wl,--export-dynamic'
2236     else
2237         DSO_PIC_CFLAGS='-fPIC -DPIC'
2238         DLL_SUFFIX=".so.1.0"
2239         DSO_LDOPTS='-shared'
2240     fi
2241     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2242     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2243     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2244     if test "$LIBRUNPATH"; then
2245         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2246     fi
2247     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2248     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2249     ;;
2251 *-nto*) 
2252         AC_DEFINE(NTO)  
2253         AC_DEFINE(_QNX_SOURCE)
2254         AC_DEFINE(_i386)
2255         OS_TARGET=NTO
2256         WARNINGS_AS_ERRORS=''
2257         MOZ_OPTIMIZE_FLAGS="-O"
2258         MOZ_DEBUG_FLAGS="-gstabs"
2259         USE_PTHREADS=1
2260         _PEDANTIC=
2261         LIBS="$LIBS -lsocket -lstdc++"
2262         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2263         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2264         if test "$with_x" != "yes"
2265         then
2266                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2267             TK_CFLAGS='-I/usr/include/photon'
2268                 TK_LIBS='-lph'
2269         fi
2270         case "${target_cpu}" in
2271         ppc*)
2272         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2273         ;;
2274         esac
2275         case "${host_cpu}" in
2276         i*86)
2277         USE_ELF_DYNSTR_GC=1
2278         ;;
2279         esac
2280         ;;
2282 *-openbsd*)
2283     DLL_SUFFIX=".so.1.0"
2284     DSO_CFLAGS=''
2285     DSO_PIC_CFLAGS='-fPIC'
2286     DSO_LDOPTS='-shared -fPIC'
2287     if test "$LIBRUNPATH"; then
2288         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2289     fi
2290     ;;
2292 *-openvms*) 
2293     AC_DEFINE(NO_PW_GECOS)
2294     AC_DEFINE(NO_UDSOCK)
2295     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2296     USE_PTHREADS=1
2297     MKSHLIB_FORCE_ALL='-all'
2298     MKSHLIB_UNFORCE_ALL='-none'
2299     AS='as'
2300     AS_DASH_C_FLAG='-Wc/names=as_is'
2301     AR_FLAGS='c $@'
2302     DSO_LDOPTS='-shared -auto_symvec'
2303     DSO_PIC_CFLAGS=
2304     MOZ_DEBUG_LDFLAGS='-g'
2305     COMPAQ_CXX=1
2306     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2307     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2308     ;;
2311 *-os2*)
2312     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2313     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2314     AC_DEFINE(OS2)
2315     AC_DEFINE(XP_OS2)
2316     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2317     AC_DEFINE(TCPV40HDRS)
2318     USE_SHORT_LIBNAME=1
2319     DLL_PREFIX=
2320     LIB_PREFIX=
2321     LIB_SUFFIX=lib
2322     BIN_SUFFIX=".exe"
2323     DLL_SUFFIX=".dll"
2324     IMPORT_LIB_SUFFIX=lib
2325     DSO_PIC_CFLAGS=
2326     AR=emxomfar
2327     AR_FLAGS='r $@'
2328     CFLAGS="$CFLAGS -Zomf"
2329     CXXFLAGS="$CXXFLAGS -Zomf"
2330     DSO_LDOPTS='-Zdll'
2331     BIN_FLAGS='-Zlinker /ST:0x100000'
2332     IMPLIB='emximp -o'
2333     FILTER='emxexp -o'
2334     LDFLAGS='-Zmap'
2335     WARNINGS_AS_ERRORS='-Werror'
2336     MOZ_DEBUG_FLAGS="-g -fno-inline"
2337     MOZ_OPTIMIZE_FLAGS="-O2"
2338     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2339     MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2340     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2341     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2342     TARGET_MD_ARCH=os2
2343     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2344     MOZ_ENABLE_POSTSCRIPT=
2345     RC=rc.exe
2346     RCFLAGS='-n'
2347     MOZ_USER_DIR="Mozilla"
2349     if test "$MOZTOOLS"; then
2350         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2351     else
2352         AC_MSG_ERROR([MOZTOOLS is not set])
2353     fi
2354     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2355         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2356         LDFLAGS="$LDFLAGS -Zhigh-mem"
2357         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2358         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2359     fi
2361     # GCC for OS/2 currently predefines these, but we don't want them
2362     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2363     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2365     AC_CACHE_CHECK(for __declspec(dllexport),
2366         ac_os2_declspec,
2367         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2368                         [return 0;],
2369                         ac_os2_declspec="yes",
2370                         ac_os2_declspec="no")])
2371     if test "$ac_os2_declspec" = "yes"; then
2372         FILTER='true'
2373         MOZ_OS2_USE_DECLSPEC='1'
2374     fi
2375     ;;
2377 alpha*-*-osf*)
2378     if test "$GNU_CC"; then
2379       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2380       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2382     else
2383         MOZ_DEBUG_FLAGS='-g'
2384         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2385         CFLAGS="$CFLAGS -ieee"
2386         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2387         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2388         DSO_CFLAGS=
2389         DSO_PIC_CFLAGS=
2390         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2391         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2392         MKSHLIB_FORCE_ALL='-all'
2393         MKSHLIB_UNFORCE_ALL='-none'
2394         dnl Might fix the libxpcom.so breakage on this platform as well....
2395         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2396         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2397     fi
2398     if test -z "$GNU_CXX"; then
2399       COMPAQ_CXX=1
2400     fi
2401     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2402     ;;
2404 *-qnx*) 
2405     DIRENT_INO=d_stat.st_ino
2406     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2407     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2408     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2409     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2410     AC_DEFINE(STDC_HEADERS)
2411     if test "$no_x" = "yes"; then
2412             _PLATFORM_DEFAULT_TOOLKIT='photon'
2413             TK_CFLAGS='-I/usr/nto/include/photon'
2414             TK_LIBS='-lphoton -lphrender'
2415     fi
2416     ;;
2418 *-sco*) 
2419     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2420     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2421     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2422     if test ! "$GNU_CC"; then
2423        DSO_LDOPTS='-G'
2424     fi
2425     ;;
2427 dnl the qsort routine under solaris is faulty
2428 *-solaris*) 
2429     AC_DEFINE(SOLARIS)
2430     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2431     SYSTEM_MAKEDEPEND=
2432     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2433     # libraries one level up (e.g. libnspr4.so)
2434     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2435     LIBS="-lCrun -lCstd $LIBS"
2436     MOZ_MEMORY=1
2437     if test -z "$GNU_CC"; then
2438        NS_USE_NATIVE=1
2439        MOZ_FIX_LINK_PATHS=
2440        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2442        if test "$CPU_ARCH" != "sparc"; then
2443           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2444           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2445        else
2446           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2447           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2448           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2449        fi
2451        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2452        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2453            _SAVE_LDFLAGS=$LDFLAGS
2454            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2455            AC_TRY_LINK([#include <stdio.h>],
2456                        [printf("Hello World\n");],
2457                        ,
2458                        [LDFLAGS=$_SAVE_LDFLAGS])
2459        fi
2460        WARNINGS_AS_ERRORS='-Werror'
2461        MOZ_OPTIMIZE_FLAGS="-xO4"
2462        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2463        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2464        MKSHLIB_FORCE_ALL='-z allextract'
2465        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2466        DSO_LDOPTS='-G -z muldefs'
2467        AR_LIST="$AR t"
2468        AR_EXTRACT="$AR x"
2469        AR_DELETE="$AR d"
2470        AR='$(CXX) -xar'
2471        AR_FLAGS='-o $@'
2472        AS='/usr/ccs/bin/as'
2473        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2474        AS_DASH_C_FLAG=''
2475        TARGET_COMPILER_ABI="sunc"
2476         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2477         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2478        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2479        AC_LANG_SAVE
2480        AC_LANG_CPLUSPLUS
2481        AC_TRY_COMPILE([],
2482            [#if (__SUNPRO_CC < 0x530)
2483            #error "Denied"
2484            #endif],
2485            _BAD_COMPILER=,_BAD_COMPILER=1)
2486         if test -n "$_BAD_COMPILER"; then
2487             _res="no"
2488             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2489         else
2490             _res="yes"
2491         fi
2492         AC_MSG_RESULT([$_res])
2493         AC_LANG_RESTORE
2494     else
2495        ASFLAGS="$ASFLAGS -fPIC"
2496        DSO_LDOPTS='-G'
2497        _WARNINGS_CFLAGS=''
2498        _WARNINGS_CXXFLAGS=''
2499        if test "$OS_RELEASE" = "5.3"; then
2500           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2501        fi
2502     fi
2503     if test "$OS_RELEASE" = "5.5.1"; then
2504        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2505     fi
2506     ;;
2508 *-sunos*) 
2509     DSO_LDOPTS='-Bdynamic'
2510     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2511     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2512     AC_DEFINE(SUNOS4)
2513     AC_DEFINE(SPRINTF_RETURNS_STRING)
2514     case "$(target_os)" in
2515     sunos4.1*)
2516         DLL_SUFFIX='.so.1.0'
2517         ;;
2518     esac
2519     ;;
2521 *-sysv4.2uw7*) 
2522         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2523     ;;
2525 *-os2*)
2526     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2527     ;;
2529 esac
2531 dnl Only one oddball right now (QNX), but this gives us flexibility
2532 dnl if any other platforms need to override this in the future.
2533 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2535 dnl ========================================================
2536 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2537 dnl by now will not have any way to link most binaries (tests
2538 dnl as well as viewer, apprunner, etc.), because some symbols
2539 dnl will be left out of the "composite" .so's by ld as unneeded.
2540 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2541 dnl they can link in the static libs that provide the missing
2542 dnl symbols.
2543 dnl ========================================================
2544 NO_LD_ARCHIVE_FLAGS=
2545 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2546     NO_LD_ARCHIVE_FLAGS=1
2548 case "$target" in
2549 *-os2*)
2550     NO_LD_ARCHIVE_FLAGS=
2551     ;;
2552 *-aix4.3*|*-aix5*)
2553     NO_LD_ARCHIVE_FLAGS=
2554     ;;
2555 *-openvms*)
2556     NO_LD_ARCHIVE_FLAGS=
2557     ;;
2558 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2559     if test -z "$GNU_CC"; then
2560         NO_LD_ARCHIVE_FLAGS=
2561     fi
2562     ;;
2563 esac
2564 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2567 dnl Indicate that platform requires special thread safe 
2568 dnl locking when starting up the OJI JVM 
2569 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2570 dnl ========================================================
2571 case "$target" in
2572     *-hpux*)      
2573         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2574         ;;
2575 esac
2577 dnl ========================================================
2578 dnl = Flags to strip unused symbols from .so components
2579 dnl ========================================================
2580 case "$target" in
2581     *-linux*|*-kfreebsd*-gnu)
2582         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2583         ;;
2584     *-solaris*)
2585         if test -z "$GNU_CC"; then
2586          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2587         else
2588          if test -z "$GCC_USE_GNU_LD"; then
2589           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2590          else
2591           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2592          fi
2593         fi
2594         ;;
2595     *-nto*) 
2596         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2597         ;;
2598     *-darwin*)
2599         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2600         ;;
2601     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2602         if test -n "$GNU_CC"; then
2603            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2604         fi
2605         ;;
2606 esac
2608 if test -z "$COMPILE_ENVIRONMENT"; then
2609     SKIP_COMPILER_CHECKS=1
2610     SKIP_LIBRARY_CHECKS=1
2613 if test -z "$SKIP_COMPILER_CHECKS"; then
2614 dnl Checks for typedefs, structures, and compiler characteristics.
2615 dnl ========================================================
2616 AC_LANG_C
2617 AC_HEADER_STDC
2618 AC_C_CONST
2619 AC_TYPE_MODE_T
2620 AC_TYPE_OFF_T
2621 AC_TYPE_PID_T
2622 AC_TYPE_SIZE_T
2623 AC_STRUCT_ST_BLKSIZE
2624 AC_MSG_CHECKING(for siginfo_t)
2625 AC_CACHE_VAL(ac_cv_siginfo_t,
2626  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2627                   #include <signal.h>],
2628                  [siginfo_t* info;],
2629                  [ac_cv_siginfo_t=true],
2630                  [ac_cv_siginfo_t=false])])
2631 if test "$ac_cv_siginfo_t" = true ; then
2632   AC_DEFINE(HAVE_SIGINFO_T)
2633   AC_MSG_RESULT(yes)
2634 else
2635   AC_MSG_RESULT(no)
2638 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2639 dnl ========================================================
2640 AC_MSG_CHECKING(for int16_t)
2641 AC_CACHE_VAL(ac_cv_int16_t,
2642  [AC_TRY_COMPILE([#include <stdio.h>
2643                   #include <sys/types.h>],
2644                  [int16_t foo = 0;],
2645                  [ac_cv_int16_t=true],
2646                  [ac_cv_int16_t=false])])
2647 if test "$ac_cv_int16_t" = true ; then
2648   AC_DEFINE(HAVE_INT16_T)
2649   AC_MSG_RESULT(yes)
2650 else
2651   AC_MSG_RESULT(no)
2653 AC_MSG_CHECKING(for int32_t)
2654 AC_CACHE_VAL(ac_cv_int32_t,
2655  [AC_TRY_COMPILE([#include <stdio.h>
2656                   #include <sys/types.h>],
2657                  [int32_t foo = 0;],
2658                  [ac_cv_int32_t=true],
2659                  [ac_cv_int32_t=false])])
2660 if test "$ac_cv_int32_t" = true ; then
2661   AC_DEFINE(HAVE_INT32_T)
2662   AC_MSG_RESULT(yes)
2663 else
2664   AC_MSG_RESULT(no)
2666 AC_MSG_CHECKING(for int64_t)
2667 AC_CACHE_VAL(ac_cv_int64_t,
2668  [AC_TRY_COMPILE([#include <stdio.h>
2669                   #include <sys/types.h>],
2670                  [int64_t foo = 0;],
2671                  [ac_cv_int64_t=true],
2672                  [ac_cv_int64_t=false])])
2673 if test "$ac_cv_int64_t" = true ; then
2674   AC_DEFINE(HAVE_INT64_T)
2675   AC_MSG_RESULT(yes)
2676 else
2677   AC_MSG_RESULT(no)
2679 AC_MSG_CHECKING(for int64)
2680 AC_CACHE_VAL(ac_cv_int64,
2681  [AC_TRY_COMPILE([#include <stdio.h>
2682                   #include <sys/types.h>],
2683                  [int64 foo = 0;],
2684                  [ac_cv_int64=true],
2685                  [ac_cv_int64=false])])
2686 if test "$ac_cv_int64" = true ; then
2687   AC_DEFINE(HAVE_INT64)
2688   AC_MSG_RESULT(yes)
2689 else
2690   AC_MSG_RESULT(no)
2692 AC_MSG_CHECKING(for uint)
2693 AC_CACHE_VAL(ac_cv_uint,
2694  [AC_TRY_COMPILE([#include <stdio.h>
2695                   #include <sys/types.h>],
2696                  [uint foo = 0;],
2697                  [ac_cv_uint=true],
2698                  [ac_cv_uint=false])])
2699 if test "$ac_cv_uint" = true ; then
2700   AC_DEFINE(HAVE_UINT)
2701   AC_MSG_RESULT(yes)
2702 else
2703   AC_MSG_RESULT(no)
2705 AC_MSG_CHECKING(for uint_t)
2706 AC_CACHE_VAL(ac_cv_uint_t,
2707  [AC_TRY_COMPILE([#include <stdio.h>
2708                   #include <sys/types.h>],
2709                  [uint_t foo = 0;],
2710                  [ac_cv_uint_t=true],
2711                  [ac_cv_uint_t=false])])
2712 if test "$ac_cv_uint_t" = true ; then
2713   AC_DEFINE(HAVE_UINT_T)
2714   AC_MSG_RESULT(yes)
2715 else
2716   AC_MSG_RESULT(no)
2718 AC_MSG_CHECKING(for uint16_t)
2719 AC_CACHE_VAL(ac_cv_uint16_t,
2720  [AC_TRY_COMPILE([#include <stdio.h>
2721                   #include <sys/types.h>],
2722                  [uint16_t foo = 0;],
2723                  [ac_cv_uint16_t=true],
2724                  [ac_cv_uint16_t=false])])
2725 if test "$ac_cv_uint16_t" = true ; then
2726   AC_DEFINE(HAVE_UINT16_T)
2727   AC_MSG_RESULT(yes)
2728 else
2729   AC_MSG_RESULT(no)
2732 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2733 dnl are defined when compiling C++ but not C.  Since the result of this
2734 dnl test is used only in C++, do it in C++.
2735 AC_LANG_CPLUSPLUS
2737 AC_MSG_CHECKING(for uname.domainname)
2738 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2739     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2740         [ struct utsname *res; char *domain; 
2741             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2742         [ac_cv_have_uname_domainname_field=true],
2743         [ac_cv_have_uname_domainname_field=false])])
2745 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2746     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2747     AC_MSG_RESULT(yes)
2748 else
2749     AC_MSG_RESULT(no)
2752 AC_MSG_CHECKING(for uname.__domainname)
2753 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2754     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2755         [ struct utsname *res; char *domain; 
2756             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2757         [ac_cv_have_uname_us_domainname_field=true],
2758         [ac_cv_have_uname_us_domainname_field=false])])
2760 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2761     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2762     AC_MSG_RESULT(yes)
2763 else
2764     AC_MSG_RESULT(no)
2767 AC_LANG_C
2769 dnl Check for usable wchar_t (2 bytes, unsigned)
2770 dnl (we really don't need the unsignedness check anymore)
2771 dnl ========================================================
2773 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2774     ac_cv_have_usable_wchar_v2,
2775     [AC_TRY_COMPILE([#include <stddef.h>
2776                      $configure_static_assert_macros],
2777                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2778                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2779                     ac_cv_have_usable_wchar_v2="yes",
2780                     ac_cv_have_usable_wchar_v2="no")])
2781 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2782     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2783     HAVE_CPP_2BYTE_WCHAR_T=1
2784 else
2785 dnl This is really gcc-only
2786 dnl Do this test using CXX only since some versions of gcc
2787 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2788 dnl only have short-wchar support for c++.
2789 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2791     AC_LANG_SAVE
2792     AC_LANG_CPLUSPLUS
2793     _SAVE_CXXFLAGS=$CXXFLAGS
2794     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2796     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2797         ac_cv_have_usable_wchar_option_v2,
2798         [AC_TRY_LINK([#include <stddef.h>
2799                       $configure_static_assert_macros],
2800                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2801                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2802                      ac_cv_have_usable_wchar_option_v2="yes",
2803                      ac_cv_have_usable_wchar_option_v2="no")])
2805     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2806         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2807         HAVE_CPP_2BYTE_WCHAR_T=1
2808         WCHAR_CFLAGS="-fshort-wchar"
2809     else    
2810         CXXFLAGS=$_SAVE_CXXFLAGS
2811     fi
2812     AC_LANG_RESTORE
2815 dnl Check for .hidden assembler directive and visibility attribute.
2816 dnl Borrowed from glibc configure.in
2817 dnl ===============================================================
2818 if test "$GNU_CC"; then
2819   AC_CACHE_CHECK(for visibility(hidden) attribute,
2820                  ac_cv_visibility_hidden,
2821                  [cat > conftest.c <<EOF
2822                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2824                   ac_cv_visibility_hidden=no
2825                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2826                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2827                       ac_cv_visibility_hidden=yes
2828                     fi
2829                   fi
2830                   rm -f conftest.[cs]
2831                  ])
2832   if test "$ac_cv_visibility_hidden" = "yes"; then
2833     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2835     AC_CACHE_CHECK(for visibility(default) attribute,
2836                    ac_cv_visibility_default,
2837                    [cat > conftest.c <<EOF
2838                     int foo __attribute__ ((visibility ("default"))) = 1;
2840                     ac_cv_visibility_default=no
2841                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2842                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2843                         ac_cv_visibility_default=yes
2844                       fi
2845                     fi
2846                     rm -f conftest.[cs]
2847                    ])
2848     if test "$ac_cv_visibility_default" = "yes"; then
2849       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2851       AC_CACHE_CHECK(for visibility pragma support,
2852                      ac_cv_visibility_pragma,
2853                      [cat > conftest.c <<EOF
2854 #pragma GCC visibility push(hidden)
2855                       int foo_hidden = 1;
2856 #pragma GCC visibility push(default)
2857                       int foo_default = 1;
2859                       ac_cv_visibility_pragma=no
2860                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2861                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2862                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2863                             ac_cv_visibility_pragma=yes
2864                           fi
2865                         fi
2866                       fi
2867                       rm -f conftest.[cs]
2868                     ])
2869       if test "$ac_cv_visibility_pragma" = "yes"; then
2870         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2871                        ac_cv_have_visibility_class_bug,
2872                        [cat > conftest.c <<EOF
2873 #pragma GCC visibility push(hidden)
2874 struct __attribute__ ((visibility ("default"))) TestStruct {
2875   static void Init();
2877 __attribute__ ((visibility ("default"))) void TestFunc() {
2878   TestStruct::Init();
2881                        ac_cv_have_visibility_class_bug=no
2882                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2883                          ac_cv_have_visibility_class_bug=yes
2884                        else
2885                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2886                            ac_cv_have_visibility_class_bug=yes
2887                          fi
2888                        fi
2889                        rm -rf conftest.{c,S}
2890                        ])
2892         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2893                        ac_cv_have_visibility_builtin_bug,
2894                        [cat > conftest.c <<EOF
2895 #pragma GCC visibility push(hidden)
2896 #pragma GCC visibility push(default)
2897 #include <string.h>
2898 #pragma GCC visibility pop
2900 __attribute__ ((visibility ("default"))) void Func() {
2901   char c[[100]];
2902   memset(c, 0, sizeof(c));
2905                        ac_cv_have_visibility_builtin_bug=no
2906                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2907                          ac_cv_have_visibility_builtin_bug=yes
2908                        else
2909                          if test `grep -c "@PLT" conftest.S` = 0; then
2910                            ac_cv_visibility_builtin_bug=yes
2911                          fi
2912                        fi
2913                        rm -f conftest.{c,S}
2914                        ])
2915         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2916                 "$ac_cv_have_visibility_class_bug" = "no"; then
2917           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2918           WRAP_SYSTEM_INCLUDES=1
2919         else
2920           VISIBILITY_FLAGS='-fvisibility=hidden'
2921         fi # have visibility pragma bug
2922       fi   # have visibility pragma
2923     fi     # have visibility(default) attribute
2924   fi       # have visibility(hidden) attribute
2925 fi         # GNU_CC
2927 # visibility hidden flag for Sun Studio on Solaris
2928 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
2929 VISIBILITY_FLAGS='-xldscope=hidden'
2930 fi         # Sun Studio on Solaris
2932 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2933 AC_SUBST(VISIBILITY_FLAGS)
2935 dnl Checks for header files.
2936 dnl ========================================================
2937 AC_HEADER_DIRENT
2938 case "$target_os" in
2939 freebsd*)
2940 # for stuff like -lXshm
2941     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2942     ;;
2943 esac
2944 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2945 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2946 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2947 AC_CHECK_HEADERS(malloc.h)
2948 AC_CHECK_HEADERS(X11/XKBlib.h)
2950 dnl These are all the places some variant of statfs can be hiding.
2951 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2953 dnl Try for MMX support
2954 dnl NB - later gcc versions require -mmmx for this header to be successfully
2955 dnl included (or another option which implies it, such as -march=pentium-mmx)
2956 AC_CHECK_HEADERS(mmintrin.h)
2958 AC_MSG_CHECKING(for ARM SIMD support)
2959 AC_TRY_COMPILE([],
2960                [asm("uqadd8 r1, r1, r2");],
2961                result="yes", result="no")
2962 AC_MSG_RESULT("$result")
2963 if test "$result" = "yes"; then
2964     AC_DEFINE(HAVE_ARM_SIMD)
2965     HAVE_ARM_SIMD=1
2967 AC_SUBST(HAVE_ARM_SIMD)
2969 dnl Check whether the compiler supports the new-style C++ standard
2970 dnl library headers (i.e. <new>) or needs the old "new.h"
2971 AC_LANG_CPLUSPLUS
2972 NEW_H=new.h
2973 AC_CHECK_HEADER(new, [NEW_H=new])
2974 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2975 AC_LANG_C
2977 AC_ARG_ENABLE(dtrace,
2978               [  --enable-dtrace         build with dtrace support if available (default=no)],
2979               [enable_dtrace="yes"],)
2980 if test "x$enable_dtrace" = "xyes"; then
2981   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2982   if test -n "$HAVE_DTRACE"; then
2983       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2984   else
2985       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2986   fi
2988 AC_SUBST(HAVE_DTRACE)
2990 case $target in
2991 *-aix4.3*|*-aix5*)
2992         ;;
2994         AC_CHECK_HEADERS(sys/cdefs.h)
2995         ;;
2996 esac
2998 dnl Checks for libraries.
2999 dnl ========================================================
3000 case $target in
3001 *-hpux11.*)
3002         ;;
3004         AC_CHECK_LIB(c_r, gethostbyname_r)
3005         ;;
3006 esac
3008 dnl We don't want to link with libdl even if it's present on OS X, since
3009 dnl it's not used and not part of the default installation.
3010 dnl The same goes for BeOS.
3011 dnl We don't want to link against libm or libpthread on Darwin since
3012 dnl they both are just symlinks to libSystem and explicitly linking
3013 dnl against libSystem causes issues when debugging (see bug 299601).
3014 case $target in
3015 *-darwin*)
3016     ;;
3017 *-beos*)
3018     ;;
3020     AC_CHECK_LIB(m, atan)
3021     AC_CHECK_LIB(dl, dlopen,
3022     AC_CHECK_HEADER(dlfcn.h, 
3023         LIBS="-ldl $LIBS"
3024         AC_DEFINE(HAVE_LIBDL)))
3025     ;;
3026 esac
3028 _SAVE_CFLAGS="$CFLAGS"
3029 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3030 AC_CHECK_FUNCS(dladdr)
3031 CFLAGS="$_SAVE_CFLAGS"
3033 if test ! "$GNU_CXX"; then
3035     case $target in
3036     *-aix*)
3037         AC_CHECK_LIB(C_r, demangle)
3038         ;;
3039      *)
3040         AC_CHECK_LIB(C, demangle)
3041         ;;
3042      esac
3044 AC_CHECK_LIB(socket, socket)
3046 XLDFLAGS="$X_LIBS"
3047 XLIBS="$X_EXTRA_LIBS"
3049 dnl ========================================================
3050 dnl Checks for X libraries.
3051 dnl Ordering is important.
3052 dnl Xt is dependent upon SM as of X11R6
3053 dnl ========================================================
3054 if test "$no_x" = "yes"; then
3055     AC_DEFINE(NO_X11)
3056 else
3057     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3058         XLIBS="-lX11 $XLIBS"
3059         _SAVE_LDFLAGS="$LDFLAGS"
3060         LDFLAGS="$XLDFLAGS $LDFLAGS"
3061         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3062                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3063         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3064                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3065    
3066      
3067         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3068         unset ac_cv_lib_Xt_XtFree
3069             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3070             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3071         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3072                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3073         ])
3075     # AIX needs the motif library linked before libXt to prevent
3076     # crashes in plugins linked against Motif - Bug #98892
3077     case "${target_os}" in
3078     aix*)
3079         XT_LIBS="-lXm $XT_LIBS"
3080         ;;
3081     esac
3083     dnl ========================================================
3084     dnl = Check for XShm
3085     dnl ========================================================
3086     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3087         $XLIBS $XEXT_LIBS)
3088     AC_CHECK_HEADER(X11/extensions/XShm.h)
3089     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3090         test -n "$_HAVE_XSHM_XEXT"; then
3091         AC_DEFINE(HAVE_XSHM)
3092     fi
3094     dnl ========================================================
3095     dnl = Check for XIE
3096     dnl ========================================================
3097     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3098         $XLIBS $XEXT_LIBS)
3099     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3101     if test "$MOZ_XIE_LIBS"; then
3102         dnl ====================================================
3103         dnl = If XIE is present and is desired, turn it on
3104         dnl ====================================================
3105         case $target in
3106             *-hpux*)
3107                 ;;
3108             *)
3109                 HAVE_XIE=1
3110                 ;;
3111         esac
3112     fi
3114         LDFLAGS="$_SAVE_LDFLAGS"
3116     dnl ========================================================
3117     dnl = Check for freetype2 and its functionality
3118     dnl ========================================================
3119     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3121     if test "$_HAVE_FREETYPE2"; then
3122         _SAVE_LIBS="$LIBS"
3123         _SAVE_CFLAGS="$CFLAGS"
3124         LIBS="$LIBS $FT2_LIBS"
3125         CFLAGS="$CFLAGS $FT2_CFLAGS"
3127         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3128             ac_cv_member_FT_Bitmap_Size_y_ppem,
3129             [AC_TRY_COMPILE([#include <ft2build.h>
3130                              #include FT_FREETYPE_H],
3131                             [FT_Bitmap_Size s;
3132                              if (sizeof s.y_ppem) return 0;
3133                              return 1],
3134                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3135                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3136         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3137             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3138         else
3139             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3140         fi
3141         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3142                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3143                            [FT_Bitmap_Size structure includes y_ppem field])
3145         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3147         LIBS="$_SAVE_LIBS"
3148         CFLAGS="$_SAVE_CFLAGS"
3149     fi
3151 fi # $no_x
3153 AC_SUBST(XCFLAGS)
3154 AC_SUBST(XLDFLAGS)
3155 AC_SUBST(XLIBS)
3156 AC_SUBST(XT_LIBS)
3158 dnl ========================================================
3159 dnl = pthread support
3160 dnl = Start by checking whether the system support pthreads
3161 dnl ========================================================
3162 case "$target_os" in
3163 darwin*)
3164     USE_PTHREADS=1
3165     ;;
3167     MOZ_CHECK_PTHREADS(pthreads,
3168         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3169         MOZ_CHECK_PTHREADS(pthread,
3170             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3171             MOZ_CHECK_PTHREADS(c_r,
3172                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3173                 MOZ_CHECK_PTHREADS(c,
3174                     USE_PTHREADS=1
3175                 )
3176             )
3177         )
3178     )
3179     ;;
3180 esac
3182 dnl ========================================================
3183 dnl Check the command line for --with-pthreads 
3184 dnl ========================================================
3185 MOZ_ARG_WITH_BOOL(pthreads,
3186 [  --with-pthreads         Force use of system pthread library with NSPR ],
3187 [ if test "$USE_PTHREADS"x = x; then
3188     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3189 fi],
3190     USE_PTHREADS=
3191     _PTHREAD_LDFLAGS=
3194 dnl ========================================================
3195 dnl Do the platform specific pthread hackery
3196 dnl ========================================================
3197 if test "$USE_PTHREADS"x != x
3198 then
3199         dnl
3200         dnl See if -pthread is supported.
3201         dnl
3202         rm -f conftest*
3203         ac_cv_have_dash_pthread=no
3204         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3205         echo 'int main() { return 0; }' | cat > conftest.c
3206         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3207         if test $? -eq 0; then
3208                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3209                         ac_cv_have_dash_pthread=yes
3210                 case "$target_os" in
3211                 freebsd*)
3212 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3213                 ;;
3214                 *)
3215                             CFLAGS="$CFLAGS -pthread"
3216                             CXXFLAGS="$CXXFLAGS -pthread"
3217                 ;;
3218                 esac
3219                 fi
3220         fi
3221         rm -f conftest*
3222     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3224         dnl
3225         dnl See if -pthreads is supported.
3226         dnl
3227     ac_cv_have_dash_pthreads=no
3228     if test "$ac_cv_have_dash_pthread" = "no"; then
3229             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3230         echo 'int main() { return 0; }' | cat > conftest.c
3231             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3232         if test $? -eq 0; then
3233                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3234                             ac_cv_have_dash_pthreads=yes
3235                             CFLAGS="$CFLAGS -pthreads"
3236                             CXXFLAGS="$CXXFLAGS -pthreads"
3237                     fi
3238             fi
3239             rm -f conftest*
3240         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3241     fi
3243         case "$target" in
3244             *-*-freebsd*)
3245                         AC_DEFINE(_REENTRANT)
3246                         AC_DEFINE(_THREAD_SAFE)
3247                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3248                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3249                                 _PTHREAD_LDFLAGS="-pthread"
3250                         else
3251                                 _PTHREAD_LDFLAGS="-lc_r"
3252                         fi
3253                         ;;
3255             *-*-openbsd*|*-*-bsdi*)
3256                         AC_DEFINE(_REENTRANT)
3257                         AC_DEFINE(_THREAD_SAFE)
3258                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3259                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3260                 _PTHREAD_LDFLAGS="-pthread"
3261                         fi
3262                         ;;
3264             *-*-linux*|*-*-kfreebsd*-gnu)
3265                         AC_DEFINE(_REENTRANT) 
3266                         ;;
3268             *-*-nto*) 
3269                         AC_DEFINE(_REENTRANT) 
3270                         ;;
3272             *-aix4.3*|*-aix5*)
3273                         AC_DEFINE(_REENTRANT) 
3274                         ;;
3276             *-hpux11.*)
3277                         AC_DEFINE(_REENTRANT) 
3278                         ;;
3280             alpha*-*-osf*)
3281                         AC_DEFINE(_REENTRANT)
3282                         ;;
3284             *-*-solaris*) 
3285                         AC_DEFINE(_REENTRANT) 
3286                         if test ! "$GNU_CC"; then
3287                                 CFLAGS="$CFLAGS -mt" 
3288                                 CXXFLAGS="$CXXFLAGS -mt" 
3289                         fi
3290                         ;;
3291         esac
3292     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3295 dnl ========================================================
3296 dnl See if mmap sees writes
3297 dnl For cross compiling, just define it as no, which is a safe default
3298 dnl ========================================================
3299 AC_MSG_CHECKING(whether mmap() sees write()s)
3301 changequote(,)
3302 mmap_test_prog='
3303     #include <stdlib.h>
3304     #include <unistd.h>
3305     #include <sys/mman.h>
3306     #include <sys/types.h>
3307     #include <sys/stat.h>
3308     #include <fcntl.h>
3310     char fname[] = "conftest.file";
3311     char zbuff[1024]; /* Fractional page is probably worst case */
3313     int main() {
3314         char *map;
3315         int fd;
3316         int i;
3317         unlink(fname);
3318         fd = open(fname, O_RDWR | O_CREAT, 0660);
3319         if(fd<0) return 1;
3320         unlink(fname);
3321         write(fd, zbuff, sizeof(zbuff));
3322         lseek(fd, 0, SEEK_SET);
3323         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3324         if(map==(char*)-1) return 2;
3325         for(i=0; fname[i]; i++) {
3326             int rc = write(fd, &fname[i], 1);
3327             if(map[i]!=fname[i]) return 4;
3328         }
3329         return 0;
3330     }
3332 changequote([,])
3334 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3336 AC_MSG_RESULT("$result")
3338 if test "$result" = "no"; then
3339     AC_DEFINE(MMAP_MISSES_WRITES)
3343 dnl Checks for library functions.
3344 dnl ========================================================
3345 AC_PROG_GCC_TRADITIONAL
3346 AC_FUNC_MEMCMP
3347 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3348 AC_CHECK_FUNCS(flockfile getpagesize)
3350 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3351 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3352   AC_CHECK_FUNCS(localtime_r strtok_r)
3355 dnl check for wcrtomb/mbrtowc
3356 dnl =======================================================================
3357 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3358 AC_LANG_SAVE
3359 AC_LANG_CPLUSPLUS
3360 AC_CACHE_CHECK(for wcrtomb,
3361     ac_cv_have_wcrtomb,
3362     [AC_TRY_LINK([#include <wchar.h>],
3363                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3364                  ac_cv_have_wcrtomb="yes",
3365                  ac_cv_have_wcrtomb="no")])
3366 if test "$ac_cv_have_wcrtomb" = "yes"; then
3367     AC_DEFINE(HAVE_WCRTOMB)
3369 AC_CACHE_CHECK(for mbrtowc,
3370     ac_cv_have_mbrtowc,
3371     [AC_TRY_LINK([#include <wchar.h>],
3372                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3373                  ac_cv_have_mbrtowc="yes",
3374                  ac_cv_have_mbrtowc="no")])
3375 if test "$ac_cv_have_mbrtowc" = "yes"; then
3376     AC_DEFINE(HAVE_MBRTOWC)
3378 AC_LANG_RESTORE
3381 AC_CACHE_CHECK(
3382     [for res_ninit()],
3383     ac_cv_func_res_ninit,
3384     [AC_TRY_LINK([
3385         #ifdef linux
3386         #define _BSD_SOURCE 1
3387         #endif
3388         #include <resolv.h>
3389         ],
3390         [int foo = res_ninit(&_res);],
3391         [ac_cv_func_res_ninit=yes],
3392         [ac_cv_func_res_ninit=no])
3393     ])
3395 if test "$ac_cv_func_res_ninit" = "yes"; then
3396     AC_DEFINE(HAVE_RES_NINIT)
3397 dnl must add the link line we do something as foolish as this... dougt
3398 dnl else
3399 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3400 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3403 AC_LANG_CPLUSPLUS
3404 AC_CACHE_CHECK(
3405     [for gnu_get_libc_version()],
3406     ac_cv_func_gnu_get_libc_version,
3407     [AC_TRY_LINK([
3408         #ifdef HAVE_GNU_LIBC_VERSION_H
3409         #include <gnu/libc-version.h>
3410         #endif
3411         ],
3412         [const char *glibc_version = gnu_get_libc_version();],
3413         [ac_cv_func_gnu_get_libc_version=yes],
3414         [ac_cv_func_gnu_get_libc_version=no] 
3415         )]
3416     )
3418 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3419     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3422 case $target_os in
3423     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3424         ;;
3425     *)
3426     
3427 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3428     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3429         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3430 _SAVE_LIBS=$LIBS
3431 LIBS="$LIBS $_ICONV_LIBS"
3432 AC_CACHE_CHECK(
3433     [for iconv()],
3434     ac_cv_func_iconv,
3435     [AC_TRY_LINK([
3436         #include <stdlib.h>
3437         #include <iconv.h>
3438         ],
3439         [
3440             iconv_t h = iconv_open("", "");
3441             iconv(h, NULL, NULL, NULL, NULL);
3442             iconv_close(h);
3443         ],
3444         [ac_cv_func_iconv=yes],
3445         [ac_cv_func_iconv=no] 
3446         )]
3447     )
3448 if test "$ac_cv_func_iconv" = "yes"; then
3449     AC_DEFINE(HAVE_ICONV)
3450     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3451     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3452     LIBICONV="$_ICONV_LIBS"
3453     AC_CACHE_CHECK(
3454         [for iconv() with const input],
3455         ac_cv_func_const_iconv,
3456         [AC_TRY_COMPILE([
3457             #include <stdlib.h>
3458             #include <iconv.h>
3459             ],
3460             [
3461                 const char *input = "testing";
3462                 iconv_t h = iconv_open("", "");
3463                 iconv(h, &input, NULL, NULL, NULL);
3464                 iconv_close(h);
3465             ],
3466             [ac_cv_func_const_iconv=yes],
3467             [ac_cv_func_const_iconv=no] 
3468             )]
3469         )
3470     if test "$ac_cv_func_const_iconv" = "yes"; then
3471         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3472     fi
3474 LIBS=$_SAVE_LIBS
3476     ;;
3477 esac
3479 AM_LANGINFO_CODESET
3481 AC_LANG_C
3483 dnl **********************
3484 dnl *** va_copy checks ***
3485 dnl **********************
3486 dnl we currently check for all three va_copy possibilities, so we get
3487 dnl all results in config.log for bug reports.
3488 AC_MSG_CHECKING(for an implementation of va_copy())
3489 AC_CACHE_VAL(ac_cv_va_copy,[
3490     AC_TRY_RUN([
3491         #include <stdarg.h>
3492         void f (int i, ...) {
3493             va_list args1, args2;
3494             va_start (args1, i);
3495             va_copy (args2, args1);
3496             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3497                 exit (1);
3498             va_end (args1); va_end (args2);
3499         }
3500         int main() { f (0, 42); return 0; }],
3501         ac_cv_va_copy=yes,
3502         ac_cv_va_copy=no,
3503         ac_cv_va_copy=no
3504     )
3506 AC_MSG_RESULT($ac_cv_va_copy)
3507 AC_MSG_CHECKING(for an implementation of __va_copy())
3508 AC_CACHE_VAL(ac_cv___va_copy,[
3509     AC_TRY_RUN([
3510         #include <stdarg.h>
3511         void f (int i, ...) {
3512             va_list args1, args2;
3513             va_start (args1, i);
3514             __va_copy (args2, args1);
3515             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3516                 exit (1);
3517             va_end (args1); va_end (args2);
3518         }
3519         int main() { f (0, 42); return 0; }],
3520         ac_cv___va_copy=yes,
3521         ac_cv___va_copy=no,
3522         ac_cv___va_copy=no
3523     )
3525 AC_MSG_RESULT($ac_cv___va_copy)
3526 AC_MSG_CHECKING(whether va_lists can be copied by value)
3527 AC_CACHE_VAL(ac_cv_va_val_copy,[
3528     AC_TRY_RUN([
3529         #include <stdarg.h>
3530         void f (int i, ...) {
3531             va_list args1, args2;
3532             va_start (args1, i);
3533             args2 = args1;
3534             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3535                 exit (1);
3536             va_end (args1); va_end (args2);
3537         }
3538         int main() { f (0, 42); return 0; }],
3539         ac_cv_va_val_copy=yes,
3540         ac_cv_va_val_copy=no,
3541         ac_cv_va_val_copy=yes
3542     )
3544 if test "x$ac_cv_va_copy" = "xyes"; then
3545     AC_DEFINE(VA_COPY, va_copy)
3546     AC_DEFINE(HAVE_VA_COPY)
3547 elif test "x$ac_cv___va_copy" = "xyes"; then
3548     AC_DEFINE(VA_COPY, __va_copy)
3549     AC_DEFINE(HAVE_VA_COPY)
3552 if test "x$ac_cv_va_val_copy" = "xno"; then
3553    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3555 AC_MSG_RESULT($ac_cv_va_val_copy)
3557 dnl Check for dll-challenged libc's.
3558 dnl This check is apparently only needed for Linux.
3559 case "$target" in
3560         *-linux*)
3561             dnl ===================================================================
3562             _curdir=`pwd`
3563             export _curdir
3564             rm -rf conftest* _conftest
3565             mkdir _conftest
3566             cat >> conftest.C <<\EOF
3567 #include <stdio.h>
3568 #include <link.h>
3569 #include <dlfcn.h>
3570 #ifdef _dl_loaded
3571 void __dump_link_map(void) {
3572   struct link_map *map = _dl_loaded;
3573   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3575 int main() {
3576   dlopen("./conftest1.so",RTLD_LAZY);
3577   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3578   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3579   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3580   __dump_link_map();
3582 #else
3583 /* _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).*/
3584 int main() { printf("./conftest1.so\n"); }
3585 #endif
3588             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3590             cat >> conftest1.C <<\EOF
3591 #include <stdio.h>
3592 void foo(void) {printf("foo in dll called\n");}
3594             ${CXX-g++} -fPIC -c -g conftest1.C
3595             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3596             ${CXX-g++} -g conftest.C -o conftest -ldl
3597             cp -f conftest1.so conftest _conftest
3598             cd _conftest
3599             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3600             then
3601                 echo
3602                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3603                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3604                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3605                 echo "*** will be excessive memory usage at runtime."
3606                 echo
3607             fi
3608             cd ${_curdir}
3609             rm -rf conftest* _conftest
3610             dnl ===================================================================
3611             ;;
3612 esac
3614 dnl ===================================================================
3615 dnl ========================================================
3616 dnl By default, turn rtti and exceptions off on g++/egcs
3617 dnl ========================================================
3618 if test "$GNU_CXX"; then
3620   AC_MSG_CHECKING(for C++ exceptions flag)
3622   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3623   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3624   [echo "int main() { return 0; }" | cat > conftest.C
3626   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3628   if egrep "warning.*renamed" conftest.out >/dev/null; then
3629     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3630   else
3631     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3632   fi
3634   rm -f conftest*])
3636   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3637   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3638   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3641 dnl ========================================================
3642 dnl Put your C++ language/feature checks below
3643 dnl ========================================================
3644 AC_LANG_CPLUSPLUS
3646 HAVE_GCC3_ABI=
3647 if test "$GNU_CC"; then
3648   AC_CACHE_CHECK(for gcc 3.0 ABI,
3649       ac_cv_gcc_three_abi,
3650       [AC_TRY_COMPILE([],
3651                       [
3652 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3653   return 0;
3654 #else
3655 #error Not gcc3.
3656 #endif
3657                       ],
3658                       ac_cv_gcc_three_abi="yes",
3659                       ac_cv_gcc_three_abi="no")])
3660   if test "$ac_cv_gcc_three_abi" = "yes"; then
3661       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3662       HAVE_GCC3_ABI=1
3663   else
3664       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3665   fi
3667 AC_SUBST(HAVE_GCC3_ABI)
3670 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3671                ac_cv_cpp_explicit,
3672                [AC_TRY_COMPILE(class X {
3673                                public: explicit X(int i) : i_(i) {}
3674                                private: int i_;
3675                                };,
3676                                X x(3);,
3677                                ac_cv_cpp_explicit=yes,
3678                                ac_cv_cpp_explicit=no)])
3679 if test "$ac_cv_cpp_explicit" = yes ; then
3680    AC_DEFINE(HAVE_CPP_EXPLICIT)
3683 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3684                ac_cv_cpp_typename,
3685                [AC_TRY_COMPILE(class param {
3686                                public:
3687                                    typedef unsigned long num_type;
3688                                };
3690                                template <class T> class tplt {
3691                                public:
3692                                    typedef typename T::num_type t_num_type;
3693                                    t_num_type foo(typename T::num_type num) {
3694                                        return num;
3695                                    }
3696                                };,
3697                                tplt<param> A;
3698                                A.foo(0);,
3699                                ac_cv_cpp_typename=yes,
3700                                ac_cv_cpp_typename=no)])
3701 if test "$ac_cv_cpp_typename" = yes ; then
3702    AC_DEFINE(HAVE_CPP_TYPENAME)
3705 dnl Check for support of modern template specialization syntax
3706 dnl Test code and requirement from scc@netscape.com.
3707 dnl Autoconf cut-and-paste job by waterson@netscape.com
3708 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3709                ac_cv_cpp_modern_specialize_template_syntax,
3710                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3711                                class Y {};
3712                                template <> struct X<Y> { double a; };,
3713                                X<int> int_x;
3714                                X<Y> y_x;,
3715                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3716                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3717 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3718   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3722 dnl Some compilers support only full specialization, and some don't.
3723 AC_CACHE_CHECK(whether partial template specialization works,
3724                ac_cv_cpp_partial_specialization,
3725                [AC_TRY_COMPILE(template <class T> class Foo {};
3726                                template <class T> class Foo<T*> {};,
3727                                return 0;,
3728                                ac_cv_cpp_partial_specialization=yes,
3729                                ac_cv_cpp_partial_specialization=no)])
3730 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3731   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3734 dnl Some compilers have limited support for operators with templates;
3735 dnl specifically, it is necessary to define derived operators when a base
3736 dnl class's operator declaration should suffice.
3737 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3738                ac_cv_need_derived_template_operators,
3739                [AC_TRY_COMPILE([template <class T> class Base { };
3740                                 template <class T>
3741                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3742                                 template <class T> class Derived : public Base<T> { };],
3743                                [Derived<char> a, b;
3744                                 Base<char> c = a + b;
3745                                 return 0;],
3746                                ac_cv_need_derived_template_operators=no,
3747                                ac_cv_need_derived_template_operators=yes)])
3748 if test "$ac_cv_need_derived_template_operators" = yes ; then
3749   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3753 dnl Some compilers have trouble detecting that a template class
3754 dnl that derives from another template is actually an instance
3755 dnl of the base class. This test checks for that.
3756 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3757                ac_cv_need_cpp_template_cast_to_base,
3758                [AC_TRY_COMPILE([template <class T> class Base { };
3759                                 template <class T> class Derived : public Base<T> { };
3760                                 template <class T> int foo(const Base<T>&) { return 0; }],
3761                                [Derived<char> bar; return foo(bar);],
3762                                ac_cv_need_cpp_template_cast_to_base=no,
3763                                ac_cv_need_cpp_template_cast_to_base=yes)])
3764 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3765   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3768 dnl Some compilers have trouble resolving the ambiguity between two
3769 dnl functions whose arguments differ only by cv-qualifications.
3770 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3771                ac_cv_can_resolve_const_ambiguity,
3772                [AC_TRY_COMPILE([
3773                                 template <class T> class ptrClass {
3774                                   public: T* ptr;
3775                                 };
3777                                 template <class T> T* a(ptrClass<T> *arg) {
3778                                   return arg->ptr;
3779                                 }
3781                                 template <class T>
3782                                 const T* a(const ptrClass<T> *arg) {
3783                                   return arg->ptr;
3784                                 }
3785                                ],
3786                                [ ptrClass<int> i;
3787                                  a(&i); ],
3788                                ac_cv_can_resolve_const_ambiguity=yes,
3789                                ac_cv_can_resolve_const_ambiguity=no)])
3790 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3791   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3795 dnl We don't do exceptions on unix.  The only reason this used to be here
3796 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3797 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3798 dnl So im commenting this out until someone writes some artificial 
3799 dnl intelligence to detect not only if the compiler has exceptions, but if 
3800 dnl they are enabled as well.
3801 dnl 
3802 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3803 dnl                ac_cv_cpp_exceptions,
3804 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3805 dnl                                static void F() { throw X(); },
3806 dnl                                try { F(); } catch(X & e) { },
3807 dnl                                ac_cv_cpp_exceptions=yes,
3808 dnl                                ac_cv_cpp_exceptions=no)])
3809 dnl if test $ac_cv_cpp_exceptions = yes ; then
3810 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3811 dnl fi
3813 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3814 dnl supports it well enough to allow us to use it to change access, but not
3815 dnl to resolve ambiguity. The next two tests determine how well the |using|
3816 dnl keyword is supported.
3818 dnl Check to see if we can change access with |using|.  Test both a
3819 dnl legal and an illegal example.
3820 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3821                ac_cv_cpp_access_changing_using2,
3822                [AC_TRY_COMPILE(
3823                    class A { protected: int foo() { return 0; } };
3824                    class B : public A { public: using A::foo; };,
3825                    B b; return b.foo();,
3826                    [AC_TRY_COMPILE(
3827                        class A { public: int foo() { return 1; } };
3828                        class B : public A { private: using A::foo; };,
3829                        B b; return b.foo();,
3830                        ac_cv_cpp_access_changing_using2=no,
3831                        ac_cv_cpp_access_changing_using2=yes)],
3832                    ac_cv_cpp_access_changing_using2=no)])
3833 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3834    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3837 dnl Check to see if we can resolve ambiguity with |using|.
3838 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3839                ac_cv_cpp_ambiguity_resolving_using,
3840                [AC_TRY_COMPILE(class X { 
3841                                  public: int go(const X&) {return 3;}
3842                                          int jo(const X&) {return 3;}
3843                                };
3844                                class Y : public X {
3845                                  public:  int go(int) {return 2;}
3846                                           int jo(int) {return 2;}
3847                                           using X::jo;
3848                                  private: using X::go;
3849                                };,
3850                                X x; Y y; y.jo(x);,
3851                                ac_cv_cpp_ambiguity_resolving_using=yes,
3852                                ac_cv_cpp_ambiguity_resolving_using=no)])
3853 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3854    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3857 dnl Check to see if the |std| namespace is supported. If so, we'll want
3858 dnl to qualify any standard library calls with "std::" to ensure that
3859 dnl those functions can be resolved.
3860 AC_CACHE_CHECK(for \"std::\" namespace,
3861                ac_cv_cpp_namespace_std,
3862                [AC_TRY_COMPILE([#include <algorithm>],
3863                                [return std::min(0, 1);],
3864                                ac_cv_cpp_namespace_std=yes,
3865                                ac_cv_cpp_namespace_std=no)])
3866 if test "$ac_cv_cpp_namespace_std" = yes ; then
3867    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3870 dnl Older compilers are overly ambitious with respect to using the standard
3871 dnl template library's |operator!=()| when |operator==()| is defined. In
3872 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3873 dnl ambiguity at compile-time. This test checks for that case.
3874 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3875                ac_cv_cpp_unambiguous_std_notequal,
3876                [AC_TRY_COMPILE([#include <algorithm>
3877                                 struct T1 {};
3878                                 int operator==(const T1&, const T1&) { return 0; }
3879                                 int operator!=(const T1&, const T1&) { return 0; }],
3880                                [T1 a,b; return a != b;],
3881                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3882                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3883 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3884   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3888 AC_CACHE_CHECK(for C++ reinterpret_cast,
3889                ac_cv_cpp_reinterpret_cast,
3890                [AC_TRY_COMPILE(struct X { int i; };
3891                                struct Y { int i; };,
3892                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3893                                ac_cv_cpp_reinterpret_cast=yes,
3894                                ac_cv_cpp_reinterpret_cast=no)])
3895 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3896    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3899 dnl See if a dynamic_cast to void* gives the most derived object.
3900 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3901                ac_cv_cpp_dynamic_cast_void_ptr,
3902                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3903                             class Y { int j; public: virtual ~Y() { } };
3904                             class Z : public X, public Y { int k; };
3906                             int main() {
3907                                  Z mdo;
3908                                  X *subx = (X*)&mdo;
3909                                  Y *suby = (Y*)&mdo;
3910                                  return !((((void*)&mdo != (void*)subx) &&
3911                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3912                                           (((void*)&mdo != (void*)suby) &&
3913                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3914                             }],
3915                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3916                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3917                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3918 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3919    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3923 dnl note that this one is reversed - if the test fails, then
3924 dnl we require implementations of unused virtual methods. Which
3925 dnl really blows because it means we'll have useless vtable
3926 dnl bloat.
3927 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3928                ac_cv_cpp_unused_required,
3929                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3930                                X x;,
3931                                ac_cv_cpp_unused_required=no,
3932                                ac_cv_cpp_unused_required=yes)])
3933 if test "$ac_cv_cpp_unused_required" = yes ; then
3934    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3938 dnl Some compilers have trouble comparing a constant reference to a templatized
3939 dnl class to zero, and require an explicit operator==() to be defined that takes
3940 dnl an int. This test separates the strong from the weak.
3942 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3943                ac_cv_trouble_comparing_to_zero,
3944                [AC_TRY_COMPILE([#include <algorithm>
3945                                 template <class T> class Foo {};
3946                                 class T2;
3947                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3948                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3949                                [Foo<int> f; return (0 != f);],
3950                                ac_cv_trouble_comparing_to_zero=no,
3951                                ac_cv_trouble_comparing_to_zero=yes)])
3952 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3953   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3958 dnl End of C++ language/feature checks
3959 AC_LANG_C
3961 dnl ========================================================
3962 dnl =  Internationalization checks
3963 dnl ========================================================
3965 dnl Internationalization and Locale support is different
3966 dnl on various UNIX platforms.  Checks for specific i18n
3967 dnl features go here.
3969 dnl check for LC_MESSAGES
3970 AC_CACHE_CHECK(for LC_MESSAGES,
3971                 ac_cv_i18n_lc_messages,
3972                 [AC_TRY_COMPILE([#include <locale.h>],
3973                                 [int category = LC_MESSAGES;],
3974                                 ac_cv_i18n_lc_messages=yes,
3975                                 ac_cv_i18n_lc_messages=no)])
3976 if test "$ac_cv_i18n_lc_messages" = yes; then
3977    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3978 fi      
3980 fi # SKIP_COMPILER_CHECKS
3982 TARGET_XPCOM_ABI=
3983 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3984     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3987 dnl Mozilla specific options
3988 dnl ========================================================
3989 dnl The macros used for command line options
3990 dnl are defined in build/autoconf/altoptions.m4.
3993 dnl ========================================================
3994 dnl =
3995 dnl = Check for external package dependencies
3996 dnl =
3997 dnl ========================================================
3998 MOZ_ARG_HEADER(External Packages)
4000 MOZ_ENABLE_LIBXUL=
4002 MOZ_ARG_WITH_STRING(libxul-sdk,
4003 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4004   LIBXUL_SDK_DIR=$withval)
4006 if test "$LIBXUL_SDK_DIR" = "yes"; then
4007     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4008 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4009     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4011     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
4012         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
4013     fi
4015     MOZ_ENABLE_LIBXUL=1
4017 AC_SUBST(LIBXUL_SDK)
4019 if test -n "$LIBXUL_SDK"; then
4020     LIBXUL_DIST="$LIBXUL_SDK"
4021 else
4022     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4024 AC_SUBST(LIBXUL_DIST)
4026 dnl ========================================================
4027 dnl = If NSPR was not detected in the system, 
4028 dnl = use the one in the source tree (mozilla/nsprpub)
4029 dnl ========================================================
4030 MOZ_ARG_WITH_BOOL(system-nspr,
4031 [  --with-system-nspr      Use system installed NSPR],
4032     _USE_SYSTEM_NSPR=1 )
4034 if test -n "$_USE_SYSTEM_NSPR"; then
4035     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4038 if test -n "$MOZ_NATIVE_NSPR"; then
4039     _SAVE_CFLAGS=$CFLAGS
4040     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4041     AC_TRY_COMPILE([#include "prlog.h"],
4042                 [#ifndef PR_STATIC_ASSERT
4043                  #error PR_STATIC_ASSERT not defined
4044                  #endif],
4045                 [MOZ_NATIVE_NSPR=1],
4046                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4047     CFLAGS=$_SAVE_CFLAGS
4048 else
4049     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4050     if test "$OS_ARCH" = "WINCE"; then
4051         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4052         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4053     elif test "$OS_ARCH" = "WINNT"; then
4054         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4055         if test -n "$GNU_CC"; then
4056             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4057         else
4058             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4059         fi
4060     else
4061         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4062     fi
4065 dnl ========================================================
4066 dnl = If NSS was not detected in the system, 
4067 dnl = use the one in the source tree (mozilla/security/nss)
4068 dnl ========================================================
4070 MOZ_ARG_WITH_BOOL(system-nss,
4071 [  --with-system-nss      Use system installed NSS],
4072     _USE_SYSTEM_NSS=1 )
4074 if test -n "$_USE_SYSTEM_NSS"; then
4075     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4078 if test -n "$MOZ_NATIVE_NSS"; then
4079    NSS_LIBS="$NSS_LIBS -lcrmf"
4080 else
4081    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4082    NSS_DEP_LIBS="\
4083         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4084         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4085         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4086         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4087         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4088         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4090    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4091        NSS_LIBS="\
4092         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4093         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4094         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4095         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4096         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4097         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4098    else
4099        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4100    fi
4103 if test -z "$SKIP_LIBRARY_CHECKS"; then
4104 dnl system JPEG support
4105 dnl ========================================================
4106 MOZ_ARG_WITH_STRING(system-jpeg,
4107 [  --with-system-jpeg[=PFX]
4108                           Use system libjpeg [installed at prefix PFX]],
4109     JPEG_DIR=$withval)
4111 _SAVE_CFLAGS=$CFLAGS
4112 _SAVE_LDFLAGS=$LDFLAGS
4113 _SAVE_LIBS=$LIBS
4114 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4115     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4116     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4118 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4119     SYSTEM_JPEG=
4120 else
4121     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4124 if test "$SYSTEM_JPEG" = 1; then
4125     LIBS="$JPEG_LIBS $LIBS"
4126     AC_TRY_COMPILE([ #include <stdio.h>
4127                      #include <sys/types.h>
4128                      #include <jpeglib.h> ],
4129                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4130                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4131                      #endif ],
4132                    SYSTEM_JPEG=1,
4133                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4134 fi 
4135 CFLAGS=$_SAVE_CFLAGS
4136 LDFLAGS=$_SAVE_LDFLAGS
4137 LIBS=$_SAVE_LIBS
4139 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4140     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4141     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4144 dnl system ZLIB support
4145 dnl ========================================================
4146 MOZ_ARG_WITH_STRING(system-zlib,
4147 [  --with-system-zlib[=PFX]
4148                           Use system libz [installed at prefix PFX]],
4149     ZLIB_DIR=$withval)
4151 _SAVE_CFLAGS=$CFLAGS
4152 _SAVE_LDFLAGS=$LDFLAGS
4153 _SAVE_LIBS=$LIBS
4154 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4155     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4156     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4158 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4159     SYSTEM_ZLIB=
4160 else
4161     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4162         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4164 if test "$SYSTEM_ZLIB" = 1; then
4165     LIBS="$ZLIB_LIBS $LIBS"
4166     AC_TRY_COMPILE([ #include <stdio.h>
4167                      #include <string.h>
4168                      #include <zlib.h> ],
4169                    [ #if ZLIB_VERNUM < $MOZZLIB 
4170                      #error "Insufficient zlib version ($MOZZLIB required)."
4171                      #endif ],
4172                    SYSTEM_ZLIB=1,
4173                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4175 CFLAGS=$_SAVE_CFLAGS
4176 LDFLAGS=$_SAVE_LDFLAGS
4177 LIBS=$_SAVE_LIBS
4179 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4180     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4181     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4184 dnl system BZIP2 Support
4185 dnl ========================================================
4186 MOZ_ARG_WITH_STRING(system-bz2,
4187 [  --with-system-bz2[=PFX]
4188                           Use system libbz2 [installed at prefix PFX]],
4189     BZ2_DIR=$withval)
4191 _SAVE_CFLAGS=$CFLAGS
4192 _SAVE_LDFLAGS=$LDFLAGS
4193 _SAVE_LIBS=$LIBS
4194 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4195     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4196     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4198 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4199     SYSTEM_BZ2=
4200 else
4201     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4202         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4204 CFLAGS=$_SAVE_CFLAGS
4205 LDFLAGS=$_SAVE_LDFLAGS
4206 LIBS=$_SAVE_LIBS
4208 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4209     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4210     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4213 dnl system PNG Support
4214 dnl ========================================================
4215 MOZ_ARG_WITH_STRING(system-png, 
4216 [  --with-system-png[=PFX]
4217                           Use system libpng [installed at prefix PFX]],
4218     PNG_DIR=$withval)
4220 _SAVE_CFLAGS=$CFLAGS
4221 _SAVE_LDFLAGS=$LDFLAGS
4222 _SAVE_LIBS=$LIBS
4223 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4224 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4225 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4226     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4227     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4229 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4230     SYSTEM_PNG=
4231 else
4232     _SAVE_PNG_LIBS=$PNG_LIBS
4233     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4234                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4235                  $PNG_LIBS)
4236     AC_CHECK_LIB(png, png_get_acTL, ,
4237                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4238                  $_SAVE_PNG_LIBS)
4240 if test "$SYSTEM_PNG" = 1; then
4241     LIBS="$PNG_LIBS $LIBS"
4242     AC_TRY_COMPILE([ #include <stdio.h>
4243                      #include <sys/types.h>
4244                      #include <png.h> ],
4245                    [ #if PNG_LIBPNG_VER < $MOZPNG
4246                      #error "Insufficient libpng version ($MOZPNG required)."
4247                      #endif
4248                      #ifndef PNG_UINT_31_MAX
4249                      #error "Insufficient libpng version."
4250                      #endif ],
4251                    SYSTEM_PNG=1,
4252                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4254 CFLAGS=$_SAVE_CFLAGS
4255 LDFLAGS=$_SAVE_LDFLAGS
4256 LIBS=$_SAVE_LIBS
4258 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4259     PNG_CFLAGS="-I${PNG_DIR}/include"
4260     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4263 fi # SKIP_LIBRARY_CHECKS
4265 dnl system HunSpell Support
4266 dnl ========================================================
4267 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4268 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4269     SYSTEM_HUNSPELL=1 )
4271 if test -n "$SYSTEM_HUNSPELL"; then
4272     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4275 AC_SUBST(SYSTEM_HUNSPELL)
4277 dnl ========================================================
4278 dnl Java SDK support
4279 dnl ========================================================
4280 JAVA_INCLUDE_PATH=
4281 MOZ_ARG_WITH_STRING(java-include-path,
4282 [  --with-java-include-path=dir   Location of Java SDK headers],
4283     JAVA_INCLUDE_PATH=$withval)
4285 JAVA_BIN_PATH=
4286 MOZ_ARG_WITH_STRING(java-bin-path,
4287 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4288     JAVA_BIN_PATH=$withval)
4290 dnl ========================================================
4291 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4292 dnl their usage and use them in spidermonkey.
4293 dnl ========================================================
4294 MOZ_ARG_WITH_BOOL(arm-kuser,
4295 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4296     USE_ARM_KUSER=1,
4297     USE_ARM_KUSER=)
4298 if test -n "$USE_ARM_KUSER"; then
4299    AC_DEFINE(USE_ARM_KUSER)
4302 dnl ========================================================
4303 dnl =
4304 dnl = Application
4305 dnl =
4306 dnl ========================================================
4308 MOZ_ARG_HEADER(Application)
4310 BUILD_STATIC_LIBS=
4311 ENABLE_TESTS=1
4312 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4313 MOZ_BRANDING_DIRECTORY=
4314 MOZ_DBGRINFO_MODULES=
4315 MOZ_ENABLE_CANVAS=1
4316 MOZ_FEEDS=1
4317 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4318 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4319 MOZ_JAVAXPCOM=
4320 MOZ_JSDEBUGGER=1
4321 MOZ_JSLOADER=1
4322 MOZ_LIBART_CFLAGS=
4323 MOZ_LIBART_LIBS=
4324 MOZ_MATHML=1
4325 MOZ_MORK=1
4326 MOZ_MORKREADER=
4327 MOZ_AUTH_EXTENSION=1
4328 MOZ_NO_ACTIVEX_SUPPORT=1
4329 MOZ_NO_INSPECTOR_APIS=
4330 MOZ_NO_XPCOM_OBSOLETE=
4331 MOZ_NO_FAST_LOAD=
4332 MOZ_OGG=1
4333 MOZ_SYDNEYAUDIO=
4334 MOZ_WAVE=1
4335 MOZ_MEDIA=
4336 MOZ_OJI=1
4337 MOZ_PERMISSIONS=1
4338 MOZ_PLACES=
4339 MOZ_PLAINTEXT_EDITOR_ONLY=
4340 MOZ_PLUGINS=1
4341 MOZ_PREF_EXTENSIONS=1
4342 MOZ_PROFILELOCKING=1
4343 MOZ_PSM=1
4344 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4345 MOZ_PYTHON=
4346 MOZ_PYTHON_DEBUG_SUFFIX=
4347 MOZ_PYTHON_DLL_SUFFIX=
4348 MOZ_PYTHON_INCLUDES=
4349 MOZ_PYTHON_LIBS=
4350 MOZ_PYTHON_PREFIX=
4351 MOZ_PYTHON_VER=
4352 MOZ_PYTHON_VER_DOTTED=
4353 MOZ_RDF=1
4354 MOZ_REFLOW_PERF=
4355 MOZ_SAFE_BROWSING=
4356 MOZ_HELP_VIEWER=
4357 MOZ_SPELLCHECK=1
4358 MOZ_STATIC_MAIL_BUILD=
4359 MOZ_STORAGE=1
4360 MOZ_SVG=1
4361 MOZ_TIMELINE=
4362 MOZ_UI_LOCALE=en-US
4363 MOZ_UNIVERSALCHARDET=1
4364 MOZ_URL_CLASSIFIER=
4365 MOZ_USE_NATIVE_UCONV=
4366 MOZ_VIEW_SOURCE=1
4367 MOZ_XPFE_COMPONENTS=1
4368 MOZ_XPINSTALL=1
4369 MOZ_XSLT_STANDALONE=
4370 MOZ_XTF=1
4371 MOZ_XUL=1
4372 MOZ_XUL_APP=1
4373 MOZ_ZIPWRITER=1
4374 NS_PRINTING=1
4375 NECKO_COOKIES=1
4376 NECKO_DISK_CACHE=1
4377 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4378 NECKO_SMALL_BUFFERS=
4379 JS_STATIC_BUILD=
4380 XPC_IDISPATCH_SUPPORT=
4383 case "$target_os" in
4384 darwin*)
4385     ACCESSIBILITY=
4386     ;;
4388     ACCESSIBILITY=1
4389     ;;
4390 esac
4392 case "$target_os" in
4393     msvc*|mks*|cygwin*|mingw*)
4394         if test -z "$GNU_CC"; then 
4395             XPC_IDISPATCH_SUPPORT=1
4396             MOZ_NO_ACTIVEX_SUPPORT=
4397             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4398         fi
4399         ;;
4400 esac
4402 MOZ_ARG_ENABLE_STRING(application,
4403 [  --enable-application=APP
4404                           Options include:
4405                             browser (Firefox)
4406                             xulrunner
4407                             content/xslt (Standalone Transformiix XSLT)
4408                             netwerk (Standalone Necko)
4409                             tools/update-packaging (AUS-related packaging tools)
4410                             standalone (use this for standalone
4411                               xpcom/xpconnect or to manually drive a build)],
4412 [ MOZ_BUILD_APP=$enableval ] )
4414 MOZ_EMBEDDING_PROFILE=default
4415 MOZ_ARG_WITH_STRING(embedding-profile,
4416 [  --with-embedding-profile=default|basic|minimal
4417                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4418 [ MOZ_EMBEDDING_PROFILE=$withval ])
4420 case "$MOZ_EMBEDDING_PROFILE" in
4421 default)
4422   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4423   MOZ_EMBEDDING_LEVEL_BASIC=1
4424   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4425   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4426   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4427   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4428   ;;
4430 basic)
4431   MOZ_EMBEDDING_LEVEL_DEFAULT=
4432   MOZ_EMBEDDING_LEVEL_BASIC=1
4433   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4434   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4435   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4436   ENABLE_TESTS=
4437   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4438   MOZ_ENABLE_CANVAS=
4439   MOZ_ENABLE_POSTSCRIPT=
4440   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4441   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4442   MOZ_IMG_ENCODERS_DEFAULT=
4443   MOZ_IMG_ENCODERS=
4444   MOZ_INSTALLER=
4445   MOZ_JSDEBUGGER=
4446   MOZ_MATHML=
4447   MOZ_AUTH_EXTENSION=
4448   MOZ_NO_ACTIVEX_SUPPORT=1
4449   MOZ_NO_INSPECTOR_APIS=1
4450   MOZ_NO_XPCOM_OBSOLETE=1
4451   MOZ_NO_FAST_LOAD=1
4452   MOZ_OJI=
4453   MOZ_PLAINTEXT_EDITOR_ONLY=1
4454 #  MOZ_PLUGINS=
4455   MOZ_PREF_EXTENSIONS=
4456   MOZ_PROFILELOCKING=
4457   MOZ_SPELLCHECK=
4458   MOZ_SVG=
4459   MOZ_UNIVERSALCHARDET=
4460   MOZ_UPDATER=
4461   MOZ_USE_NATIVE_UCONV=
4462   MOZ_VIEW_SOURCE=
4463   MOZ_XPFE_COMPONENTS=
4464   MOZ_XPINSTALL=
4465   MOZ_XTF=
4466   MOZ_ZIPWRITER=
4467   NECKO_DISK_CACHE=
4468   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4469   NECKO_SMALL_BUFFERS=1
4470   NS_DISABLE_LOGGING=1
4471   NS_PRINTING=
4472   JS_STATIC_BUILD=1
4473   ;;
4475 minimal)
4476   MOZ_EMBEDDING_LEVEL_DEFAULT=
4477   MOZ_EMBEDDING_LEVEL_BASIC=
4478   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4479   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4480   ENABLE_TESTS=
4481   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4482   MOZ_ENABLE_CANVAS=
4483   MOZ_ENABLE_POSTSCRIPT=
4484   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4485   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4486   MOZ_IMG_ENCODERS_DEFAULT=
4487   MOZ_IMG_ENCODERS=
4488   MOZ_INSTALLER=
4489   MOZ_JSDEBUGGER=
4490   MOZ_MATHML=
4491   MOZ_AUTH_EXTENSION=
4492   MOZ_NO_ACTIVEX_SUPPORT=1
4493   MOZ_NO_INSPECTOR_APIS=1
4494   MOZ_NO_XPCOM_OBSOLETE=1
4495   MOZ_NO_FAST_LOAD=1
4496   MOZ_OJI=
4497   MOZ_PLAINTEXT_EDITOR_ONLY=1
4498   MOZ_PLUGINS=
4499   MOZ_PREF_EXTENSIONS=
4500   MOZ_PROFILELOCKING=
4501   MOZ_SPELLCHECK=
4502   MOZ_STORAGE=1
4503   MOZ_PLACES=
4504   MOZ_SVG=
4505   MOZ_UNIVERSALCHARDET=
4506   MOZ_UPDATER=
4507   MOZ_USE_NATIVE_UCONV=1
4508   MOZ_VIEW_SOURCE=
4509   MOZ_XPFE_COMPONENTS=
4510   MOZ_XPINSTALL=
4511   MOZ_XTF=
4512   MOZ_XUL=
4513   MOZ_ZIPWRITER=
4514   MOZ_RDF=
4515   NECKO_DISK_CACHE=
4516   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4517   NECKO_SMALL_BUFFERS=1
4518   NS_DISABLE_LOGGING=1
4519   NS_PRINTING=
4520   JS_STATIC_BUILD=1
4521   ;;
4524   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4525   ;;
4526 esac
4528 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4529 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4530 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4532 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4533 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4534   XULRUNNER_STUB_NAME=$withval)
4536 if test -z "$XULRUNNER_STUB_NAME"; then
4537   case "$target_os" in
4538   darwin*)
4539     XULRUNNER_STUB_NAME=xulrunner
4540     ;;
4541   *)
4542     XULRUNNER_STUB_NAME=xulrunner-stub
4543   esac
4545 AC_SUBST(XULRUNNER_STUB_NAME)
4547 if test -z "$MOZ_BUILD_APP"; then
4548   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4549 else
4550   # We have a valid application only if it has a build.mk file in its top
4551   # directory.
4552   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4553     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4554   fi
4557 # Allow the application to influence configure with a confvars.sh script.
4559 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4560 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4561   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4562   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4563 else
4564   AC_MSG_RESULT([no])
4567 # Now is a good time to test for logic errors, define mismatches, etc.
4568 case "$MOZ_BUILD_APP" in
4569 xulrunner)
4570   if test "$LIBXUL_SDK"; then
4571     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4572   fi
4573   ;;
4575   # Fix this case for folks who forget. Warn them.
4576   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4577     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4578     MOZ_XUL_APP=1
4579   fi
4580   ;;
4581 esac
4583 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4584 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4585 # MOZ_BUILD_APP.
4586 case "$MOZ_BUILD_APP" in
4587 browser)
4588   AC_DEFINE(MOZ_PHOENIX)
4589   ;;
4591 xulrunner)
4592   AC_DEFINE(MOZ_XULRUNNER)
4593   ;;
4595 content/xslt)
4596   AC_DEFINE(TX_EXE)
4597   ;;
4599 standalone) 
4600   MOZ_APP_NAME=mozilla
4601   MOZ_APP_DISPLAYNAME=Mozilla
4602   MOZ_APP_VERSION=$MOZILLA_VERSION
4603   ;;
4605 esac
4607 if test -z "$MOZ_XUL_APP"; then
4608         AC_MSG_ERROR([builds with unsetting MOZ_XUL_APP in confvars.sh are not supported.])
4611 AC_SUBST(MOZ_BUILD_APP)
4612 AC_SUBST(MOZ_XUL_APP)
4613 AC_SUBST(MOZ_PHOENIX)
4614 AC_SUBST(MOZ_XULRUNNER)
4616 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4618 if test "$MOZ_XUL_APP"; then
4619   AC_DEFINE(MOZ_XUL_APP)
4622 dnl ========================================================
4623 dnl = 
4624 dnl = Toolkit Options
4625 dnl = 
4626 dnl ========================================================
4627 MOZ_ARG_HEADER(Toolkit Options)
4629     dnl ========================================================
4630     dnl = Select the default toolkit
4631     dnl ========================================================
4632         MOZ_ARG_ENABLE_STRING(default-toolkit,
4633         [  --enable-default-toolkit=TK
4634                           Select default toolkit
4635                           Platform specific defaults:
4636                             BeOS - cairo-beos
4637                             Mac OS X - cairo-cocoa
4638                             Neutrino/QNX - photon
4639                             OS/2 - cairo-os2
4640                             Win32 - cairo-windows
4641                             WinCE - windows
4642                             Gtk2 with DirectFB - cairo-gtk2-dfb
4643                             * - cairo-gtk2
4644                             * - cairo-qt],
4645     [ _DEFAULT_TOOLKIT=$enableval ],
4646     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4648     if test "$_DEFAULT_TOOLKIT" = "photon" \
4649         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4650         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4651         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4652         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4653         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4654         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4655         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4656         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4657     then
4658         dnl nglayout only supports building with one toolkit,
4659         dnl so ignore everything after the first comma (",").
4660         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4661     else
4662         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4663     fi
4665 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4667 dnl ========================================================
4668 dnl = Enable the toolkit as needed                         =
4669 dnl ========================================================
4671 case "$MOZ_WIDGET_TOOLKIT" in
4672 photon)
4673         MOZ_ENABLE_PHOTON=1
4674         AC_DEFINE(MOZ_WIDGET_PHOTON)
4675     ;;
4677 cairo-windows)
4678     MOZ_WIDGET_TOOLKIT=windows
4679     MOZ_GFX_TOOLKIT=cairo
4680     ;;
4682 cairo-gtk2|cairo-gtk2-x11)
4683     MOZ_WIDGET_TOOLKIT=gtk2
4684     MOZ_GFX_TOOLKIT=cairo
4685     MOZ_ENABLE_GTK2=1
4686     MOZ_ENABLE_XREMOTE=1
4688     AC_DEFINE(MOZ_X11)
4689     MOZ_X11=1
4691     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4692     TK_LIBS='$(MOZ_GTK2_LIBS)'
4693     AC_DEFINE(MOZ_WIDGET_GTK2)
4694     ;;
4696 cairo-gtk2-dfb)
4697     MOZ_WIDGET_TOOLKIT=gtk2
4698     MOZ_GFX_TOOLKIT=cairo
4699     MOZ_ENABLE_GTK2=1
4701     AC_DEFINE(MOZ_DFB)
4702     MOZ_DFB=1
4704     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4705     TK_LIBS='$(MOZ_GTK2_LIBS)'
4706     AC_DEFINE(MOZ_WIDGET_GTK2)
4707     if test "$no_x" != "yes"; then
4708         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4709         no_x=yes
4710     fi
4711     ;;
4713 cairo-qt)
4714     MOZ_WIDGET_TOOLKIT=qt
4715     MOZ_GFX_TOOLKIT=cairo
4716     MOZ_ENABLE_QT=1
4717     MOZ_ENABLE_XREMOTE=1
4718     USE_ELF_DYNSTR_GC=
4720     AC_DEFINE(MOZ_X11)
4721     MOZ_X11=1
4723     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4724     TK_LIBS='$(MOZ_QT_LIBS)'
4725     AC_DEFINE(MOZ_WIDGET_QT)
4726     ;;
4728 cairo-beos)
4729     MOZ_WIDGET_TOOLKIT=beos
4730     MOZ_GFX_TOOLKIT=cairo
4731     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4732     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4733     ;;
4735 cairo-os2)
4736     MOZ_WIDGET_TOOLKIT=os2
4737     MOZ_GFX_TOOLKIT=cairo
4738     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4739     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4740     ;;
4742 cairo-cocoa)
4743     MOZ_WIDGET_TOOLKIT=cocoa
4744     AC_DEFINE(MOZ_WIDGET_COCOA)
4745     MOZ_ENABLE_COCOA=1
4746     MOZ_GFX_TOOLKIT=cairo
4747     MOZ_USER_DIR="Mozilla"
4748     AC_DEFINE(XP_MACOSX)
4749     AC_DEFINE(TARGET_CARBON)
4750     AC_DEFINE(TARGET_API_MAC_CARBON)
4751     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4752     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4753     CFLAGS="$CFLAGS $TK_CFLAGS"
4754     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4755     ;;
4756 esac
4758 if test "$MOZ_ENABLE_XREMOTE"; then
4759     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4762 if test "$COMPILE_ENVIRONMENT"; then
4763   if test "$MOZ_ENABLE_GTK2"; then
4764     if test "$MOZ_X11"; then
4765       GDK_PACKAGES=gdk-x11-2.0
4766     elif test "$MOZ_DFB"; then
4767       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4768       GDK_PACKAGES=directfb
4769     fi
4771     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4772   fi
4774 fi # COMPILE_ENVIRONMENT
4776 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4778 dnl ========================================================
4779 dnl = startup-notification support module
4780 dnl ========================================================
4782 if test "$MOZ_ENABLE_GTK2"
4783 then
4784     MOZ_ENABLE_STARTUP_NOTIFICATION=
4786     MOZ_ARG_ENABLE_BOOL(startup-notification,
4787     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4788         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4789         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4790     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4791     then
4792         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4793                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4794         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4795             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4796             then
4797                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4798             fi
4799             MOZ_ENABLE_STARTUP_NOTIFICATION=
4800         ])
4801     fi
4803     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4804         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4805     fi
4807     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4809 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4810 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4811 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4813 dnl ========================================================
4814 dnl = QT support
4815 dnl ========================================================
4816 if test "$MOZ_ENABLE_QT"
4817 then
4818     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4819     AC_SUBST(MOZ_QT_CFLAGS)
4820     AC_SUBST(MOZ_QT_LIBS)
4822     MOZ_ARG_WITH_STRING(qtdir,
4823     [  --with-qtdir=\$dir       Specify Qt directory ],
4824     [ QTDIR=$withval])
4826     if test -z "$QTDIR"; then
4827       QTDIR="/usr"
4828     fi
4829     QTINCDIR="/include/qt"
4830     if test ! -d "$QTDIR$QTINCDIR"; then
4831        QTINCDIR="/include/X11/qt"
4832     fi
4833     if test ! -d "$QTDIR$QTINCDIR"; then
4834        QTINCDIR="/include"
4835     fi
4837     if test -x "$QTDIR/bin/moc-qt4"; then
4838       HOST_MOC="$QTDIR/bin/moc-qt4"
4839     else
4840       if test -x "$QTDIR/bin/moc"; then
4841         HOST_MOC="$QTDIR/bin/moc"
4842       else
4843         AC_CHECK_PROGS(HOST_MOC, moc, "")
4844       fi
4845     fi
4846     if test -z "$HOST_MOC"; then
4847       AC_MSG_ERROR([no acceptable moc preprocessor found])
4848     fi
4849     MOC=$HOST_MOC
4852 AC_SUBST(GTK_CONFIG)
4853 AC_SUBST(TK_CFLAGS)
4854 AC_SUBST(TK_LIBS)
4856 AC_SUBST(MOZ_ENABLE_GTK2)
4857 AC_SUBST(MOZ_ENABLE_PHOTON)
4858 AC_SUBST(MOZ_ENABLE_COCOA)
4859 AC_SUBST(MOZ_ENABLE_QT)
4860 AC_SUBST(MOZ_ENABLE_XREMOTE)
4861 AC_SUBST(MOZ_GTK2_CFLAGS)
4862 AC_SUBST(MOZ_GTK2_LIBS)
4863 AC_SUBST(MOZ_QT_CFLAGS)
4864 AC_SUBST(MOZ_QT_LIBS)
4866 AC_SUBST(MOC)
4868 AC_SUBST(MOZ_DFB)
4869 AC_SUBST(MOZ_X11)
4871 dnl ========================================================
4872 dnl =
4873 dnl = Components & Features
4874 dnl = 
4875 dnl ========================================================
4876 MOZ_ARG_HEADER(Components and Features)
4878 dnl ========================================================
4879 dnl = Localization
4880 dnl ========================================================
4881 MOZ_ARG_ENABLE_STRING(ui-locale,
4882 [  --enable-ui-locale=ab-CD
4883                           Select the user interface locale (default: en-US)],
4884     MOZ_UI_LOCALE=$enableval )
4885 AC_SUBST(MOZ_UI_LOCALE)
4887 dnl ========================================================
4888 dnl = Trademarked Branding 
4889 dnl ========================================================
4890 MOZ_ARG_ENABLE_BOOL(official-branding,
4891 [  --enable-official-branding Enable Official mozilla.org Branding
4892                           Do not distribute builds with
4893                           --enable-official-branding unless you have
4894                           permission to use trademarks per
4895                           http://www.mozilla.org/foundation/trademarks/ .],
4896 [case "$MOZ_BUILD_APP" in
4897 browser)
4898     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4899     MOZ_APP_DISPLAYNAME=Firefox
4900     ;;
4903     AC_MSG_ERROR([Official branding is only available for Firefox.])
4904 esac
4907 MOZ_ARG_WITH_STRING(branding,
4908 [  --with-branding=dir    Use branding from the specified directory.],
4909     MOZ_BRANDING_DIRECTORY=$withval)
4911 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4912 if test -z "$REAL_BRANDING_DIRECTORY"; then
4913   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4916 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4917   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4920 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4922 dnl ========================================================
4923 dnl = Distribution ID
4924 dnl ========================================================
4925 MOZ_ARG_WITH_STRING(distribution-id,
4926 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4927 [ val=`echo $withval`
4928     MOZ_DISTRIBUTION_ID="$val"])
4930 if test -z "$MOZ_DISTRIBUTION_ID"; then
4931    MOZ_DISTRIBUTION_ID="org.mozilla"
4934 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4935 AC_SUBST(MOZ_DISTRIBUTION_ID)
4938 dnl ========================================================
4939 dnl complex text support off by default
4940 dnl ========================================================
4941 MOZ_PANGO=1
4942 MOZ_ARG_DISABLE_BOOL(pango,
4943 [  --disable-pango Disable usage of Pango ],
4944     MOZ_PANGO=,
4945     MOZ_PANGO=1)
4948 dnl ========================================================
4949 dnl = Pango
4950 dnl ========================================================
4951 if test "$MOZ_ENABLE_GTK2"
4952 then
4953     AC_SUBST(MOZ_PANGO)
4955     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4957     if test "$MOZ_PANGO"
4958     then
4959         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4960         AC_SUBST(MOZ_PANGO_CFLAGS)
4961         AC_SUBST(MOZ_PANGO_LIBS)
4962         AC_DEFINE(MOZ_PANGO)
4963     else
4964         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4965         AC_SUBST(MOZ_PANGO_CFLAGS)
4966         AC_SUBST(MOZ_PANGO_LIBS)
4968         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
4969         AC_SUBST(FT2_CFLAGS)
4970         AC_SUBST(FT2_LIBS)
4971     fi
4974 dnl ========================================================
4975 dnl = PostScript print module
4976 dnl ========================================================
4977 MOZ_ARG_DISABLE_BOOL(postscript,
4978 [  --disable-postscript    Disable PostScript printing support ],
4979     MOZ_ENABLE_POSTSCRIPT=,
4980     MOZ_ENABLE_POSTSCRIPT=1 )
4982 dnl ========================================================
4983 dnl = GnomeVFS support module
4984 dnl ========================================================
4986 if test "$MOZ_X11"
4987 then
4988     dnl build the gnomevfs extension by default only when the
4989     dnl GTK2 toolkit is in use.
4990     if test "$MOZ_ENABLE_GTK2"
4991     then
4992         MOZ_ENABLE_GNOMEVFS=1
4993         MOZ_ENABLE_GCONF=1
4994         MOZ_ENABLE_LIBGNOME=1
4995     fi
4997     MOZ_ARG_DISABLE_BOOL(gnomevfs,
4998     [  --disable-gnomevfs      Disable GnomeVFS support ],
4999         MOZ_ENABLE_GNOMEVFS=,
5000         MOZ_ENABLE_GNOMEVFS=force)
5002     if test "$MOZ_ENABLE_GNOMEVFS"
5003     then
5004         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5005             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5006             MOZ_ENABLE_GNOMEVFS=1
5007         ],[
5008             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5009             then
5010                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5011             fi
5012             MOZ_ENABLE_GNOMEVFS=
5013         ])
5014     fi
5016     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5017     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5019     if test "$MOZ_ENABLE_GCONF"
5020     then
5021         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5022             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5023             MOZ_ENABLE_GCONF=1
5024         ],[
5025             MOZ_ENABLE_GCONF=
5026         ])
5027     fi
5029     if test "$MOZ_ENABLE_GCONF"; then
5030         AC_DEFINE(MOZ_ENABLE_GCONF)
5031     fi
5033     AC_SUBST(MOZ_ENABLE_GCONF)
5034     AC_SUBST(MOZ_GCONF_CFLAGS)
5035     AC_SUBST(MOZ_GCONF_LIBS)
5037     if test "$MOZ_ENABLE_LIBGNOME"
5038     then
5039         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5040             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5041             MOZ_ENABLE_LIBGNOME=1
5042         ],[
5043             MOZ_ENABLE_LIBGNOME=
5044         ])
5045     fi
5047     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5048     AC_SUBST(MOZ_LIBGNOME_LIBS)
5050     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5051     # are all available.
5053     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5054             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5055       MOZ_ENABLE_GNOME_COMPONENT=1
5056     else
5057       MOZ_ENABLE_GNOME_COMPONENT=
5058     fi
5060     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5063 dnl ========================================================
5064 dnl = libgnomeui support module
5065 dnl ========================================================
5067 if test "$MOZ_ENABLE_GTK2"
5068 then
5069     MOZ_ENABLE_GNOMEUI=1
5071     MOZ_ARG_DISABLE_BOOL(gnomeui,
5072     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5073         MOZ_ENABLE_GNOMEUI=,
5074         MOZ_ENABLE_GNOMEUI=force)
5076     if test "$MOZ_ENABLE_GNOMEUI"
5077     then
5078         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5079         [
5080             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5081             MOZ_ENABLE_GNOMEUI=1
5082         ],[
5083             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5084             then
5085                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5086             fi
5087             MOZ_ENABLE_GNOMEUI=
5088         ])
5089     fi
5091     if test "$MOZ_ENABLE_GNOMEUI"; then
5092         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5093     fi
5095 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5096 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5097 AC_SUBST(MOZ_GNOMEUI_LIBS)
5099 dnl ========================================================
5100 dnl = dbus support
5101 dnl ========================================================
5103 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5104 then
5105     MOZ_ENABLE_DBUS=1
5107     MOZ_ARG_DISABLE_BOOL(dbus,
5108     [  --disable-dbus       Disable dbus support ],
5109         MOZ_ENABLE_DBUS=,
5110         MOZ_ENABLE_DBUS=1)
5112     if test "$MOZ_ENABLE_DBUS"
5113     then
5114         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5115         AC_DEFINE(MOZ_ENABLE_DBUS)
5116     fi
5118 AC_SUBST(MOZ_ENABLE_DBUS)
5119 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5120 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5122 dnl ========================================================
5123 dnl = Build Personal Security Manager
5124 dnl ========================================================
5125 MOZ_ARG_DISABLE_BOOL(crypto,
5126 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5127     MOZ_PSM=,
5128     MOZ_PSM=1 )
5130 dnl ========================================================
5131 dnl = JS Debugger XPCOM component (js/jsd)
5132 dnl ========================================================
5133 MOZ_ARG_DISABLE_BOOL(jsd,
5134 [  --disable-jsd           Disable JavaScript debug library],
5135     MOZ_JSDEBUGGER=,
5136     MOZ_JSDEBUGGER=1)
5139 dnl ========================================================
5140 dnl = Disable plugin support
5141 dnl ========================================================
5142 MOZ_ARG_DISABLE_BOOL(plugins,
5143 [  --disable-plugins       Disable plugins support],
5144     MOZ_PLUGINS=,
5145     MOZ_PLUGINS=1)
5147 dnl ========================================================
5148 dnl = Disable building dbm
5149 dnl ========================================================
5150 MOZ_ARG_DISABLE_BOOL(dbm,
5151 [  --disable-dbm       Disable building dbm],
5152     NSS_DISABLE_DBM=1,
5153     NSS_DISABLE_DBM=)
5155 dnl ========================================================
5156 dnl = Open JVM Interface (OJI) support
5157 dnl ========================================================
5158 MOZ_ARG_DISABLE_BOOL(oji,
5159 [  --disable-oji           Disable Open JVM Integration support],
5160     MOZ_OJI=,
5161     MOZ_OJI=1)
5162 if test -n "$MOZ_OJI"; then
5163     AC_DEFINE(OJI)
5166 dnl bi-directional support always on
5167 IBMBIDI=1
5168 AC_DEFINE(IBMBIDI)
5170 dnl ========================================================
5171 dnl view source support on by default
5172 dnl ========================================================
5173 MOZ_ARG_DISABLE_BOOL(view-source,
5174 [  --disable-view-source     Disable view source support],
5175     MOZ_VIEW_SOURCE=,
5176     MOZ_VIEW_SOURCE=1 )
5177 if test "$MOZ_VIEW_SOURCE"; then
5178     AC_DEFINE(MOZ_VIEW_SOURCE)
5182 dnl ========================================================
5183 dnl accessibility support on by default on all platforms 
5184 dnl except OS X.
5185 dnl ========================================================
5186 MOZ_ARG_DISABLE_BOOL(accessibility,
5187 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5188     ACCESSIBILITY=,
5189     ACCESSIBILITY=1 )
5190 if test "$ACCESSIBILITY"; then
5191     AC_DEFINE(ACCESSIBILITY)
5194 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5195 case "$target" in
5196 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5197     if test "$ac_cv_header_atlbase_h" = "no"; then
5198         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.])
5199     fi
5200     if test "$ac_cv_header_oleacc_idl" = "no"; then
5201         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.])
5202     fi
5203     ;;
5204 esac
5207 dnl ========================================================
5208 dnl xpfe/components on by default
5209 dnl ========================================================
5210 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5211 [  --disable-xpfe-components
5212                           Disable xpfe components],
5213     MOZ_XPFE_COMPONENTS=,
5214     MOZ_XPFE_COMPONENTS=1 )
5216 dnl ========================================================
5217 dnl xpinstall support on by default
5218 dnl ========================================================
5219 MOZ_ARG_DISABLE_BOOL(xpinstall,
5220 [  --disable-xpinstall     Disable xpinstall support],
5221     MOZ_XPINSTALL=,
5222     MOZ_XPINSTALL=1 )
5223 if test "$MOZ_XPINSTALL"; then
5224     AC_DEFINE(MOZ_XPINSTALL)
5227 dnl ========================================================
5228 dnl xpcom js loader support on by default
5229 dnl ========================================================
5230 MOZ_ARG_DISABLE_BOOL(jsloader,
5231 [  --disable-jsloader      Disable xpcom js loader support],
5232     MOZ_JSLOADER=,
5233     MOZ_JSLOADER=1 )
5234 if test "$MOZ_JSLOADER"; then
5235     AC_DEFINE(MOZ_JSLOADER)
5238 dnl ========================================================
5239 dnl Disable printing
5240 dnl ========================================================
5241 MOZ_ARG_DISABLE_BOOL(printing,
5242 [  --disable-printing  Disable printing support],
5243     NS_PRINTING=,
5244     NS_PRINTING=1 )
5246 if test "$NS_PRINTING"; then
5247     AC_DEFINE(NS_PRINTING)
5248     AC_DEFINE(NS_PRINT_PREVIEW)
5251 dnl ========================================================
5252 dnl use native unicode converters
5253 dnl ========================================================
5254 MOZ_ARG_ENABLE_BOOL(native-uconv,
5255 [  --enable-native-uconv   Enable iconv support],
5256     MOZ_USE_NATIVE_UCONV=1,
5257     MOZ_USE_NATIVE_UCONV= )
5258 if test "$MOZ_USE_NATIVE_UCONV"; then
5259     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5261 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5262     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5266 dnl ========================================================
5267 dnl Libeditor can be build as plaintext-only,
5268 dnl or as a full html and text editing component.
5269 dnl We build both by default.
5270 dnl ========================================================
5271 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5272 [  --enable-plaintext-editor-only
5273                           Allow only plaintext editing],
5274     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5275     MOZ_PLAINTEXT_EDITOR_ONLY= )
5276 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5277 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5279 dnl ========================================================
5280 dnl = Drop XPCOM Obsolete library
5281 dnl ========================================================
5282 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5283 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5284     MOZ_NO_XPCOM_OBSOLETE=1,
5285     MOZ_NO_XPCOM_OBSOLETE=)
5287 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5288     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5291 dnl ========================================================
5292 dnl = Disable Fast Load
5293 dnl ========================================================
5294 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5295 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5296     MOZ_NO_FAST_LOAD=1,
5297     MOZ_NO_FAST_LOAD=)
5299 AC_SUBST(MOZ_NO_FAST_LOAD)
5301 if test -n "$MOZ_NO_FAST_LOAD"; then
5302     AC_DEFINE(MOZ_NO_FAST_LOAD)
5305 dnl ========================================================
5306 dnl = Disable Ogg Codecs
5307 dnl ========================================================
5308 MOZ_ARG_DISABLE_BOOL(ogg,
5309 [  --disable-ogg           Disable Ogg Codec support],
5310     MOZ_OGG=,
5311     MOZ_OGG=1)
5313 AC_SUBST(MOZ_OGG)
5315 if test -n "$MOZ_OGG"; then
5316     AC_DEFINE(MOZ_OGG)
5317     MOZ_SYDNEYAUDIO=1
5318     MOZ_MEDIA=1
5321 dnl ========================================================
5322 dnl = Disable Wave decoder support
5323 dnl ========================================================
5324 MOZ_ARG_DISABLE_BOOL(wave,
5325 [  --disable-wave          Disable Wave decoder support],
5326     MOZ_WAVE=,
5327     MOZ_WAVE=1)
5329 AC_SUBST(MOZ_WAVE)
5331 if test -n "$MOZ_WAVE"; then
5332     AC_DEFINE(MOZ_WAVE)
5333     MOZ_SYDNEYAUDIO=1
5334     MOZ_MEDIA=1
5337 dnl ========================================================
5338 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5339 dnl ========================================================
5341 AC_SUBST(MOZ_SYDNEYAUDIO)
5343 if test -n "$MOZ_SYDNEYAUDIO"; then
5344     AC_DEFINE(MOZ_SYDNEYAUDIO)
5347 AC_SUBST(MOZ_MEDIA)
5349 if test -n "$MOZ_MEDIA"; then
5350     AC_DEFINE(MOZ_MEDIA)
5353 dnl ========================================================
5354 dnl = Check alsa availability on Linux if using sydneyaudio
5355 dnl ========================================================
5357 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5358 if test "$COMPILE_ENVIRONMENT"; then
5359 if test -n "$MOZ_SYDNEYAUDIO"; then
5360    case "$target_os" in
5361 linux*)
5362       AC_CHECK_LIB(asound, snd_pcm_open,,AC_MSG_ERROR([Ogg support on Linux requires the alsa library]))
5363       ;;
5364    esac
5368 dnl ========================================================
5369 dnl Permissions System
5370 dnl ========================================================
5371 MOZ_ARG_DISABLE_BOOL(permissions,
5372 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5373     MOZ_PERMISSIONS=,
5374     MOZ_PERMISSIONS=1
5377 dnl ========================================================
5378 dnl NegotiateAuth
5379 dnl ========================================================
5380 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5381 [  --disable-negotiateauth Disable GSS-API negotiation ],
5382     MOZ_AUTH_EXTENSION=,
5383     MOZ_AUTH_EXTENSION=1 )
5385 dnl ========================================================
5386 dnl XTF
5387 dnl ========================================================
5388 MOZ_ARG_DISABLE_BOOL(xtf,
5389 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5390     MOZ_XTF=,
5391     MOZ_XTF=1 )
5392 if test "$MOZ_XTF"; then
5393   AC_DEFINE(MOZ_XTF)
5396 dnl ========================================================
5397 dnl Inspector APIs
5398 dnl ========================================================
5399 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5400 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5401     MOZ_NO_INSPECTOR_APIS=1,
5402     MOZ_NO_INSPECTOR_APIS= )
5404 dnl ========================================================
5405 dnl Pref extensions (autoconfig and system-pref)
5406 dnl ========================================================
5407 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5408 [  --disable-pref-extensions
5409                           Disable pref extensions such as autoconfig and
5410                           system-pref],
5411   MOZ_PREF_EXTENSIONS=,
5412   MOZ_PREF_EXTENSIONS=1 )
5414 dnl ========================================================
5415 dnl = Universalchardet
5416 dnl ========================================================
5417 MOZ_ARG_DISABLE_BOOL(universalchardet,
5418 [  --disable-universalchardet
5419                           Disable universal encoding detection],
5420   MOZ_UNIVERSALCHARDET=,
5421   MOZ_UNIVERSALCHARDET=1 )
5423 dnl ========================================================
5424 dnl JavaXPCOM
5425 dnl ========================================================
5426 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5427 [  --enable-javaxpcom
5428                           Enable Java-XPCOM bridge],
5429     MOZ_JAVAXPCOM=1,
5430     MOZ_JAVAXPCOM= )
5432 if test -n "${MOZ_JAVAXPCOM}"; then
5433   case "$host_os" in
5434     cygwin*|msvc*|mks*)
5435       if test -n "$JAVA_HOME"; then
5436         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5437       fi
5438       ;;
5439     *mingw*)
5440       if test -n "$JAVA_HOME"; then
5441         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5442       fi
5443       ;;
5444   esac
5446   if test -n "${JAVA_INCLUDE_PATH}"; then
5447     dnl Make sure jni.h exists in the given include path.
5448     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5449       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5450     fi
5451   else
5452     case "$target_os" in
5453       darwin*)
5454         dnl Default to java system location
5455         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5456         ;;
5457       *)
5458         dnl Try $JAVA_HOME
5459         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5460         ;;
5461     esac
5462     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5463       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.])
5464     fi
5465   fi
5467   if test -n "${JAVA_BIN_PATH}"; then
5468     dnl Look for javac and jar in the specified path.
5469     JAVA_PATH="$JAVA_BIN_PATH"
5470   else
5471     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5472     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5473   fi
5475   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5476   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5477   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5478   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5479     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.])
5480   fi
5483 dnl ========================================================
5484 dnl = Breakpad crash reporting (on by default on supported platforms)
5485 dnl ========================================================
5487 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5488     || test "$OS_ARCH" = "Darwin" \
5489     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5490     || test "$OS_ARCH" = "SunOS") \
5491    && test -z "$HAVE_64BIT_OS"; then
5492    MOZ_CRASHREPORTER=1
5495 MOZ_ARG_DISABLE_BOOL(crashreporter,
5496 [  --disable-crashreporter          Disable breakpad crash reporting],
5497     MOZ_CRASHREPORTER=,
5498     MOZ_CRASHREPORTER=1)
5500 if test -n "$MOZ_CRASHREPORTER"; then
5501    AC_DEFINE(MOZ_CRASHREPORTER)
5503   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5504     test -z "$SKIP_LIBRARY_CHECKS"; then
5505     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5506     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5507     AC_SUBST(MOZ_GTHREAD_LIBS)
5509     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.])])
5510   fi
5513 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5514 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5515 [ val=`echo $withval | sed 's/[^0-9]//g'`
5516     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5518 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5519    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5521 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5523 dnl ========================================================
5524 dnl = Enable compilation of specific extension modules
5525 dnl ========================================================
5527 MOZ_ARG_ENABLE_STRING(extensions,
5528 [  --enable-extensions     Enable extensions],
5529 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5530     if test "$option" = "yes" || test "$option" = "all"; then
5531         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5532     elif test "$option" = "no" || test "$option" = "none"; then
5533         MOZ_EXTENSIONS=""
5534     elif test "$option" = "default"; then
5535         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5536     elif test `echo "$option" | grep -c \^-` != 0; then
5537         option=`echo $option | sed 's/^-//'`
5538         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5539     else
5540         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5541     fi
5542 done],
5543     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5545 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5546     # Suppress warning on non-X11 platforms
5547     if test -n "$MOZ_X11"; then
5548         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5549     fi
5550     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5553 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5554     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5555     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5558 dnl This might be temporary: build tridentprofile only on Windows
5559 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5560     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5561     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5564 dnl cookie must be built before tridentprofile. put it at list's end.
5565 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5566   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5567   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5570 dnl xforms requires xtf and schema-validation
5571 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5572     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5573     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5575 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5576     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5577     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5580 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5581     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5582     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5585 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5586     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5587     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5590 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5591     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5592     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5595 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5596     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5597     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5600 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5601     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5602     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5605 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5606     AC_MSG_WARN([spellcheck is no longer an extension.])
5607     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5610 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5611     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5612     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5615 dnl Remove dupes
5616 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5618 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5619 dnl when trying to build a non-existent extension.
5620 for extension in $MOZ_EXTENSIONS; do
5621     if test ! -d "${srcdir}/extensions/${extension}"; then
5622         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5623     fi
5624 done
5627 dnl ========================================================
5628 dnl Image decoders
5629 dnl ========================================================
5630 case "$MOZ_WIDGET_TOOLKIT" in
5631 beos|windows|os2|mac|cocoa)
5632     ;;
5634     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
5635        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
5636     fi
5637     ;;
5638 esac
5640 MOZ_ARG_ENABLE_STRING(image-decoders,
5641 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5642                           Enable specific image decoders],
5643 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5644     if test "$option" = "yes" || test "$option" = "all"; then
5645         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5646     elif test "$option" = "no" || test "$option" = "none"; then
5647         MOZ_IMG_DECODERS=""
5648     elif test "$option" = "default"; then
5649         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5650     elif test `echo "$option" | grep -c \^-` != 0; then
5651         option=`echo $option | sed 's/^-//'`
5652         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5653     else
5654         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5655     fi
5656 done],
5657     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5659 dnl Dupes are removed in the encoder section because it will also add decoders
5661 dnl ========================================================
5662 dnl Image encoders
5663 dnl ========================================================
5664 MOZ_ARG_ENABLE_STRING(image-encoders,
5665 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5666                           Enable specific image encoders],
5667 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5668     if test "$option" = "yes" || test "$option" = "all"; then
5669         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5670     elif test "$option" = "no" || test "$option" = "none"; then
5671         MOZ_IMG_ENCODERS=""
5672         addencoder=""
5673     elif test "$option" = "default"; then
5674         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5675     elif test `echo "$option" | grep -c \^-` != 0; then
5676         option=`echo $option | sed 's/^-//'`
5677         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5678     else
5679         addencoder="$option"
5680     fi
5681     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5682 done],
5683     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5685 dnl Remove dupes
5686 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5687 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5689 dnl ========================================================
5690 dnl MathML on by default
5691 dnl ========================================================
5692 MOZ_ARG_DISABLE_BOOL(mathml,
5693 [  --disable-mathml        Disable MathML support],
5694     MOZ_MATHML=,
5695     MOZ_MATHML=1 )
5696 if test "$MOZ_MATHML"; then
5697   AC_DEFINE(MOZ_MATHML)
5700 dnl ========================================================
5701 dnl Canvas
5702 dnl ========================================================
5703 MOZ_ARG_DISABLE_BOOL(canvas,
5704 [  --disable-canvas          Disable html:canvas feature],
5705     MOZ_ENABLE_CANVAS=,
5706     MOZ_ENABLE_CANVAS=1 )
5707 if test -n "$MOZ_ENABLE_CANVAS"; then
5708     AC_DEFINE(MOZ_ENABLE_CANVAS)
5710 AC_SUBST(MOZ_ENABLE_CANVAS)
5712 dnl ========================================================
5713 dnl SVG
5714 dnl ========================================================
5715 MOZ_ARG_DISABLE_BOOL(svg,
5716 [  --disable-svg            Disable SVG support],
5717     MOZ_SVG=,
5718     MOZ_SVG=1 )
5719 if test -n "$MOZ_SVG"; then
5720   AC_DEFINE(MOZ_SVG)
5723 dnl ========================================================
5724 dnl Installer
5725 dnl ========================================================
5726 case "$target_os" in
5727     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5728         MOZ_INSTALLER=1
5729         ;;
5730 esac
5732 MOZ_ARG_DISABLE_BOOL(installer,
5733 [  --disable-installer     Disable building of installer],
5734     MOZ_INSTALLER=,
5735     MOZ_INSTALLER=1 )
5736 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5737     # Disable installer for Windows builds that use the new toolkit if NSIS
5738     # isn't in the path.
5739     AC_PATH_PROGS(MAKENSIS, makensis)
5740     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5741         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5742     fi
5743     # The Windows build for NSIS requires the iconv command line utility to
5744     # convert the charset of the locale files.
5745     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5746     if test -z "$HOST_ICONV"; then
5747         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5748     fi
5751 # Automatically disable installer if xpinstall isn't built
5752 if test -z "$MOZ_XPINSTALL"; then
5753     MOZ_INSTALLER=
5755 AC_SUBST(MOZ_INSTALLER)
5757 AC_MSG_CHECKING([for tar archiver])
5758 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5759 if test -z "$TAR"; then
5760     AC_MSG_ERROR([no tar archiver found in \$PATH])
5762 AC_MSG_RESULT([$TAR])
5763 AC_SUBST(TAR)
5765 AC_MSG_CHECKING([for wget])
5766 AC_CHECK_PROGS(WGET, wget, "")
5767 AC_MSG_RESULT([$WGET])
5768 AC_SUBST(WGET)
5770 dnl ========================================================
5771 dnl Updater
5772 dnl ========================================================
5774 MOZ_ARG_DISABLE_BOOL(updater,
5775 [  --disable-updater       Disable building of updater],
5776     MOZ_UPDATER=,
5777     MOZ_UPDATER=1 )
5778 # The Windows build requires the iconv command line utility
5779 # in order to build the updater.
5780 case "$target_os" in
5781     msvc*|mks*|cygwin*|mingw*|wince*)
5782         if test -n "$MOZ_UPDATER"; then
5783             AC_MSG_CHECKING([for iconv])
5784             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5785             if test -z "$HOST_ICONV"; then
5786                 AC_MSG_ERROR([iconv not found in \$PATH])
5787             fi
5788         fi
5789         ;;
5790 esac
5791 AC_SUBST(MOZ_UPDATER)
5793 # app update channel is 'default' when not supplied.
5794 MOZ_ARG_ENABLE_STRING([update-channel],
5795 [  --enable-update-channel=CHANNEL
5796                            Select application update channel (default=default)],
5797     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5799 if test -z "$MOZ_UPDATE_CHANNEL"; then
5800     MOZ_UPDATE_CHANNEL=default
5802 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5804 # tools/update-packaging is not checked out by default.
5805 MOZ_ARG_ENABLE_BOOL(update-packaging,
5806 [  --enable-update-packaging
5807                            Enable tools/update-packaging],
5808     MOZ_UPDATE_PACKAGING=1,
5809     MOZ_UPDATE_PACKAGING= )
5810 AC_SUBST(MOZ_UPDATE_PACKAGING)
5812 dnl ========================================================
5813 dnl ActiveX
5814 dnl ========================================================
5816 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5817 [  --disable-xpconnect-idispatch
5818                           Disable building of xpconnect support for IDispatch
5819                           (win32 only)],
5820     XPC_IDISPATCH_SUPPORT=,
5821     XPC_IDISPATCH_SUPPORT=1)
5822 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5824 MOZ_ARG_DISABLE_BOOL(activex,
5825 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5826     MOZ_NO_ACTIVEX_SUPPORT=1,
5827     MOZ_NO_ACTIVEX_SUPPORT= )
5828 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5830 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5831 [  --disable-activex-scripting
5832                           Disable building of ActiveX scripting support (win32)],
5833     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5834     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5835 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5837 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5838 then
5839     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5842 if test "$COMPILE_ENVIRONMENT" = "1"; then
5843 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5844 case "$target" in
5845 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5846     if test "$ac_cv_header_atlbase_h" = "no"; then
5847         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.])
5848     fi
5849     ;;
5850 esac
5854 dnl ========================================================
5855 dnl leaky
5856 dnl ========================================================
5857 MOZ_ARG_ENABLE_BOOL(leaky,
5858 [  --enable-leaky          Build leaky memory tool],
5859     MOZ_LEAKY=1,
5860     MOZ_LEAKY=)
5863 dnl ========================================================
5864 dnl xpctools
5865 dnl ========================================================
5866 MOZ_ARG_ENABLE_BOOL(xpctools,
5867 [  --enable-xpctools       Build JS profiling tool],
5868     MOZ_XPCTOOLS=1,
5869     MOZ_XPCTOOLS= )
5872 dnl ========================================================
5873 dnl build the tests by default
5874 dnl ========================================================
5875 MOZ_ARG_DISABLE_BOOL(tests,
5876 [  --disable-tests         Do not build test libraries & programs],
5877     ENABLE_TESTS=,
5878     ENABLE_TESTS=1 )
5880 dnl ========================================================
5881 dnl parental controls (for Windows Vista)
5882 dnl ========================================================
5883 MOZ_ARG_DISABLE_BOOL(parental-controls,
5884 [  --disable-parental-controls
5885                            Do not build parental controls],
5886    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5887    MOZ_DISABLE_PARENTAL_CONTROLS=)
5888 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5889     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5892 dnl ========================================================
5893 dnl Vista SDK specific api
5894 dnl ========================================================
5895 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
5896 [  --disable-vista-sdk-requirements
5897                            Do not build Vista SDK specific code],
5898    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
5899    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
5900 if test -n "$COMPILE_ENVIRONMENT"; then
5901 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
5902     AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
5903     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5904     if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5905         AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5906     fi
5907     MOZ_DISABLE_PARENTAL_CONTROLS=1
5908 else
5909 case "$target" in
5910 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5911     if test "$ac_cv_header_wpcapi_h" = "no"; then
5912         AC_MSG_ERROR([System header wpcapi.h is not available. See updated http://developer.mozilla.org/en/docs/wpcapi.h for details on fixing this problem.])
5913     fi
5914     ;;
5915 esac
5918 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5919 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5921 dnl ========================================================
5922 dnl =
5923 dnl = Module specific options
5924 dnl =
5925 dnl ========================================================
5926 MOZ_ARG_HEADER(Individual module options)
5928 dnl ========================================================
5929 dnl = Enable Lea malloc in xpcom. OFF by default.
5930 dnl ========================================================
5931 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
5932 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
5933     XPCOM_USE_LEA=1,
5934     XPCOM_USE_LEA= )
5935 if test -n "$XPCOM_USE_LEA"; then
5936     AC_DEFINE(XPCOM_USE_LEA)
5939 dnl ========================================================
5940 dnl = Enable places (new history/bookmarks)
5941 dnl ========================================================
5942 MOZ_ARG_ENABLE_BOOL(places,
5943 [  --enable-places        Enable 'places' bookmark/history implementation],
5944     MOZ_PLACES=1,
5945     MOZ_PLACES= )
5946 if test -n "$MOZ_PLACES"; then
5947     AC_DEFINE(MOZ_PLACES)
5948     if test -z "$MOZ_MAIL_NEWS"; then
5949       MOZ_MORK=
5950     fi
5951     MOZ_MORKREADER=1
5952 else
5953   if test "$MOZ_BUILD_APP" = "browser"; then
5954     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5955   fi
5958 dnl ========================================================
5959 dnl = Disable feed handling components
5960 dnl ========================================================
5961 MOZ_ARG_DISABLE_BOOL(feeds,
5962 [  --disable-feeds        Disable feed handling and processing components],
5963     MOZ_FEEDS=,
5964     MOZ_FEEDS=1 )
5965 if test -n "$MOZ_FEEDS"; then
5966     AC_DEFINE(MOZ_FEEDS)
5967 else
5968     if test "$MOZ_BUILD_APP" = "browser"; then
5969         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
5970     fi
5973 dnl ========================================================
5974 dnl = Enable mozStorage
5975 dnl ========================================================
5976 dnl Implicitly enabled by default if building calendar or places
5977 MOZ_ARG_ENABLE_BOOL(storage,
5978 [  --enable-storage        Enable mozStorage module and related components],
5979     MOZ_STORAGE=1,
5980     MOZ_STORAGE= )
5981 if test -n "$MOZ_STORAGE"; then
5982     AC_DEFINE(MOZ_STORAGE)
5985 dnl ========================================================
5986 dnl Check for sqlite
5987 dnl ========================================================
5989 MOZ_NATIVE_SQLITE=
5990 MOZ_ARG_ENABLE_BOOL(system-sqlite,
5991 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
5992 MOZ_NATIVE_SQLITE=1,
5993 MOZ_NATIVE_SQLITE= )
5995 if test -z "$MOZ_NATIVE_SQLITE"
5996 then
5997     SQLITE_CFLAGS=
5998     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
5999 else
6000     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6003 AC_SUBST(MOZ_NATIVE_SQLITE)
6005 dnl ========================================================
6006 dnl = Enable help viewer (off by default)
6007 dnl ========================================================
6008 MOZ_ARG_ENABLE_BOOL(help-viewer,
6009 [  --enable-help-viewer        Enable help viewer],
6010     MOZ_HELP_VIEWER=1,
6011     MOZ_HELP_VIEWER= )
6012 if test -n "$MOZ_HELP_VIEWER"; then
6013      AC_DEFINE(MOZ_HELP_VIEWER)
6015 AC_SUBST(MOZ_HELP_VIEWER)
6016 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6017     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6020 dnl ========================================================
6021 dnl = Enable safe browsing (anti-phishing)
6022 dnl ========================================================
6023 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6024 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6025     MOZ_SAFE_BROWSING=1,
6026     MOZ_SAFE_BROWSING= )
6027 if test -n "$MOZ_SAFE_BROWSING"; then
6028     AC_DEFINE(MOZ_SAFE_BROWSING)
6030 AC_SUBST(MOZ_SAFE_BROWSING)
6032 dnl ========================================================
6033 dnl = Enable url-classifier
6034 dnl ========================================================
6035 dnl Implicitly enabled by default if building with safe-browsing
6036 if test -n "$MOZ_SAFE_BROWSING"; then
6037     MOZ_URL_CLASSIFIER=1
6039 MOZ_ARG_ENABLE_BOOL(url-classifier,
6040 [  --enable-url-classifier        Enable url classifier module],
6041     MOZ_URL_CLASSIFIER=1,
6042     MOZ_URL_CLASSIFIER= )
6043 if test -n "$MOZ_URL_CLASSIFIER"; then
6044     AC_DEFINE(MOZ_URL_CLASSIFIER)
6046 AC_SUBST(MOZ_URL_CLASSIFIER)
6048 dnl ========================================================
6049 dnl = Disable zipwriter
6050 dnl ========================================================
6051 MOZ_ARG_DISABLE_BOOL(zipwriter,
6052 [  --disable-zipwriter             Disable zipwriter component],
6053     MOZ_ZIPWRITER=,
6054     MOZ_ZIPWRITER=1 )
6055 AC_SUBST(MOZ_ZIPWRITER)
6057 dnl ========================================================
6058 dnl = Enable Ultrasparc specific optimizations for JS
6059 dnl ========================================================
6060 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6061 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6062     JS_ULTRASPARC_OPTS=1,
6063     JS_ULTRASPARC_OPTS= )
6065 dnl only enable option for ultrasparcs
6066 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6067     "$OS_TEST" != "sun4u"; then
6068     JS_ULTRASPARC_OPTS=
6070 AC_SUBST(JS_ULTRASPARC_OPTS)
6072 dnl ========================================================
6073 dnl = Hildon and OSSO checks
6074 dnl ========================================================
6075 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
6076                   MOZ_PLATFORM_HILDON=1,
6077                   MOZ_PLATFORM_HILDON=)
6078 if test $MOZ_PLATFORM_HILDON; then
6079    AC_DEFINE(MOZ_PLATFORM_HILDON)
6081 AC_SUBST(LIBHILDONMIME_CFLAGS)
6082 AC_SUBST(LIBHILDONMIME_LIBS)
6084 PKG_CHECK_MODULES(LIBOSSO,libosso,
6085                   NS_OSSO=1,
6086                   NS_OSSO=)
6088 if test $NS_OSSO; then
6089     if test -z "$MOZ_ENABLE_DBUS"; then
6090         AC_MSG_ERROR([DBus is required when building for OSSO])
6091     fi
6092     AC_DEFINE(NS_OSSO)
6093     dnl XXX this should go somewhere else; it's not just for OSSO
6094     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6096 AC_SUBST(LIBOSSO_CFLAGS)
6097 AC_SUBST(LIBOSSO_LIBS)
6099 PKG_CHECK_MODULES(MOZ_LOCATION, [liblocation gpsbt],
6100                   NS_MAEMO_LOCATION=1,
6101                   NS_MAEMO_LOCATION=)
6103 if test $NS_MAEMO_LOCATION; then
6104   AC_DEFINE(NS_MAEMO_LOCATION)
6107 AC_SUBST(MOZ_LOCATION_CFLAGS)
6108 AC_SUBST(MOZ_LOCATION_LIBS)
6110 dnl ========================================================
6111 dnl =
6112 dnl = Feature options that require extra sources to be pulled
6113 dnl =
6114 dnl ========================================================
6115 dnl MOZ_ARG_HEADER(Features that require extra sources)
6117 dnl ========================================================
6118 dnl =
6119 dnl = Debugging Options
6120 dnl = 
6121 dnl ========================================================
6122 MOZ_ARG_HEADER(Debugging and Optimizations)
6124 dnl ========================================================
6125 dnl = Disable building with debug info.
6126 dnl = Debugging is OFF by default
6127 dnl ========================================================
6128 if test -z "$MOZ_DEBUG_FLAGS"
6129 then
6130     case "$target" in
6131     *-irix*)
6132         if test "$GNU_CC"; then
6133             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6134             case "$GCC_VERSION" in
6135             2.95.*)
6136                 MOZ_DEBUG_FLAGS=""
6137                 ;;
6138             *)
6139                 MOZ_DEBUG_FLAGS="-g"
6140                 ;;
6141             esac
6142         else
6143             MOZ_DEBUG_FLAGS="-g"
6144         fi
6145         ;;
6146     *)
6147         MOZ_DEBUG_FLAGS="-g"
6148         ;;
6149     esac
6152 MOZ_ARG_ENABLE_STRING(debug,
6153 [  --enable-debug[=DBG]    Enable building with developer debug info
6154                           (Using compiler flags DBG)],
6155 [ if test "$enableval" != "no"; then
6156     MOZ_DEBUG=1
6157     if test -n "$enableval" && test "$enableval" != "yes"; then
6158         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6159     fi
6160   else
6161     MOZ_DEBUG=
6162   fi ],
6163   MOZ_DEBUG=)
6165 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6166  case "${target_os}" in
6167     beos*)
6168         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6169         ;;
6170     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6171         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6172         ;;
6173     *) 
6174         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6175         ;;
6176   esac
6177 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6179 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6181 if test -n "$MOZ_DEBUG"; then
6182     AC_MSG_CHECKING([for valid debug flags])
6183     _SAVE_CFLAGS=$CFLAGS
6184     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6185     AC_TRY_COMPILE([#include <stdio.h>], 
6186         [printf("Hello World\n");],
6187         _results=yes,
6188         _results=no)
6189     AC_MSG_RESULT([$_results])
6190     if test "$_results" = "no"; then
6191         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6192     fi
6193     CFLAGS=$_SAVE_CFLAGS
6196 dnl ========================================================
6197 dnl = Enable code optimization. ON by default.
6198 dnl ========================================================
6199 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6200         MOZ_OPTIMIZE_FLAGS="-O"
6203 MOZ_ARG_ENABLE_STRING(optimize,
6204 [  --disable-optimize      Disable compiler optimization
6205   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6206 [ if test "$enableval" != "no"; then
6207     MOZ_OPTIMIZE=1
6208     if test -n "$enableval" && test "$enableval" != "yes"; then
6209         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6210         MOZ_OPTIMIZE=2
6211     fi
6212 else
6213     MOZ_OPTIMIZE=
6214 fi ], MOZ_OPTIMIZE=1)
6216 if test "$COMPILE_ENVIRONMENT"; then
6217 if test -n "$MOZ_OPTIMIZE"; then
6218     AC_MSG_CHECKING([for valid optimization flags])
6219     _SAVE_CFLAGS=$CFLAGS
6220     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6221     AC_TRY_COMPILE([#include <stdio.h>], 
6222         [printf("Hello World\n");],
6223         _results=yes,
6224         _results=no)
6225     AC_MSG_RESULT([$_results])
6226     if test "$_results" = "no"; then
6227         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6228     fi
6229     CFLAGS=$_SAVE_CFLAGS
6231 fi # COMPILE_ENVIRONMENT
6233 AC_SUBST(MOZ_OPTIMIZE)
6234 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6235 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6236 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6238 dnl ========================================================
6239 dnl = Enable/disable debug for specific modules only
6240 dnl =   module names beginning with ^ will be disabled 
6241 dnl ========================================================
6242 MOZ_ARG_ENABLE_STRING(debug-modules,
6243 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6244 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6246 dnl ========================================================
6247 dnl = Enable/disable generation of debugger info for specific modules only
6248 dnl =    the special module name ALL_MODULES can be used to denote all modules
6249 dnl =    module names beginning with ^ will be disabled
6250 dnl ========================================================
6251 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6252 [  --enable-debugger-info-modules
6253                           Enable/disable debugger info for specific modules],
6254 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6255       dnl note that the list of module names is reversed as it is copied
6256       dnl this is important, as it will allow config.mk to interpret stuff like
6257       dnl "^ALL_MODULES xpcom" properly
6258       if test "$i" = "no"; then
6259         i="^ALL_MODULES"
6260       fi
6261       if test "$i" = "yes"; then
6262         i="ALL_MODULES"
6263       fi
6264       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6265     done ])
6267 dnl ========================================================
6268 dnl Enable garbage collector
6269 dnl ========================================================
6270 MOZ_ARG_ENABLE_BOOL(boehm,
6271 [  --enable-boehm          Enable the Boehm Garbage Collector],
6272     GC_LEAK_DETECTOR=1,
6273     GC_LEAK_DETECTOR= )
6274 if test -n "$GC_LEAK_DETECTOR"; then
6275     AC_DEFINE(GC_LEAK_DETECTOR)
6278 dnl ========================================================
6279 dnl Disable runtime logging checks
6280 dnl ========================================================
6281 MOZ_ARG_DISABLE_BOOL(logging,
6282 [  --disable-logging       Disable logging facilities],
6283     NS_DISABLE_LOGGING=1,
6284     NS_DISABLE_LOGGING= )
6285 if test "$NS_DISABLE_LOGGING"; then
6286     AC_DEFINE(NS_DISABLE_LOGGING)
6287 else
6288     AC_DEFINE(MOZ_LOGGING)
6291 dnl ========================================================
6292 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6293 dnl ========================================================
6294 _ENABLE_LOGREFCNT=42
6295 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6296 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6297     _ENABLE_LOGREFCNT=1,
6298     _ENABLE_LOGREFCNT= )
6299 if test "$_ENABLE_LOGREFCNT" = "1"; then
6300     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6301 elif test -z "$_ENABLE_LOGREFCNT"; then
6302     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6305 dnl ========================================================
6306 dnl = Enable trace malloc
6307 dnl ========================================================
6308 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6309 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6310 [  --enable-trace-malloc   Enable malloc tracing],
6311     NS_TRACE_MALLOC=1,
6312     NS_TRACE_MALLOC= )
6313 if test "$NS_TRACE_MALLOC"; then
6314   # Please, Mr. Linker Man, don't take away our symbol names
6315   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6316   USE_ELF_DYNSTR_GC=
6317   AC_DEFINE(NS_TRACE_MALLOC)
6319 AC_SUBST(NS_TRACE_MALLOC)
6321 dnl ========================================================
6322 dnl = Enable jemalloc
6323 dnl ========================================================
6324 MOZ_ARG_ENABLE_BOOL(jemalloc,
6325 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6326     MOZ_MEMORY=1,
6327     MOZ_MEMORY=)
6329 if test "$NS_TRACE_MALLOC"; then
6330     MOZ_MEMORY=
6333 if test "$MOZ_MEMORY"; then
6335   dnl Don't try to run compiler tests on Windows  
6336   if test "$OS_ARCH" = "WINNT"; then
6337     if test -z "$HAVE_64BIT_OS"; then
6338       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6339     else
6340       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6341     fi
6342   else
6343     AC_CHECK_SIZEOF([int *], [4])
6344     case "${ac_cv_sizeof_int_p}" in
6345     4)
6346       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6347       ;;
6348     8)
6349       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6350       ;;
6351     *)
6352       AC_MSG_ERROR([Unexpected pointer size])
6353       ;;
6354     esac
6355   fi
6357   AC_DEFINE(MOZ_MEMORY)
6358   if test "x$MOZ_DEBUG" = "x1"; then
6359     AC_DEFINE(MOZ_MEMORY_DEBUG)
6360   fi
6361   dnl The generic feature tests that determine how to compute ncpus are long and
6362   dnl complicated.  Therefore, simply define special cpp variables for the
6363   dnl platforms we have special knowledge of.
6364   case "${target_os}" in
6365   darwin*)
6366     AC_DEFINE(MOZ_MEMORY_DARWIN)
6367     ;;
6368   *freebsd*)
6369     AC_DEFINE(MOZ_MEMORY_BSD)
6370     ;;
6371   *linux*)
6372     AC_DEFINE(MOZ_MEMORY_LINUX)
6373     ;;
6374   netbsd*)
6375     AC_DEFINE(MOZ_MEMORY_BSD)
6376     ;;
6377   solaris*)
6378     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6379     ;;
6380   msvc*|mks*|cygwin*|mingw*)
6381     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6382     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6383     dnl will fail miserably
6384     if test "$_CC_SUITE" -lt "8"; then
6385         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6386     fi
6387     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6388       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6389         AC_MSG_ERROR([When building jemalloc, either set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src), or set WIN32_CUSTOM_CRT_DIR to the path to a folder containing a pre-built CRT DLL.])
6390       else
6391         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6392       fi
6393     fi
6394     if test -z "$WIN32_CRT_SRC_DIR"; then
6395       # pre-built dll
6396       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6397       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6398     else
6399       # CRT source directory
6400       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6401       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6402       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6403     fi
6404     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6405     dnl are to avoid m4
6406     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6407     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6408     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6409     dnl This needs to be unix style.
6410     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6411     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6412     AC_DEFINE(_STATIC_CPPLIB)
6413     dnl Don't generate a manifest, since we're linking to a custom CRT.
6414     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6415     dnl Also pass this to NSPR/NSS
6416     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6417     export DLLFLAGS
6418     ;;
6419   *)
6420     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6421     ;;
6422   esac
6424   AC_ARG_WITH([valgrind],
6425     [  --with-valgrind         Enable valgrind integration hooks],
6426     [enable_valgrind="yes"], [enable_valgrind="no"])
6427   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6428   if test "x$enable_valgrind" = "xyes" ; then
6429     AC_DEFINE(MOZ_VALGRIND)
6430   fi
6432 AC_SUBST(MOZ_MEMORY)
6433 AC_SUBST(WIN32_CRT_SRC_DIR)
6434 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6435 AC_SUBST(MOZ_LIB)
6436 AC_SUBST(MOZ_PATH)
6437 dnl Need to set this for make because NSS doesn't have configure
6438 AC_SUBST(DLLFLAGS)
6440 dnl ========================================================
6441 dnl = Use malloc wrapper lib
6442 dnl ========================================================
6443 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6444 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6445     _WRAP_MALLOC=1,
6446     _WRAP_MALLOC= )
6448 if test -n "$_WRAP_MALLOC"; then
6449     if test "$GNU_CC"; then
6450     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"
6451     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6452     fi
6455 dnl ========================================================
6456 dnl = Location of malloc wrapper lib
6457 dnl ========================================================
6458 MOZ_ARG_WITH_STRING(wrap-malloc,
6459 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6460     WRAP_MALLOC_LIB=$withval)
6462 dnl ========================================================
6463 dnl = Use Electric Fence
6464 dnl ========================================================
6465 MOZ_ARG_ENABLE_BOOL(efence,
6466 [  --enable-efence         Link with Electric Fence],
6467     _ENABLE_EFENCE=1,
6468     _ENABLE_EFENCE= )
6469 if test -n "$_ENABLE_EFENCE"; then
6470     AC_CHECK_LIB(efence,malloc)
6473 dnl ========================================================
6474 dnl jprof
6475 dnl ========================================================
6476 MOZ_ARG_ENABLE_BOOL(jprof,
6477 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6478     MOZ_JPROF=1,
6479     MOZ_JPROF= )
6480 if test -n "$MOZ_JPROF"; then
6481     AC_DEFINE(MOZ_JPROF)
6484 dnl ========================================================
6485 dnl shark
6486 dnl ========================================================
6487 MOZ_ARG_ENABLE_BOOL(shark,
6488 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6489     MOZ_SHARK=1,
6490     MOZ_SHARK= )
6491 if test -n "$MOZ_SHARK"; then
6492     AC_DEFINE(MOZ_SHARK)
6495 dnl ========================================================
6496 dnl callgrind
6497 dnl ========================================================
6498 MOZ_ARG_ENABLE_BOOL(callgrind,
6499 [  --enable-callgrind      Enable callgrind profiling],
6500     MOZ_CALLGRIND=1,
6501     MOZ_CALLGRIND= )
6502 if test -n "$MOZ_CALLGRIND"; then
6503     AC_DEFINE(MOZ_CALLGRIND)
6506 dnl ========================================================
6507 dnl vtune
6508 dnl ========================================================
6509 MOZ_ARG_ENABLE_BOOL(vtune,
6510 [  --enable-vtune          Enable vtune profiling],
6511     MOZ_VTUNE=1,
6512     MOZ_VTUNE= )
6513 if test -n "$MOZ_VTUNE"; then
6514     AC_DEFINE(MOZ_VTUNE)
6517 dnl ========================================================
6518 dnl = Enable static checking using gcc-dehydra
6519 dnl ========================================================
6521 MOZ_ARG_WITH_STRING(static-checking,
6522 [  --with-static-checking=path/to/gcc_dehydra.so
6523                             Enable static checking of code using GCC-dehydra],
6524     DEHYDRA_PATH=$withval,
6525     DEHYDRA_PATH= )
6527 if test -n "$DEHYDRA_PATH"; then
6528     if ! test -f "$DEHYDRA_PATH"; then
6529         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6530     fi
6531     AC_DEFINE(NS_STATIC_CHECKING)
6533 AC_SUBST(DEHYDRA_PATH)
6535 dnl ========================================================
6536 dnl = Enable stripping of libs & executables
6537 dnl ========================================================
6538 MOZ_ARG_ENABLE_BOOL(strip,
6539 [  --enable-strip          Enable stripping of libs & executables ],
6540     ENABLE_STRIP=1,
6541     ENABLE_STRIP= )
6543 dnl ========================================================
6544 dnl = Enable stripping of libs & executables when packaging
6545 dnl ========================================================
6546 MOZ_ARG_ENABLE_BOOL(install-strip,
6547 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6548     PKG_SKIP_STRIP= ,
6549     PKG_SKIP_STRIP=1)
6551 dnl ========================================================
6552 dnl = --enable-elf-dynstr-gc
6553 dnl ========================================================
6554 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6555 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6556     USE_ELF_DYNSTR_GC=1,
6557     USE_ELF_DYNSTR_GC= )
6559 dnl ========================================================
6560 dnl = --enable-old-abi-compat-wrappers
6561 dnl ========================================================
6562 dnl on x86 linux, the current builds of some popular plugins (notably
6563 dnl flashplayer and real) expect a few builtin symbols from libgcc
6564 dnl which were available in some older versions of gcc.  However,
6565 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6566 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6567 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6568 dnl to true on x86 linux, and false everywhere else.
6571 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6572 [  --enable-old-abi-compat-wrappers
6573                           Support old GCC ABI symbols to ease the pain 
6574                           of the linux compiler change],
6575     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6576     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6577 if test "$COMPILE_ENVIRONMENT"; then
6578 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6579     AC_LANG_SAVE
6580     AC_LANG_CPLUSPLUS
6581     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6582     AC_LANG_RESTORE
6583     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6585 fi # COMPILE_ENVIRONMENT
6587 dnl ========================================================
6588 dnl = 
6589 dnl = Profiling and Instrumenting
6590 dnl = 
6591 dnl ========================================================
6592 MOZ_ARG_HEADER(Profiling and Instrumenting)
6594 dnl ========================================================
6595 dnl = Enable timeline service, which provides lightweight
6596 dnl = instrumentation of mozilla for performance measurement.
6597 dnl = Timeline is off by default.
6598 dnl ========================================================
6599 MOZ_ARG_ENABLE_BOOL(timeline,
6600 [  --enable-timeline       Enable timeline services ],
6601     MOZ_TIMELINE=1,
6602     MOZ_TIMELINE= )
6603 if test -n "$MOZ_TIMELINE"; then
6604     AC_DEFINE(MOZ_TIMELINE)
6607 dnl ========================================================
6608 dnl Turn on reflow counting
6609 dnl ========================================================
6610 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6611 [  --enable-reflow-perf    Enable reflow performance tracing],
6612     MOZ_REFLOW_PERF=1,
6613     MOZ_REFLOW_PERF= )
6614 if test -n "$MOZ_REFLOW_PREF"; then
6615     AC_DEFINE(MOZ_REFLOW_PREF)
6617 AC_SUBST(MOZ_REFLOW_PERF)
6619 dnl ========================================================
6620 dnl Enable performance metrics.
6621 dnl ========================================================
6622 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6623 [  --enable-perf-metrics   Enable performance metrics],
6624     MOZ_PERF_METRICS=1,
6625     MOZ_PERF_METRICS= )
6626 if test -n "$MOZ_PERF_METRICS"; then
6627     AC_DEFINE(MOZ_PERF_METRICS)
6630 dnl ========================================================
6631 dnl Enable code size metrics.
6632 dnl ========================================================
6633 MOZ_ARG_ENABLE_BOOL(codesighs,
6634 [  --enable-codesighs      Enable code size analysis tools],
6635     _ENABLE_CODESIGHS=1,
6636     _ENABLE_CODESIGHS= )
6637 if test -n "$_ENABLE_CODESIGHS"; then
6638     if test -d $srcdir/tools/codesighs; then 
6639         MOZ_MAPINFO=1
6640     else
6641         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6642     fi
6645 dnl ========================================================
6646 dnl = Add support for Eazel profiler
6647 dnl ========================================================
6648 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6649 [  --enable-eazel-profiler-support
6650                           Enable Corel/Eazel profiler support],
6651     ENABLE_EAZEL_PROFILER=1,
6652     ENABLE_EAZEL_PROFILER= )
6653 if test -n "$ENABLE_EAZEL_PROFILER"; then
6654     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6655     USE_ELF_DYNSTR_GC=
6656     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6657     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6658     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6661 MOZ_ARG_ENABLE_STRING(profile-modules,
6662 [  --enable-profile-modules
6663                           Enable/disable profiling for specific modules],
6664 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6666 MOZ_ARG_ENABLE_BOOL(insure,
6667 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6668     _ENABLE_INSURE=1,
6669     _ENABLE_INSURE= )
6670 if test -n "$_ENABLE_INSURE"; then
6671     MOZ_INSURE="insure"
6672     MOZ_INSURIFYING=1
6673     MOZ_INSURE_DIRS="."
6674     MOZ_INSURE_EXCLUDE_DIRS="config"
6677 MOZ_ARG_WITH_STRING(insure-dirs,
6678 [  --with-insure-dirs=DIRS
6679                           Dirs to instrument with insure ],
6680     MOZ_INSURE_DIRS=$withval )
6682 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6683 [  --with-insure-exclude-dirs=DIRS
6684                           Dirs to not instrument with insure ],
6685     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6687 dnl ========================================================
6688 dnl = Support for Quantify (Windows)
6689 dnl ========================================================
6690 MOZ_ARG_ENABLE_BOOL(quantify,
6691 [  --enable-quantify      Enable Quantify support (Windows only) ],
6692     MOZ_QUANTIFY=1,
6693     MOZ_QUANTIFY= )
6695 dnl ========================================================
6696 dnl = Support for demangling undefined symbols
6697 dnl ========================================================
6698 if test -z "$SKIP_LIBRARY_CHECKS"; then
6699     AC_LANG_SAVE
6700     AC_LANG_CPLUSPLUS
6701     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6702     AC_LANG_RESTORE
6705 # Demangle only for debug or trace-malloc builds
6706 MOZ_DEMANGLE_SYMBOLS=
6707 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6708     MOZ_DEMANGLE_SYMBOLS=1
6709     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6711 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6713 dnl ========================================================
6714 dnl = Support for gcc stack unwinding (from gcc 3.3)
6715 dnl ========================================================
6716 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6717     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6720 dnl ========================================================
6721 dnl =
6722 dnl = Misc. Options
6723 dnl = 
6724 dnl ========================================================
6725 MOZ_ARG_HEADER(Misc. Options)
6727 dnl ========================================================
6728 dnl update xterm title
6729 dnl ========================================================
6730 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6731 [  --enable-xterm-updates  Update XTERM titles with current command.],
6732     MOZ_UPDATE_XTERM=1,
6733     MOZ_UPDATE_XTERM= )
6735 dnl =========================================================
6736 dnl = Chrome format
6737 dnl =========================================================
6738 MOZ_ARG_ENABLE_STRING([chrome-format],
6739 [  --enable-chrome-format=jar|flat|both|symlink
6740                           Select FORMAT of chrome files (default=jar)],
6741     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6743 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6744     MOZ_CHROME_FILE_FORMAT=jar
6747 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6748     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6749     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6750     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6751     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6754 dnl ========================================================
6755 dnl = Define default location for MOZILLA_FIVE_HOME
6756 dnl ========================================================
6757 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6758 [  --with-default-mozilla-five-home
6759                           Set the default value for MOZILLA_FIVE_HOME],
6760 [ val=`echo $withval`
6761   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6763 dnl ========================================================
6764 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6765 dnl ========================================================
6766 MOZ_ARG_WITH_STRING(user-appdir,
6767 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6768 [ val=`echo $withval`
6769 if echo "$val" | grep "\/" >/dev/null; then
6770     AC_MSG_ERROR("Homedir must be single relative path.")
6771 else 
6772     MOZ_USER_DIR="$val"
6773 fi])
6775 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6777 dnl ========================================================
6778 dnl = Doxygen configuration
6779 dnl ========================================================
6780 dnl Use commas to specify multiple dirs to this arg
6781 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6782 MOZ_ARG_WITH_STRING(doc-input-dirs,
6783 [  --with-doc-input-dirs=DIRS
6784                           Header/idl dirs to create docs from],
6785 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6786 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6788 dnl Use commas to specify multiple dirs to this arg
6789 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6790 MOZ_ARG_WITH_STRING(doc-include-dirs,
6791 [  --with-doc-include-dirs=DIRS  
6792                           Include dirs to preprocess doc headers],
6793 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6794 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6796 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6797 MOZ_ARG_WITH_STRING(doc-output-dir,
6798 [  --with-doc-output-dir=DIR
6799                           Dir to generate docs into],
6800 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6801 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6803 if test -z "$SKIP_COMPILER_CHECKS"; then
6804 dnl ========================================================
6805 dnl =
6806 dnl = Compiler Options
6807 dnl = 
6808 dnl ========================================================
6809 MOZ_ARG_HEADER(Compiler Options)
6811 dnl ========================================================
6812 dnl Check for gcc -pipe support
6813 dnl ========================================================
6814 AC_MSG_CHECKING([for gcc -pipe support])
6815 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6816     echo '#include <stdio.h>' > dummy-hello.c
6817     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6818     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6819     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6820     if test $? = 0; then
6821         _res_as_stdin="yes"
6822     else
6823         _res_as_stdin="no"
6824     fi
6825     if test "$_res_as_stdin" = "yes"; then
6826         _SAVE_CFLAGS=$CFLAGS
6827         CFLAGS="$CFLAGS -pipe"
6828         AC_TRY_COMPILE( [ #include <stdio.h> ],
6829             [printf("Hello World\n");],
6830             [_res_gcc_pipe="yes"],
6831             [_res_gcc_pipe="no"] )
6832         CFLAGS=$_SAVE_CFLAGS
6833     fi
6834     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6835         _res="yes";
6836         CFLAGS="$CFLAGS -pipe"
6837         CXXFLAGS="$CXXFLAGS -pipe"
6838     else
6839         _res="no"
6840     fi
6841     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6842     AC_MSG_RESULT([$_res])
6843 else
6844     AC_MSG_RESULT([no])
6847 dnl pass -Wno-long-long to the compiler
6848 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6849 [  --enable-long-long-warning 
6850                           Warn about use of non-ANSI long long type],
6851     _IGNORE_LONG_LONG_WARNINGS=,
6852     _IGNORE_LONG_LONG_WARNINGS=1)
6854 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6855      _SAVE_CFLAGS="$CFLAGS"
6856      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6857      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6858      AC_TRY_COMPILE([], [return(0);], 
6859         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6860           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6861           result="yes" ], result="no")
6862      AC_MSG_RESULT([$result])
6863      CFLAGS="$_SAVE_CFLAGS"
6866 dnl ========================================================
6867 dnl Profile guided optimization
6868 dnl ========================================================
6869 dnl Test for profiling options
6870 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6871 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6873 dnl Provide a switch to disable PGO even when called via profiledbuild.
6874 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6875 [  --disable-profile-guided-optimization
6876                            Don't build with PGO even if called via make profiledbuild],
6877 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6878 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6880 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6882 _SAVE_CFLAGS="$CFLAGS"
6883 CFLAGS="$CFLAGS -fprofile-generate"
6885 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6886 AC_TRY_COMPILE([], [return 0;],
6887                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6888                  result="yes" ], result="no")
6889 AC_MSG_RESULT([$result])
6891 if test $result = "yes"; then
6892   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6893   PROFILE_USE_CFLAGS="-fprofile-use"
6894   PROFILE_USE_LDFLAGS="-fprofile-use"
6895 else
6896   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6897   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6898   AC_TRY_COMPILE([], [return 0;],
6899                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6900                    result="yes" ], result="no")
6901   AC_MSG_RESULT([$result])
6902   if test $result = "yes"; then
6903     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6904   fi
6905   # don't really care, this is an old GCC
6906   PROFILE_GEN_LDFLAGS=
6907   PROFILE_USE_LDFLAGS=
6910 CFLAGS="$_SAVE_CFLAGS"
6912 if test -n "$INTEL_CC"; then
6913   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6914   PROFILE_GEN_LDFLAGS=
6915   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6916   PROFILE_USE_LDFLAGS=
6919 dnl Sun Studio on Solaris
6920 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6921   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6922   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6923   if test "$CPU_ARCH" != "sparc"; then
6924     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6925     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6926   else
6927     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6928     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6929   fi
6932 AC_SUBST(PROFILE_GEN_CFLAGS)
6933 AC_SUBST(PROFILE_GEN_LDFLAGS)
6934 AC_SUBST(PROFILE_USE_CFLAGS)
6935 AC_SUBST(PROFILE_USE_LDFLAGS)
6937 AC_LANG_CPLUSPLUS
6939 dnl ========================================================
6940 dnl Test for -pedantic bustage
6941 dnl ========================================================
6942 MOZ_ARG_DISABLE_BOOL(pedantic,
6943 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6944 _PEDANTIC= )
6945 if test "$_PEDANTIC"; then
6946     _SAVE_CXXFLAGS=$CXXFLAGS
6947     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6948     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6949     AC_TRY_COMPILE([$configure_static_assert_macros],
6950                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6951                    result="no", result="yes" )
6952     AC_MSG_RESULT([$result])
6953     CXXFLAGS="$_SAVE_CXXFLAGS"
6955     case "$result" in
6956     no)
6957         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6958         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6959         ;;
6960     yes)
6961         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
6962         ;;
6963     esac
6966 dnl ========================================================
6967 dnl Test for correct temporary object destruction order
6968 dnl ========================================================
6969 dnl We want to make sure the compiler follows the C++ spec here as 
6970 dnl xpcom and the string classes depend on it (bug 235381).
6971 AC_MSG_CHECKING([for correct temporary object destruction order])
6972 AC_TRY_RUN([ class A {
6973              public:  A(int& x) : mValue(x) {}
6974                       ~A() { mValue--; }
6975                       operator char**() { return 0; }
6976              private:  int& mValue;
6977              };
6978              void func(char **arg) {}
6979              int m=2;
6980              void test() {
6981                   func(A(m));
6982                   if (m==1) m = 0;
6983              }
6984              int main() {
6985                  test();
6986                  return(m);
6987              }
6988              ],
6989      result="yes", result="no", result="maybe")
6990 AC_MSG_RESULT([$result])
6992 if test "$result" = "no"; then
6993     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
6996 dnl ========================================================
6997 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
6998 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
6999 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7000 dnl ========================================================
7001 _SAVE_CXXFLAGS=$CXXFLAGS
7002 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7003 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7004     ac_nscap_nonconst_opeq_bug,
7005     [AC_TRY_COMPILE([
7006                       template <class T>
7007                       class Pointer
7008                         {
7009                         public:
7010                           T* myPtr;
7011                         };
7012                       
7013                       template <class T, class U>
7014                       int operator==(const Pointer<T>& rhs, U* lhs)
7015                         {
7016                           return rhs.myPtr == lhs;
7017                         }
7018                       
7019                       template <class T, class U>
7020                       int operator==(const Pointer<T>& rhs, const U* lhs)
7021                         {
7022                           return rhs.myPtr == lhs;
7023                         }
7024                     ],
7025                     [
7026                       Pointer<int> foo;
7027                       const int* bar;
7028                       return foo == bar;
7029                     ],
7030                     ac_nscap_nonconst_opeq_bug="no",
7031                     ac_nscap_nonconst_opeq_bug="yes")])
7032 CXXFLAGS="$_SAVE_CXXFLAGS"
7034 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7035     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7037 fi # SKIP_COMPILER_CHECKS
7039 dnl ========================================================
7040 dnl C++ rtti
7041 dnl Should be smarter and check that the compiler does indeed have rtti
7042 dnl ========================================================
7043 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7044 [  --enable-cpp-rtti       Enable C++ RTTI ],
7045 [ _MOZ_USE_RTTI=1 ],
7046 [ _MOZ_USE_RTTI= ])
7048 if test "$_MOZ_USE_RTTI"; then
7049    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7050 else
7051    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7054 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7056 dnl ========================================================
7057 dnl C++ exceptions (g++/egcs only - for now)
7058 dnl Should be smarter and check that the compiler does indeed have exceptions
7059 dnl ========================================================
7060 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7061 [  --enable-cpp-exceptions Enable C++ exceptions ],
7062 [ _MOZ_CPP_EXCEPTIONS=1 ],
7063 [ _MOZ_CPP_EXCEPTIONS= ])
7065 if test "$_MOZ_CPP_EXCEPTIONS"; then
7066     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7067 else
7068     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7071 # Irix & OSF native compilers do not like exception declarations 
7072 # when exceptions are disabled
7073 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7074     AC_DEFINE(CPP_THROW_NEW, [])
7075 else
7076     AC_DEFINE(CPP_THROW_NEW, [throw()])
7078 AC_LANG_C
7080 dnl ========================================================
7081 dnl =
7082 dnl = Build depencency options
7083 dnl =
7084 dnl ========================================================
7085 MOZ_ARG_HEADER(Build dependencies)
7087 dnl ========================================================
7088 dnl = Do not auto generate dependency info
7089 dnl ========================================================
7090 MOZ_AUTO_DEPS=1
7091 MOZ_ARG_DISABLE_BOOL(auto-deps,
7092 [  --disable-auto-deps     Do not automatically generate dependency info],
7093     MOZ_AUTO_DEPS=,
7094     MOZ_AUTO_DEPS=1)
7096 if test -n "$MOZ_AUTO_DEPS"; then
7097 dnl ========================================================
7098 dnl = Use mkdepend instead of $CC -MD for dependency generation
7099 dnl ========================================================
7100 _cpp_md_flag=
7101 MOZ_ARG_DISABLE_BOOL(md,
7102 [  --disable-md            Do not use compiler-based dependencies ],
7103   [_cpp_md_flag=],
7104   [_cpp_md_flag=1],
7105   [dnl Default is to turn on -MD if using GNU-compatible compilers
7106    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7107      _cpp_md_flag=1
7108    fi
7109   dnl Default is to use -xM if using Sun Studio on Solaris
7110    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7111      _cpp_md_flag=1
7112    fi])
7113 if test "$_cpp_md_flag"; then
7114   COMPILER_DEPEND=1
7115   if test "$OS_ARCH" = "OpenVMS"; then
7116     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7117   else
7118     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7119   fi
7120   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7121   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7122     _DEPEND_CFLAGS=
7123   fi
7124 else
7125   COMPILER_DEPEND=
7126   _USE_CPP_INCLUDE_FLAG=
7127   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7128   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7130 fi # MOZ_AUTO_DEPS
7131 MDDEPDIR='.deps'
7132 AC_SUBST(MOZ_AUTO_DEPS)
7133 AC_SUBST(COMPILER_DEPEND)
7134 AC_SUBST(MDDEPDIR)
7137 dnl ========================================================
7138 dnl =
7139 dnl = Static Build Options
7140 dnl =
7141 dnl ========================================================
7142 MOZ_ARG_HEADER(Static build options)
7144 MOZ_ARG_ENABLE_BOOL(static,
7145 [  --enable-static         Enable building of internal static libs],
7146     BUILD_STATIC_LIBS=1,
7147     BUILD_STATIC_LIBS=)
7149 dnl Disable libxul in debug builds, but not for xulrunner.
7150 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7151    MOZ_ENABLE_LIBXUL=
7154 MOZ_ARG_ENABLE_BOOL(libxul,
7155 [  --enable-libxul         Enable building of libxul],
7156     MOZ_ENABLE_LIBXUL=1,
7157     MOZ_ENABLE_LIBXUL=)
7159 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7160         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7163 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7164         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7167 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
7168         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
7171 if test -n "$MOZ_ENABLE_LIBXUL"; then
7172     XPCOM_LIBS="$LIBXUL_LIBS"
7173     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7174 else
7175     if test -n "$BUILD_STATIC_LIBS"; then
7176         AC_DEFINE(MOZ_STATIC_BUILD)
7177     fi
7178     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7181 dnl ========================================================
7182 dnl = Force JS to be a static lib
7183 dnl ========================================================
7184 MOZ_ARG_ENABLE_BOOL(js-static-build,
7185 [  --enable-js-static-build  Force js to be a static lib],
7186     JS_STATIC_BUILD=1,
7187     JS_STATIC_BUILD= )
7189 AC_SUBST(JS_STATIC_BUILD)
7190         
7191 if test -n "$JS_STATIC_BUILD"; then
7192     AC_DEFINE(EXPORT_JS_API)
7194 if test -z "$BUILD_STATIC_LIBS"; then
7195     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
7200 dnl ========================================================
7201 dnl =
7202 dnl = Standalone module options
7203 dnl = 
7204 dnl ========================================================
7205 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7207 dnl Check for GLib and libIDL.
7208 dnl ========================================================
7209 case "$target_os" in
7210 msvc*|mks*|cygwin*|mingw*|wince*)
7211     SKIP_IDL_CHECK="yes"
7212     ;;
7214     SKIP_IDL_CHECK="no"
7215     ;;
7216 esac
7218 if test -z "$COMPILE_ENVIRONMENT"; then
7219     SKIP_IDL_CHECK="yes"
7222 dnl = Allow users to disable libIDL checking for standalone modules
7223 MOZ_ARG_WITHOUT_BOOL(libIDL,
7224 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7225         SKIP_IDL_CHECK="yes")
7227 if test "$SKIP_IDL_CHECK" = "no"
7228 then
7229     _LIBIDL_FOUND=
7230     if test "$MACOS_SDK_DIR"; then 
7231       dnl xpidl, and therefore libIDL, is only needed on the build host.
7232       dnl Don't build it against the SDK, as that causes problems.
7233       _MACSAVE_CFLAGS="$CFLAGS"
7234       _MACSAVE_LIBS="$LIBS"
7235       _MACSAVE_LDFLAGS="$LDFLAGS"
7236       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7237       changequote(,)
7238       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"`
7239       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7240       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7241       changequote([,])
7242       unset NEXT_ROOT
7243     fi
7245     if test "$MOZ_ENABLE_GTK2"; then
7246         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7247     fi
7248     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7249     dnl to either libIDL1 or libIDL2.
7250     if test -z "$_LIBIDL_FOUND"; then
7251         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7252         if test -z "$_LIBIDL_FOUND"; then
7253             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7254         fi
7255     fi
7256     dnl
7257     dnl If we don't have a libIDL config program & not cross-compiling, 
7258     dnl     look for orbit-config instead.
7259     dnl
7260     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7261         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7262         if test -n "$ORBIT_CONFIG"; then
7263             AC_MSG_CHECKING([for ORBit libIDL usability])
7264                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7265             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7266             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7267             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7268             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7269             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7270             LIBIDL_CONFIG=
7271             _SAVE_CFLAGS="$CFLAGS"
7272             _SAVE_LIBS="$LIBS"
7273             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7274             LIBS="$LIBIDL_LIBS $LIBS"
7275             AC_TRY_RUN([
7276 #include <stdlib.h>
7277 #include <libIDL/IDL.h>
7278 int main() {
7279   char *s;
7280   s=strdup(IDL_get_libver_string());
7281   if(s==NULL) {
7282     exit(1);
7283   }
7284   exit(0);
7286             ], [_LIBIDL_FOUND=1
7287                 result="yes"],
7288                [LIBIDL_CFLAGS=
7289                 LIBIDL_LIBS=
7290                 result="no"],
7291                [_LIBIDL_FOUND=1
7292                 result="maybe"] )
7293             AC_MSG_RESULT($result)
7294             CFLAGS="$_SAVE_CFLAGS"
7295             LIBS="$_SAVE_LIBS"
7296         fi
7297     fi
7298     if test -z "$_LIBIDL_FOUND"; then
7299         AC_MSG_ERROR([libIDL not found.
7300         libIDL $LIBIDL_VERSION or higher is required.])
7301     fi
7302     if test "$MACOS_SDK_DIR"; then
7303       CFLAGS="$_MACSAVE_CFLAGS"
7304       LIBS="$_MACSAVE_LIBS"
7305       LDFLAGS="$_MACSAVE_LDFLAGS"
7306       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7307         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7308       fi
7309     fi
7312 if test -n "$CROSS_COMPILE"; then
7313      if test -z "$HOST_LIBIDL_CONFIG"; then
7314         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7315     fi
7316     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7317         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7318         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7319     else
7320         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7321         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7322     fi
7325 if test -z "$SKIP_PATH_CHECKS"; then
7326 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7327     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7328         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7329     else
7330         AM_PATH_GLIB(${GLIB_VERSION})
7331     fi
7335 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7336     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7339 AC_SUBST(LIBIDL_CFLAGS)
7340 AC_SUBST(LIBIDL_LIBS)
7341 AC_SUBST(STATIC_LIBIDL)
7342 AC_SUBST(GLIB_CFLAGS)
7343 AC_SUBST(GLIB_LIBS)
7344 AC_SUBST(GLIB_GMODULE_LIBS)
7345 AC_SUBST(HOST_LIBIDL_CONFIG)
7346 AC_SUBST(HOST_LIBIDL_CFLAGS)
7347 AC_SUBST(HOST_LIBIDL_LIBS)
7349 dnl ========================================================
7350 dnl Check for libart
7351 dnl ========================================================
7352 if test "$MOZ_SVG_RENDERER_LIBART"; then
7353   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
7354     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
7355 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
7356   fi
7358   dnl libart's configure hasn't been run yet, but we know what the
7359   dnl answer should be anyway
7360   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
7361   case "$target_os" in
7362   msvc*|mks*|cygwin*|mingw*|wince*)
7363       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
7364       ;;
7365   os2*)
7366       MOZ_LIBART_LIBS='-lmoz_art -lm'
7367       ;;
7368   beos*)
7369       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
7370       ;;
7371   *)
7372       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
7373       ;;
7374   esac
7375   AC_FUNC_ALLOCA
7378 AC_SUBST(MOZ_LIBART_CFLAGS)
7379 AC_SUBST(MOZ_LIBART_LIBS)
7381 dnl ========================================================
7382 dnl Check for cairo
7383 dnl ========================================================
7384 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7386 MOZ_TREE_CAIRO=1
7387 MOZ_ARG_ENABLE_BOOL(system-cairo,
7388 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7389 MOZ_TREE_CAIRO=,
7390 MOZ_TREE_CAIRO=1 )
7392 # Check for headers defining standard int types.
7393 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7395 if test "$MOZ_TREE_CAIRO"; then
7396     AC_DEFINE(MOZ_TREE_CAIRO)
7398     # For now we assume that we will have a uint64_t available through
7399     # one of the above headers or mozstdint.h.
7400     AC_DEFINE(HAVE_UINT64_T)
7402     # Define macros for cairo-features.h
7403     if test "$MOZ_X11"; then
7404         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7405         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7406         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7407         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7408         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7409         MOZ_ENABLE_CAIRO_FT=1
7410         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7411     fi
7412     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7413         QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7414     fi
7415     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7416         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7417         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7418         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7419     fi
7420     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7421         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7422         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7423         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7424     fi
7425     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7426         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7427         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7428         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7429         MOZ_ENABLE_CAIRO_FT=1
7430         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7431         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7432     fi
7433     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7434         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7435         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7436         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7437         MOZ_ENABLE_CAIRO_FT=1
7438     fi
7439     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7440     AC_SUBST(CAIRO_FT_CFLAGS)
7442     if test "$MOZ_DEBUG"; then
7443       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7444     else
7445       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7446     fi
7448     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7450     AC_SUBST(PS_SURFACE_FEATURE)
7451     AC_SUBST(PDF_SURFACE_FEATURE)
7452     AC_SUBST(SVG_SURFACE_FEATURE)
7453     AC_SUBST(XLIB_SURFACE_FEATURE)
7454     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7455     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7456     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7457     AC_SUBST(XCB_SURFACE_FEATURE)
7458     AC_SUBST(WIN32_SURFACE_FEATURE)
7459     AC_SUBST(OS2_SURFACE_FEATURE)
7460     AC_SUBST(BEOS_SURFACE_FEATURE)
7461     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7462     AC_SUBST(FT_FONT_FEATURE)
7463     AC_SUBST(WIN32_FONT_FEATURE)
7464     AC_SUBST(QUARTZ_FONT_FEATURE)
7465     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7466     AC_SUBST(QPAINTER_SURFACE_FEATURE)
7468     if test "$_WIN32_MSVC"; then
7469         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7470     else
7471         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"
7473         if test "$MOZ_X11"; then
7474             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7475         fi
7476     fi
7478     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7479     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7481 else
7482    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7483    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7484    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7485    if test "$MOZ_X11"; then
7486         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7487         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7488         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7489    fi
7492 AC_SUBST(MOZ_TREE_CAIRO)
7493 AC_SUBST(MOZ_CAIRO_CFLAGS)
7494 AC_SUBST(MOZ_CAIRO_LIBS)
7496 dnl ========================================================
7497 dnl Check for lcms
7498 dnl ========================================================
7500 MOZ_NATIVE_LCMS=
7501 MOZ_ARG_ENABLE_BOOL(system-lcms,
7502 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7503 MOZ_NATIVE_LCMS=1,
7504 MOZ_NATIVE_LCMS= )
7506 if test -z "$MOZ_NATIVE_LCMS"
7507 then
7508     LCMS_CFLAGS=
7509     if test "$_WIN32_MSVC"; then
7510         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7511             LCMS_CFLAGS=-DLCMS_DLL
7512         fi
7513         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7514     else
7515         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7516     fi
7517 else
7518     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7521 AC_SUBST(MOZ_NATIVE_LCMS)
7522 AC_SUBST(LCMS_CFLAGS)
7523 AC_SUBST(LCMS_LIBS)
7525 dnl ========================================================
7526 dnl disable xul
7527 dnl ========================================================
7528 MOZ_ARG_DISABLE_BOOL(xul,
7529 [  --disable-xul           Disable XUL],
7530     MOZ_XUL= )
7531 if test "$MOZ_XUL"; then
7532   AC_DEFINE(MOZ_XUL)
7533 else
7534   dnl remove extensions that require XUL
7535   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7538 AC_SUBST(MOZ_XUL)
7540 dnl ========================================================
7541 dnl Two ways to enable Python support:
7542 dnl   --enable-extensions=python # select all available.
7543 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7544 dnl or:
7545 dnl   --enable-extensions=python/xpcom,... # select individual ones
7547 dnl If either is used, we locate the Python to use.
7548 dnl ========================================================
7550 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7551 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7552     dnl Allow PYTHON to point to the Python interpreter to use
7553     dnl (note that it must be the python executable - which we
7554     dnl run to locate the relevant paths etc)
7555     dnl If not set, we use whatever Python we can find.
7556     MOZ_PYTHON=$PYTHON
7557     dnl Ask Python what its version number is
7558     changequote(,)
7559     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7560     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7561     changequote([,])
7562     dnl Ask for the Python "prefix" (ie, home/source dir)
7563     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7564     dnl Setup the include and library directories.
7565     if test "$OS_ARCH" = "WINNT"; then
7566         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7567         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7568         dnl Binary trees have "include" for .h, and "libs" for .lib
7569         dnl We add 'em both - along with quotes, to handle spaces.
7570         MOZ_PYTHON_DLL_SUFFIX=.pyd
7571         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7572         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7573     else
7574         dnl Non-Windows include and libs
7575         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7576         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7577         dnl Check for dynamic Python lib
7578         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7579         dnl - core, xpcom loader, pydom etc) all need to share Python.
7580         dnl - Python 2.3's std --enable-shared configure option will
7581         dnl   create a libpython2.3.so.1.0. We should first try this
7582         dnl   dotted versioned .so file because this is the one that
7583         dnl   the PyXPCOM build mechanics tries to link to.
7584         dnl   XXX Should find a better way than hardcoding "1.0".
7585         dnl - Python developement tree dir layouts are NOT allowed here
7586         dnl   because the PyXPCOM build just dies on it later anyway.
7587         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7588         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7589             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7590         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7591             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7592         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7593             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7594         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7595             dnl Don't Python development tree directory layout.
7596             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7597             AC_MSG_ERROR([The Python at $MOZ_PYTHON_PREFIX looks like a dev tree. The PyXPCOM build cannot handle this yet. You must 'make install' Python and use the installed tree.])
7598         elif test "$OS_ARCH" = "Darwin"; then
7599             dnl We do Darwin last, so if a custom non-framework build of
7600             dnl python is used on OSX, then it will be picked up first by
7601             dnl the logic above.
7602             MOZ_PYTHON_LIBS="-framework Python"
7603         else
7604             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7605         fi
7606         if test "$OS_ARCH" = "Linux"; then
7607             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7608         fi
7609     fi
7610     dnl Handle "_d" on Windows
7611     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7612         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7613     else
7614         MOZ_PYTHON_DEBUG_SUFFIX=
7615     fi
7616     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7619 dnl If the user asks for the 'python' extension, then we add
7620 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7621 dnl Note the careful regex - it must match 'python' followed by anything
7622 dnl other than a '/', including the end-of-string.
7623 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7624     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7625         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7626     done
7628 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7629 dnl command-line, but not yet
7630 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7631 AC_SUBST(MOZ_PYTHON)
7632 AC_SUBST(MOZ_PYTHON_PREFIX)
7633 AC_SUBST(MOZ_PYTHON_INCLUDES)
7634 AC_SUBST(MOZ_PYTHON_LIBS)
7635 AC_SUBST(MOZ_PYTHON_VER)
7636 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7637 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7638 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7640 dnl ========================================================
7641 dnl disable profile locking
7642 dnl   do no use this in applications that can have more than
7643 dnl   one process accessing the profile directory.
7644 dnl ========================================================
7645 MOZ_ARG_DISABLE_BOOL(profilelocking,
7646 [  --disable-profilelocking           Disable profile locking],
7647     MOZ_PROFILELOCKING=,
7648     MOZ_PROFILELOCKING=1 )
7649 if test "$MOZ_PROFILELOCKING"; then
7650   AC_DEFINE(MOZ_PROFILELOCKING)
7653 dnl ========================================================
7654 dnl disable rdf services
7655 dnl ========================================================
7656 MOZ_ARG_DISABLE_BOOL(rdf,
7657 [  --disable-rdf           Disable RDF],
7658     MOZ_RDF= )
7659 if test "$MOZ_RDF"; then
7660   AC_DEFINE(MOZ_RDF)
7663 AC_SUBST(MOZ_RDF)
7665 dnl ========================================================
7666 dnl necko configuration options
7667 dnl ========================================================
7670 dnl option to disable various necko protocols
7672 MOZ_ARG_ENABLE_STRING(necko-protocols,
7673 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7674                           Enable/disable specific protocol handlers],
7675 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7676     if test "$option" = "yes" || test "$option" = "all"; then
7677         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7678     elif test "$option" = "no" || test "$option" = "none"; then
7679         NECKO_PROTOCOLS=""
7680     elif test "$option" = "default"; then
7681         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7682     elif test `echo "$option" | grep -c \^-` != 0; then
7683         option=`echo $option | sed 's/^-//'`
7684         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7685     else
7686         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7687     fi
7688 done],
7689     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7690 dnl Remove dupes
7691 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7692 AC_SUBST(NECKO_PROTOCOLS)
7693 for p in $NECKO_PROTOCOLS; do
7694     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7695 done
7698 dnl option to disable necko's disk cache
7700 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7701 [  --disable-necko-disk-cache
7702                           Disable necko disk cache],
7703     NECKO_DISK_CACHE=,
7704     NECKO_DISK_CACHE=1)
7705 AC_SUBST(NECKO_DISK_CACHE)
7706 if test "$NECKO_DISK_CACHE"; then
7707     AC_DEFINE(NECKO_DISK_CACHE)
7711 dnl option to minimize size of necko's i/o buffers
7713 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7714 [  --enable-necko-small-buffers
7715                           Minimize size of necko's i/o buffers],
7716     NECKO_SMALL_BUFFERS=1,
7717     NECKO_SMALL_BUFFERS=)
7718 AC_SUBST(NECKO_SMALL_BUFFERS)
7719 if test "$NECKO_SMALL_BUFFERS"; then
7720     AC_DEFINE(NECKO_SMALL_BUFFERS)
7721 fi 
7724 dnl option to disable cookies
7726 MOZ_ARG_DISABLE_BOOL(cookies,
7727 [  --disable-cookies       Disable cookie support],
7728     NECKO_COOKIES=,
7729     NECKO_COOKIES=1)
7730 AC_SUBST(NECKO_COOKIES)
7731 if test "$NECKO_COOKIES"; then
7732     AC_DEFINE(NECKO_COOKIES)
7735 dnl NECKO_ configuration options are not global
7736 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7738 dnl Only build Mork if it's required
7739 AC_SUBST(MOZ_MORK)
7740 if test "$MOZ_MORK"; then
7741   AC_DEFINE(MOZ_MORK)
7744 dnl Build the lightweight Mork reader if required
7745 AC_SUBST(MOZ_MORKREADER)
7746 if test "$MOZ_MORKREADER"; then
7747   AC_DEFINE(MOZ_MORKREADER)
7750 dnl ========================================================
7751 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7752     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7755 dnl ========================================================
7756 dnl =
7757 dnl = Maintainer debug option (no --enable equivalent)
7758 dnl =
7759 dnl ========================================================
7761 AC_SUBST(AR)
7762 AC_SUBST(AR_FLAGS)
7763 AC_SUBST(AR_LIST)
7764 AC_SUBST(AR_EXTRACT)
7765 AC_SUBST(AR_DELETE)
7766 AC_SUBST(AS)
7767 AC_SUBST(ASFLAGS)
7768 AC_SUBST(AS_DASH_C_FLAG)
7769 AC_SUBST(LD)
7770 AC_SUBST(RC)
7771 AC_SUBST(RCFLAGS)
7772 AC_SUBST(WINDRES)
7773 AC_SUBST(USE_SHORT_LIBNAME)
7774 AC_SUBST(IMPLIB)
7775 AC_SUBST(FILTER)
7776 AC_SUBST(BIN_FLAGS)
7777 AC_SUBST(NS_USE_NATIVE)
7778 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7779 AC_SUBST(MOZ_GFX_TOOLKIT)
7780 AC_SUBST(MOZ_UPDATE_XTERM)
7781 AC_SUBST(MINIMO)
7782 AC_SUBST(MOZ_PLATFORM_HILDON)
7783 AC_SUBST(NS_OSSO)
7784 AC_SUBST(NS_MAEMO_LOCATION)
7785 AC_SUBST(MOZ_AUTH_EXTENSION)
7786 AC_SUBST(MOZ_MATHML)
7787 AC_SUBST(MOZ_PERMISSIONS)
7788 AC_SUBST(MOZ_XTF)
7789 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7790 AC_SUBST(MOZ_PREF_EXTENSIONS)
7791 AC_SUBST(MOZ_SVG)
7792 AC_SUBST(MOZ_XSLT_STANDALONE)
7793 AC_SUBST(MOZ_JS_LIBS)
7794 AC_SUBST(MOZ_PSM)
7795 AC_SUBST(MOZ_DEBUG)
7796 AC_SUBST(MOZ_DEBUG_MODULES)
7797 AC_SUBST(MOZ_PROFILE_MODULES)
7798 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7799 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7800 AC_SUBST(MOZ_DEBUG_FLAGS)
7801 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7802 AC_SUBST(WARNINGS_AS_ERRORS)
7803 AC_SUBST(MOZ_DBGRINFO_MODULES)
7804 AC_SUBST(MOZ_EXTENSIONS)
7805 AC_SUBST(MOZ_IMG_DECODERS)
7806 AC_SUBST(MOZ_IMG_ENCODERS)
7807 AC_SUBST(MOZ_JSDEBUGGER)
7808 AC_SUBST(MOZ_OJI)
7809 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7810 AC_SUBST(MOZ_PLUGINS)
7811 AC_SUBST(ENABLE_EAZEL_PROFILER)
7812 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7813 AC_SUBST(EAZEL_PROFILER_LIBS)
7814 AC_SUBST(MOZ_PERF_METRICS)
7815 AC_SUBST(GC_LEAK_DETECTOR)
7816 AC_SUBST(MOZ_LOG_REFCNT)
7817 AC_SUBST(MOZ_LEAKY)
7818 AC_SUBST(MOZ_JPROF)
7819 AC_SUBST(MOZ_SHARK)
7820 AC_SUBST(MOZ_CALLGRIND)
7821 AC_SUBST(MOZ_VTUNE)
7822 AC_SUBST(MOZ_XPCTOOLS)
7823 AC_SUBST(MOZ_JSLOADER)
7824 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7825 AC_SUBST(MOZ_INSURE)
7826 AC_SUBST(MOZ_INSURE_DIRS)
7827 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7828 AC_SUBST(MOZ_QUANTIFY)
7829 AC_SUBST(MOZ_INSURIFYING)
7830 AC_SUBST(LIBICONV)
7831 AC_SUBST(MOZ_PLACES)
7832 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7833 AC_SUBST(MOZ_STORAGE)
7834 AC_SUBST(MOZ_FEEDS)
7835 AC_SUBST(NS_PRINTING)
7837 AC_SUBST(MOZ_JAVAXPCOM)
7838 AC_SUBST(JAVA_INCLUDE_PATH)
7839 AC_SUBST(JAVA)
7840 AC_SUBST(JAVAC)
7841 AC_SUBST(JAR)
7843 AC_SUBST(MOZ_PROFILELOCKING)
7845 AC_SUBST(HAVE_XIE)
7846 AC_SUBST(MOZ_XIE_LIBS)
7847 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7849 AC_SUBST(XPCOM_USE_LEA)
7850 AC_SUBST(BUILD_STATIC_LIBS)
7851 AC_SUBST(MOZ_ENABLE_LIBXUL)
7852 AC_SUBST(ENABLE_TESTS)
7853 AC_SUBST(IBMBIDI)
7854 AC_SUBST(MOZ_UNIVERSALCHARDET)
7855 AC_SUBST(ACCESSIBILITY)
7856 AC_SUBST(MOZ_XPINSTALL)
7857 AC_SUBST(MOZ_VIEW_SOURCE)
7858 AC_SUBST(MOZ_SPELLCHECK)
7859 AC_SUBST(MOZ_XPFE_COMPONENTS)
7860 AC_SUBST(MOZ_USER_DIR)
7861 AC_SUBST(MOZ_CRASHREPORTER)
7863 AC_SUBST(ENABLE_STRIP)
7864 AC_SUBST(PKG_SKIP_STRIP)
7865 AC_SUBST(USE_ELF_DYNSTR_GC)
7866 AC_SUBST(INCREMENTAL_LINKER)
7867 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7868 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7869 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7871 AC_SUBST(MOZ_FIX_LINK_PATHS)
7872 AC_SUBST(XPCOM_LIBS)
7873 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7874 AC_SUBST(XPCOM_GLUE_LDOPTS)
7875 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7877 AC_SUBST(USE_DEPENDENT_LIBS)
7879 AC_SUBST(MOZ_BUILD_ROOT)
7880 AC_SUBST(MOZ_OS2_TOOLS)
7881 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7883 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7884 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7885 AC_SUBST(MOZ_TIMELINE)
7886 AC_SUBST(WINCE)
7887 AC_SUBST(WINCE_SDK)
7888 AC_SUBST(TARGET_DEVICE)
7890 AC_SUBST(MOZ_APP_NAME)
7891 AC_SUBST(MOZ_APP_DISPLAYNAME)
7892 AC_SUBST(MOZ_APP_VERSION)
7893 AC_SUBST(FIREFOX_VERSION)
7895 AC_SUBST(MOZ_PKG_SPECIAL)
7897 AC_SUBST(MOZILLA_OFFICIAL)
7898 AC_SUBST(BUILD_OFFICIAL)
7899 AC_SUBST(MOZ_MILESTONE_RELEASE)
7901 dnl win32 options
7902 AC_SUBST(MOZ_PROFILE)
7903 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7904 AC_SUBST(MOZ_MAPINFO)
7905 AC_SUBST(MOZ_BROWSE_INFO)
7906 AC_SUBST(MOZ_TOOLS_DIR)
7907 AC_SUBST(CYGWIN_WRAPPER)
7908 AC_SUBST(AS_PERL)
7909 AC_SUBST(WIN32_REDIST_DIR)
7910 AC_SUBST(PYTHON)
7912 dnl Echo the CFLAGS to remove extra whitespace.
7913 CFLAGS=`echo \
7914         $_WARNINGS_CFLAGS \
7915         $CFLAGS`
7917 CXXFLAGS=`echo \
7918         $_MOZ_RTTI_FLAGS \
7919         $_MOZ_EXCEPTIONS_FLAGS \
7920         $_WARNINGS_CXXFLAGS \
7921         $CXXFLAGS`
7923 COMPILE_CFLAGS=`echo \
7924     $_DEFINES_CFLAGS \
7925         $_DEPEND_CFLAGS \
7926     $COMPILE_CFLAGS`
7928 COMPILE_CXXFLAGS=`echo \
7929     $_DEFINES_CXXFLAGS \
7930         $_DEPEND_CFLAGS \
7931     $COMPILE_CXXFLAGS`
7933 AC_SUBST(SYSTEM_MAKEDEPEND)
7934 AC_SUBST(SYSTEM_JPEG)
7935 AC_SUBST(SYSTEM_PNG)
7936 AC_SUBST(SYSTEM_ZLIB)
7937 AC_SUBST(SYSTEM_BZ2)
7939 AC_SUBST(JPEG_CFLAGS)
7940 AC_SUBST(JPEG_LIBS)
7941 AC_SUBST(ZLIB_CFLAGS)
7942 AC_SUBST(ZLIB_LIBS)
7943 AC_SUBST(BZ2_CFLAGS)
7944 AC_SUBST(BZ2_LIBS)
7945 AC_SUBST(PNG_CFLAGS)
7946 AC_SUBST(PNG_LIBS)
7948 AC_SUBST(MOZ_JPEG_CFLAGS)
7949 AC_SUBST(MOZ_JPEG_LIBS)
7950 AC_SUBST(MOZ_ZLIB_CFLAGS)
7951 AC_SUBST(MOZ_ZLIB_LIBS)
7952 AC_SUBST(MOZ_BZ2_CFLAGS)
7953 AC_SUBST(MOZ_BZ2_LIBS)
7954 AC_SUBST(MOZ_PNG_CFLAGS)
7955 AC_SUBST(MOZ_PNG_LIBS)
7957 AC_SUBST(NSPR_CFLAGS)
7958 AC_SUBST(NSPR_LIBS)
7959 AC_SUBST(MOZ_NATIVE_NSPR)
7961 AC_SUBST(NSS_CFLAGS)
7962 AC_SUBST(NSS_LIBS)
7963 AC_SUBST(NSS_DEP_LIBS)
7964 AC_SUBST(MOZ_NATIVE_NSS)
7965 AC_SUBST(NSS_DISABLE_DBM)
7967 AC_SUBST(CFLAGS)
7968 AC_SUBST(CXXFLAGS)
7969 AC_SUBST(CPPFLAGS)
7970 AC_SUBST(COMPILE_CFLAGS)
7971 AC_SUBST(COMPILE_CXXFLAGS)
7972 AC_SUBST(LDFLAGS)
7973 AC_SUBST(LIBS)
7974 AC_SUBST(CROSS_COMPILE)
7975 AC_SUBST(WCHAR_CFLAGS)
7977 AC_SUBST(HOST_CC)
7978 AC_SUBST(HOST_CXX)
7979 AC_SUBST(HOST_CFLAGS)
7980 AC_SUBST(HOST_CXXFLAGS)
7981 AC_SUBST(HOST_OPTIMIZE_FLAGS)
7982 AC_SUBST(HOST_AR)
7983 AC_SUBST(HOST_AR_FLAGS)
7984 AC_SUBST(HOST_LD)
7985 AC_SUBST(HOST_RANLIB)
7986 AC_SUBST(HOST_NSPR_MDCPUCFG)
7987 AC_SUBST(HOST_BIN_SUFFIX)
7988 AC_SUBST(HOST_OS_ARCH)
7990 AC_SUBST(TARGET_CPU)
7991 AC_SUBST(TARGET_VENDOR)
7992 AC_SUBST(TARGET_OS)
7993 AC_SUBST(TARGET_NSPR_MDCPUCFG)
7994 AC_SUBST(TARGET_MD_ARCH)
7995 AC_SUBST(TARGET_XPCOM_ABI)
7996 AC_SUBST(OS_TARGET)
7997 AC_SUBST(OS_ARCH)
7998 AC_SUBST(OS_RELEASE)
7999 AC_SUBST(OS_TEST)
8001 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8002 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8004 AC_SUBST(WRAP_MALLOC_CFLAGS)
8005 AC_SUBST(WRAP_MALLOC_LIB)
8006 AC_SUBST(MKSHLIB)
8007 AC_SUBST(MKCSHLIB)
8008 AC_SUBST(MKSHLIB_FORCE_ALL)
8009 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8010 AC_SUBST(DSO_CFLAGS)
8011 AC_SUBST(DSO_PIC_CFLAGS)
8012 AC_SUBST(DSO_LDOPTS)
8013 AC_SUBST(LIB_PREFIX)
8014 AC_SUBST(DLL_PREFIX)
8015 AC_SUBST(DLL_SUFFIX)
8016 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8017 AC_SUBST(LIB_SUFFIX)
8018 AC_SUBST(OBJ_SUFFIX)
8019 AC_SUBST(BIN_SUFFIX)
8020 AC_SUBST(ASM_SUFFIX)
8021 AC_SUBST(IMPORT_LIB_SUFFIX)
8022 AC_SUBST(USE_N32)
8023 AC_SUBST(CC_VERSION)
8024 AC_SUBST(CXX_VERSION)
8025 AC_SUBST(MSMANIFEST_TOOL)
8027 if test "$USING_HCC"; then
8028    CC='${topsrcdir}/build/hcc'
8029    CC="$CC '$_OLDCC'"
8030    CXX='${topsrcdir}/build/hcpp'
8031    CXX="$CXX '$_OLDCXX'"
8032    AC_SUBST(CC)
8033    AC_SUBST(CXX)
8036 dnl Check for missing components
8037 if test "$COMPILE_ENVIRONMENT"; then
8038 if test "$MOZ_X11"; then
8039     dnl ====================================================
8040     dnl = Check if X headers exist
8041     dnl ====================================================
8042     _SAVE_CFLAGS=$CFLAGS
8043     CFLAGS="$CFLAGS $XCFLAGS"
8044     AC_TRY_COMPILE([
8045         #include <stdio.h>
8046         #include <stdlib.h>
8047         #include <X11/Xlib.h>
8048         #include <X11/Intrinsic.h>
8049     ],
8050     [
8051         Display *dpy = 0;
8052         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8053             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8054             exit(1);
8055         }
8056     ], [], 
8057     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8058     CFLAGS="$_SAVE_CFLAGS"
8060     if test ! -z "$MISSING_X"; then
8061         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8062     fi
8064 fi # MOZ_X11
8065 fi # COMPILE_ENVIRONMENT
8067 dnl Set various defines and substitutions
8068 dnl ========================================================
8070 if test "$OS_ARCH" = "BeOS"; then
8071   AC_DEFINE(XP_BEOS)
8072   MOZ_MOVEMAIL=1
8073 elif test "$OS_ARCH" = "Darwin"; then
8074   AC_DEFINE(XP_UNIX)
8075   AC_DEFINE(UNIX_ASYNC_DNS)
8076   MOZ_MOVEMAIL=1
8077 elif test "$OS_ARCH" = "OpenVMS"; then
8078   AC_DEFINE(XP_UNIX)
8079 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8080   AC_DEFINE(XP_UNIX)
8081   AC_DEFINE(UNIX_ASYNC_DNS)
8082   MOZ_MOVEMAIL=1
8084 AC_SUBST(MOZ_MOVEMAIL)
8086 if test "$MOZ_DEBUG"; then
8087     AC_DEFINE(MOZ_REFLOW_PERF)
8088     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8091 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8092     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8093     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8094     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8095     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8096     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8097     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8098     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8099     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8102 # Used for LD_LIBRARY_PATH of run_viewer target
8103 LIBS_PATH=
8104 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8105   case $lib_arg in
8106     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8107       * ) ;;
8108   esac
8109 done
8110 AC_SUBST(LIBS_PATH)
8112 dnl ========================================================
8113 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8114 dnl ========================================================
8115 case "$host_os" in
8116 mingw*)
8117     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8118     ;;
8119 cygwin*|msvc*|mks*)
8120     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8121     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8122     CC="\$(CYGWIN_WRAPPER) $CC"
8123     CXX="\$(CYGWIN_WRAPPER) $CXX"
8124     CPP="\$(CYGWIN_WRAPPER) $CPP"
8125     LD="\$(CYGWIN_WRAPPER) $LD"
8126     AS="\$(CYGWIN_WRAPPER) $AS"
8127     RC="\$(CYGWIN_WRAPPER) $RC"
8128     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8129     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8130     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8131     ;;
8132 esac
8134 AC_SUBST(CYGDRIVE_MOUNT)
8135 AC_SUBST(WIN_TOP_SRC)
8137 AC_SUBST(MOZILLA_VERSION)
8139 AC_SUBST(ac_configure_args)
8141 dnl Spit out some output
8142 dnl ========================================================
8144 dnl The following defines are used by xpcom
8145 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8146 CPP_THROW_NEW
8147 HAVE_CPP_2BYTE_WCHAR_T
8148 HAVE_CPP_ACCESS_CHANGING_USING
8149 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8150 HAVE_CPP_BOOL
8151 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8152 HAVE_CPP_EXPLICIT
8153 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8154 HAVE_CPP_NAMESPACE_STD
8155 HAVE_CPP_NEW_CASTS
8156 HAVE_CPP_PARTIAL_SPECIALIZATION
8157 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8158 HAVE_CPP_TYPENAME
8159 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8160 HAVE_STATVFS
8161 NEED_CPP_UNUSED_IMPLEMENTATIONS
8162 NEW_H
8163 HAVE_GETPAGESIZE
8164 HAVE_ICONV
8165 HAVE_ICONV_WITH_CONST_INPUT
8166 HAVE_MBRTOWC
8167 HAVE_SYS_MOUNT_H
8168 HAVE_SYS_VFS_H
8169 HAVE_WCRTOMB
8172 AC_CONFIG_HEADER(
8173 netwerk/necko-config.h
8174 xpcom/xpcom-config.h
8175 xpcom/xpcom-private.h
8178 # Save the defines header file before autoconf removes it.
8179 # (Do not add AC_DEFINE calls after this line.)
8180   _CONFIG_TMP=confdefs-tmp.h
8181   _CONFIG_DEFS_H=mozilla-config.h
8183   cat > $_CONFIG_TMP <<\EOF
8184 /* List of defines generated by configure. Included with preprocessor flag,
8185  * -include, to avoid long list of -D defines on the compile command-line.
8186  * Do not edit.
8187  */
8189 #ifndef _MOZILLA_CONFIG_H_
8190 #define _MOZILLA_CONFIG_H_
8193 _EGREP_PATTERN='^#define ('
8194 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8195     for f in $_NON_GLOBAL_ACDEFINES; do
8196         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8197     done
8199 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8201   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8203   cat >> $_CONFIG_TMP <<\EOF
8205 #endif /* _MOZILLA_CONFIG_H_ */
8209   # Only write mozilla-config.h when something changes (or it doesn't exist)
8210   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8211     rm $_CONFIG_TMP
8212   else
8213     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8214     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8216     echo ==== $_CONFIG_DEFS_H =================================
8217     cat $_CONFIG_DEFS_H
8218   fi
8220 dnl Probably shouldn't call this manually but we always want the output of DEFS
8221 rm -f confdefs.h.save
8222 mv confdefs.h confdefs.h.save
8223 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8224 AC_OUTPUT_MAKE_DEFS()
8225 MOZ_DEFINES=$DEFS
8226 AC_SUBST(MOZ_DEFINES)
8227 rm -f confdefs.h
8228 mv confdefs.h.save confdefs.h
8230 dnl Load the list of Makefiles to generate.
8231 dnl   To add new Makefiles, edit allmakefiles.sh.
8232 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8233 . ${srcdir}/allmakefiles.sh
8234 dnl 
8235 dnl Run a perl script to quickly create the makefiles.
8236 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8237 dnl   for the files it cannot handle correctly. This way, config.status
8238 dnl   will handle these files.
8239 dnl If it fails, nothing is set and config.status will run as usual.
8241 dnl This does not change the $MAKEFILES variable.
8243 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8245 if test -z "${AS_PERL}"; then
8246 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8247 else
8248 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8250 . ./conftest.sh
8251 rm conftest.sh
8253 echo $MAKEFILES > unallmakefiles
8255 AC_OUTPUT($MAKEFILES)
8257 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8258 if test "$CAIRO_FEATURES_H"; then
8259   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8260     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8261   else
8262     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8263   fi
8266 dnl ========================================================
8267 dnl = Setup a nice relatively clean build environment for
8268 dnl = sub-configures.
8269 dnl ========================================================
8270 CC="$_SUBDIR_CC" 
8271 CXX="$_SUBDIR_CXX" 
8272 CFLAGS="$_SUBDIR_CFLAGS" 
8273 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8274 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8275 LDFLAGS="$_SUBDIR_LDFLAGS"
8276 HOST_CC="$_SUBDIR_HOST_CC" 
8277 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8278 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8281 unset MAKEFILES
8282 unset CONFIG_FILES
8284 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8285 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8287 if test -z "$MOZ_NATIVE_NSPR"; then
8288     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8289     if test -z "$MOZ_DEBUG"; then
8290         ac_configure_args="$ac_configure_args --disable-debug"
8291     fi
8292     if test "$MOZ_OPTIMIZE" = "1"; then
8293         ac_configure_args="$ac_configure_args --enable-optimize"
8294     fi
8295     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8296        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8297     fi
8298     if test -n "$HAVE_64BIT_OS"; then
8299         ac_configure_args="$ac_configure_args --enable-64bit"
8300     fi
8301     if test -n "$USE_ARM_KUSER"; then
8302         ac_configure_args="$ac_configure_args --with-arm-kuser"
8303     fi
8304     AC_OUTPUT_SUBDIRS(nsprpub)
8305     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8308 if test -z "$MOZ_NATIVE_NSPR"; then
8309     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8310     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8311     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8312        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8313        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8314        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8315        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8316     fi
8317     rm -f config/autoconf.mk.bak
8320 # Run the SpiderMonkey 'configure' script.
8321 dist=$MOZ_BUILD_ROOT/dist
8322 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8323 ac_configure_args="$ac_configure_args --enable-threadsafe"
8324 if test -z "$MOZ_NATIVE_NSPR"; then
8325     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8326     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8328 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8329 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8330 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8331 ac_configure_args="$ac_configure_args --with-sync-build-files=$srcdir"
8332 if test "$MOZ_MEMORY"; then
8333    ac_configure_args="$ac_configure_args --enable-jemalloc"  
8335 AC_OUTPUT_SUBDIRS(js/src)
8336 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8338 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR