Disable links opening blocker for very small movements
[mozilla-central.git] / configure.in
blobb253f127361d16ed17b08623372dbb8201dbd568
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}"
71 dnl ========================================================
72 dnl =
73 dnl = Don't change the following two lines.  Doing so breaks:
74 dnl =
75 dnl = CFLAGS="-foo" ./configure
76 dnl =
77 dnl ========================================================
78 CFLAGS="${CFLAGS=}"
79 CPPFLAGS="${CPPFLAGS=}"
80 CXXFLAGS="${CXXFLAGS=}"
81 LDFLAGS="${LDFLAGS=}"
82 HOST_CFLAGS="${HOST_CFLAGS=}"
83 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
84 HOST_LDFLAGS="${HOST_LDFLAGS=}"
86 dnl ========================================================
87 dnl = Preserve certain environment flags passed to configure
88 dnl = We want sub projects to receive the same flags
89 dnl = untainted by this configure script
90 dnl ========================================================
91 _SUBDIR_CC="$CC"
92 _SUBDIR_CXX="$CXX"
93 _SUBDIR_CFLAGS="$CFLAGS"
94 _SUBDIR_CPPFLAGS="$CPPFLAGS"
95 _SUBDIR_CXXFLAGS="$CXXFLAGS"
96 _SUBDIR_LDFLAGS="$LDFLAGS"
97 _SUBDIR_HOST_CC="$HOST_CC"
98 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
99 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
100 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
101 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
103 dnl Set the version number of the libs included with mozilla
104 dnl ========================================================
105 MOZJPEG=62
106 MOZPNG=10217
107 MOZZLIB=0x1230
108 NSPR_VERSION=4
109 NSS_VERSION=3
111 dnl Set the minimum version of toolkit libs used by mozilla
112 dnl ========================================================
113 GLIB_VERSION=1.2.0
114 LIBIDL_VERSION=0.6.3
115 PERL_VERSION=5.006
116 LIBART_VERSION=2.3.4
117 CAIRO_VERSION=1.6.0
118 GLITZ_VERSION=0.4.0
119 PANGO_VERSION=1.10.0
120 GTK2_VERSION=2.10.0
121 MAKE_VERSION=3.78
122 WINDRES_VERSION=2.14.90
123 W32API_VERSION=3.8
124 GNOMEVFS_VERSION=2.0
125 GNOMEUI_VERSION=2.2.0
126 GCONF_VERSION=1.2.1
127 LIBGNOME_VERSION=2.0
128 STARTUP_NOTIFICATION_VERSION=0.8
129 DBUS_VERSION=0.60
130 LCMS_VERSION=1.17
131 SQLITE_VERSION=3.5.4
133 MSMANIFEST_TOOL=
135 dnl Set various checks
136 dnl ========================================================
137 MISSING_X=
138 AC_PROG_AWK
140 dnl Initialize the Pthread test variables early so they can be
141 dnl  overridden by each platform.
142 dnl ========================================================
143 USE_PTHREADS=
144 _PTHREAD_LDFLAGS=""
146 dnl Do not allow a separate objdir build if a srcdir build exists.
147 dnl ==============================================================
148 _topsrcdir=`cd \`dirname $0\`; pwd`
149 _objdir=`pwd`
151 if test "$_topsrcdir" != "$_objdir"
152 then
153   # Check for a couple representative files in the source tree
154   _conflict_files=
155   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
156     if test -f $file; then
157       _conflict_files="$_conflict_files $file"
158     fi
159   done
160   if test "$_conflict_files"; then
161     echo "***"
162     echo "*   Your source tree contains these files:"
163     for file in $_conflict_files; do
164       echo "*         $file"
165     done
166     cat 1>&2 <<-EOF
167         *   This indicates that you previously built in the source tree.
168         *   A source tree build can confuse the separate objdir build.
169         *
170         *   To clean up the source tree:
171         *     1. cd $_topsrcdir
172         *     2. gmake distclean
173         ***
174         EOF
175     exit 1
176     break
177   fi
179 MOZ_BUILD_ROOT=`pwd`
181 dnl Default to MSVC for win32
182 dnl ==============================================================
183 if test -z "$CROSS_COMPILE"; then
184 case "$target" in
185 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
186     MAKE_VERSION=3.79
187     if test -z "$CC"; then CC=cl; fi
188     if test -z "$CXX"; then CXX=cl; fi
189     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
190     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
191     if test -z "$LD"; then LD=link; fi
192     if test -z "$AS"; then AS=ml; fi
193     if test -z "$MIDL"; then MIDL=midl; fi
194     ;;
195 esac
198 COMPILE_ENVIRONMENT=1
199 MOZ_ARG_ENABLE_BOOL(compile-environment,
200 [  --disable-compile-environment
201                            Disable compiler/library checks.],
202     COMPILE_ENVIRONMENT=1,
203     COMPILE_ENVIRONMENT= )
205 dnl ========================================================
206 dnl Checks for compilers.
207 dnl ========================================================
208 dnl Set CROSS_COMPILE in the environment when running configure
209 dnl to use the cross-compile setup for now
210 dnl ========================================================
212 if test "$COMPILE_ENVIRONMENT"; then
214 dnl Do some special WinCE toolchain stuff
215 case "$target" in
216 *wince)
217     echo -----------------------------------------------------------------------------
218     echo Building Windows CE Shunt Library and Tool Chain
219     echo -----------------------------------------------------------------------------
221     ac_exeext=.exe
223     echo -n "#define TOPSRCDIR \"" > $srcdir/build/wince/tools/topsrcdir.h
224     echo `cd "$_topsrcdir" && pwd -W | tr '\n' '\"'` >> $srcdir/build/wince/tools/topsrcdir.h
225     make -C $srcdir/build/wince/tools
226     echo -----------------------------------------------------------------------------
227     ;;
228 esac
230 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
231     echo "cross compiling from $host to $target"
232     cross_compiling=yes
234     _SAVE_CC="$CC"
235     _SAVE_CFLAGS="$CFLAGS"
236     _SAVE_LDFLAGS="$LDFLAGS"
238     AC_MSG_CHECKING([for host c compiler])
239     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
240     if test -z "$HOST_CC"; then
241         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
242     fi
243     AC_MSG_RESULT([$HOST_CC])
244     AC_MSG_CHECKING([for host c++ compiler])
245     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
246     if test -z "$HOST_CXX"; then
247         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
248     fi
249     AC_MSG_RESULT([$HOST_CXX])
251     if test -z "$HOST_CFLAGS"; then
252         HOST_CFLAGS="$CFLAGS"
253     fi
254     if test -z "$HOST_CXXFLAGS"; then
255         HOST_CXXFLAGS="$CXXFLAGS"
256     fi
257     if test -z "$HOST_LDFLAGS"; then
258         HOST_LDFLAGS="$LDFLAGS"
259     fi
260     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
261     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
262     CC="$HOST_CC"
263     CFLAGS="$HOST_CFLAGS"
264     LDFLAGS="$HOST_LDFLAGS"
266     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
267     AC_TRY_COMPILE([], [return(0);], 
268         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
269         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
271     CC="$HOST_CXX"
272     CFLAGS="$HOST_CXXFLAGS"
274     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
275     AC_TRY_COMPILE([], [return(0);], 
276         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
277         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
278     
279     CC=$_SAVE_CC
280     CFLAGS=$_SAVE_CFLAGS
281     LDFLAGS=$_SAVE_LDFLAGS
283     case "$build:$target" in
284       powerpc-apple-darwin8*:i?86-apple-darwin*)
285         dnl The Darwin cross compiler doesn't necessarily point itself at a
286         dnl root that has libraries for the proper architecture, it defaults
287         dnl to the system root.  The libraries in the system root on current
288         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
289         dnl checks will fail.  Fake a working SDK in that case.
290         _SAVE_CFLAGS=$CFLAGS
291         _SAVE_CXXFLAGS=$CXXLAGS
292         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
293         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
294         ;;
295     esac
297     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
298     unset ac_cv_prog_CC
299     AC_PROG_CC
300     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
301     unset ac_cv_prog_CXX
302     AC_PROG_CXX
304     case "$build:$target" in
305       powerpc-apple-darwin8*:i?86-apple-darwin*)
306         dnl Revert the changes made above.  From this point on, the target
307         dnl compiler will never be used without applying the SDK to CFLAGS
308         dnl (see --with-macos-sdk below).
309         CFLAGS=$_SAVE_CFLAGS
310         CXXFLAGS=$_SAVE_CXXFLAGS
311         ;;
312     esac
314     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
315     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
316     AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
317     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
318     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
319     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
320     AC_DEFINE(CROSS_COMPILE)
321 else
322     AC_PROG_CC
323     AC_PROG_CXX
324     AC_PROG_RANLIB
325     AC_PATH_PROGS(AS, $AS as, $CC)
326     AC_CHECK_PROGS(AR, ar, :)
327     AC_CHECK_PROGS(LD, ld, :)
328     AC_CHECK_PROGS(STRIP, strip, :)
329     AC_CHECK_PROGS(WINDRES, windres, :)
330     if test -z "$HOST_CC"; then
331         HOST_CC="$CC"
332     fi
333     if test -z "$HOST_CFLAGS"; then
334         HOST_CFLAGS="$CFLAGS"
335     fi
336     if test -z "$HOST_CXX"; then
337         HOST_CXX="$CXX"
338     fi
339     if test -z "$HOST_CXXFLAGS"; then
340         HOST_CXXFLAGS="$CXXFLAGS"
341     fi
342     if test -z "$HOST_LDFLAGS"; then
343         HOST_LDFLAGS="$LDFLAGS"
344     fi
345     if test -z "$HOST_RANLIB"; then
346         HOST_RANLIB="$RANLIB"
347     fi
348     if test -z "$HOST_AR"; then
349        HOST_AR="$AR"
350     fi
353 GNU_AS=
354 GNU_LD=
355 GNU_CC=
356 GNU_CXX=
357 CC_VERSION='N/A'
358 CXX_VERSION='N/A'
359 if test "$GCC" = "yes"; then
360     GNU_CC=1
361     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
363 if test "$GXX" = "yes"; then
364     GNU_CXX=1
365     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
367 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
368     GNU_AS=1
370 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
371     GNU_LD=1
373 if test "$GNU_CC"; then
374     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
375         GCC_USE_GNU_LD=1
376     fi
379 INTEL_CC=
380 INTEL_CXX=
381 if test "$GCC" = yes; then
382    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
383      INTEL_CC=1
384    fi
387 if test "$GXX" = yes; then
388    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
389      INTEL_CXX=1
390    fi
393 dnl Special win32 checks
394 dnl ========================================================
395 case "$target" in
396 *-wince)
397     WINVER=500
398     ;;
400     if test -n "$GNU_CC"; then  
401         WINVER=501
402     else    
403         WINVER=500
404     fi
405     ;;
406 esac
408 MOZ_ARG_WITH_STRING(windows-version,
409 [  --with-windows-version=WINVER
410                           Minimum Windows version (WINVER) to support
411                               400: Windows 95
412                               500: Windows 2000
413                               501: Windows XP],
414   WINVER=$withval)
416 case "$WINVER" in
417 400|500|501)
418     ;;
421     AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
422     ;;
424 esac
426 case "$target" in
427 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
428     if test "$GCC" != "yes"; then
429         # Check to see if we are really running in a msvc environemnt
430         _WIN32_MSVC=1
431         AC_CHECK_PROGS(MIDL, midl)
433         # Make sure compilers are valid
434         CFLAGS="$CFLAGS -TC -nologo"
435         CXXFLAGS="$CXXFLAGS -TP -nologo"
436         AC_LANG_SAVE
437         AC_LANG_C
438         AC_TRY_COMPILE([#include <stdio.h>],
439             [ printf("Hello World\n"); ],,
440             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
442         AC_LANG_CPLUSPLUS
443         AC_TRY_COMPILE([#include <new.h>],
444             [ unsigned *test = new unsigned(42); ],,
445             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
446         AC_LANG_RESTORE
447         
448         changequote(,)
449         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
450         changequote([,])
451         
452         # Determine compiler version
453         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
454         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
455         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
456         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
457         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
458         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
460         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
461         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
463         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
464             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
465         fi
466         if test "$_CC_MAJOR_VERSION" = "12"; then
467             _CC_SUITE=6
468         elif test "$_CC_MAJOR_VERSION" = "13"; then
469             _CC_SUITE=7
470         elif test "$_CC_MAJOR_VERSION" = "14"; then
471             _CC_SUITE=8
472             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
473             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
474             dnl so be very specific here!
475             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
476             if test $_CC_RELEASE -gt 50727; then
477                _USE_DYNAMICBASE=1
478             elif test $_CC_BUILD -ge 762; then
479                _USE_DYNAMICBASE=1
480             fi
481             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
482             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
483         elif test "$_CC_MAJOR_VERSION" = "15"; then
484             _CC_SUITE=9
485             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
486             _USE_DYNAMICBASE=1
487             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
488             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
489         else
490             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
491         fi
493         _MOZ_RTTI_FLAGS_ON='-GR'
494         _MOZ_RTTI_FLAGS_OFF='-GR-'
495         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
496         _MOZ_EXCEPTIONS_FLAGS_OFF=''
498         if test -n "$WIN32_REDIST_DIR"; then
499             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
500         fi
501         
502         # bug #249782
503         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
504         if test "$_CC_SUITE" -ge "8"; then
505                 changequote(,)
506                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
507                 changequote([,])
509                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
510                 if test -n "$MSMT_TOOL"; then
511                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
512                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
513                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
514                         fi
515                         MSMANIFEST_TOOL=1
516                         unset MSMT_TOOL
517                 else
518                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
519                 fi
520         fi
522         # Check linker version
523         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
524         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
525         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
526             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
527         fi
528         INCREMENTAL_LINKER=1
530         # Check midl version
531         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
532         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
533         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
534         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
535          # Add flags if necessary
536          AC_MSG_CHECKING([for midl flags])
537          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
538              # Starting with MIDL version 6.0.359, the MIDL compiler
539              # generates /Oicf /robust stubs by default, which is not
540              # compatible with versions of Windows older than Win2k.
541              # This switches us back to the old behaviour. When we drop
542              # support for Windows older than Win2k, we should remove
543              # this.
544              MIDL_FLAGS="${MIDL_FLAGS} -no_robust"
545              AC_MSG_RESULT([need -no_robust])
546          else
547              MIDL_FLAGS="${MIDL_FLAGS}"
548              AC_MSG_RESULT([none needed])
549         fi
550         
551         unset _MSVC_VER_FILTER
552         
553     else
554         # Check w32api version
555         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
556         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
557         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
558         AC_TRY_COMPILE([#include <w32api.h>],
559             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
560                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
561                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
562                 #error "test failed."
563             #endif
564             , [ res=yes ], [ res=no ])
565         AC_MSG_RESULT([$res])
566         if test "$res" != "yes"; then
567             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
568         fi
569         # Check windres version
570         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
571         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
572         AC_MSG_RESULT([$_WINDRES_VERSION])
573         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
574         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
575         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
576         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
577         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
578         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
579         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
580                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
581                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
582                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
583                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
584                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
585         then
586             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
587         fi
588     fi # !GNU_CC
590     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
591     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
592     # Require OS features provided by IE 5.0
593     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
594     ;;
595 esac
597 dnl Test breaks icc on OS/2 && MSVC
598 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
599     AC_PROG_CC_C_O
600     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
601         USING_HCC=1
602         _OLDCC=$CC
603         _OLDCXX=$CXX
604         CC="${srcdir}/build/hcc '$CC'"
605         CXX="${srcdir}/build/hcpp '$CXX'"
606     fi
609 AC_PROG_CPP
610 AC_PROG_CXXCPP
612 if test -n "$_WIN32_MSVC"; then
613     SKIP_PATH_CHECKS=1
614     SKIP_COMPILER_CHECKS=1
615     SKIP_LIBRARY_CHECKS=1
618 fi # COMPILE_ENVIRONMENT
620 AC_SUBST(MIDL_FLAGS)
621 AC_SUBST(_MSC_VER)
623 AC_SUBST(GNU_AS)
624 AC_SUBST(GNU_LD)
625 AC_SUBST(GNU_CC)
626 AC_SUBST(GNU_CXX)
627 AC_SUBST(INTEL_CC)
628 AC_SUBST(INTEL_CXX)
630 dnl ========================================================
631 dnl Checks for programs.
632 dnl ========================================================
633 AC_PROG_INSTALL
634 AC_PROG_LN_S
635 AC_PATH_PROGS(PERL, $PERL perl5 perl )
636 if test -z "$PERL" || test "$PERL" = ":"; then
637     AC_MSG_ERROR([perl not found in \$PATH])
640 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
641 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
642 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
643 _perl_res=$?
644 AC_MSG_RESULT([$_perl_version])
646 if test "$_perl_res" != 0; then
647     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
651 AC_MSG_CHECKING([for full perl installation])
652 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
653 _perl_res=$?
654 if test "$_perl_res" != 0; then
655     AC_MSG_RESULT([no])
656     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
657 else
658     AC_MSG_RESULT([yes])    
661 AC_PATH_PROGS(PYTHON, $PYTHON python)
662 if test -z "$PYTHON"; then
663     AC_MSG_ERROR([python was not found in \$PATH])
665 echo PYTHON="$PYTHON"
667 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
668 if test -z "$COMPILE_ENVIRONMENT"; then
669 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
670     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
673 AC_SUBST(NSINSTALL_BIN)
675 AC_PATH_PROG(DOXYGEN, doxygen, :)
676 AC_PATH_PROG(WHOAMI, whoami, :)
677 AC_PATH_PROG(AUTOCONF, autoconf, :)
678 AC_PATH_PROG(UNZIP, unzip, :)
679 AC_PATH_PROGS(ZIP, zip)
680 if test -z "$ZIP" || test "$ZIP" = ":"; then
681     AC_MSG_ERROR([zip not found in \$PATH])
683 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
684 AC_PATH_PROG(XARGS, xargs)
685 if test -z "$XARGS" || test "$XARGS" = ":"; then
686     AC_MSG_ERROR([xargs not found in \$PATH .])
689 if test "$COMPILE_ENVIRONMENT"; then
691 dnl ========================================================
692 dnl = Mac OS X toolchain support
693 dnl ========================================================
695 case "$target_os" in
696 darwin*)
697     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
698     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
699     dnl the environment and includedir purposes (when using an SDK, below),
700     dnl but remember the full version number for the libdir (SDK).
701     changequote(,)
702     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
703     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
704     changequote([,])
705     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
706         dnl Bug 280479, but this keeps popping up in bug 292530 too because
707         dnl 4.0.0/4061 is the default compiler in Tiger.
708         changequote(,)
709         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
710         changequote([,])
711         if test "$GCC_BUILD" = "4061" ; then
712             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
713 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
714 from building Mozilla. Upgrade to Xcode 2.1 or later.])
715         fi
716     fi
718     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
719     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
720     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
721     AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
723     case "$PBBUILD" in
724       *xcodebuild*)
725         changequote(,)
726         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
727         changequote([,])
728         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
729           HAS_XCODE_2_1=1;
730         fi
731       ;;
732     esac
734     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
735     dnl it has moved into /usr/bin.
736     AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
737     ;;
738 esac
740 AC_SUBST(GCC_VERSION)
741 AC_SUBST(XCODEBUILD_VERSION)
742 AC_SUBST(HAS_XCODE_2_1)
744 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
745 dnl that a universal binary is being produced.
746 AC_SUBST(UNIVERSAL_BINARY)
748 dnl ========================================================
749 dnl Check for MacOS deployment target version
750 dnl ========================================================
752 MOZ_ARG_ENABLE_STRING(macos-target,
753                       [  --enable-macos-target=VER (default=10.4)
754                           Set the minimum MacOS version needed at runtime],
755                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
757 case "$target" in
758 *-darwin*)
759     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
760         dnl Use the specified value
761         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
762         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
763     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
764         dnl No value specified on the command line or in the environment,
765         dnl use the lesser of the application's minimum or the architecture's
766         dnl minimum.
767         export MACOSX_DEPLOYMENT_TARGET=10.4
768     fi
769     ;;
770 esac
772 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
774 dnl ========================================================
775 dnl = Mac OS X SDK support
776 dnl ========================================================
777 MACOS_SDK_DIR=
778 NEXT_ROOT=
779 MOZ_ARG_WITH_STRING(macos-sdk,
780 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
781     MACOS_SDK_DIR=$withval)
783 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
784 dnl NEXT_ROOT will be set and exported only if it's needed.
785 AC_SUBST(MACOS_SDK_DIR)
786 AC_SUBST(NEXT_ROOT)
788 if test "$MACOS_SDK_DIR"; then
789   dnl Sync this section with the ones in NSPR and NSS.
790   dnl Changes to the cross environment here need to be accounted for in
791   dnl the libIDL checks (below) and xpidl build.
793   if test ! -d "$MACOS_SDK_DIR"; then
794     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
795 specify a valid SDK.  SDKs are installed when the optional cross-development
796 tools are selected during the Xcode/Developer Tools installation.])
797   fi
799   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
800   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
801     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"
802     if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
803       SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
804     fi
805     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"
807     CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
808     CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
810     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
811     CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
812     CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
814     dnl ld support for -syslibroot is compiler-agnostic, but only available
815     dnl on Tiger.  Although it's possible to switch on the build host's
816     dnl OS release to use ld -syslibroot when available, ld -syslibroot will
817     dnl cause warnings as long as NEXT_ROOT is set.  NEXT_ROOT should be
818     dnl set because both the compiler and linker use it.
819     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"
820     export NEXT_ROOT=$MACOS_SDK_DIR
822     if test -n "$CROSS_COMPILE" ; then
823       dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
824       dnl the build host.  HOST_CXX is presently unused.
825       HOST_CC="NEXT_ROOT= $HOST_CC"
826       HOST_CXX="NEXT_ROOT= $HOST_CXX"
827     fi
828   else
829     dnl gcc >= 4.0 uses different paths than above, but knows how to find
830     dnl them itself.
831     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
832     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
834     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
835     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
836     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
838     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
839       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
840       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
841       dnl be ignored and cause warnings when -syslibroot is specified.
842       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
843       dnl the -isysroot it receives, so this is only needed with 4.0.0.
844       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
845     fi
846   fi
848   AC_LANG_SAVE
849   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
850   AC_LANG_CPLUSPLUS
851   AC_TRY_COMPILE([#include <new>
852                  int main() { return 0; }],
853    result=yes,
854    result=no)
855   AC_LANG_RESTORE
856   AC_MSG_RESULT($result)
858   if test "$result" = "no" ; then
859     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
860   fi
863 fi # COMPILE_ENVIRONMENT
865 dnl Be sure the make we use is GNU make.
866 dnl on win32, gmake.exe is the generally the wrong version
867 case "$host_os" in
868 cygwin*|mingw*|mks*|msvc*)
869     AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
870     ;;
872     AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
873     ;;
874 esac
875 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
876 if test ! "$_make_try"
877 then
878         echo
879         echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
880         echo
881         exit 1
883 dnl Now exit if version if < MAKE_VERSION
884 rm -f dummy.mk
885 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
886 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
887 rm -f dummy.mk
888 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
889 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
890 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
891 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
892 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
893    test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
894         "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
895    AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
897 AC_SUBST(MAKE)
899 if test "$COMPILE_ENVIRONMENT"; then
901 AC_PATH_XTRA
903 dnl Check in X11 include directory too.
904 if test "$no_x" != "yes"; then
905     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
908 XCFLAGS="$X_CFLAGS"
910 fi # COMPILE_ENVIRONMENT
912 dnl ========================================================
913 dnl set the defaults first
914 dnl ========================================================
915 AS_BIN=$AS
916 AR_FLAGS='cr $@'
917 AR_LIST='$(AR) t'
918 AR_EXTRACT='$(AR) x'
919 AR_DELETE='$(AR) d'
920 AS='$(CC)'
921 AS_DASH_C_FLAG='-c'
922 DLL_PREFIX=lib
923 LIB_PREFIX=lib
924 DLL_SUFFIX=.so
925 OBJ_SUFFIX=o
926 LIB_SUFFIX=a
927 ASM_SUFFIX=s
928 IMPORT_LIB_SUFFIX=
929 TARGET_MD_ARCH=unix
930 DIRENT_INO=d_ino
931 CYGWIN_WRAPPER=
932 WIN_TOP_SRC=
933 MOZ_USER_DIR=".mozilla"
934 HOST_AR='$(AR)'
935 HOST_AR_FLAGS='$(AR_FLAGS)'
937 MOZ_JPEG_CFLAGS=
938 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
939 MOZ_ZLIB_CFLAGS=
940 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
941 MOZ_BZ2_CFLAGS=
942 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
943 MOZ_PNG_CFLAGS=
944 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
946 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
947 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
948 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin:/usr/lib:/usr/local/lib:/lib'
949 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
950 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
951 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
952 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
954 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
955 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
957 USE_DEPENDENT_LIBS=1
959 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
960 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
962 MOZ_ENABLE_POSTSCRIPT=1 
964 if test -n "$CROSS_COMPILE"; then
965     OS_TARGET="${target_os}"
966     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
967     OS_RELEASE=
968     case "${target_os}" in
969         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
970         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
971         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
972         mingw*)       OS_ARCH=WINNT ;;
973         wince*)       OS_ARCH=WINCE ;;
974         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
975     esac
976 else
977     OS_TARGET=`uname -s`
978     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
979     OS_RELEASE=`uname -r`
982 # Before this used `uname -m` when not cross compiling
983 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
984 OS_TEST="${target_cpu}"
986 _COMPILER_PREFIX=
988 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
990 #######################################################################
991 # Master "Core Components" macros for getting the OS target           #
992 #######################################################################
995 # Note: OS_TARGET should be specified on the command line for gmake.
996 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
997 # The difference between the Win95 target and the WinNT target is that
998 # the WinNT target uses Windows NT specific features not available
999 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
1000 # at lesser performance (the Win95 target uses threads; the WinNT target
1001 # uses fibers).
1003 # When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target
1004 # is built. See: win16_3.11.mk for lots more about the Win16 target.
1006 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1007 # cross-compilation.
1011 # The following hack allows one to build on a WIN95 machine (as if
1012 # s/he were cross-compiling on a WINNT host for a WIN95 target).
1013 # It also accomodates for MKS's uname.exe.  If you never intend
1014 # to do development on a WIN95 machine, you don't need this hack.
1016 case "$OS_ARCH" in
1017 WIN95)
1018     OS_ARCH=WINNT
1019     OS_TARGET=WIN95
1020     ;;
1021 Windows_95)
1022     OS_ARCH=Windows_NT
1023     OS_TARGET=WIN95
1024     ;;
1025 Windows_98)
1026     OS_ARCH=Windows_NT
1027     OS_TARGET=WIN95
1028     ;;
1029 CYGWIN_9*|CYGWIN_ME*)
1030     OS_ARCH='CYGWIN_NT-4.0'
1031     OS_TARGET=WIN95
1032     ;;
1033 esac
1036 # Define and override various archtecture-specific variables, including
1037 # HOST_OS_ARCH
1038 # OS_ARCH
1039 # OS_TEST
1040 # OS_TARGET
1041 # OS_RELEASE
1042 # OS_MINOR_RELEASE
1045 case "$HOST_OS_ARCH" in
1046 cygwin*|mingw*|mks*|msvc*)
1047     HOST_OS_ARCH=WINNT
1048     ;;
1049 linux*)
1050     HOST_OS_ARCH=Linux
1051     ;;
1052 solaris*)
1053     HOST_OS_ARCH=SunOS
1054     ;;
1055 BSD_386)
1056     HOST_OS_ARCH=BSD
1057     ;;
1058 dgux)
1059     HOST_OS_ARCH=DGUX
1060     ;;
1061 IRIX64)
1062     HOST_OS_ARCH=IRIX
1063     ;;
1064 UNIX_SV)
1065     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1066         HOST_OS_ARCH=NCR
1067     else
1068         HOST_OS_ARCH=UNIXWARE
1069     fi
1070     ;;
1071 ncr)
1072     HOST_OS_ARCH=NCR
1073     ;;
1074 UNIX_SYSTEM_V)
1075     HOST_OS_ARCH=NEC
1076     ;;
1077 OSF1)
1078     ;;
1079 *OpenVMS*)
1080     HOST_OS_ARCH=OpenVMS
1081     ;;
1082 OS_2)
1083     HOST_OS_ARCH=OS2
1084     ;;
1085 QNX)
1086     ;;
1087 SCO_SV)
1088     HOST_OS_ARCH=SCOOS
1089     ;;
1090 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1091     HOST_OS_ARCH=SINIX
1092     ;;
1093 UnixWare)
1094     HOST_OS_ARCH=UNIXWARE
1095     ;;
1096 esac
1098 case "$OS_ARCH" in
1099 WINNT)
1100     OS_TEST=`uname -p`
1101     ;;
1102 Windows_NT)
1104 # If uname -s returns "Windows_NT", we assume that we are using
1105 # the uname.exe in MKS toolkit.
1107 # The -r option of MKS uname only returns the major version number.
1108 # So we need to use its -v option to get the minor version number.
1109 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1111     OS_ARCH=WINNT
1112     OS_TARGET=WINNT
1113     OS_MINOR_RELEASE=`uname -v`
1114     if test "$OS_MINOR_RELEASE" = "00"; then
1115         OS_MINOR_RELEASE=0
1116     fi
1117     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1118     ;;
1119 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1121 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1122 # the uname.exe in the Cygwin tools.
1123 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1124 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1125 # the uname.exe in the GNU-Win32 tools.
1126 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1127 # the uname.exe in the MSYS tools.
1129     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1130     OS_ARCH=WINNT
1131     OS_TARGET=WINNT
1132     ;;
1133 AIX)
1134     OS_RELEASE=`uname -v`.`uname -r`
1135     OS_TEST=`uname -p`
1136     ;;
1137 BSD_386)
1138     OS_ARCH=BSD
1139     ;;
1140 dgux)
1141     OS_ARCH=DGUX
1142     ;;
1143 IRIX64)
1144     OS_ARCH=IRIX
1145     ;;
1146 UNIX_SV)
1147     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1148         OS_ARCH=NCR
1149     else
1150         OS_ARCH=UNIXWARE
1151         OS_RELEASE=`uname -v`
1152     fi
1153     ;;
1154 ncr)
1155     OS_ARCH=NCR
1156     ;;
1157 UNIX_SYSTEM_V)
1158     OS_ARCH=NEC
1159     ;;
1160 OSF1)
1161     case `uname -v` in
1162     148)
1163         OS_RELEASE=V3.2C
1164         ;;
1165     564)
1166         OS_RELEASE=V4.0B
1167         ;;
1168     878)
1169         OS_RELEASE=V4.0D
1170         ;;
1171     esac
1172     ;;
1173 *OpenVMS*)
1174     OS_ARCH=OpenVMS
1175     OS_RELEASE=`uname -v`
1176     OS_TEST=`uname -p`
1177     ;;
1178 OS_2)
1179     OS_ARCH=OS2
1180     OS_TARGET=OS2
1181     OS_RELEASE=`uname -v`
1182     ;;
1183 QNX)
1184     if test "$OS_TARGET" != "NTO"; then
1185         changequote(,)
1186         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1187         changequote([,])
1188     fi
1189     OS_TEST=x86
1190     ;;
1191 SCO_SV)
1192     OS_ARCH=SCOOS
1193     OS_RELEASE=5.0
1194     ;;
1195 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1196     OS_ARCH=SINIX
1197     OS_TEST=`uname -p`
1198     ;;
1199 UnixWare)
1200     OS_ARCH=UNIXWARE
1201     OS_RELEASE=`uname -v`
1202     ;;
1203 WINCE)
1204     OS_ARCH=WINCE
1205     OS_TARGET=WINCE
1206     ;;
1207 Darwin)
1208     case "${target_cpu}" in
1209     powerpc*)
1210         OS_TEST=ppc
1211         ;;
1212     i*86*)
1213         OS_TEST=i386 
1214         ;;
1215     *)
1216         if test -z "$CROSS_COMPILE" ; then
1217             OS_TEST=`uname -p`
1218         fi
1219         ;;
1220     esac
1221     ;;
1222 esac
1224 if test "$OS_ARCH" = "NCR"; then
1225     changequote(,)
1226     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1227     changequote([,])
1230 # Only set CPU_ARCH if we recognize the value of OS_TEST
1232 case "$OS_TEST" in
1233 *86 | i86pc)
1234     CPU_ARCH=x86
1235     ;;
1237 powerpc* | ppc)
1238     CPU_ARCH=ppc
1239     ;;
1241 Alpha | alpha | ALPHA)
1242     CPU_ARCH=Alpha
1243     ;;
1245 sun4u | sparc*)
1246     CPU_ARCH=sparc
1247     ;;
1249 x86_64 | ia64)
1250     CPU_ARCH="$OS_TEST"
1251     ;;
1252 esac
1254 if test -z "$OS_TARGET"; then
1255     OS_TARGET=$OS_ARCH
1257 if test "$OS_TARGET" = "WIN95"; then
1258     OS_RELEASE="4.0"
1260 if test "$OS_TARGET" = "WIN16"; then
1261     OS_RELEASE=
1263 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1265 dnl ========================================================
1266 dnl GNU specific defaults
1267 dnl ========================================================
1268 if test "$GNU_CC"; then
1269     # FIXME: Let us build with strict aliasing. bug 414641.
1270     CFLAGS="$CFLAGS -fno-strict-aliasing"
1271     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1272     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1273     DSO_LDOPTS='-shared'
1274     if test "$GCC_USE_GNU_LD"; then
1275         # Don't allow undefined symbols in libraries
1276         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1277     fi
1278     WARNINGS_AS_ERRORS='-Werror'
1279     DSO_CFLAGS=''
1280     DSO_PIC_CFLAGS='-fPIC'
1281     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1282     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1283     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1284     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1286     # Turn on GNU specific features
1287     # -Wall - turn on all warnings
1288     # -pedantic - make compiler warn about non-ANSI stuff, and
1289     #             be a little bit stricter
1290     # Warnings slamm took out for now (these were giving more noise than help):
1291     # -Wbad-function-cast - warns when casting a function to a new return type
1292     # -Wconversion - complained when char's or short's were used a function args
1293     # -Wshadow - removed because it generates more noise than help --pete
1294     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1295     if test "$CPU_ARCH" != "ia64" && test "$CPU_ARCH" != "sparc" \
1296        && test -z "$INTEL_CC"; then
1297         # don't use -Wcast-align on ia64 or sparc, it's noisy on those platforms
1298         # icc doesn't support this flag.
1299         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1300     fi
1302     dnl Turn pedantic on but disable the warnings for long long
1303     _PEDANTIC=1
1305     if test -z "$INTEL_CC"; then
1306       _IGNORE_LONG_LONG_WARNINGS=1
1307       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1308     else
1309       _IGNORE_LONG_LONG_WARNINGS=
1310     fi
1313     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1314     _USE_CPP_INCLUDE_FLAG=1
1315 else
1316     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1317     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1319     DSO_LDOPTS='-shared'
1320     if test "$GNU_LD"; then
1321         # Don't allow undefined symbols in libraries
1322         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1323     fi
1325     DSO_CFLAGS=''
1326     DSO_PIC_CFLAGS='-KPIC'
1327     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1330 if test "$GNU_CXX"; then
1331     # FIXME: Let us build with strict aliasing. bug 414641.
1332     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1333     # Turn on GNU specific features
1334     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wconversion -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1335     if test "$CPU_ARCH" != "ia64" && test "$CPU_ARCH" != "sparc" \
1336        && test -z "$INTEL_CC"; then
1337         # don't use -Wcast-align on ia64 or sparc, it's noisy on those platforms
1338         # icc doesn't support this flag.
1339         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1340     fi
1342     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1343     _USE_CPP_INCLUDE_FLAG=1
1344 else
1345     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1348 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1349 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1350 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1351 dnl normal behavior.
1352 dnl ========================================================
1353 MKSHLIB_FORCE_ALL=
1354 MKSHLIB_UNFORCE_ALL=
1356 if test "$COMPILE_ENVIRONMENT"; then
1357 if test "$GNU_CC"; then
1358   AC_MSG_CHECKING(whether ld has archive extraction flags)
1359   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1360    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1361     ac_cv_mkshlib_force_and_unforce="no"
1362     exec 3<&0 <<LOOP_INPUT
1363         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1364         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1365         force="-Wl,-all";              unforce="-Wl,-none"
1366 LOOP_INPUT
1367     while read line
1368     do
1369       eval $line
1370       LDFLAGS=$force
1371       LIBS=$unforce
1372       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1373     done
1374     exec 0<&3 3<&-
1375     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1376    ])
1377   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1378     AC_MSG_RESULT(no)
1379   else
1380     AC_MSG_RESULT(yes)
1381     eval $ac_cv_mkshlib_force_and_unforce
1382     MKSHLIB_FORCE_ALL=$force
1383     MKSHLIB_UNFORCE_ALL=$unforce
1384   fi
1385 fi # GNU_CC
1386 fi # COMPILE_ENVIRONMENT
1388 dnl =================================================================
1389 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1390 dnl which is bad when cross compiling.
1391 dnl =================================================================
1392 if test "$COMPILE_ENVIRONMENT"; then
1393 configure_static_assert_macros='
1394 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1395 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1396 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1399 dnl test that the macros actually work:
1400 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1401 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1402  [AC_LANG_SAVE
1403   AC_LANG_C
1404   ac_cv_static_assertion_macros_work="yes"
1405   AC_TRY_COMPILE([$configure_static_assert_macros],
1406                  [CONFIGURE_STATIC_ASSERT(1)],
1407                  ,
1408                  ac_cv_static_assertion_macros_work="no")
1409   AC_TRY_COMPILE([$configure_static_assert_macros],
1410                  [CONFIGURE_STATIC_ASSERT(0)],
1411                  ac_cv_static_assertion_macros_work="no",
1412                  )
1413   AC_LANG_CPLUSPLUS
1414   AC_TRY_COMPILE([$configure_static_assert_macros],
1415                  [CONFIGURE_STATIC_ASSERT(1)],
1416                  ,
1417                  ac_cv_static_assertion_macros_work="no")
1418   AC_TRY_COMPILE([$configure_static_assert_macros],
1419                  [CONFIGURE_STATIC_ASSERT(0)],
1420                  ac_cv_static_assertion_macros_work="no",
1421                  )
1422   AC_LANG_RESTORE
1423  ])
1424 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1425 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1426     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1429 fi # COMPILE_ENVIRONMENT
1431 dnl ========================================================
1432 dnl Checking for 64-bit OS
1433 dnl ========================================================
1434 if test "$COMPILE_ENVIRONMENT"; then
1435 AC_LANG_SAVE
1436 AC_LANG_C
1437 AC_MSG_CHECKING(for 64-bit OS)
1438 AC_TRY_COMPILE([$configure_static_assert_macros],
1439                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1440                result="yes", result="no")
1441 AC_MSG_RESULT("$result")
1442 if test "$result" = "yes"; then
1443     AC_DEFINE(HAVE_64BIT_OS)
1444     HAVE_64BIT_OS=1
1446 AC_SUBST(HAVE_64BIT_OS)
1447 AC_LANG_RESTORE
1448 fi # COMPILE_ENVIRONMENT
1450 dnl ========================================================
1451 dnl Enable high-memory support on OS/2 by default.
1452 dnl ========================================================
1453 MOZ_OS2_HIGH_MEMORY=1
1454 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1455 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1456     MOZ_OS2_HIGH_MEMORY=,
1457     MOZ_OS2_HIGH_MEMORY=1 )
1458 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1460 dnl ========================================================
1461 dnl System overrides of the defaults for host
1462 dnl ========================================================
1463 case "$host" in
1464 *-beos*)
1465     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1466     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1467     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1468     ;;
1470 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1471     if test -n "$_WIN32_MSVC"; then
1472         HOST_AR=lib
1473         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1474         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1475         HOST_RANLIB='echo ranlib'
1476     else
1477         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1478     fi
1479     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1480     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1481     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1482     HOST_BIN_SUFFIX=.exe
1483     case "$host" in
1484     *mingw*)
1485     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1486         ;;
1487     *)
1488         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1489         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1490             _pwd=`pwd`
1491             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1492         fi
1493         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1494             AS_PERL=1
1495             PERL="${CYGWIN_WRAPPER} $PERL"
1496         fi
1498         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1499             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1500         fi
1501         ;;
1502     esac
1503     ;;
1505 *-darwin*)
1506     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1507     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1508     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1509     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1510     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1511     ;;
1513 *-linux*|*-kfreebsd*-gnu)
1514     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1515     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1516     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1517     ;;
1519 *os2*)
1520     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1521     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1522     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1523     HOST_BIN_SUFFIX=.exe
1524     MOZ_FIX_LINK_PATHS=
1525     ;;
1527 *-osf*)
1528     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1529     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1530     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1531     ;;
1534     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1535     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1536     ;;
1537 esac
1539 dnl Get mozilla version from central milestone file
1540 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1542 dnl Get version of various core apps from the version files.
1543 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1544 THUNDERBIRD_VERSION=`cat $topsrcdir/mail/config/version.txt`
1545 SUNBIRD_VERSION=`cat $topsrcdir/calendar/sunbird/config/version.txt`
1546 SEAMONKEY_VERSION=`cat $topsrcdir/suite/config/version.txt`
1548 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1549 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1551 dnl ========================================================
1552 dnl System overrides of the defaults for target
1553 dnl ========================================================
1555 case "$target" in
1556 *-aix*)
1557     AC_DEFINE(AIX)
1558     if test ! "$GNU_CC"; then
1559         if test ! "$HAVE_64BIT_OS"; then
1560             # Compiling with Visual Age C++ object model compat is the
1561             # default. To compile with object model ibm, add 
1562             # AIX_OBJMODEL=ibm to .mozconfig.
1563             if test "$AIX_OBJMODEL" = "ibm"; then
1564                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1565             else
1566                 AIX_OBJMODEL=compat
1567             fi
1568         else
1569             AIX_OBJMODEL=compat
1570         fi
1571         AC_SUBST(AIX_OBJMODEL)
1572         DSO_LDOPTS='-qmkshrobj=1'
1573         DSO_CFLAGS='-qflag=w:w'
1574         DSO_PIC_CFLAGS=
1575         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1576         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1577         MOZ_FIX_LINK_PATHS=
1578         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1579         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1580         if test "$COMPILE_ENVIRONMENT"; then
1581             AC_LANG_SAVE
1582             AC_LANG_CPLUSPLUS
1583             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 5.0.2.0])
1584             AC_TRY_COMPILE([],
1585                 [#if (__IBMCPP__ < 502)
1586                  #error "Bad compiler"
1587                  #endif],
1588                 _BAD_COMPILER=,_BAD_COMPILER=1)
1589             if test -n "$_BAD_COMPILER"; then
1590                 AC_MSG_RESULT([no])    
1591                 AC_MSG_ERROR([VisualAge C++ version 5.0.2.0 or higher is required to build.])
1592             else
1593                 AC_MSG_RESULT([yes])    
1594             fi
1595             AC_LANG_RESTORE
1596             TARGET_COMPILER_ABI="ibmc"
1597             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1598             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1599         fi
1600     fi
1601     case "${target_os}" in
1602     aix4.1*)
1603         DLL_SUFFIX='_shr.a'
1604         ;;
1605     esac
1606     if test "$COMPILE_ENVIRONMENT"; then
1607         AC_CHECK_HEADERS(sys/inttypes.h)
1608     fi
1609     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1610     ;;
1612 *-beos*)
1613     no_x=yes
1614     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1615     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1616     DSO_LDOPTS='-nostart'
1617     TK_LIBS='-lbe -lroot'
1618     LIBS="$LIBS -lbe"
1619     if test "$COMPILE_ENVIRONMENT"; then
1620         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1621         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1622     fi
1623     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1624     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1625     _MOZ_USE_RTTI=1
1626     USE_DEPENDENT_LIBS=
1627     MOZ_USER_DIR="Mozilla"
1628     ;;
1630 *-bsdi*)
1631     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1632     _PEDANTIC=
1633     _IGNORE_LONG_LONG_WARNINGS=
1634     case $OS_RELEASE in
1635         4.*|5.*)
1636             STRIP="$STRIP -d"
1637             ;;
1638         *)
1639             DSO_CFLAGS=''
1640             DSO_LDOPTS='-r'
1641             _WARNINGS_CFLAGS="-Wall"
1642             _WARNINGS_CXXFLAGS="-Wall"
1643             # The test above doesn't work properly, at least on 3.1.
1644             MKSHLIB_FORCE_ALL=''
1645             MKSHLIB_UNFORCE_ALL=''
1646         ;;
1647     esac
1648     ;;
1650 *-darwin*) 
1651     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1652     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1653     MOZ_OPTIMIZE_FLAGS="-O2"
1654     _PEDANTIC=
1655     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1656     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1657     DLL_SUFFIX=".dylib"
1658     DSO_LDOPTS=''
1659     STRIP="$STRIP -x -S"
1660     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1661     MOZ_ENABLE_POSTSCRIPT=
1662     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1663     LDFLAGS="$LDFLAGS -framework Cocoa"
1664     # The ExceptionHandling framework is needed for Objective-C exception
1665     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1666     # builds.
1667     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1668     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1669     MACOSX=1
1671     dnl check for the presence of the -dead_strip linker flag
1672     AC_MSG_CHECKING([for -dead_strip option to ld])
1673     _SAVE_LDFLAGS=$LDFLAGS
1674     LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1675     AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1676     if test -n "$_HAVE_DEAD_STRIP" ; then
1677         AC_MSG_RESULT([yes])
1678         MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1679     else
1680         AC_MSG_RESULT([no])
1681     fi
1682     LDFLAGS=$_SAVE_LDFLAGS
1683     ;;
1685 *-freebsd*)
1686     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
1687         DLL_SUFFIX=".so.1.0"
1688         DSO_LDOPTS="-shared"
1689     fi
1690     if test ! "$GNU_CC"; then
1691         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1692     fi
1693 # Can't have force w/o an unforce.
1694 #    # Hack for FreeBSD 2.2
1695 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1696 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1697 #       MKSHLIB_UNFORCE_ALL=''
1698 #    fi
1699     ;; 
1701 *-hpux*)
1702     DLL_SUFFIX=".sl"
1703     if test ! "$GNU_CC"; then
1704         DSO_LDOPTS='-b -Wl,+s'
1705         DSO_CFLAGS=""
1706         DSO_PIC_CFLAGS="+Z"
1707         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1708         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1709         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1710     else
1711         DSO_LDOPTS='-b -E +s'
1712         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1713         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1714     fi
1715     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1716     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1717     ;;
1719 *-irix5*)
1720     AC_DEFINE(IRIX)
1721     DSO_LDOPTS='-elf -shared'
1723     if test "$GNU_CC"; then
1724        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1725        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1726        MKSHLIB_FORCE_ALL='-Wl,-all'
1727        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1728        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1729     else
1730        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1731        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1732        MKSHLIB_FORCE_ALL='-all'
1733        MKSHLIB_UNFORCE_ALL='-none'
1734     fi
1735     ;;
1737 *-irix6*)
1738     AC_DEFINE(IRIX)
1739     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1740     dnl compile and link using -n32
1741     USE_N32=1
1742     TARGET_COMPILER_ABI=n32
1743     DSO_LDOPTS='-elf -shared'
1744     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1745     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1746     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1747     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1748     if test "$GNU_CC"; then
1749        MKSHLIB_FORCE_ALL='-Wl,-all'
1750        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1751        _WARNINGS_CFLAGS="-Wall"
1752        _WARNINGS_CXXFLAGS="-Wall"
1753        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1754     else
1755        MKSHLIB_FORCE_ALL='-all'
1756        MKSHLIB_UNFORCE_ALL='-none'
1757            AR_LIST="$AR t"
1758            AR_EXTRACT="$AR x"
1759            AR_DELETE="$AR d"
1760            AR='$(CXX) -ar'
1761            AR_FLAGS='-o $@'
1762        CFLAGS="$CFLAGS -woff 3262 -G 4"
1763        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1764        if test -n "$USE_N32"; then
1765            ASFLAGS="$ASFLAGS -n32"
1766            CFLAGS="$CFLAGS -n32"
1767            CXXFLAGS="$CXXFLAGS -n32"
1768            LDFLAGS="$LDFLAGS -n32"
1769        fi
1770        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1771        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1772        MOZ_FIX_LINK_PATHS=
1773     fi
1774     if test -z "$GNU_CXX"; then
1775       MIPSPRO_CXX=1
1776     fi
1777     ;;
1779 *-*linux*)
1780     if test "$GNU_CC"; then
1781         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1782         case $GCC_VERSION in
1783         4.1.*|4.2.*)
1784             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1785             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1786         esac
1787     fi
1789     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1790     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1791     MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1792                                       # and that combo is not yet good at
1793                                       # debugging inlined functions (even
1794                                       # when using DWARF2 as the debugging
1795                                       # format)    
1797     MOZ_MEMORY=1
1799     case "${target_cpu}" in
1800     alpha*)
1801         CFLAGS="$CFLAGS -mieee"
1802         CXXFLAGS="$CXXFLAGS -mieee"
1803     ;;
1804     i*86)
1805         USE_ELF_DYNSTR_GC=1
1806         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1807     ;;
1808     mips*)
1809         CFLAGS="$CFLAGS -Wa,-xgot"
1810         CXXFLAGS="$CXXFLAGS -Wa,-xgot"
1811     ;;
1812     esac
1813     ;;
1815 *-wince*)
1817     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1818     AR_LIST="$AR -list"
1819     AR_EXTRACT="$AR -extract"
1820     AR_DELETE="$AR d"
1821     AR_FLAGS='-OUT:"$@"'
1823     DSO_CFLAGS=
1824     DSO_PIC_CFLAGS=
1825     DLL_SUFFIX=.dll
1826     BIN_SUFFIX='.exe'
1827     RC=rc.exe
1828     # certain versions of cygwin's makedepend barf on the 
1829     # #include <string> vs -I./dist/include/string issue so don't use it
1830     SYSTEM_MAKEDEPEND=
1832     HOST_CC=cl
1833     HOST_CXX=cl
1834     HOST_LD=link
1835     HOST_AR='lib -OUT:$@'
1836     HOST_RANLIB='echo ranlib'
1837     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1838         
1839         
1840     WARNINGS_AS_ERRORS='-WX'
1841         MOZ_OPTIMIZE_FLAGS='-O1'
1842     AR_FLAGS='-NOLOGO -OUT:"$@"'
1843     ASM_SUFFIX=asm
1844     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1845     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1846     DLL_PREFIX=
1847     DOXYGEN=:
1848     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1849     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1850     GARBAGE=
1851     IMPORT_LIB_SUFFIX=lib
1852     LIBS="$LIBS"
1853     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1854     LIB_PREFIX=
1855     LIB_SUFFIX=lib 
1856     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1857     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1858     MKSHLIB_FORCE_ALL=
1859     MKSHLIB_UNFORCE_ALL=
1860     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1861     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1862     MOZ_DEBUG_FLAGS='-Zi'
1863     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1864     MOZ_FIX_LINK_PATHS=
1865     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1866     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1867     OBJ_SUFFIX=obj
1868     RANLIB='echo not_ranlib'
1869     STRIP='echo not_strip'
1870     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1871     UNZIP=unzip
1872     XARGS=xargs
1873     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1874     ZIP=zip
1875     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1876     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1877     STATIC_LIBIDL=1
1879     AC_DEFINE(HAVE_SNPRINTF)
1880     AC_DEFINE(_WINDOWS)
1881     AC_DEFINE(_WIN32)
1882     AC_DEFINE(WIN32)
1883     AC_DEFINE(XP_WIN)
1884     AC_DEFINE(XP_WIN32)
1885     AC_DEFINE(HW_THREADS)
1886     AC_DEFINE(STDC_HEADERS)
1887     AC_DEFINE(NEW_H, <new>)
1888     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1890     TARGET_MD_ARCH=win32
1891     _PLATFORM_DEFAULT_TOOLKIT='windows'
1892     BIN_SUFFIX='.exe'
1893     USE_SHORT_LIBNAME=1
1894     MOZ_ENABLE_POSTSCRIPT=
1895     MOZ_USER_DIR="Mozilla"
1899 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1900     DSO_CFLAGS=
1901     DSO_PIC_CFLAGS=
1902     DLL_SUFFIX=.dll
1903     RC=rc.exe
1904     # certain versions of cygwin's makedepend barf on the 
1905     # #include <string> vs -I./dist/include/string issue so don't use it
1906     SYSTEM_MAKEDEPEND=
1907     if test -n "$GNU_CC"; then
1908         CC="$CC -mno-cygwin"
1909         CXX="$CXX -mno-cygwin"
1910         CPP="$CPP -mno-cygwin"
1911         CFLAGS="$CFLAGS -mms-bitfields"
1912         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1913         DSO_LDOPTS='-shared'
1914         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1915         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1916         RC='$(WINDRES)'
1917         # Use temp file for windres (bug 213281)
1918         RCFLAGS='-O coff --use-temp-file'
1919         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1920         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1921         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1922         MOZ_FIX_LINK_PATHS=
1923         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1924         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1925         DLL_PREFIX=
1926         IMPORT_LIB_SUFFIX=dll.a
1927     else
1928         TARGET_COMPILER_ABI=msvc
1929         HOST_CC='$(CC)'
1930         HOST_CXX='$(CXX)'
1931         HOST_LD='$(LD)'
1932         AR='lib -NOLOGO -OUT:"$@"'
1933         AR_FLAGS=
1934         RANLIB='echo not_ranlib'
1935         STRIP='echo not_strip'
1936         XARGS=xargs
1937         ZIP=zip
1938         UNZIP=unzip
1939         DOXYGEN=:
1940         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1941         OBJ_SUFFIX=obj
1942         LIB_SUFFIX=lib
1943         DLL_PREFIX=
1944         LIB_PREFIX=
1945         IMPORT_LIB_SUFFIX=lib
1946         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1947         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1948         MKSHLIB_FORCE_ALL=
1949         MKSHLIB_UNFORCE_ALL=
1950         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1951         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1952         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1953         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1954         MOZ_DEBUG_FLAGS='-Zi'
1955         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1956         WARNINGS_AS_ERRORS='-WX'
1957         MOZ_OPTIMIZE_FLAGS='-O1'
1958         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1959         MOZ_FIX_LINK_PATHS=
1960         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1961         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1962         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1963         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1964         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1965         if test $_MSC_VER -ge 1400; then
1966             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
1967             dnl For profile-guided optimization
1968             PROFILE_GEN_CFLAGS="-GL"
1969             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
1970             dnl XXX: PGO builds can fail with warnings treated as errors,
1971             dnl specifically "no profile data available" appears to be
1972             dnl treated as an error sometimes. This might be a consequence
1973             dnl of using WARNINGS_AS_ERRORS in some modules, combined
1974             dnl with the linker doing most of the work in the whole-program
1975             dnl optimization/PGO case. I think it's probably a compiler bug,
1976             dnl but we work around it here.
1977             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1978             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1979             dnl Probably also a compiler bug, but what can you do?
1980             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
1981             if test -n "$_USE_DYNAMICBASE"; then
1982                LDFLAGS="$LDFLAGS -DYNAMICBASE"
1983             fi
1984         fi
1985     fi
1986     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
1987     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
1988     AC_DEFINE(HAVE_SNPRINTF)
1989     AC_DEFINE(_WINDOWS)
1990     AC_DEFINE(_WIN32)
1991     AC_DEFINE(WIN32)
1992     AC_DEFINE(XP_WIN)
1993     AC_DEFINE(XP_WIN32)
1994     AC_DEFINE(HW_THREADS)
1995     AC_DEFINE(STDC_HEADERS)
1996     AC_DEFINE(NEW_H, <new>)
1997     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1998     TARGET_MD_ARCH=win32
1999     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2000     BIN_SUFFIX='.exe'
2001     USE_SHORT_LIBNAME=1
2002     MOZ_ENABLE_POSTSCRIPT=
2003     MOZ_USER_DIR="Mozilla"
2005     dnl Hardcode to win95 for now - cls
2006     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2008     dnl set NO_X11 defines here as the general check is skipped on win32
2009     no_x=yes
2010     AC_DEFINE(NO_X11)
2012     dnl MinGW/MSYS doesn't provide or need cygpath
2013     case "$host" in
2014     *-mingw*)
2015         CYGPATH_W=echo
2016         CYGPATH_S=cat
2017         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2018         ;;
2019     *-cygwin*|*-msvc*|*-mks*)
2020         CYGPATH_W="cygpath -a -w"
2021         CYGPATH_S="sed -e s|\\\\|/|g"
2022         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2023         ;;
2024     esac
2025     case "$host" in
2026     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2028     if test -z "$MOZ_TOOLS"; then
2029         AC_MSG_ERROR([MOZ_TOOLS is not set])
2030     fi
2032     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2033     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2034         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2035     fi
2036     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2037         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2038     fi
2039     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2041     if test -n "$GLIB_PREFIX"; then
2042         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2043         if test "$?" = "0"; then
2044             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2045                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2046             fi
2047             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2048         else
2049             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2050         fi
2051     else
2052         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2053     fi
2054     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2055         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2056     fi
2057     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2058     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2059         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2060     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2061         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2062     else
2063         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2064     fi
2066     if test -n "$LIBIDL_PREFIX"; then
2067         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2068         if test "$?" = "0"; then
2069             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2070                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2071             fi
2072             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2073         else
2074             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2075         fi
2076     else
2077         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2078     fi        
2079     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2080         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2081     fi
2082     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2083     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2084         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2085         STATIC_LIBIDL=1
2086     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2087         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2088     else
2089         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2090     fi
2091     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2092     ;;
2094     *) # else cross-compiling
2095         if test -n "$GLIB_PREFIX"; then
2096             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2097             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2098                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2099             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2100                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2101             else
2102                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2103             fi
2104         fi
2105         if test -n "$LIBIDL_PREFIX"; then
2106             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2107             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2108                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2109                 STATIC_LIBIDL=1
2110             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2111                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2112             else
2113                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2114             fi
2115         fi
2116         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2117         ;;
2118     esac 
2121     case "$host_os" in
2122     cygwin*)
2123         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])
2124         ;;
2126     *)
2127         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2129         AC_LANG_SAVE
2130         AC_LANG_CPLUSPLUS
2131         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2132         AC_LANG_RESTORE
2133         ;;
2134     esac
2136     case "$target" in
2137     i*86-*)
2138         AC_DEFINE(_X86_)
2139         ;;
2140     alpha-*)
2141         AC_DEFINE(_ALPHA_)
2142         ;;
2143     mips-*)
2144         AC_DEFINE(_MIPS_)
2145         ;;
2146     *)
2147         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2148         ;;
2149     esac
2150     ;;
2152 *-netbsd*)
2153     DSO_CFLAGS=''
2154     CFLAGS="$CFLAGS -Dunix"
2155     CXXFLAGS="$CXXFLAGS -Dunix"
2156     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2157         DLL_SUFFIX=".so"
2158         DSO_PIC_CFLAGS='-fPIC -DPIC'
2159         DSO_LDOPTS='-shared'
2160         BIN_FLAGS='-Wl,--export-dynamic'
2161     else
2162         DSO_PIC_CFLAGS='-fPIC -DPIC'
2163         DLL_SUFFIX=".so.1.0"
2164         DSO_LDOPTS='-shared'
2165     fi
2166     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2167     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2168     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2169     if test "$LIBRUNPATH"; then
2170         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2171     fi
2172     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2173     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2174     ;;
2176 *-nto*) 
2177         AC_DEFINE(NTO)  
2178         AC_DEFINE(_QNX_SOURCE)
2179         AC_DEFINE(_i386)
2180         OS_TARGET=NTO
2181         WARNINGS_AS_ERRORS=''
2182         MOZ_OPTIMIZE_FLAGS="-O"
2183         MOZ_DEBUG_FLAGS="-gstabs"
2184         USE_PTHREADS=1
2185         _PEDANTIC=
2186         LIBS="$LIBS -lsocket -lstdc++"
2187         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2188         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2189         if test "$with_x" != "yes"
2190         then
2191                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2192             TK_CFLAGS='-I/usr/include/photon'
2193                 TK_LIBS='-lph'
2194         fi
2195         case "${target_cpu}" in
2196         ppc*)
2197         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2198         ;;
2199         esac
2200         case "${host_cpu}" in
2201         i*86)
2202         USE_ELF_DYNSTR_GC=1
2203         ;;
2204         esac
2205         ;;
2207 *-openbsd*)
2208     DLL_SUFFIX=".so.1.0"
2209     DSO_CFLAGS=''
2210     DSO_PIC_CFLAGS='-fPIC'
2211     DSO_LDOPTS='-shared -fPIC'
2212     if test "$LIBRUNPATH"; then
2213         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2214     fi
2215     ;;
2217 *-openvms*) 
2218     AC_DEFINE(NO_PW_GECOS)
2219     AC_DEFINE(NO_UDSOCK)
2220     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2221     USE_PTHREADS=1
2222     MKSHLIB_FORCE_ALL='-all'
2223     MKSHLIB_UNFORCE_ALL='-none'
2224     AS='as'
2225     AS_DASH_C_FLAG='-Wc/names=as_is'
2226     AR_FLAGS='c $@'
2227     DSO_LDOPTS='-shared -auto_symvec'
2228     DSO_PIC_CFLAGS=
2229     MOZ_DEBUG_LDFLAGS='-g'
2230     COMPAQ_CXX=1
2231     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2232     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2233     ;;
2236 *-os2*)
2237     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2238     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2239     AC_DEFINE(XP_OS2)
2240     USE_SHORT_LIBNAME=1
2241     DLL_PREFIX=
2242     LIB_PREFIX=
2243     LIB_SUFFIX=lib
2244     BIN_SUFFIX=".exe"
2245     DLL_SUFFIX=".dll"
2246     IMPORT_LIB_SUFFIX=lib
2247     DSO_PIC_CFLAGS=
2248     TARGET_MD_ARCH=os2
2249     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2250     MOZ_ENABLE_POSTSCRIPT=
2251     RC=rc.exe
2252     RCFLAGS='-n'
2253     MOZ_USER_DIR="Mozilla"
2255     if test "$MOZTOOLS"; then
2256         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2257     else
2258         AC_MSG_ERROR([MOZTOOLS is not set])
2259     fi
2261     # EMX/GCC build
2262     if test -n "$GNU_CC"; then
2263         AC_DEFINE(OS2)
2264         AC_DEFINE(XP_OS2_EMX)
2265         AC_DEFINE(OS2EMX_PLAIN_CHAR)
2266         AC_DEFINE(TCPV40HDRS)
2267         AR=emxomfar
2268         AR_FLAGS='r $@'
2269         CFLAGS="$CFLAGS -Zomf"
2270         CXXFLAGS="$CXXFLAGS -Zomf"
2271         DSO_LDOPTS='-Zdll'
2272         BIN_FLAGS='-Zlinker /ST:0x100000'
2273         IMPLIB='emximp -o'
2274         FILTER='emxexp -o'
2275         LDFLAGS='-Zmap'
2276         WARNINGS_AS_ERRORS='-Werror'
2277         MOZ_DEBUG_FLAGS="-g -fno-inline"
2278         MOZ_OPTIMIZE_FLAGS="-O2"
2279         MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2280         MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2281         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2282         LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2283         if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2284           DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2285           LDFLAGS="$LDFLAGS -Zhigh-mem"
2286           MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2287           AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2288         fi
2290         # GCC for OS/2 currently predefines these, but we don't want them
2291         _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2292         _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2294         AC_CACHE_CHECK(for __declspec(dllexport),
2295            ac_os2_declspec,
2296            [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2297                            [return 0;],
2298                            ac_os2_declspec="yes",
2299                            ac_os2_declspec="no")])
2300         if test "$ac_os2_declspec" = "yes"; then
2301            FILTER='true'
2302            MOZ_OS2_USE_DECLSPEC='1'
2303         fi
2304         
2305     # Visual Age C++ build
2306     elif test "$VACPP" = "yes"; then
2307         MOZ_BUILD_ROOT=`pwd -D`
2308         OBJ_SUFFIX=obj
2309         AR=-ilib
2310         AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
2311         AR_LIST='/L'
2312         AR_EXTRACT='-*'
2313         AR_DELETE='-'
2314         AS=alp
2315         ASFLAGS='-Mb'
2316         AS_DASH_C_FLAG=''
2317         ASM_SUFFIX=asm
2318         LD='-ilink'
2319         CFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9"
2320         CXXFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9 /Gx+"
2321         MOZ_DEBUG_FLAGS="/Ti+"
2322         WARNINGS_AS_ERRORS='-WX'
2323         MOZ_OPTIMIZE_FLAGS="/O+ /Gl+ /G5 /qarch=pentium"
2324         LDFLAGS="/NOL /M"
2325         MOZ_DEBUG_LDFLAGS="/DE"
2326         MOZ_OPTIMIZE_LDFLAGS="/OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
2327         DSO_LDOPTS=''
2328         DSO_PIC_CFLAGS=
2329         IMPLIB='implib /NOL /NOI'
2330         FILTER='cppfilt -q -B -P'
2331         AC_DEFINE(NO_ANSI_KEYWORDS)
2332         AC_DEFINE(OS2,4)
2333         AC_DEFINE(_X86_)
2334         AC_DEFINE(XP_OS2_VACPP)
2335         AC_DEFINE(TCPV40HDRS)
2336         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2337         AC_DEFINE(STDC_HEADERS)
2338         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2339         MKSHLIB='$(LD) $(DSO_LDOPTS)'
2340         MKCSHLIB='$(LD) $(DSO_LDOPTS)'
2341         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2342         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcomct.lib'
2343         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2344         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2345     fi
2346     ;;
2348 alpha*-*-osf*)
2349     if test "$GNU_CC"; then
2350       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2351       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2353     else
2354         MOZ_DEBUG_FLAGS='-g'
2355         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2356         CFLAGS="$CFLAGS -ieee"
2357         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2358         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2359         DSO_CFLAGS=
2360         DSO_PIC_CFLAGS=
2361         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2362         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2363         MKSHLIB_FORCE_ALL='-all'
2364         MKSHLIB_UNFORCE_ALL='-none'
2365         dnl Might fix the libxpcom.so breakage on this platform as well....
2366         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2367         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2368     fi
2369     if test -z "$GNU_CXX"; then
2370       COMPAQ_CXX=1
2371     fi
2372     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2373     ;;
2375 *-qnx*) 
2376     DIRENT_INO=d_stat.st_ino
2377     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2378     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2379     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2380     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2381     AC_DEFINE(STDC_HEADERS)
2382     if test "$no_x" = "yes"; then
2383             _PLATFORM_DEFAULT_TOOLKIT='photon'
2384             TK_CFLAGS='-I/usr/nto/include/photon'
2385             TK_LIBS='-lphoton -lphrender'
2386     fi
2387     ;;
2389 *-sco*) 
2390     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2391     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2392     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2393     if test ! "$GNU_CC"; then
2394        DSO_LDOPTS='-G'
2395     fi
2396     ;;
2398 dnl the qsort routine under solaris is faulty
2399 *-solaris*) 
2400     AC_DEFINE(SOLARIS)
2401     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2402     SYSTEM_MAKEDEPEND=
2403     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2404     # libraries one level up (e.g. libnspr4.so)
2405     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2406     MOZ_MEMORY=1
2407     if test -z "$GNU_CC"; then
2408        NS_USE_NATIVE=1
2409        MOZ_FIX_LINK_PATHS='-R $(LIBXUL_DIST)/bin'
2410        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2412        if test "$CPU_ARCH" != "sparc"; then
2413           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2414           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2415        else
2416           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2417           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2418           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2419        fi
2421        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2422        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2423            _SAVE_LDFLAGS=$LDFLAGS
2424            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2425            AC_TRY_LINK([#include <stdio.h>],
2426                        [printf("Hello World\n");],
2427                        ,
2428                        [LDFLAGS=$_SAVE_LDFLAGS])
2429        fi
2430        WARNINGS_AS_ERRORS='-Werror'
2431        MOZ_OPTIMIZE_FLAGS="-xO4"
2432        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2433        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2434        MKSHLIB_FORCE_ALL='-z allextract'
2435        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2436        DSO_LDOPTS='-G -z muldefs'
2437        AR_LIST="$AR t"
2438        AR_EXTRACT="$AR x"
2439        AR_DELETE="$AR d"
2440        AR='$(CXX) -xar'
2441        AR_FLAGS='-o $@'
2442        AS='/usr/ccs/bin/as'
2443        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2444        AS_DASH_C_FLAG=''
2445        TARGET_COMPILER_ABI="sunc"
2446         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2447         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2448        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2449        AC_LANG_SAVE
2450        AC_LANG_CPLUSPLUS
2451        AC_TRY_COMPILE([],
2452            [#if (__SUNPRO_CC < 0x530)
2453            #error "Denied"
2454            #endif],
2455            _BAD_COMPILER=,_BAD_COMPILER=1)
2456         if test -n "$_BAD_COMPILER"; then
2457             _res="no"
2458             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2459         else
2460             _res="yes"
2461         fi
2462         AC_MSG_RESULT([$_res])
2463         AC_LANG_RESTORE
2464     else
2465        ASFLAGS="$ASFLAGS -fPIC"
2466        DSO_LDOPTS='-G'
2467        _WARNINGS_CFLAGS=''
2468        _WARNINGS_CXXFLAGS=''
2469        if test "$OS_RELEASE" = "5.3"; then
2470           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2471        fi
2472     fi
2473     if test "$OS_RELEASE" = "5.5.1"; then
2474        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2475     fi
2476     ;;
2478 *-sunos*) 
2479     DSO_LDOPTS='-Bdynamic'
2480     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2481     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2482     AC_DEFINE(SUNOS4)
2483     AC_DEFINE(SPRINTF_RETURNS_STRING)
2484     case "$(target_os)" in
2485     sunos4.1*)
2486         DLL_SUFFIX='.so.1.0'
2487         ;;
2488     esac
2489     ;;
2491 *-sysv4.2uw7*) 
2492         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2493     ;;
2495 *-os2*)
2496     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2497     ;;
2499 esac
2501 dnl Only one oddball right now (QNX), but this gives us flexibility
2502 dnl if any other platforms need to override this in the future.
2503 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2505 dnl ========================================================
2506 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2507 dnl by now will not have any way to link most binaries (tests
2508 dnl as well as viewer, apprunner, etc.), because some symbols
2509 dnl will be left out of the "composite" .so's by ld as unneeded.
2510 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2511 dnl they can link in the static libs that provide the missing
2512 dnl symbols.
2513 dnl ========================================================
2514 NO_LD_ARCHIVE_FLAGS=
2515 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2516     NO_LD_ARCHIVE_FLAGS=1
2518 case "$target" in
2519 *-os2*)
2520     NO_LD_ARCHIVE_FLAGS=
2521     ;;
2522 *-aix4.3*|*-aix5*)
2523     NO_LD_ARCHIVE_FLAGS=
2524     ;;
2525 *-openvms*)
2526     NO_LD_ARCHIVE_FLAGS=
2527     ;;
2528 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2529     if test -z "$GNU_CC"; then
2530         NO_LD_ARCHIVE_FLAGS=
2531     fi
2532     ;;
2533 esac
2534 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2537 dnl Indicate that platform requires special thread safe 
2538 dnl locking when starting up the OJI JVM 
2539 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2540 dnl ========================================================
2541 case "$target" in
2542     *-hpux*)      
2543         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2544         ;;
2545 esac
2547 dnl ========================================================
2548 dnl = Flags to strip unused symbols from .so components
2549 dnl ========================================================
2550 case "$target" in
2551     *-linux*|*-kfreebsd*-gnu)
2552         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2553         ;;
2554     *-solaris*)
2555         if test -z "$GNU_CC"; then
2556          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2557         else
2558          if test -z "$GCC_USE_GNU_LD"; then
2559           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2560          else
2561           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2562          fi
2563         fi
2564         ;;
2565     *-nto*) 
2566         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2567         ;;
2568     *-darwin*)
2569         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2570         ;;
2571     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2572         if test -n "$GNU_CC"; then
2573            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2574         fi
2575         ;;
2576 esac
2578 if test -z "$COMPILE_ENVIRONMENT"; then
2579     SKIP_COMPILER_CHECKS=1
2580     SKIP_LIBRARY_CHECKS=1
2583 if test -z "$SKIP_COMPILER_CHECKS"; then
2584 dnl Checks for typedefs, structures, and compiler characteristics.
2585 dnl ========================================================
2586 AC_LANG_C
2587 AC_HEADER_STDC
2588 AC_C_CONST
2589 AC_TYPE_MODE_T
2590 AC_TYPE_OFF_T
2591 AC_TYPE_PID_T
2592 AC_TYPE_SIZE_T
2593 AC_STRUCT_ST_BLKSIZE
2594 AC_MSG_CHECKING(for siginfo_t)
2595 AC_CACHE_VAL(ac_cv_siginfo_t,
2596  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2597                   #include <signal.h>],
2598                  [siginfo_t* info;],
2599                  [ac_cv_siginfo_t=true],
2600                  [ac_cv_siginfo_t=false])])
2601 if test "$ac_cv_siginfo_t" = true ; then
2602   AC_DEFINE(HAVE_SIGINFO_T)
2603   AC_MSG_RESULT(yes)
2604 else
2605   AC_MSG_RESULT(no)
2608 dnl Visual Age for os/2 also defines size_t and off_t in certain 
2609 dnl  header files.  These defines make Visual Age use the mozilla
2610 dnl  defines types.
2611 if test "$VACPP" = "yes"; then
2612    AC_DEFINE(__size_t)
2613    AC_DEFINE(__off_t)
2616 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2617 dnl ========================================================
2618 AC_MSG_CHECKING(for int16_t)
2619 AC_CACHE_VAL(ac_cv_int16_t,
2620  [AC_TRY_COMPILE([#include <stdio.h>
2621                   #include <sys/types.h>],
2622                  [int16_t foo = 0;],
2623                  [ac_cv_int16_t=true],
2624                  [ac_cv_int16_t=false])])
2625 if test "$ac_cv_int16_t" = true ; then
2626   AC_DEFINE(HAVE_INT16_T)
2627   AC_MSG_RESULT(yes)
2628 else
2629   AC_MSG_RESULT(no)
2631 AC_MSG_CHECKING(for int32_t)
2632 AC_CACHE_VAL(ac_cv_int32_t,
2633  [AC_TRY_COMPILE([#include <stdio.h>
2634                   #include <sys/types.h>],
2635                  [int32_t foo = 0;],
2636                  [ac_cv_int32_t=true],
2637                  [ac_cv_int32_t=false])])
2638 if test "$ac_cv_int32_t" = true ; then
2639   AC_DEFINE(HAVE_INT32_T)
2640   AC_MSG_RESULT(yes)
2641 else
2642   AC_MSG_RESULT(no)
2644 AC_MSG_CHECKING(for int64_t)
2645 AC_CACHE_VAL(ac_cv_int64_t,
2646  [AC_TRY_COMPILE([#include <stdio.h>
2647                   #include <sys/types.h>],
2648                  [int64_t foo = 0;],
2649                  [ac_cv_int64_t=true],
2650                  [ac_cv_int64_t=false])])
2651 if test "$ac_cv_int64_t" = true ; then
2652   AC_DEFINE(HAVE_INT64_T)
2653   AC_MSG_RESULT(yes)
2654 else
2655   AC_MSG_RESULT(no)
2657 AC_MSG_CHECKING(for int64)
2658 AC_CACHE_VAL(ac_cv_int64,
2659  [AC_TRY_COMPILE([#include <stdio.h>
2660                   #include <sys/types.h>],
2661                  [int64 foo = 0;],
2662                  [ac_cv_int64=true],
2663                  [ac_cv_int64=false])])
2664 if test "$ac_cv_int64" = true ; then
2665   AC_DEFINE(HAVE_INT64)
2666   AC_MSG_RESULT(yes)
2667 else
2668   AC_MSG_RESULT(no)
2670 AC_MSG_CHECKING(for uint)
2671 AC_CACHE_VAL(ac_cv_uint,
2672  [AC_TRY_COMPILE([#include <stdio.h>
2673                   #include <sys/types.h>],
2674                  [uint foo = 0;],
2675                  [ac_cv_uint=true],
2676                  [ac_cv_uint=false])])
2677 if test "$ac_cv_uint" = true ; then
2678   AC_DEFINE(HAVE_UINT)
2679   AC_MSG_RESULT(yes)
2680 else
2681   AC_MSG_RESULT(no)
2683 AC_MSG_CHECKING(for uint_t)
2684 AC_CACHE_VAL(ac_cv_uint_t,
2685  [AC_TRY_COMPILE([#include <stdio.h>
2686                   #include <sys/types.h>],
2687                  [uint_t foo = 0;],
2688                  [ac_cv_uint_t=true],
2689                  [ac_cv_uint_t=false])])
2690 if test "$ac_cv_uint_t" = true ; then
2691   AC_DEFINE(HAVE_UINT_T)
2692   AC_MSG_RESULT(yes)
2693 else
2694   AC_MSG_RESULT(no)
2696 AC_MSG_CHECKING(for uint16_t)
2697 AC_CACHE_VAL(ac_cv_uint16_t,
2698  [AC_TRY_COMPILE([#include <stdio.h>
2699                   #include <sys/types.h>],
2700                  [uint16_t foo = 0;],
2701                  [ac_cv_uint16_t=true],
2702                  [ac_cv_uint16_t=false])])
2703 if test "$ac_cv_uint16_t" = true ; then
2704   AC_DEFINE(HAVE_UINT16_T)
2705   AC_MSG_RESULT(yes)
2706 else
2707   AC_MSG_RESULT(no)
2710 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2711 dnl are defined when compiling C++ but not C.  Since the result of this
2712 dnl test is used only in C++, do it in C++.
2713 AC_LANG_CPLUSPLUS
2715 AC_MSG_CHECKING(for uname.domainname)
2716 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2717     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2718         [ struct utsname *res; char *domain; 
2719             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2720         [ac_cv_have_uname_domainname_field=true],
2721         [ac_cv_have_uname_domainname_field=false])])
2723 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2724     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2725     AC_MSG_RESULT(yes)
2726 else
2727     AC_MSG_RESULT(no)
2730 AC_MSG_CHECKING(for uname.__domainname)
2731 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2732     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2733         [ struct utsname *res; char *domain; 
2734             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2735         [ac_cv_have_uname_us_domainname_field=true],
2736         [ac_cv_have_uname_us_domainname_field=false])])
2738 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2739     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2740     AC_MSG_RESULT(yes)
2741 else
2742     AC_MSG_RESULT(no)
2745 AC_LANG_C
2747 dnl Check for usable wchar_t (2 bytes, unsigned)
2748 dnl (we really don't need the unsignedness check anymore)
2749 dnl ========================================================
2751 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2752     ac_cv_have_usable_wchar_v2,
2753     [AC_TRY_COMPILE([#include <stddef.h>
2754                      $configure_static_assert_macros],
2755                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2756                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2757                     ac_cv_have_usable_wchar_v2="yes",
2758                     ac_cv_have_usable_wchar_v2="no")])
2759 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2760     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2761     HAVE_CPP_2BYTE_WCHAR_T=1
2762 else
2763 dnl This is really gcc-only
2764 dnl Do this test using CXX only since some versions of gcc
2765 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2766 dnl only have short-wchar support for c++.
2767 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2769     AC_LANG_SAVE
2770     AC_LANG_CPLUSPLUS
2771     _SAVE_CXXFLAGS=$CXXFLAGS
2772     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2774     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2775         ac_cv_have_usable_wchar_option_v2,
2776         [AC_TRY_LINK([#include <stddef.h>
2777                          $configure_static_assert_macros],
2778                         [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2779                          CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2780                         ac_cv_have_usable_wchar_option_v2="yes",
2781                         ac_cv_have_usable_wchar_option_v2="no")])
2783     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2784         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2785         HAVE_CPP_2BYTE_WCHAR_T=1
2786     else    
2787         CXXFLAGS=$_SAVE_CXXFLAGS
2788     fi
2789     AC_LANG_RESTORE
2792 dnl Check for .hidden assembler directive and visibility attribute.
2793 dnl Borrowed from glibc configure.in
2794 dnl ===============================================================
2795 if test "$GNU_CC"; then
2796   AC_CACHE_CHECK(for visibility(hidden) attribute,
2797                  ac_cv_visibility_hidden,
2798                  [cat > conftest.c <<EOF
2799                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2801                   ac_cv_visibility_hidden=no
2802                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2803                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2804                       ac_cv_visibility_hidden=yes
2805                     fi
2806                   fi
2807                   rm -f conftest.[cs]
2808                  ])
2809   if test "$ac_cv_visibility_hidden" = "yes"; then
2810     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2812     AC_CACHE_CHECK(for visibility(default) attribute,
2813                    ac_cv_visibility_default,
2814                    [cat > conftest.c <<EOF
2815                     int foo __attribute__ ((visibility ("default"))) = 1;
2817                     ac_cv_visibility_default=no
2818                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2819                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2820                         ac_cv_visibility_default=yes
2821                       fi
2822                     fi
2823                     rm -f conftest.[cs]
2824                    ])
2825     if test "$ac_cv_visibility_default" = "yes"; then
2826       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2828       AC_CACHE_CHECK(for visibility pragma support,
2829                      ac_cv_visibility_pragma,
2830                      [cat > conftest.c <<EOF
2831 #pragma GCC visibility push(hidden)
2832                       int foo_hidden = 1;
2833 #pragma GCC visibility push(default)
2834                       int foo_default = 1;
2836                       ac_cv_visibility_pragma=no
2837                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2838                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2839                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2840                             ac_cv_visibility_pragma=yes
2841                           fi
2842                         fi
2843                       fi
2844                       rm -f conftest.[cs]
2845                     ])
2846       if test "$ac_cv_visibility_pragma" = "yes"; then
2847         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2848                        ac_cv_have_visibility_class_bug,
2849                        [cat > conftest.c <<EOF
2850 #pragma GCC visibility push(hidden)
2851 struct __attribute__ ((visibility ("default"))) TestStruct {
2852   static void Init();
2854 __attribute__ ((visibility ("default"))) void TestFunc() {
2855   TestStruct::Init();
2858                        ac_cv_have_visibility_class_bug=no
2859                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2860                          ac_cv_have_visibility_class_bug=yes
2861                        else
2862                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2863                            ac_cv_have_visibility_class_bug=yes
2864                          fi
2865                        fi
2866                        rm -rf conftest.{c,S}
2867                        ])
2869         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2870                        ac_cv_have_visibility_builtin_bug,
2871                        [cat > conftest.c <<EOF
2872 #pragma GCC visibility push(hidden)
2873 #pragma GCC visibility push(default)
2874 #include <string.h>
2875 #pragma GCC visibility pop
2877 __attribute__ ((visibility ("default"))) void Func() {
2878   char c[[100]];
2879   memset(c, 0, sizeof(c));
2882                        ac_cv_have_visibility_builtin_bug=no
2883                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2884                          ac_cv_have_visibility_builtin_bug=yes
2885                        else
2886                          if test `grep -c "@PLT" conftest.S` = 0; then
2887                            ac_cv_visibility_builtin_bug=yes
2888                          fi
2889                        fi
2890                        rm -f conftest.{c,S}
2891                        ])
2892         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2893                 "$ac_cv_have_visibility_class_bug" = "no"; then
2894           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2895           WRAP_SYSTEM_INCLUDES=1
2896         else
2897           VISIBILITY_FLAGS='-fvisibility=hidden'
2898         fi # have visibility pragma bug
2899       fi   # have visibility pragma
2900     fi     # have visibility(default) attribute
2901   fi       # have visibility(hidden) attribute
2902 fi         # GNU_CC
2904 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2905 AC_SUBST(VISIBILITY_FLAGS)
2907 dnl Checks for header files.
2908 dnl ========================================================
2909 AC_HEADER_DIRENT
2910 case "$target_os" in
2911 freebsd*)
2912 # for stuff like -lXshm
2913     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2914     ;;
2915 esac
2916 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2917 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2918 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2919 AC_CHECK_HEADERS(malloc.h)
2920 AC_CHECK_HEADERS(X11/XKBlib.h)
2922 dnl These are all the places some variant of statfs can be hiding.
2923 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2925 dnl Try for MMX support
2926 dnl NB - later gcc versions require -mmmx for this header to be successfully
2927 dnl included (or another option which implies it, such as -march=pentium-mmx)
2928 AC_CHECK_HEADERS(mmintrin.h)
2930 dnl Check whether the compiler supports the new-style C++ standard
2931 dnl library headers (i.e. <new>) or needs the old "new.h"
2932 AC_LANG_CPLUSPLUS
2933 NEW_H=new.h
2934 AC_CHECK_HEADER(new, [NEW_H=new])
2935 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2936 AC_LANG_C
2938 AC_ARG_ENABLE(dtrace,
2939               [  --enable-dtrace         build with dtrace support if available (default=no)],
2940               [enable_dtrace="yes"],)
2941 if test "x$enable_dtrace" = "xyes"; then
2942   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2943   if test -n "$HAVE_DTRACE"; then
2944       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2945   else
2946       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2947   fi
2949 AC_SUBST(HAVE_DTRACE)
2951 case $target in
2952 *-aix4.3*|*-aix5*)
2953         ;;
2955         AC_CHECK_HEADERS(sys/cdefs.h)
2956         ;;
2957 esac
2959 dnl Checks for libraries.
2960 dnl ========================================================
2961 case $target in
2962 *-hpux11.*)
2963         ;;
2965         AC_CHECK_LIB(c_r, gethostbyname_r)
2966         ;;
2967 esac
2969 dnl We don't want to link with libdl even if it's present on OS X, since
2970 dnl it's not used and not part of the default installation.
2971 dnl The same goes for BeOS.
2972 dnl We don't want to link against libm or libpthread on Darwin since
2973 dnl they both are just symlinks to libSystem and explicitly linking
2974 dnl against libSystem causes issues when debugging (see bug 299601).
2975 case $target in
2976 *-darwin*)
2977     ;;
2978 *-beos*)
2979     ;;
2981     AC_CHECK_LIB(m, atan)
2982     AC_CHECK_LIB(dl, dlopen,
2983     AC_CHECK_HEADER(dlfcn.h, 
2984         LIBS="-ldl $LIBS"
2985         AC_DEFINE(HAVE_LIBDL)))
2986     ;;
2987 esac
2989 _SAVE_CFLAGS="$CFLAGS"
2990 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2991 AC_CHECK_FUNCS(dladdr)
2992 CFLAGS="$_SAVE_CFLAGS"
2994 if test ! "$GNU_CXX"; then
2996     case $target in
2997     *-aix*)
2998         AC_CHECK_LIB(C_r, demangle)
2999         ;;
3000      *)
3001         AC_CHECK_LIB(C, demangle)
3002         ;;
3003      esac
3005 AC_CHECK_LIB(socket, socket)
3007 XLDFLAGS="$X_LIBS"
3008 XLIBS="$X_EXTRA_LIBS"
3010 dnl ========================================================
3011 dnl Checks for X libraries.
3012 dnl Ordering is important.
3013 dnl Xt is dependent upon SM as of X11R6
3014 dnl ========================================================
3015 if test "$no_x" = "yes"; then
3016     AC_DEFINE(NO_X11)
3017 else
3018     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3019         XLIBS="-lX11 $XLIBS"
3020         _SAVE_LDFLAGS="$LDFLAGS"
3021         LDFLAGS="$XLDFLAGS $LDFLAGS"
3022         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3023                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3024         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3025                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3026    
3027      
3028         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3029         unset ac_cv_lib_Xt_XtFree
3030             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3031             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3032         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3033                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3034         ])
3036     # AIX needs the motif library linked before libXt to prevent
3037     # crashes in plugins linked against Motif - Bug #98892
3038     case "${target_os}" in
3039     aix*)
3040         XT_LIBS="-lXm $XT_LIBS"
3041         ;;
3042     esac
3044     dnl ========================================================
3045     dnl = Check for XShm
3046     dnl ========================================================
3047     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3048         $XLIBS $XEXT_LIBS)
3049     AC_CHECK_HEADER(X11/extensions/XShm.h)
3050     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3051         test -n "$_HAVE_XSHM_XEXT"; then
3052         AC_DEFINE(HAVE_XSHM)
3053     fi
3055     dnl ========================================================
3056     dnl = Check for XIE
3057     dnl ========================================================
3058     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3059         $XLIBS $XEXT_LIBS)
3060     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3062     if test "$MOZ_XIE_LIBS"; then
3063         dnl ====================================================
3064         dnl = If XIE is present and is desired, turn it on
3065         dnl ====================================================
3066         case $target in
3067             *-hpux*)
3068                 ;;
3069             *)
3070                 HAVE_XIE=1
3071                 ;;
3072         esac
3073     fi
3075         LDFLAGS="$_SAVE_LDFLAGS"
3077     dnl ========================================================
3078     dnl = Check for freetype2 and its functionality
3079     dnl ========================================================
3080     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3082     if test "$_HAVE_FREETYPE2"; then
3083         _SAVE_LIBS="$LIBS"
3084         _SAVE_CFLAGS="$CFLAGS"
3085         LIBS="$LIBS $FT2_LIBS"
3086         CFLAGS="$CFLAGS $FT2_CFLAGS"
3088         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3089             ac_cv_member_FT_Bitmap_Size_y_ppem,
3090             [AC_TRY_COMPILE([#include <ft2build.h>
3091                              #include FT_FREETYPE_H],
3092                             [FT_Bitmap_Size s;
3093                              if (sizeof s.y_ppem) return 0;
3094                              return 1],
3095                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3096                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3097         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3098             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3099         else
3100             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3101         fi
3102         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3103                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3104                            [FT_Bitmap_Size structure includes y_ppem field])
3106         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3108         LIBS="$_SAVE_LIBS"
3109         CFLAGS="$_SAVE_CFLAGS"
3110     fi
3112 fi # $no_x
3114 AC_SUBST(XCFLAGS)
3115 AC_SUBST(XLDFLAGS)
3116 AC_SUBST(XLIBS)
3117 AC_SUBST(XT_LIBS)
3119 dnl ========================================================
3120 dnl = pthread support
3121 dnl = Start by checking whether the system support pthreads
3122 dnl ========================================================
3123 case "$target_os" in
3124 darwin*)
3125     USE_PTHREADS=1
3126     ;;
3128     MOZ_CHECK_PTHREADS(pthreads,
3129         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3130         MOZ_CHECK_PTHREADS(pthread,
3131             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3132             MOZ_CHECK_PTHREADS(c_r,
3133                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3134                 MOZ_CHECK_PTHREADS(c,
3135                     USE_PTHREADS=1
3136                 )
3137             )
3138         )
3139     )
3140     ;;
3141 esac
3143 dnl ========================================================
3144 dnl Check the command line for --with-pthreads 
3145 dnl ========================================================
3146 MOZ_ARG_WITH_BOOL(pthreads,
3147 [  --with-pthreads         Force use of system pthread library with NSPR ],
3148 [ if test "$USE_PTHREADS"x = x; then
3149     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3150 fi],
3151     USE_PTHREADS=
3152     _PTHREAD_LDFLAGS=
3155 dnl ========================================================
3156 dnl Do the platform specific pthread hackery
3157 dnl ========================================================
3158 if test "$USE_PTHREADS"x != x
3159 then
3160         dnl
3161         dnl See if -pthread is supported.
3162         dnl
3163         rm -f conftest*
3164         ac_cv_have_dash_pthread=no
3165         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3166         echo 'int main() { return 0; }' | cat > conftest.c
3167         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3168         if test $? -eq 0; then
3169                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3170                         ac_cv_have_dash_pthread=yes
3171                 case "$target_os" in
3172                 freebsd*)
3173 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3174                 ;;
3175                 *)
3176                             CFLAGS="$CFLAGS -pthread"
3177                             CXXFLAGS="$CXXFLAGS -pthread"
3178                 ;;
3179                 esac
3180                 fi
3181         fi
3182         rm -f conftest*
3183     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3185         dnl
3186         dnl See if -pthreads is supported.
3187         dnl
3188     ac_cv_have_dash_pthreads=no
3189     if test "$ac_cv_have_dash_pthread" = "no"; then
3190             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3191         echo 'int main() { return 0; }' | cat > conftest.c
3192             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3193         if test $? -eq 0; then
3194                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3195                             ac_cv_have_dash_pthreads=yes
3196                             CFLAGS="$CFLAGS -pthreads"
3197                             CXXFLAGS="$CXXFLAGS -pthreads"
3198                     fi
3199             fi
3200             rm -f conftest*
3201         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3202     fi
3204         case "$target" in
3205             *-*-freebsd*)
3206                         AC_DEFINE(_REENTRANT)
3207                         AC_DEFINE(_THREAD_SAFE)
3208                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3209                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3210                                 _PTHREAD_LDFLAGS="-pthread"
3211                         else
3212                                 _PTHREAD_LDFLAGS="-lc_r"
3213                         fi
3214                         ;;
3216             *-*-openbsd*|*-*-bsdi*)
3217                         AC_DEFINE(_REENTRANT)
3218                         AC_DEFINE(_THREAD_SAFE)
3219                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3220                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3221                 _PTHREAD_LDFLAGS="-pthread"
3222                         fi
3223                         ;;
3225             *-*-linux*|*-*-kfreebsd*-gnu)
3226                         AC_DEFINE(_REENTRANT) 
3227                         ;;
3229             *-*-nto*) 
3230                         AC_DEFINE(_REENTRANT) 
3231                         ;;
3233             *-aix4.3*|*-aix5*)
3234                         AC_DEFINE(_REENTRANT) 
3235                         ;;
3237             *-hpux11.*)
3238                         AC_DEFINE(_REENTRANT) 
3239                         ;;
3241             alpha*-*-osf*)
3242                         AC_DEFINE(_REENTRANT)
3243                         ;;
3245             *-*-solaris*) 
3246                         AC_DEFINE(_REENTRANT) 
3247                         if test ! "$GNU_CC"; then
3248                                 CFLAGS="$CFLAGS -mt" 
3249                                 CXXFLAGS="$CXXFLAGS -mt" 
3250                         fi
3251                         ;;
3252         esac
3253     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3256 dnl ========================================================
3257 dnl See if mmap sees writes
3258 dnl For cross compiling, just define it as no, which is a safe default
3259 dnl ========================================================
3260 AC_MSG_CHECKING(whether mmap() sees write()s)
3262 changequote(,)
3263 mmap_test_prog='
3264     #include <stdlib.h>
3265     #include <unistd.h>
3266     #include <sys/mman.h>
3267     #include <sys/types.h>
3268     #include <sys/stat.h>
3269     #include <fcntl.h>
3271     char fname[] = "conftest.file";
3272     char zbuff[1024]; /* Fractional page is probably worst case */
3274     int main() {
3275         char *map;
3276         int fd;
3277         int i;
3278         unlink(fname);
3279         fd = open(fname, O_RDWR | O_CREAT, 0660);
3280         if(fd<0) return 1;
3281         unlink(fname);
3282         write(fd, zbuff, sizeof(zbuff));
3283         lseek(fd, 0, SEEK_SET);
3284         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3285         if(map==(char*)-1) return 2;
3286         for(i=0; fname[i]; i++) {
3287             int rc = write(fd, &fname[i], 1);
3288             if(map[i]!=fname[i]) return 4;
3289         }
3290         return 0;
3291     }
3293 changequote([,])
3295 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3297 AC_MSG_RESULT("$result")
3299 if test "$result" = "no"; then
3300     AC_DEFINE(MMAP_MISSES_WRITES)
3304 dnl Checks for library functions.
3305 dnl ========================================================
3306 AC_PROG_GCC_TRADITIONAL
3307 AC_FUNC_MEMCMP
3308 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3309 AC_CHECK_FUNCS(flockfile getpagesize)
3311 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3312 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3313   AC_CHECK_FUNCS(localtime_r strtok_r)
3316 dnl check for wcrtomb/mbrtowc
3317 dnl =======================================================================
3318 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3319 AC_LANG_SAVE
3320 AC_LANG_CPLUSPLUS
3321 AC_CACHE_CHECK(for wcrtomb,
3322     ac_cv_have_wcrtomb,
3323     [AC_TRY_LINK([#include <wchar.h>],
3324                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3325                  ac_cv_have_wcrtomb="yes",
3326                  ac_cv_have_wcrtomb="no")])
3327 if test "$ac_cv_have_wcrtomb" = "yes"; then
3328     AC_DEFINE(HAVE_WCRTOMB)
3330 AC_CACHE_CHECK(for mbrtowc,
3331     ac_cv_have_mbrtowc,
3332     [AC_TRY_LINK([#include <wchar.h>],
3333                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3334                  ac_cv_have_mbrtowc="yes",
3335                  ac_cv_have_mbrtowc="no")])
3336 if test "$ac_cv_have_mbrtowc" = "yes"; then
3337     AC_DEFINE(HAVE_MBRTOWC)
3339 AC_LANG_RESTORE
3342 AC_CACHE_CHECK(
3343     [for res_ninit()],
3344     ac_cv_func_res_ninit,
3345     [AC_TRY_LINK([
3346         #ifdef linux
3347         #define _BSD_SOURCE 1
3348         #endif
3349         #include <resolv.h>
3350         ],
3351         [int foo = res_ninit(&_res);],
3352         [ac_cv_func_res_ninit=yes],
3353         [ac_cv_func_res_ninit=no])
3354     ])
3356 if test "$ac_cv_func_res_ninit" = "yes"; then
3357     AC_DEFINE(HAVE_RES_NINIT)
3358 dnl must add the link line we do something as foolish as this... dougt
3359 dnl else
3360 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3361 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3364 AC_LANG_CPLUSPLUS
3365 AC_CACHE_CHECK(
3366     [for gnu_get_libc_version()],
3367     ac_cv_func_gnu_get_libc_version,
3368     [AC_TRY_LINK([
3369         #ifdef HAVE_GNU_LIBC_VERSION_H
3370         #include <gnu/libc-version.h>
3371         #endif
3372         ],
3373         [const char *glibc_version = gnu_get_libc_version();],
3374         [ac_cv_func_gnu_get_libc_version=yes],
3375         [ac_cv_func_gnu_get_libc_version=no] 
3376         )]
3377     )
3379 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3380     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3383 case $target_os in
3384     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3385         ;;
3386     *)
3387     
3388 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3389     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3390         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3391 _SAVE_LIBS=$LIBS
3392 LIBS="$LIBS $_ICONV_LIBS"
3393 AC_CACHE_CHECK(
3394     [for iconv()],
3395     ac_cv_func_iconv,
3396     [AC_TRY_LINK([
3397         #include <stdlib.h>
3398         #include <iconv.h>
3399         ],
3400         [
3401             iconv_t h = iconv_open("", "");
3402             iconv(h, NULL, NULL, NULL, NULL);
3403             iconv_close(h);
3404         ],
3405         [ac_cv_func_iconv=yes],
3406         [ac_cv_func_iconv=no] 
3407         )]
3408     )
3409 if test "$ac_cv_func_iconv" = "yes"; then
3410     AC_DEFINE(HAVE_ICONV)
3411     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3412     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3413     LIBICONV="$_ICONV_LIBS"
3414     AC_CACHE_CHECK(
3415         [for iconv() with const input],
3416         ac_cv_func_const_iconv,
3417         [AC_TRY_COMPILE([
3418             #include <stdlib.h>
3419             #include <iconv.h>
3420             ],
3421             [
3422                 const char *input = "testing";
3423                 iconv_t h = iconv_open("", "");
3424                 iconv(h, &input, NULL, NULL, NULL);
3425                 iconv_close(h);
3426             ],
3427             [ac_cv_func_const_iconv=yes],
3428             [ac_cv_func_const_iconv=no] 
3429             )]
3430         )
3431     if test "$ac_cv_func_const_iconv" = "yes"; then
3432         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3433     fi
3435 LIBS=$_SAVE_LIBS
3437     ;;
3438 esac
3440 AM_LANGINFO_CODESET
3442 AC_LANG_C
3444 dnl **********************
3445 dnl *** va_copy checks ***
3446 dnl **********************
3447 dnl we currently check for all three va_copy possibilities, so we get
3448 dnl all results in config.log for bug reports.
3449 AC_MSG_CHECKING(for an implementation of va_copy())
3450 AC_CACHE_VAL(ac_cv_va_copy,[
3451     AC_TRY_RUN([
3452         #include <stdarg.h>
3453         void f (int i, ...) {
3454             va_list args1, args2;
3455             va_start (args1, i);
3456             va_copy (args2, args1);
3457             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3458                 exit (1);
3459             va_end (args1); va_end (args2);
3460         }
3461         int main() { f (0, 42); return 0; }],
3462         ac_cv_va_copy=yes,
3463         ac_cv_va_copy=no,
3464         ac_cv_va_copy=no
3465     )
3467 AC_MSG_RESULT($ac_cv_va_copy)
3468 AC_MSG_CHECKING(for an implementation of __va_copy())
3469 AC_CACHE_VAL(ac_cv___va_copy,[
3470     AC_TRY_RUN([
3471         #include <stdarg.h>
3472         void f (int i, ...) {
3473             va_list args1, args2;
3474             va_start (args1, i);
3475             __va_copy (args2, args1);
3476             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3477                 exit (1);
3478             va_end (args1); va_end (args2);
3479         }
3480         int main() { f (0, 42); return 0; }],
3481         ac_cv___va_copy=yes,
3482         ac_cv___va_copy=no,
3483         ac_cv___va_copy=no
3484     )
3486 AC_MSG_RESULT($ac_cv___va_copy)
3487 AC_MSG_CHECKING(whether va_lists can be copied by value)
3488 AC_CACHE_VAL(ac_cv_va_val_copy,[
3489     AC_TRY_RUN([
3490         #include <stdarg.h>
3491         void f (int i, ...) {
3492             va_list args1, args2;
3493             va_start (args1, i);
3494             args2 = args1;
3495             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3496                 exit (1);
3497             va_end (args1); va_end (args2);
3498         }
3499         int main() { f (0, 42); return 0; }],
3500         ac_cv_va_val_copy=yes,
3501         ac_cv_va_val_copy=no,
3502         ac_cv_va_val_copy=yes
3503     )
3505 if test "x$ac_cv_va_copy" = "xyes"; then
3506     AC_DEFINE(VA_COPY, va_copy)
3507     AC_DEFINE(HAVE_VA_COPY)
3508 elif test "x$ac_cv___va_copy" = "xyes"; then
3509     AC_DEFINE(VA_COPY, __va_copy)
3510     AC_DEFINE(HAVE_VA_COPY)
3513 if test "x$ac_cv_va_val_copy" = "xno"; then
3514    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3516 AC_MSG_RESULT($ac_cv_va_val_copy)
3518 dnl Check for dll-challenged libc's.
3519 dnl This check is apparently only needed for Linux.
3520 case "$target" in
3521         *-linux*)
3522             dnl ===================================================================
3523             _curdir=`pwd`
3524             export _curdir
3525             rm -rf conftest* _conftest
3526             mkdir _conftest
3527             cat >> conftest.C <<\EOF
3528 #include <stdio.h>
3529 #include <link.h>
3530 #include <dlfcn.h>
3531 #ifdef _dl_loaded
3532 void __dump_link_map(void) {
3533   struct link_map *map = _dl_loaded;
3534   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3536 int main() {
3537   dlopen("./conftest1.so",RTLD_LAZY);
3538   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3539   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3540   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3541   __dump_link_map();
3543 #else
3544 /* _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).*/
3545 int main() { printf("./conftest1.so\n"); }
3546 #endif
3549             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3551             cat >> conftest1.C <<\EOF
3552 #include <stdio.h>
3553 void foo(void) {printf("foo in dll called\n");}
3555             ${CXX-g++} -fPIC -c -g conftest1.C
3556             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3557             ${CXX-g++} -g conftest.C -o conftest -ldl
3558             cp -f conftest1.so conftest _conftest
3559             cd _conftest
3560             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3561             then
3562                 echo
3563                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3564                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3565                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3566                 echo "*** will be excessive memory usage at runtime."
3567                 echo
3568             fi
3569             cd ${_curdir}
3570             rm -rf conftest* _conftest
3571             dnl ===================================================================
3572             ;;
3573 esac
3575 dnl ===================================================================
3576 dnl ========================================================
3577 dnl By default, turn rtti and exceptions off on g++/egcs
3578 dnl ========================================================
3579 if test "$GNU_CXX"; then
3581   AC_MSG_CHECKING(for C++ exceptions flag)
3583   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3584   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3585   [echo "int main() { return 0; }" | cat > conftest.C
3587   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3589   if egrep "warning.*renamed" conftest.out >/dev/null; then
3590     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3591   else
3592     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3593   fi
3595   rm -f conftest*])
3597   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3598   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3599   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3602 dnl ========================================================
3603 dnl Put your C++ language/feature checks below
3604 dnl ========================================================
3605 AC_LANG_CPLUSPLUS
3607 HAVE_GCC3_ABI=
3608 if test "$GNU_CC"; then
3609   AC_CACHE_CHECK(for gcc 3.0 ABI,
3610       ac_cv_gcc_three_abi,
3611       [AC_TRY_COMPILE([],
3612                       [
3613 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3614   return 0;
3615 #else
3616 #error Not gcc3.
3617 #endif
3618                       ],
3619                       ac_cv_gcc_three_abi="yes",
3620                       ac_cv_gcc_three_abi="no")])
3621   if test "$ac_cv_gcc_three_abi" = "yes"; then
3622       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3623       HAVE_GCC3_ABI=1
3624   else
3625       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3626   fi
3628 AC_SUBST(HAVE_GCC3_ABI)
3631 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3632                ac_cv_cpp_explicit,
3633                [AC_TRY_COMPILE(class X {
3634                                public: explicit X(int i) : i_(i) {}
3635                                private: int i_;
3636                                };,
3637                                X x(3);,
3638                                ac_cv_cpp_explicit=yes,
3639                                ac_cv_cpp_explicit=no)])
3640 if test "$ac_cv_cpp_explicit" = yes ; then
3641    AC_DEFINE(HAVE_CPP_EXPLICIT)
3644 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3645                ac_cv_cpp_typename,
3646                [AC_TRY_COMPILE(class param {
3647                                public:
3648                                    typedef unsigned long num_type;
3649                                };
3651                                template <class T> class tplt {
3652                                public:
3653                                    typedef typename T::num_type t_num_type;
3654                                    t_num_type foo(typename T::num_type num) {
3655                                        return num;
3656                                    }
3657                                };,
3658                                tplt<param> A;
3659                                A.foo(0);,
3660                                ac_cv_cpp_typename=yes,
3661                                ac_cv_cpp_typename=no)])
3662 if test "$ac_cv_cpp_typename" = yes ; then
3663    AC_DEFINE(HAVE_CPP_TYPENAME)
3666 dnl Check for support of modern template specialization syntax
3667 dnl Test code and requirement from scc@netscape.com.
3668 dnl Autoconf cut-and-paste job by waterson@netscape.com
3669 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3670                ac_cv_cpp_modern_specialize_template_syntax,
3671                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3672                                class Y {};
3673                                template <> struct X<Y> { double a; };,
3674                                X<int> int_x;
3675                                X<Y> y_x;,
3676                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3677                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3678 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3679   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3683 dnl Some compilers support only full specialization, and some don't.
3684 AC_CACHE_CHECK(whether partial template specialization works,
3685                ac_cv_cpp_partial_specialization,
3686                [AC_TRY_COMPILE(template <class T> class Foo {};
3687                                template <class T> class Foo<T*> {};,
3688                                return 0;,
3689                                ac_cv_cpp_partial_specialization=yes,
3690                                ac_cv_cpp_partial_specialization=no)])
3691 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3692   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3695 dnl Some compilers have limited support for operators with templates;
3696 dnl specifically, it is necessary to define derived operators when a base
3697 dnl class's operator declaration should suffice.
3698 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3699                ac_cv_need_derived_template_operators,
3700                [AC_TRY_COMPILE([template <class T> class Base { };
3701                                 template <class T>
3702                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3703                                 template <class T> class Derived : public Base<T> { };],
3704                                [Derived<char> a, b;
3705                                 Base<char> c = a + b;
3706                                 return 0;],
3707                                ac_cv_need_derived_template_operators=no,
3708                                ac_cv_need_derived_template_operators=yes)])
3709 if test "$ac_cv_need_derived_template_operators" = yes ; then
3710   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3714 dnl Some compilers have trouble detecting that a template class
3715 dnl that derives from another template is actually an instance
3716 dnl of the base class. This test checks for that.
3717 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3718                ac_cv_need_cpp_template_cast_to_base,
3719                [AC_TRY_COMPILE([template <class T> class Base { };
3720                                 template <class T> class Derived : public Base<T> { };
3721                                 template <class T> int foo(const Base<T>&) { return 0; }],
3722                                [Derived<char> bar; return foo(bar);],
3723                                ac_cv_need_cpp_template_cast_to_base=no,
3724                                ac_cv_need_cpp_template_cast_to_base=yes)])
3725 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3726   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3729 dnl Some compilers have trouble resolving the ambiguity between two
3730 dnl functions whose arguments differ only by cv-qualifications.
3731 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3732                ac_cv_can_resolve_const_ambiguity,
3733                [AC_TRY_COMPILE([
3734                                 template <class T> class ptrClass {
3735                                   public: T* ptr;
3736                                 };
3738                                 template <class T> T* a(ptrClass<T> *arg) {
3739                                   return arg->ptr;
3740                                 }
3742                                 template <class T>
3743                                 const T* a(const ptrClass<T> *arg) {
3744                                   return arg->ptr;
3745                                 }
3746                                ],
3747                                [ ptrClass<int> i;
3748                                  a(&i); ],
3749                                ac_cv_can_resolve_const_ambiguity=yes,
3750                                ac_cv_can_resolve_const_ambiguity=no)])
3751 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3752   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3756 dnl We don't do exceptions on unix.  The only reason this used to be here
3757 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3758 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3759 dnl So im commenting this out until someone writes some artificial 
3760 dnl intelligence to detect not only if the compiler has exceptions, but if 
3761 dnl they are enabled as well.
3762 dnl 
3763 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3764 dnl                ac_cv_cpp_exceptions,
3765 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3766 dnl                                static void F() { throw X(); },
3767 dnl                                try { F(); } catch(X & e) { },
3768 dnl                                ac_cv_cpp_exceptions=yes,
3769 dnl                                ac_cv_cpp_exceptions=no)])
3770 dnl if test $ac_cv_cpp_exceptions = yes ; then
3771 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3772 dnl fi
3774 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3775 dnl supports it well enough to allow us to use it to change access, but not
3776 dnl to resolve ambiguity. The next two tests determine how well the |using|
3777 dnl keyword is supported.
3779 dnl Check to see if we can change access with |using|.  Test both a
3780 dnl legal and an illegal example.
3781 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3782                ac_cv_cpp_access_changing_using2,
3783                [AC_TRY_COMPILE(
3784                    class A { protected: int foo() { return 0; } };
3785                    class B : public A { public: using A::foo; };,
3786                    B b; return b.foo();,
3787                    [AC_TRY_COMPILE(
3788                        class A { public: int foo() { return 1; } };
3789                        class B : public A { private: using A::foo; };,
3790                        B b; return b.foo();,
3791                        ac_cv_cpp_access_changing_using2=no,
3792                        ac_cv_cpp_access_changing_using2=yes)],
3793                    ac_cv_cpp_access_changing_using2=no)])
3794 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3795    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3798 dnl Check to see if we can resolve ambiguity with |using|.
3799 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3800                ac_cv_cpp_ambiguity_resolving_using,
3801                [AC_TRY_COMPILE(class X { 
3802                                  public: int go(const X&) {return 3;}
3803                                          int jo(const X&) {return 3;}
3804                                };
3805                                class Y : public X {
3806                                  public:  int go(int) {return 2;}
3807                                           int jo(int) {return 2;}
3808                                           using X::jo;
3809                                  private: using X::go;
3810                                };,
3811                                X x; Y y; y.jo(x);,
3812                                ac_cv_cpp_ambiguity_resolving_using=yes,
3813                                ac_cv_cpp_ambiguity_resolving_using=no)])
3814 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3815    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3818 dnl Check to see if the |std| namespace is supported. If so, we'll want
3819 dnl to qualify any standard library calls with "std::" to ensure that
3820 dnl those functions can be resolved.
3821 AC_CACHE_CHECK(for \"std::\" namespace,
3822                ac_cv_cpp_namespace_std,
3823                [AC_TRY_COMPILE([#include <algorithm>],
3824                                [return std::min(0, 1);],
3825                                ac_cv_cpp_namespace_std=yes,
3826                                ac_cv_cpp_namespace_std=no)])
3827 if test "$ac_cv_cpp_namespace_std" = yes ; then
3828    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3831 dnl Older compilers are overly ambitious with respect to using the standard
3832 dnl template library's |operator!=()| when |operator==()| is defined. In
3833 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3834 dnl ambiguity at compile-time. This test checks for that case.
3835 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3836                ac_cv_cpp_unambiguous_std_notequal,
3837                [AC_TRY_COMPILE([#include <algorithm>
3838                                 struct T1 {};
3839                                 int operator==(const T1&, const T1&) { return 0; }
3840                                 int operator!=(const T1&, const T1&) { return 0; }],
3841                                [T1 a,b; return a != b;],
3842                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3843                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3844 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3845   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3849 AC_CACHE_CHECK(for C++ reinterpret_cast,
3850                ac_cv_cpp_reinterpret_cast,
3851                [AC_TRY_COMPILE(struct X { int i; };
3852                                struct Y { int i; };,
3853                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3854                                ac_cv_cpp_reinterpret_cast=yes,
3855                                ac_cv_cpp_reinterpret_cast=no)])
3856 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3857    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3860 dnl See if a dynamic_cast to void* gives the most derived object.
3861 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3862                ac_cv_cpp_dynamic_cast_void_ptr,
3863                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3864                             class Y { int j; public: virtual ~Y() { } };
3865                             class Z : public X, public Y { int k; };
3867                             int main() {
3868                                  Z mdo;
3869                                  X *subx = (X*)&mdo;
3870                                  Y *suby = (Y*)&mdo;
3871                                  return !((((void*)&mdo != (void*)subx) &&
3872                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3873                                           (((void*)&mdo != (void*)suby) &&
3874                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3875                             }],
3876                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3877                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3878                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3879 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3880    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3884 dnl note that this one is reversed - if the test fails, then
3885 dnl we require implementations of unused virtual methods. Which
3886 dnl really blows because it means we'll have useless vtable
3887 dnl bloat.
3888 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3889                ac_cv_cpp_unused_required,
3890                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3891                                X x;,
3892                                ac_cv_cpp_unused_required=no,
3893                                ac_cv_cpp_unused_required=yes)])
3894 if test "$ac_cv_cpp_unused_required" = yes ; then
3895    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3899 dnl Some compilers have trouble comparing a constant reference to a templatized
3900 dnl class to zero, and require an explicit operator==() to be defined that takes
3901 dnl an int. This test separates the strong from the weak.
3903 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3904                ac_cv_trouble_comparing_to_zero,
3905                [AC_TRY_COMPILE([#include <algorithm>
3906                                 template <class T> class Foo {};
3907                                 class T2;
3908                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3909                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3910                                [Foo<int> f; return (0 != f);],
3911                                ac_cv_trouble_comparing_to_zero=no,
3912                                ac_cv_trouble_comparing_to_zero=yes)])
3913 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3914   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3919 dnl End of C++ language/feature checks
3920 AC_LANG_C
3922 dnl ========================================================
3923 dnl =  Internationalization checks
3924 dnl ========================================================
3926 dnl Internationalization and Locale support is different
3927 dnl on various UNIX platforms.  Checks for specific i18n
3928 dnl features go here.
3930 dnl check for LC_MESSAGES
3931 AC_CACHE_CHECK(for LC_MESSAGES,
3932                 ac_cv_i18n_lc_messages,
3933                 [AC_TRY_COMPILE([#include <locale.h>],
3934                                 [int category = LC_MESSAGES;],
3935                                 ac_cv_i18n_lc_messages=yes,
3936                                 ac_cv_i18n_lc_messages=no)])
3937 if test "$ac_cv_i18n_lc_messages" = yes; then
3938    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3939 fi      
3941 fi # SKIP_COMPILER_CHECKS
3943 TARGET_XPCOM_ABI=
3944 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3945     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3948 dnl Mozilla specific options
3949 dnl ========================================================
3950 dnl The macros used for command line options
3951 dnl are defined in build/autoconf/altoptions.m4.
3954 dnl ========================================================
3955 dnl =
3956 dnl = Check for external package dependencies
3957 dnl =
3958 dnl ========================================================
3959 MOZ_ARG_HEADER(External Packages)
3961 MOZ_ENABLE_LIBXUL=
3963 MOZ_ARG_WITH_STRING(libxul-sdk,
3964 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3965   LIBXUL_SDK_DIR=$withval)
3967 if test "$LIBXUL_SDK_DIR" = "yes"; then
3968     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3969 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3970     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3972     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
3973         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
3974     fi
3976     MOZ_ENABLE_LIBXUL=1
3978 AC_SUBST(LIBXUL_SDK)
3980 dnl ========================================================
3981 dnl = If NSPR was not detected in the system, 
3982 dnl = use the one in the source tree (mozilla/nsprpub)
3983 dnl ========================================================
3984 MOZ_ARG_WITH_BOOL(system-nspr,
3985 [  --with-system-nspr      Use system installed NSPR],
3986     _USE_SYSTEM_NSPR=1 )
3988 if test -n "$_USE_SYSTEM_NSPR"; then
3989     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
3992 if test -n "$MOZ_NATIVE_NSPR"; then
3993     _SAVE_CFLAGS=$CFLAGS
3994     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3995     AC_TRY_COMPILE([#include "prlog.h"],
3996                 [#ifndef PR_STATIC_ASSERT
3997                  #error PR_STATIC_ASSERT not defined
3998                  #endif],
3999                 [MOZ_NATIVE_NSPR=1],
4000                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4001     CFLAGS=$_SAVE_CFLAGS
4002 else
4003     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --includedir=$(LIBXUL_DIST)/include/nspr --cflags`'
4004     # explicitly set libs for Visual Age C++ for OS/2
4005     if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
4006         NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '$_PTHREAD_LDFLAGS''
4007     elif test "$OS_ARCH" = "WINCE"; then
4008         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4009         NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4010     elif test "$OS_ARCH" = "WINNT"; then
4011         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4012         if test -n "$GNU_CC"; then
4013             NSPR_LIBS="-L\$(LIBXUL_DIST)/lib -lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION"
4014         else
4015             NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4016         fi
4017     else
4018         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --libdir=$(LIBXUL_DIST)/lib --libs`'
4019     fi
4022 dnl ========================================================
4023 dnl = If NSS was not detected in the system, 
4024 dnl = use the one in the source tree (mozilla/security/nss)
4025 dnl ========================================================
4027 MOZ_ARG_WITH_BOOL(system-nss,
4028 [  --with-system-nss      Use system installed NSS],
4029     _USE_SYSTEM_NSS=1 )
4031 if test -n "$_USE_SYSTEM_NSS"; then
4032     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4035 if test -n "$MOZ_NATIVE_NSS"; then
4036    NSS_LIBS="$NSS_LIBS -lcrmf"
4037 else
4038    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4039    NSS_DEP_LIBS="\
4040         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4041         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4042         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4043         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4044         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4045         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4047    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4048        NSS_LIBS="\
4049         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4050         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4051         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4052         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4053         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4054         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4055    else
4056        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4057    fi
4060 if test -z "$SKIP_LIBRARY_CHECKS"; then
4061 dnl system JPEG support
4062 dnl ========================================================
4063 MOZ_ARG_WITH_STRING(system-jpeg,
4064 [  --with-system-jpeg[=PFX]
4065                           Use system libjpeg [installed at prefix PFX]],
4066     JPEG_DIR=$withval)
4068 _SAVE_CFLAGS=$CFLAGS
4069 _SAVE_LDFLAGS=$LDFLAGS
4070 _SAVE_LIBS=$LIBS
4071 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4072     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4073     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4075 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4076     SYSTEM_JPEG=
4077 else
4078     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4081 if test "$SYSTEM_JPEG" = 1; then
4082     LIBS="$JPEG_LIBS $LIBS"
4083     AC_TRY_COMPILE([ #include <stdio.h>
4084                      #include <sys/types.h>
4085                      #include <jpeglib.h> ],
4086                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4087                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4088                      #endif ],
4089                    SYSTEM_JPEG=1,
4090                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4091 fi 
4092 CFLAGS=$_SAVE_CFLAGS
4093 LDFLAGS=$_SAVE_LDFLAGS
4094 LIBS=$_SAVE_LIBS
4096 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4097     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4098     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4101 dnl system ZLIB support
4102 dnl ========================================================
4103 MOZ_ARG_WITH_STRING(system-zlib,
4104 [  --with-system-zlib[=PFX]
4105                           Use system libz [installed at prefix PFX]],
4106     ZLIB_DIR=$withval)
4108 _SAVE_CFLAGS=$CFLAGS
4109 _SAVE_LDFLAGS=$LDFLAGS
4110 _SAVE_LIBS=$LIBS
4111 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4112     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4113     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4115 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4116     SYSTEM_ZLIB=
4117 else
4118     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4119         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4121 if test "$SYSTEM_ZLIB" = 1; then
4122     LIBS="$ZLIB_LIBS $LIBS"
4123     AC_TRY_COMPILE([ #include <stdio.h>
4124                      #include <string.h>
4125                      #include <zlib.h> ],
4126                    [ #if ZLIB_VERNUM < $MOZZLIB 
4127                      #error "Insufficient zlib version ($MOZZLIB required)."
4128                      #endif ],
4129                    SYSTEM_ZLIB=1,
4130                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4132 CFLAGS=$_SAVE_CFLAGS
4133 LDFLAGS=$_SAVE_LDFLAGS
4134 LIBS=$_SAVE_LIBS
4136 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4137     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4138     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4141 dnl system BZIP2 Support
4142 dnl ========================================================
4143 MOZ_ARG_WITH_STRING(system-bz2,
4144 [  --with-system-bz2[=PFX]
4145                           Use system libbz2 [installed at prefix PFX]],
4146     BZ2_DIR=$withval)
4148 _SAVE_CFLAGS=$CFLAGS
4149 _SAVE_LDFLAGS=$LDFLAGS
4150 _SAVE_LIBS=$LIBS
4151 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4152     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4153     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4155 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4156     SYSTEM_BZ2=
4157 else
4158     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4159         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4161 CFLAGS=$_SAVE_CFLAGS
4162 LDFLAGS=$_SAVE_LDFLAGS
4163 LIBS=$_SAVE_LIBS
4165 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4166     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4167     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4170 dnl system PNG Support
4171 dnl ========================================================
4172 MOZ_ARG_WITH_STRING(system-png, 
4173 [  --with-system-png[=PFX]
4174                           Use system libpng [installed at prefix PFX]],
4175     PNG_DIR=$withval)
4177 _SAVE_CFLAGS=$CFLAGS
4178 _SAVE_LDFLAGS=$LDFLAGS
4179 _SAVE_LIBS=$LIBS
4180 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4181 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4182 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4183     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4184     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4186 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4187     SYSTEM_PNG=
4188 else
4189     _SAVE_PNG_LIBS=$PNG_LIBS
4190     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4191                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4192                  $PNG_LIBS)
4193     AC_CHECK_LIB(png, png_get_acTL, ,
4194                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4195                  $_SAVE_PNG_LIBS)
4197 if test "$SYSTEM_PNG" = 1; then
4198     LIBS="$PNG_LIBS $LIBS"
4199     AC_TRY_COMPILE([ #include <stdio.h>
4200                      #include <sys/types.h>
4201                      #include <png.h> ],
4202                    [ #if PNG_LIBPNG_VER < $MOZPNG
4203                      #error "Insufficient libpng version ($MOZPNG required)."
4204                      #endif
4205                      #ifndef PNG_UINT_31_MAX
4206                      #error "Insufficient libpng version."
4207                      #endif ],
4208                    SYSTEM_PNG=1,
4209                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4211 CFLAGS=$_SAVE_CFLAGS
4212 LDFLAGS=$_SAVE_LDFLAGS
4213 LIBS=$_SAVE_LIBS
4215 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4216     PNG_CFLAGS="-I${PNG_DIR}/include"
4217     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4220 fi # SKIP_LIBRARY_CHECKS
4222 dnl system HunSpell Support
4223 dnl ========================================================
4224 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4225 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4226     SYSTEM_HUNSPELL=1 )
4228 if test -n "$SYSTEM_HUNSPELL"; then
4229     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4232 AC_SUBST(SYSTEM_HUNSPELL)
4234 dnl check whether to enable glitz
4235 dnl ========================================================
4236 MOZ_ARG_ENABLE_BOOL(glitz,
4237 [  --enable-glitz          Enable Glitz for use with Cairo],
4238     MOZ_ENABLE_GLITZ=1,
4239     MOZ_ENABLE_GLITZ= )
4240 if test "$MOZ_ENABLE_GLITZ"; then
4241     AC_DEFINE(MOZ_ENABLE_GLITZ)
4244 dnl ========================================================
4245 dnl Java SDK support
4246 dnl ========================================================
4247 JAVA_INCLUDE_PATH=
4248 MOZ_ARG_WITH_STRING(java-include-path,
4249 [  --with-java-include-path=dir   Location of Java SDK headers],
4250     JAVA_INCLUDE_PATH=$withval)
4252 JAVA_BIN_PATH=
4253 MOZ_ARG_WITH_STRING(java-bin-path,
4254 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4255     JAVA_BIN_PATH=$withval)
4257 dnl ========================================================
4258 dnl =
4259 dnl = Application
4260 dnl =
4261 dnl ========================================================
4263 MOZ_ARG_HEADER(Application)
4265 BUILD_STATIC_LIBS=
4266 ENABLE_TESTS=1
4267 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4268 MOZ_BRANDING_DIRECTORY=
4269 MOZ_CALENDAR=
4270 MOZ_DBGRINFO_MODULES=
4271 MOZ_ENABLE_CANVAS=1
4272 MOZ_EXTENSIONS_ALL=" wallet p3p venkman inspector irc typeaheadfind gnomevfs sroaming datetime finger cview layout-debug tasks sql xforms schema-validation reporter"
4273 MOZ_FEEDS=1
4274 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4275 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4276 MOZ_IPCD=
4277 MOZ_JAVAXPCOM=
4278 MOZ_JSDEBUGGER=1
4279 MOZ_JSLOADER=1
4280 MOZ_LDAP_XPCOM=
4281 MOZ_LIBART_CFLAGS=
4282 MOZ_LIBART_LIBS=
4283 MOZ_MAIL_NEWS=
4284 MOZ_MATHML=1
4285 MOZ_MOCHITEST=1
4286 MOZ_MORK=1
4287 MOZ_MORKREADER=
4288 MOZ_AUTH_EXTENSION=1
4289 MOZ_NO_ACTIVEX_SUPPORT=1
4290 MOZ_NO_INSPECTOR_APIS=
4291 MOZ_NO_XPCOM_OBSOLETE=
4292 MOZ_NO_FAST_LOAD=
4293 MOZ_OJI=
4294 MOZ_PERMISSIONS=1
4295 MOZ_PLACES=
4296 MOZ_PLAINTEXT_EDITOR_ONLY=
4297 MOZ_PLUGINS=1
4298 MOZ_PREF_EXTENSIONS=1
4299 MOZ_PROFILELOCKING=1
4300 MOZ_PROFILESHARING=1
4301 MOZ_PSM=1
4302 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4303 MOZ_PYTHON=
4304 MOZ_PYTHON_DEBUG_SUFFIX=
4305 MOZ_PYTHON_DLL_SUFFIX=
4306 MOZ_PYTHON_INCLUDES=
4307 MOZ_PYTHON_LIBS=
4308 MOZ_PYTHON_PREFIX=
4309 MOZ_PYTHON_VER=
4310 MOZ_PYTHON_VER_DOTTED=
4311 MOZ_RDF=1
4312 MOZ_REFLOW_PERF=
4313 MOZ_SAFE_BROWSING=
4314 MOZ_HELP_VIEWER=
4315 MOZ_SPELLCHECK=1
4316 MOZ_STATIC_MAIL_BUILD=
4317 MOZ_STORAGE=1
4318 MOZ_SVG=1
4319 MOZ_TIMELINE=
4320 MOZ_UI_LOCALE=en-US
4321 MOZ_UNIVERSALCHARDET=1
4322 MOZ_URL_CLASSIFIER=
4323 MOZ_USE_NATIVE_UCONV=
4324 MOZ_V1_STRING_ABI=
4325 MOZ_VIEW_SOURCE=1
4326 MOZ_XPFE_COMPONENTS=1
4327 MOZ_XPINSTALL=1
4328 MOZ_XSLT_STANDALONE=
4329 MOZ_XTF=1
4330 MOZ_XUL=1
4331 MOZ_XUL_APP=1
4332 MOZ_ZIPWRITER=1
4333 NS_PRINTING=1
4334 NECKO_COOKIES=1
4335 NECKO_DISK_CACHE=1
4336 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4337 NECKO_SMALL_BUFFERS=
4338 SUNCTL=
4339 JS_STATIC_BUILD=
4340 XPC_IDISPATCH_SUPPORT=
4343 case "$target_os" in
4344 darwin*)
4345     ACCESSIBILITY=
4346     ;;
4348     ACCESSIBILITY=1
4349     ;;
4350 esac
4352 case "$target_os" in
4353     msvc*|mks*|cygwin*|mingw*)
4354         if test -z "$GNU_CC"; then 
4355             XPC_IDISPATCH_SUPPORT=1
4356             MOZ_NO_ACTIVEX_SUPPORT=
4357             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4358         fi
4359         ;;
4360 esac
4362 MOZ_ARG_ENABLE_STRING(application,
4363 [  --enable-application=APP
4364                           Options include:
4365                             suite
4366                             browser (Firefox)
4367                             mail (Thunderbird)
4368                             minimo
4369                             composer
4370                             calendar (Sunbird)
4371                             xulrunner
4372                             camino
4373                             content/xslt (Standalone Transformiix XSLT)
4374                             netwerk (Standalone Necko)
4375                             tools/update-packaging (AUS-related packaging tools)
4376                             standalone (use this for standalone
4377                               xpcom/xpconnect or to manually drive a build)],
4378 [ MOZ_BUILD_APP=$enableval ] )
4380 if test "$MOZ_BUILD_APP" = "macbrowser"; then
4381     AC_MSG_WARN([--enable-application=macbrowser is deprecated. Use --enable-application=camino.])
4382     MOZ_BUILD_APP=camino
4385 case "$MOZ_BUILD_APP" in
4386 minimo)
4387   MOZ_EMBEDDING_PROFILE=basic
4388   ;;
4391   MOZ_EMBEDDING_PROFILE=default
4392   ;;
4393 esac
4395 MOZ_ARG_WITH_STRING(embedding-profile,
4396 [  --with-embedding-profile=default|basic|minimal
4397                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4398 [ MOZ_EMBEDDING_PROFILE=$withval ])
4400 case "$MOZ_EMBEDDING_PROFILE" in
4401 default)
4402   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4403   MOZ_EMBEDDING_LEVEL_BASIC=1
4404   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4405   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4406   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4407   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4408   ;;
4410 basic)
4411   MOZ_EMBEDDING_LEVEL_DEFAULT=
4412   MOZ_EMBEDDING_LEVEL_BASIC=1
4413   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4414   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4415   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4416   ENABLE_TESTS=
4417   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4418   MOZ_COMPOSER=
4419   MOZ_ENABLE_CANVAS=
4420   MOZ_ENABLE_POSTSCRIPT=
4421   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4422   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4423   MOZ_IMG_ENCODERS_DEFAULT=
4424   MOZ_IMG_ENCODERS=
4425   MOZ_INSTALLER=
4426   MOZ_JSDEBUGGER=
4427   MOZ_LDAP_XPCOM=
4428   MOZ_MAIL_NEWS=
4429   MOZ_MATHML=
4430   MOZ_AUTH_EXTENSION=
4431   MOZ_NO_ACTIVEX_SUPPORT=1
4432   MOZ_NO_INSPECTOR_APIS=1
4433   MOZ_NO_XPCOM_OBSOLETE=1
4434   MOZ_NO_FAST_LOAD=1
4435   MOZ_OJI=
4436   MOZ_PLAINTEXT_EDITOR_ONLY=1
4437 #  MOZ_PLUGINS=
4438   MOZ_PREF_EXTENSIONS=
4439   MOZ_PROFILELOCKING=
4440   MOZ_PROFILESHARING=
4441   MOZ_SPELLCHECK=
4442   MOZ_SVG=
4443   MOZ_UNIVERSALCHARDET=
4444   MOZ_UPDATER=
4445   MOZ_USE_NATIVE_UCONV=
4446   MOZ_VIEW_SOURCE=
4447   MOZ_XPFE_COMPONENTS=
4448   MOZ_XPINSTALL=
4449   MOZ_XTF=
4450   MOZ_ZIPWRITER=
4451   NECKO_DISK_CACHE=
4452   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4453   NECKO_SMALL_BUFFERS=1
4454   NS_DISABLE_LOGGING=1
4455   NS_PRINTING=
4456   JS_STATIC_BUILD=1
4457   ;;
4459 minimal)
4460   MOZ_EMBEDDING_LEVEL_DEFAULT=
4461   MOZ_EMBEDDING_LEVEL_BASIC=
4462   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4463   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4464   ENABLE_TESTS=
4465   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4466   MOZ_COMPOSER=
4467   MOZ_ENABLE_CANVAS=
4468   MOZ_ENABLE_POSTSCRIPT=
4469   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4470   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4471   MOZ_IMG_ENCODERS_DEFAULT=
4472   MOZ_IMG_ENCODERS=
4473   MOZ_INSTALLER=
4474   MOZ_JSDEBUGGER=
4475   MOZ_LDAP_XPCOM=
4476   MOZ_MAIL_NEWS=
4477   MOZ_MATHML=
4478   MOZ_AUTH_EXTENSION=
4479   MOZ_NO_ACTIVEX_SUPPORT=1
4480   MOZ_NO_INSPECTOR_APIS=1
4481   MOZ_NO_XPCOM_OBSOLETE=1
4482   MOZ_NO_FAST_LOAD=1
4483   MOZ_OJI=
4484   MOZ_PLAINTEXT_EDITOR_ONLY=1
4485   MOZ_PLUGINS=
4486   MOZ_PREF_EXTENSIONS=
4487   MOZ_PROFILELOCKING=
4488   MOZ_PROFILESHARING=
4489   MOZ_SPELLCHECK=
4490   MOZ_STORAGE=1
4491   MOZ_PLACES=
4492   MOZ_SVG=
4493   MOZ_UNIVERSALCHARDET=
4494   MOZ_UPDATER=
4495   MOZ_USE_NATIVE_UCONV=1
4496   MOZ_VIEW_SOURCE=
4497   MOZ_XPFE_COMPONENTS=
4498   MOZ_XPINSTALL=
4499   MOZ_XTF=
4500   MOZ_XUL=
4501   MOZ_ZIPWRITER=
4502   MOZ_RDF=
4503   NECKO_DISK_CACHE=
4504   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4505   NECKO_SMALL_BUFFERS=1
4506   NS_DISABLE_LOGGING=1
4507   NS_PRINTING=
4508   JS_STATIC_BUILD=1
4509   ;;
4512   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4513   ;;
4514 esac
4516 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4517 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4518 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4520 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4521 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4522   XULRUNNER_STUB_NAME=$withval)
4524 if test -z "$XULRUNNER_STUB_NAME"; then
4525   case "$target_os" in
4526   darwin*)
4527     XULRUNNER_STUB_NAME=xulrunner
4528     ;;
4529   *)
4530     XULRUNNER_STUB_NAME=xulrunner-stub
4531   esac
4533 AC_SUBST(XULRUNNER_STUB_NAME)
4535 if test -z "$MOZ_BUILD_APP"; then
4536   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4537 else
4538   # We have a valid application only if it has a build.mk file in its top
4539   # directory.
4540   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4541     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4542   fi
4545 # Allow the application to influence configure with a confvars.sh script.
4547 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4548 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4549   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4550   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4551 else
4552   AC_MSG_RESULT([no])
4555 # Now is a good time to test for logic errors, define mismatches, etc.
4556 case "$MOZ_BUILD_APP" in
4557 xulrunner)
4558   if test "$LIBXUL_SDK"; then
4559     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4560   fi
4561   ;;
4563   # Fix this case for folks who forget. Warn them.
4564   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4565     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4566     MOZ_XUL_APP=1
4567   fi
4568   ;;
4569 esac
4571 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4572 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4573 # MOZ_BUILD_APP.
4574 case "$MOZ_BUILD_APP" in
4575 suite)
4576   AC_DEFINE(MOZ_SUITE)
4577   ;;
4579 browser)
4580   AC_DEFINE(MOZ_PHOENIX)
4581   ;;
4583 minimo)
4584   AC_DEFINE(MINIMO)
4585   ;;
4587 mail)
4588   AC_DEFINE(MOZ_THUNDERBIRD)
4589   ;;
4591 composer)
4592   AC_DEFINE(MOZ_STANDALONE_COMPOSER)
4593   ;;
4595 calendar)
4596   AC_DEFINE(MOZ_SUNBIRD)
4597   ;;
4599 xulrunner)
4600   AC_DEFINE(MOZ_XULRUNNER)
4601   ;;
4603 camino) 
4604   AC_DEFINE(MOZ_MACBROWSER)
4605   ;;
4607 content/xslt)
4608   AC_DEFINE(TX_EXE)
4609   ;;
4611 standalone) 
4612   MOZ_APP_NAME=mozilla
4613   MOZ_APP_DISPLAYNAME=Mozilla
4614   MOZ_APP_VERSION=$MOZILLA_VERSION
4615   ;;
4617 esac
4619 AC_SUBST(MOZ_BUILD_APP)
4620 AC_SUBST(MOZ_XUL_APP)
4621 AC_SUBST(MOZ_SUITE)
4622 AC_SUBST(MOZ_PHOENIX)
4623 AC_SUBST(MOZ_THUNDERBIRD)
4624 AC_SUBST(MOZ_STANDALONE_COMPOSER)
4625 AC_SUBST(MOZ_SUNBIRD)
4626 AC_SUBST(MOZ_XULRUNNER)
4628 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4630 if test "$MOZ_XUL_APP"; then
4631   MOZ_PROFILESHARING=
4632   AC_DEFINE(MOZ_XUL_APP)
4635 dnl ========================================================
4636 dnl = 
4637 dnl = Toolkit Options
4638 dnl = 
4639 dnl ========================================================
4640 MOZ_ARG_HEADER(Toolkit Options)
4642     dnl ========================================================
4643     dnl = Select the default toolkit
4644     dnl ========================================================
4645         MOZ_ARG_ENABLE_STRING(default-toolkit,
4646         [  --enable-default-toolkit=TK
4647                           Select default toolkit
4648                           Platform specific defaults:
4649                             BeOS - cairo-beos
4650                             Mac OS X - cairo-cocoa
4651                             Neutrino/QNX - photon
4652                             OS/2 - cairo-os2
4653                             Win32 - cairo-windows
4654                             WinCE - windows
4655                             * - cairo-gtk2
4656                             * - cairo-qt],
4657     [ _DEFAULT_TOOLKIT=$enableval ],
4658     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4660     if test "$_DEFAULT_TOOLKIT" = "photon" \
4661         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4662         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4663         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4664         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4665         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4666         -o "$_DEFAULT_TOOLKIT" = "cairo-mac" \
4667         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4668     then
4669         dnl nglayout only supports building with one toolkit,
4670         dnl so ignore everything after the first comma (",").
4671         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4672     else
4673         if test "$no_x" != "yes"; then
4674             AC_MSG_ERROR([Toolkit must be cairo-gtk2 or cairo-qt.])
4675         else
4676             AC_MSG_ERROR([Toolkit must be $_PLATFORM_DEFAULT_TOOLKIT (if supported).])
4677         fi
4678     fi
4680 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4682 dnl ========================================================
4683 dnl = Enable the toolkit as needed                         =
4684 dnl ========================================================
4686 case "$MOZ_WIDGET_TOOLKIT" in
4687 photon)
4688         MOZ_ENABLE_PHOTON=1
4689         AC_DEFINE(MOZ_WIDGET_PHOTON)
4690     ;;
4692 cairo-windows)
4693     MOZ_WIDGET_TOOLKIT=windows
4694     MOZ_GFX_TOOLKIT=cairo
4695     ;;
4697 cairo-gtk2)
4698     MOZ_WIDGET_TOOLKIT=gtk2
4699     MOZ_GFX_TOOLKIT=cairo
4700     MOZ_ENABLE_GTK2=1
4701     MOZ_ENABLE_XREMOTE=1
4702     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4703     TK_LIBS='$(MOZ_GTK2_LIBS)'
4704     AC_DEFINE(MOZ_WIDGET_GTK2)
4705     ;;
4706 cairo-qt)
4707     MOZ_WIDGET_TOOLKIT=qt
4708     MOZ_GFX_TOOLKIT=cairo
4709     MOZ_ENABLE_QT=1
4710     MOZ_ENABLE_XREMOTE=1
4711     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4712     TK_LIBS='$(MOZ_QT_LIBS)'
4713     AC_DEFINE(MOZ_WIDGET_QT)
4714     ;;
4715 cairo-beos)
4716     MOZ_WIDGET_TOOLKIT=beos
4717     MOZ_GFX_TOOLKIT=cairo
4718     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4719     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4720     ;;
4722 cairo-os2)
4723     MOZ_WIDGET_TOOLKIT=os2
4724     MOZ_GFX_TOOLKIT=cairo
4725     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4726     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4727     ;;
4729 cairo-mac|cairo-cocoa)
4730     if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
4731         MOZ_WIDGET_TOOLKIT=cocoa
4732         AC_DEFINE(MOZ_WIDGET_COCOA)
4733         MOZ_ENABLE_COCOA=1
4734     else
4735         MOZ_WIDGET_TOOLKIT=mac
4736     fi
4737     MOZ_GFX_TOOLKIT=cairo
4738     MOZ_USER_DIR="Mozilla"
4739     AC_DEFINE(XP_MACOSX)
4740     AC_DEFINE(TARGET_CARBON)
4741     AC_DEFINE(TARGET_API_MAC_CARBON)
4742     TK_LIBS='-framework Carbon'
4743     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4744     CFLAGS="$CFLAGS $TK_CFLAGS"
4745     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4746     ;;
4747 esac
4749 if test "$MOZ_ENABLE_XREMOTE"; then
4750     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4753 if test "$COMPILE_ENVIRONMENT"; then
4754 if test "$MOZ_ENABLE_GTK2"
4755 then
4756     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 gdk-x11-2.0 glib-2.0 gobject-2.0)
4758 fi # COMPILE_ENVIRONMENT
4760 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4762 dnl ========================================================
4763 dnl = startup-notification support module
4764 dnl ========================================================
4766 if test "$MOZ_ENABLE_GTK2"
4767 then
4768     MOZ_ENABLE_STARTUP_NOTIFICATION=
4770     MOZ_ARG_ENABLE_BOOL(startup-notification,
4771     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4772         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4773         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4774     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4775     then
4776         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4777                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4778         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4779             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4780             then
4781                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4782             fi
4783             MOZ_ENABLE_STARTUP_NOTIFICATION=
4784         ])
4785     fi
4787     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4788         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4789     fi
4791     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4793 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4794 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4795 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4797 dnl ========================================================
4798 dnl = QT support
4799 dnl ========================================================
4800 if test "$MOZ_ENABLE_QT"
4801 then
4802     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4803     AC_SUBST(MOZ_QT_CFLAGS)
4804     AC_SUBST(MOZ_QT_LIBS)
4806     MOZ_ARG_WITH_STRING(qtdir,
4807     [  --with-qtdir=\$dir       Specify Qt directory ],
4808     [ QTDIR=$withval])
4810     if test -z "$QTDIR"; then
4811       QTDIR="/usr"
4812     fi
4813     QTINCDIR="/include/qt"
4814     if test ! -d "$QTDIR$QTINCDIR"; then
4815        QTINCDIR="/include/X11/qt"
4816     fi
4817     if test ! -d "$QTDIR$QTINCDIR"; then
4818        QTINCDIR="/include"
4819     fi
4821     if test -x "$QTDIR/bin/moc-qt4"; then
4822       HOST_MOC="$QTDIR/bin/moc-qt4"
4823     else
4824       if test -x "$QTDIR/bin/moc"; then
4825         HOST_MOC="$QTDIR/bin/moc"
4826       else
4827         AC_CHECK_PROGS(HOST_MOC, moc, "")
4828       fi
4829     fi
4830     if test -z "$HOST_MOC"; then
4831       AC_MSG_ERROR([no acceptable moc preprocessor found])
4832     fi
4833     MOC=$HOST_MOC
4836 AC_SUBST(GTK_CONFIG)
4837 AC_SUBST(TK_CFLAGS)
4838 AC_SUBST(TK_LIBS)
4840 AC_SUBST(MOZ_ENABLE_GTK2)
4841 AC_SUBST(MOZ_ENABLE_PHOTON)
4842 AC_SUBST(MOZ_ENABLE_COCOA)
4843 AC_SUBST(MOZ_ENABLE_GLITZ)
4844 AC_SUBST(MOZ_ENABLE_QT)
4845 AC_SUBST(MOZ_ENABLE_XREMOTE)
4846 AC_SUBST(MOZ_GTK2_CFLAGS)
4847 AC_SUBST(MOZ_GTK2_LIBS)
4848 AC_SUBST(MOZ_QT_CFLAGS)
4849 AC_SUBST(MOZ_QT_LIBS)
4851 AC_SUBST(MOC)
4853 if test "$MOZ_ENABLE_GTK2" \
4854 || test "$MOZ_ENABLE_QT"
4855 then
4856     AC_DEFINE(MOZ_X11)
4857     MOZ_X11=1
4859 AC_SUBST(MOZ_X11)
4861 dnl ========================================================
4862 dnl =
4863 dnl = Components & Features
4864 dnl = 
4865 dnl ========================================================
4866 MOZ_ARG_HEADER(Components and Features)
4868 dnl ========================================================
4869 dnl = Localization
4870 dnl ========================================================
4871 MOZ_ARG_ENABLE_STRING(ui-locale,
4872 [  --enable-ui-locale=ab-CD
4873                           Select the user interface locale (default: en-US)],
4874     MOZ_UI_LOCALE=$enableval )
4875 AC_SUBST(MOZ_UI_LOCALE)
4877 dnl =========================================================
4878 dnl = Calendar client
4879 dnl =========================================================
4880 MOZ_ARG_ENABLE_BOOL(calendar,,
4881     MOZ_OLD_CALENDAR=1,
4882     MOZ_OLD_CALENDAR= )
4884 if test "$MOZ_OLD_CALENDAR"; then
4885     AC_MSG_WARN([Building with the calendar extension is no longer supported.])
4886     if test "$MOZ_THUNDERBIRD"; then
4887         AC_MSG_WARN([Since you're trying to build mail, you could try adding])
4888         AC_MSG_WARN(['--enable-extensions=default,lightning' to your mozconfig])
4889         AC_MSG_WARN([and building WITH A FRESH TREE.])
4890     fi
4891     AC_MSG_WARN([For more information, please visit:])
4892     AC_MSG_ERROR([http://www.mozilla.org/projects/calendar/])
4895 AC_SUBST(MOZ_CALENDAR)
4897 dnl =========================================================
4898 dnl = Mail & News
4899 dnl =========================================================
4900 MOZ_ARG_DISABLE_BOOL(mailnews,
4901 [  --disable-mailnews      Disable building of mail & news components],
4902     MOZ_MAIL_NEWS=,
4903     MOZ_MAIL_NEWS=1 )
4904 AC_SUBST(MOZ_MAIL_NEWS)
4906 dnl =========================================================
4907 dnl = LDAP
4908 dnl =========================================================
4909 MOZ_ARG_DISABLE_BOOL(ldap,
4910 [  --disable-ldap          Disable LDAP support],
4911     MOZ_LDAP_XPCOM=,
4912     MOZ_LDAP_XPCOM=1)
4914 dnl ========================================================
4915 dnl = Trademarked Branding 
4916 dnl ========================================================
4917 MOZ_ARG_ENABLE_BOOL(official-branding,
4918 [  --enable-official-branding Enable Official mozilla.org Branding
4919                           Do not distribute builds with
4920                           --enable-official-branding unless you have
4921                           permission to use trademarks per
4922                           http://www.mozilla.org/foundation/trademarks/ .],
4923 [case "$MOZ_BUILD_APP" in
4924 browser)
4925     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4926     MOZ_APP_DISPLAYNAME=Firefox
4927     ;;
4929 calendar)
4930     MOZ_BRANDING_DIRECTORY=other-licenses/branding/sunbird
4931     MOZ_APP_DISPLAYNAME=Sunbird
4932     ;;
4934 mail)
4935     MOZ_BRANDING_DIRECTORY=other-licenses/branding/thunderbird
4936     ;;
4939     AC_MSG_ERROR([Official branding is only available for Firefox Sunbird and Thunderbird.])
4940 esac
4943 MOZ_ARG_WITH_STRING(branding,
4944 [  --with-branding=dir    Use branding from the specified directory.],
4945     MOZ_BRANDING_DIRECTORY=$withval)
4947 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4948 if test -z "$REAL_BRANDING_DIRECTORY"; then
4949   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4952 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4953   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4956 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4958 dnl ========================================================
4959 dnl = Distribution ID
4960 dnl ========================================================
4961 MOZ_ARG_WITH_STRING(distribution-id,
4962 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4963 [ val=`echo $withval`
4964     MOZ_DISTRIBUTION_ID="$val"])
4966 if test -z "$MOZ_DISTRIBUTION_ID"; then
4967    MOZ_DISTRIBUTION_ID="org.mozilla"
4970 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4971 AC_SUBST(MOZ_DISTRIBUTION_ID)
4973 dnl ========================================================
4974 dnl = Xft and Pango
4975 dnl ========================================================
4976 if test "$MOZ_ENABLE_GTK2"
4977 then
4978     PKG_CHECK_MODULES(MOZ_XFT, xft)
4979     AC_SUBST(MOZ_XFT_CFLAGS)
4980     AC_SUBST(MOZ_XFT_LIBS)
4982     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4983     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangocairo >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4984     AC_SUBST(MOZ_PANGO_CFLAGS)
4985     AC_SUBST(MOZ_PANGO_LIBS)
4988 dnl ========================================================
4989 dnl = PostScript print module
4990 dnl ========================================================
4991 MOZ_ARG_DISABLE_BOOL(postscript,
4992 [  --disable-postscript    Disable PostScript printing support ],
4993     MOZ_ENABLE_POSTSCRIPT=,
4994     MOZ_ENABLE_POSTSCRIPT=1 )
4996 dnl ========================================================
4997 dnl = GnomeVFS support module
4998 dnl ========================================================
5000 if test "$MOZ_X11"
5001 then
5002     dnl build the gnomevfs extension by default only when the
5003     dnl GTK2 toolkit is in use.
5004     if test "$MOZ_ENABLE_GTK2"
5005     then
5006         MOZ_ENABLE_GNOMEVFS=1
5007         MOZ_ENABLE_GCONF=1
5008         MOZ_ENABLE_LIBGNOME=1
5009     fi
5011     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5012     [  --disable-gnomevfs      Disable GnomeVFS support ],
5013         MOZ_ENABLE_GNOMEVFS=,
5014         MOZ_ENABLE_GNOMEVFS=force)
5016     if test "$MOZ_ENABLE_GNOMEVFS"
5017     then
5018         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5019             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5020             MOZ_ENABLE_GNOMEVFS=1
5021         ],[
5022             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5023             then
5024                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5025             fi
5026             MOZ_ENABLE_GNOMEVFS=
5027         ])
5028     fi
5030     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5031     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5033     if test "$MOZ_ENABLE_GCONF"
5034     then
5035         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5036             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5037             MOZ_ENABLE_GCONF=1
5038         ],[
5039             MOZ_ENABLE_GCONF=
5040         ])
5041     fi
5043     AC_SUBST(MOZ_GCONF_CFLAGS)
5044     AC_SUBST(MOZ_GCONF_LIBS)
5046     if test "$MOZ_ENABLE_LIBGNOME"
5047     then
5048         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5049             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5050             MOZ_ENABLE_LIBGNOME=1
5051         ],[
5052             MOZ_ENABLE_LIBGNOME=
5053         ])
5054     fi
5056     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5057     AC_SUBST(MOZ_LIBGNOME_LIBS)
5059     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5060     # are all available.
5062     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5063             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5064       MOZ_ENABLE_GNOME_COMPONENT=1
5065     else
5066       MOZ_ENABLE_GNOME_COMPONENT=
5067     fi
5069     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5072 dnl ========================================================
5073 dnl = libgnomeui support module
5074 dnl ========================================================
5076 if test "$MOZ_ENABLE_GTK2"
5077 then
5078     MOZ_ENABLE_GNOMEUI=1
5080     MOZ_ARG_DISABLE_BOOL(gnomeui,
5081     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5082         MOZ_ENABLE_GNOMEUI=,
5083         MOZ_ENABLE_GNOMEUI=force)
5085     if test "$MOZ_ENABLE_GNOMEUI"
5086     then
5087         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5088         [
5089             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5090             MOZ_ENABLE_GNOMEUI=1
5091         ],[
5092             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5093             then
5094                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5095             fi
5096             MOZ_ENABLE_GNOMEUI=
5097         ])
5098     fi
5100     if test "$MOZ_ENABLE_GNOMEUI"; then
5101         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5102     fi
5104 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5105 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5106 AC_SUBST(MOZ_GNOMEUI_LIBS)
5108 dnl ========================================================
5109 dnl = dbus support
5110 dnl ========================================================
5112 if test "$MOZ_ENABLE_GTK2"
5113 then
5114     MOZ_ENABLE_DBUS=1
5116     MOZ_ARG_DISABLE_BOOL(dbus,
5117     [  --disable-dbus       Disable dbus support ],
5118         MOZ_ENABLE_DBUS=,
5119         MOZ_ENABLE_DBUS=1)
5121     if test "$MOZ_ENABLE_DBUS"
5122     then
5123         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5124         AC_DEFINE(MOZ_ENABLE_DBUS)
5125     fi
5127 AC_SUBST(MOZ_ENABLE_DBUS)
5128 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5129 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5131 dnl ========================================================
5132 dnl = Build Personal Security Manager
5133 dnl ========================================================
5134 MOZ_ARG_DISABLE_BOOL(crypto,
5135 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5136     MOZ_PSM=,
5137     MOZ_PSM=1 )
5139 dnl ========================================================
5140 dnl = JS Debugger XPCOM component (js/jsd)
5141 dnl ========================================================
5142 MOZ_ARG_DISABLE_BOOL(jsd,
5143 [  --disable-jsd           Disable JavaScript debug library],
5144     MOZ_JSDEBUGGER=,
5145     MOZ_JSDEBUGGER=1)
5148 dnl ========================================================
5149 dnl = Disable plugin support
5150 dnl ========================================================
5151 MOZ_ARG_DISABLE_BOOL(plugins,
5152 [  --disable-plugins       Disable plugins support],
5153     MOZ_PLUGINS=,
5154     MOZ_PLUGINS=1)
5156 dnl ========================================================
5157 dnl = Open JVM Interface (OJI) support
5158 dnl ========================================================
5159 MOZ_ARG_ENABLE_BOOL(oji,
5160 [  --enable-oji           Enable Open JVM Integration support],
5161     MOZ_OJI=1,
5162     MOZ_OJI=)
5163 if test -n "$MOZ_OJI"; then
5164     AC_DEFINE(OJI)
5167 dnl bi-directional support always on
5168 IBMBIDI=1
5169 AC_DEFINE(IBMBIDI)
5171 dnl ========================================================
5172 dnl complex text support off by default
5173 dnl ========================================================
5174 MOZ_ARG_ENABLE_BOOL(ctl,
5175 [  --enable-ctl            Enable Thai Complex Script support],
5176     SUNCTL=1,
5177     SUNCTL= )
5179 dnl ========================================================
5180 dnl view source support on by default
5181 dnl ========================================================
5182 MOZ_ARG_DISABLE_BOOL(view-source,
5183 [  --disable-view-source     Disable view source support],
5184     MOZ_VIEW_SOURCE=,
5185     MOZ_VIEW_SOURCE=1 )
5186 if test "$MOZ_VIEW_SOURCE"; then
5187     AC_DEFINE(MOZ_VIEW_SOURCE)
5191 dnl ========================================================
5192 dnl accessibility support on by default on all platforms 
5193 dnl except OS X.
5194 dnl ========================================================
5195 MOZ_ARG_DISABLE_BOOL(accessibility,
5196 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5197     ACCESSIBILITY=,
5198     ACCESSIBILITY=1 )
5199 if test "$ACCESSIBILITY"; then
5200     AC_DEFINE(ACCESSIBILITY)
5203 if test -n "$ACCESSIBILITY"; then
5204 case "$target" in
5205 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5206     if test "$ac_cv_header_atlbase_h" = "no"; then
5207         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.])
5208     fi
5209     if test "$ac_cv_header_oleacc_idl" = "no"; then
5210         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.])
5211     fi
5212     ;;
5213 esac
5216 dnl ========================================================
5217 dnl xpfe/components on by default
5218 dnl ========================================================
5219 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5220 [  --disable-xpfe-components
5221                           Disable xpfe components],
5222     MOZ_XPFE_COMPONENTS=,
5223     MOZ_XPFE_COMPONENTS=1 )
5225 dnl ========================================================
5226 dnl xpinstall support on by default
5227 dnl ========================================================
5228 MOZ_ARG_DISABLE_BOOL(xpinstall,
5229 [  --disable-xpinstall     Disable xpinstall support],
5230     MOZ_XPINSTALL=,
5231     MOZ_XPINSTALL=1 )
5232 if test "$MOZ_XPINSTALL"; then
5233     AC_DEFINE(MOZ_XPINSTALL)
5236 dnl ========================================================
5237 dnl xpcom js loader support on by default
5238 dnl ========================================================
5239 MOZ_ARG_DISABLE_BOOL(jsloader,
5240 [  --disable-jsloader      Disable xpcom js loader support],
5241     MOZ_JSLOADER=,
5242     MOZ_JSLOADER=1 )
5243 if test "$MOZ_JSLOADER"; then
5244     AC_DEFINE(MOZ_JSLOADER)
5247 dnl ========================================================
5248 dnl Disable printing
5249 dnl ========================================================
5250 MOZ_ARG_DISABLE_BOOL(printing,
5251 [  --disable-printing  Disable printing support],
5252     NS_PRINTING=,
5253     NS_PRINTING=1 )
5255 if test "$NS_PRINTING"; then
5256     AC_DEFINE(NS_PRINTING)
5257     AC_DEFINE(NS_PRINT_PREVIEW)
5260 dnl ========================================================
5261 dnl use native unicode converters
5262 dnl ========================================================
5263 MOZ_ARG_ENABLE_BOOL(native-uconv,
5264 [  --enable-native-uconv   Enable iconv support],
5265     MOZ_USE_NATIVE_UCONV=1,
5266     MOZ_USE_NATIVE_UCONV= )
5267 if test "$MOZ_USE_NATIVE_UCONV"; then
5268     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5270 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5271     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5275 dnl ========================================================
5276 dnl Libeditor can be build as plaintext-only,
5277 dnl or as a full html and text editing component.
5278 dnl We build both by default.
5279 dnl ========================================================
5280 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5281 [  --enable-plaintext-editor-only
5282                           Allow only plaintext editing],
5283     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5284     MOZ_PLAINTEXT_EDITOR_ONLY= )
5285 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5286 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5288 dnl ========================================================
5289 dnl Composer is on by default.
5290 dnl ========================================================
5291 MOZ_ARG_DISABLE_BOOL(composer,
5292 [  --disable-composer      Disable building of Composer],
5293     MOZ_COMPOSER=,
5294     MOZ_COMPOSER=1 )
5295 AC_SUBST(MOZ_COMPOSER)
5298 dnl ========================================================
5299 dnl = Drop XPCOM Obsolete library
5300 dnl ========================================================
5301 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5302 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5303     MOZ_NO_XPCOM_OBSOLETE=1,
5304     MOZ_NO_XPCOM_OBSOLETE=)
5306 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5307     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5310 dnl ========================================================
5311 dnl = Disable Fast Load
5312 dnl ========================================================
5313 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5314 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5315     MOZ_NO_FAST_LOAD=1,
5316     MOZ_NO_FAST_LOAD=)
5318 AC_SUBST(MOZ_NO_FAST_LOAD)
5320 if test -n "$MOZ_NO_FAST_LOAD"; then
5321     AC_DEFINE(MOZ_NO_FAST_LOAD)
5324 dnl ========================================================
5325 dnl Permissions System
5326 dnl ========================================================
5327 MOZ_ARG_DISABLE_BOOL(permissions,
5328 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5329     MOZ_PERMISSIONS=,
5330     MOZ_PERMISSIONS=1
5333 dnl ========================================================
5334 dnl NegotiateAuth
5335 dnl ========================================================
5336 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5337 [  --disable-negotiateauth Disable GSS-API negotiation ],
5338     MOZ_AUTH_EXTENSION=,
5339     MOZ_AUTH_EXTENSION=1 )
5341 dnl ========================================================
5342 dnl XTF
5343 dnl ========================================================
5344 MOZ_ARG_DISABLE_BOOL(xtf,
5345 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5346     MOZ_XTF=,
5347     MOZ_XTF=1 )
5348 if test "$MOZ_XTF"; then
5349   AC_DEFINE(MOZ_XTF)
5352 dnl ========================================================
5353 dnl Inspector APIs
5354 dnl ========================================================
5355 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5356 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5357     MOZ_NO_INSPECTOR_APIS=1,
5358     MOZ_NO_INSPECTOR_APIS= )
5360 dnl ========================================================
5361 dnl Pref extensions (autoconfig and system-pref)
5362 dnl ========================================================
5363 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5364 [  --disable-pref-extensions
5365                           Disable pref extensions such as autoconfig and
5366                           system-pref],
5367   MOZ_PREF_EXTENSIONS=,
5368   MOZ_PREF_EXTENSIONS=1 )
5370 dnl ========================================================
5371 dnl = Universalchardet
5372 dnl ========================================================
5373 MOZ_ARG_DISABLE_BOOL(universalchardet,
5374 [  --disable-universalchardet
5375                           Disable universal encoding detection],
5376   MOZ_UNIVERSALCHARDET=,
5377   MOZ_UNIVERSALCHARDET=1 )
5379 dnl ========================================================
5380 dnl JavaXPCOM
5381 dnl ========================================================
5382 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5383 [  --enable-javaxpcom
5384                           Enable Java-XPCOM bridge],
5385     MOZ_JAVAXPCOM=1,
5386     MOZ_JAVAXPCOM= )
5388 if test -n "${MOZ_JAVAXPCOM}"; then
5389   case "$host_os" in
5390     cygwin*|msvc*|mks*)
5391       if test -n "$JAVA_HOME"; then
5392         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5393       fi
5394       ;;
5395     *mingw*)
5396       if test -n "$JAVA_HOME"; then
5397         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5398       fi
5399       ;;
5400   esac
5402   if test -n "${JAVA_INCLUDE_PATH}"; then
5403     dnl Make sure jni.h exists in the given include path.
5404     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5405       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5406     fi
5407   else
5408     case "$target_os" in
5409       darwin*)
5410         dnl Default to java system location
5411         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5412         ;;
5413       *)
5414         dnl Try $JAVA_HOME
5415         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5416         ;;
5417     esac
5418     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5419       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.])
5420     fi
5421   fi
5423   if test -n "${JAVA_BIN_PATH}"; then
5424     dnl Look for javac and jar in the specified path.
5425     JAVA_PATH="$JAVA_BIN_PATH"
5426   else
5427     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5428     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5429   fi
5431   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5432   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5433   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5434   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5435     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.])
5436   fi
5439 dnl ========================================================
5440 dnl = Breakpad crash reporting (on by default on supported platforms)
5441 dnl ========================================================
5443 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5444     || test "$OS_ARCH" = "Darwin" \
5445     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5446     || test "$OS_ARCH" = "SunOS") \
5447    && test -z "$HAVE_64BIT_OS"; then
5448    MOZ_CRASHREPORTER=1
5451 MOZ_ARG_DISABLE_BOOL(crashreporter,
5452 [  --disable-crashreporter          Disable breakpad crash reporting],
5453     MOZ_CRASHREPORTER=,
5454     MOZ_CRASHREPORTER=1)
5456 if test -n "$MOZ_CRASHREPORTER"; then
5457    AC_DEFINE(MOZ_CRASHREPORTER)
5459   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5460     test -z "$SKIP_LIBRARY_CHECKS"; then
5461     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5462     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5463     AC_SUBST(MOZ_GTHREAD_LIBS)
5465     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.])])
5466   fi
5469 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5470 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5471 [ val=`echo $withval | sed 's/[^0-9]//g'`
5472     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5474 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5475    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5477 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5480 dnl ========================================================
5481 dnl = Build mochitest JS/DOM tests (on by default)
5482 dnl ========================================================
5483 MOZ_ARG_DISABLE_BOOL(mochitest,
5484 [  --disable-mochitest        Disable mochitest harness],
5485     MOZ_MOCHITEST=,
5486     MOZ_MOCHITEST=1 )
5488 dnl ========================================================
5489 dnl = Enable compilation of specific extension modules
5490 dnl ========================================================
5492 MOZ_ARG_ENABLE_STRING(extensions,
5493 [  --enable-extensions     Enable extensions],
5494 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5495     if test "$option" = "yes" || test "$option" = "all"; then
5496         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
5497     elif test "$option" = "no" || test "$option" = "none"; then
5498         MOZ_EXTENSIONS=""
5499     elif test "$option" = "default"; then
5500         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5501     elif test `echo "$option" | grep -c \^-` != 0; then
5502         option=`echo $option | sed 's/^-//'`
5503         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5504     else
5505         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5506     fi
5507 done],
5508     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5510 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5511     # Suppress warning on non-X11 platforms
5512     if test -n "$MOZ_X11"; then
5513         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5514     fi
5515     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5518 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5519     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5520     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5523 dnl This might be temporary: build tridentprofile only on Windows
5524 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5525     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5526     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5529 dnl cookie must be built before tridentprofile. put it at list's end.
5530 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5531   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5532   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5535 dnl xforms requires xtf and schema-validation
5536 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5537     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5538     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5540 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5541     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5542     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5545 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5546     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5547     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5550 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5551     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5552     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5555 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5556     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5557     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5560 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5561     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5562     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5565 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5566     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5567     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5570 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5571     AC_MSG_WARN([spellcheck is no longer an extension.])
5572     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5575 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5576     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5577     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5580 dnl Remove dupes
5581 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5583 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5584 dnl when trying to build a non-existent extension.
5585 for extension in $MOZ_EXTENSIONS; do
5586     if test ! -d "${srcdir}/extensions/${extension}"; then
5587         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5588     fi
5589 done
5592 dnl ========================================================
5593 dnl Image decoders
5594 dnl ========================================================
5595 case "$MOZ_WIDGET_TOOLKIT" in
5596 beos|windows|os2|mac|cocoa)
5597     ;;
5599     if test -z "$MOZ_ENABLE_GTK2"; then
5600        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`                
5601     fi
5602     ;;
5603 esac
5605 MOZ_ARG_ENABLE_STRING(image-decoders,
5606 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5607                           Enable specific image decoders],
5608 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5609     if test "$option" = "yes" || test "$option" = "all"; then
5610         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5611     elif test "$option" = "no" || test "$option" = "none"; then
5612         MOZ_IMG_DECODERS=""
5613     elif test "$option" = "default"; then
5614         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5615     elif test `echo "$option" | grep -c \^-` != 0; then
5616         option=`echo $option | sed 's/^-//'`
5617         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5618     else
5619         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5620     fi
5621 done],
5622     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5624 dnl Dupes are removed in the encoder section because it will also add decoders
5626 dnl ========================================================
5627 dnl Image encoders
5628 dnl ========================================================
5629 MOZ_ARG_ENABLE_STRING(image-encoders,
5630 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5631                           Enable specific image encoders],
5632 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5633     if test "$option" = "yes" || test "$option" = "all"; then
5634         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5635     elif test "$option" = "no" || test "$option" = "none"; then
5636         MOZ_IMG_ENCODERS=""
5637         addencoder=""
5638     elif test "$option" = "default"; then
5639         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5640     elif test `echo "$option" | grep -c \^-` != 0; then
5641         option=`echo $option | sed 's/^-//'`
5642         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5643     else
5644         addencoder="$option"
5645     fi
5646     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5647 done],
5648     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5650 dnl Remove dupes
5651 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5652 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5654 dnl ========================================================
5655 dnl experimental ldap features
5656 dnl ========================================================
5657 MOZ_ARG_ENABLE_BOOL(ldap-experimental,
5658 [  --enable-ldap-experimental
5659                           Enable LDAP experimental features],
5660     MOZ_LDAP_XPCOM_EXPERIMENTAL=1,
5661     MOZ_LDAP_XPCOM_EXPERIMENTAL=)
5663 dnl ========================================================
5664 dnl MathML on by default
5665 dnl ========================================================
5666 MOZ_ARG_DISABLE_BOOL(mathml,
5667 [  --disable-mathml        Disable MathML support],
5668     MOZ_MATHML=,
5669     MOZ_MATHML=1 )
5670 if test "$MOZ_MATHML"; then
5671   AC_DEFINE(MOZ_MATHML)
5674 dnl ========================================================
5675 dnl Canvas
5676 dnl ========================================================
5677 MOZ_ARG_DISABLE_BOOL(canvas,
5678 [  --disable-canvas          Disable html:canvas feature],
5679     MOZ_ENABLE_CANVAS=,
5680     MOZ_ENABLE_CANVAS=1 )
5681 if test -n "$MOZ_ENABLE_CANVAS"; then
5682     AC_DEFINE(MOZ_ENABLE_CANVAS)
5684 AC_SUBST(MOZ_ENABLE_CANVAS)
5686 dnl ========================================================
5687 dnl SVG
5688 dnl ========================================================
5689 MOZ_ARG_DISABLE_BOOL(svg,
5690 [  --disable-svg            Disable SVG support],
5691     MOZ_SVG=,
5692     MOZ_SVG=1 )
5693 if test -n "$MOZ_SVG"; then
5694   AC_DEFINE(MOZ_SVG)
5697 MOZ_SVG_FOREIGNOBJECT=1
5698 dnl ========================================================
5699 dnl SVG <foreignObject>
5700 dnl ========================================================
5701 MOZ_ARG_DISABLE_BOOL(svg-foreignobject,
5702    [  --disable-svg-foreignobject
5703                         Disable SVG <foreignObject> support],
5704    MOZ_SVG_FOREIGNOBJECT=,
5705    MOZ_SVG_FOREIGNOBJECT=1 )
5706 if test "$MOZ_SVG_FOREIGNOBJECT"; then
5707   if test "$MOZ_SVG"; then
5708     AC_DEFINE(MOZ_SVG_FOREIGNOBJECT)
5709   else
5710     MOZ_SVG_FOREIGNOBEJCT=
5711   fi
5714 dnl ========================================================
5715 dnl Installer
5716 dnl ========================================================
5717 case "$target_os" in
5718     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5719         MOZ_INSTALLER=1
5720         ;;
5721 esac
5723 MOZ_ARG_DISABLE_BOOL(installer,
5724 [  --disable-installer     Disable building of installer],
5725     MOZ_INSTALLER=,
5726     MOZ_INSTALLER=1 )
5727 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5728     # Disable installer for Windows builds that use the new toolkit if NSIS
5729     # isn't in the path.
5730     AC_PATH_PROGS(MAKENSIS, makensis)
5731     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5732         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5733     fi
5734     # The Windows build for NSIS requires the iconv command line utility to
5735     # convert the charset of the locale files.
5736     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5737     if test -z "$HOST_ICONV"; then
5738         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5739     fi
5742 # Automatically disable installer if xpinstall isn't built
5743 if test -z "$MOZ_XPINSTALL"; then
5744     MOZ_INSTALLER=
5746 AC_SUBST(MOZ_INSTALLER)
5748 AC_MSG_CHECKING([for tar archiver])
5749 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5750 if test -z "$TAR"; then
5751     AC_MSG_ERROR([no tar archiver found in \$PATH])
5753 AC_MSG_RESULT([$TAR])
5754 AC_SUBST(TAR)
5756 dnl ========================================================
5757 dnl Updater
5758 dnl ========================================================
5760 MOZ_ARG_DISABLE_BOOL(updater,
5761 [  --disable-updater       Disable building of updater],
5762     MOZ_UPDATER=,
5763     MOZ_UPDATER=1 )
5764 # The Windows build requires the iconv command line utility
5765 # in order to build the updater.
5766 case "$target_os" in
5767     msvc*|mks*|cygwin*|mingw*|wince*)
5768         if test -n "$MOZ_UPDATER"; then
5769             AC_MSG_CHECKING([for iconv])
5770             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5771             if test -z "$HOST_ICONV"; then
5772                 AC_MSG_ERROR([iconv not found in \$PATH])
5773             fi
5774         fi
5775         ;;
5776 esac
5777 AC_SUBST(MOZ_UPDATER)
5779 # app update channel is 'default' when not supplied.
5780 MOZ_ARG_ENABLE_STRING([update-channel],
5781 [  --enable-update-channel=CHANNEL
5782                            Select application update channel (default=default)],
5783     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5785 if test -z "$MOZ_UPDATE_CHANNEL"; then
5786     MOZ_UPDATE_CHANNEL=default
5788 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5790 # tools/update-packaging is not checked out by default.
5791 MOZ_ARG_ENABLE_BOOL(update-packaging,
5792 [  --enable-update-packaging
5793                            Enable tools/update-packaging],
5794     MOZ_UPDATE_PACKAGING=1,
5795     MOZ_UPDATE_PACKAGING= )
5796 AC_SUBST(MOZ_UPDATE_PACKAGING)
5798 dnl ========================================================
5799 dnl ActiveX
5800 dnl ========================================================
5802 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5803 [  --disable-xpconnect-idispatch
5804                           Disable building of xpconnect support for IDispatch
5805                           (win32 only)],
5806     XPC_IDISPATCH_SUPPORT=,
5807     XPC_IDISPATCH_SUPPORT=1)
5808 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5810 MOZ_ARG_DISABLE_BOOL(activex,
5811 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5812     MOZ_NO_ACTIVEX_SUPPORT=1,
5813     MOZ_NO_ACTIVEX_SUPPORT= )
5814 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5816 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5817 [  --disable-activex-scripting
5818                           Disable building of ActiveX scripting support (win32)],
5819     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5820     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5821 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5823 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5824 then
5825     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5828 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5829 case "$target" in
5830 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5831     if test "$ac_cv_header_atlbase_h" = "no"; then
5832         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.])
5833     fi
5834     ;;
5835 esac
5838 dnl ========================================================
5839 dnl leaky
5840 dnl ========================================================
5841 MOZ_ARG_ENABLE_BOOL(leaky,
5842 [  --enable-leaky          Build leaky memory tool],
5843     MOZ_LEAKY=1,
5844     MOZ_LEAKY=)
5847 dnl ========================================================
5848 dnl xpctools
5849 dnl ========================================================
5850 MOZ_ARG_ENABLE_BOOL(xpctools,
5851 [  --enable-xpctools       Build JS profiling tool],
5852     MOZ_XPCTOOLS=1,
5853     MOZ_XPCTOOLS= )
5856 dnl ========================================================
5857 dnl build the tests by default
5858 dnl ========================================================
5859 MOZ_ARG_DISABLE_BOOL(tests,
5860 [  --disable-tests         Do not build test libraries & programs],
5861     ENABLE_TESTS=,
5862     ENABLE_TESTS=1 )
5864 dnl ========================================================
5865 dnl parental controls (for Windows Vista)
5866 dnl ========================================================
5867 MOZ_ARG_DISABLE_BOOL(parental-controls,
5868 [  --disable-parental-controls
5869                            Do not build parental controls],
5870    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5871    MOZ_DISABLE_PARENTAL_CONTROLS=)
5872 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5873     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5876 dnl ========================================================
5877 dnl Vista SDK specific api
5878 dnl ========================================================
5879 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
5880 [  --disable-vista-sdk-requirements
5881                            Do not build Vista SDK specific code],
5882    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
5883    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
5884 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
5885     AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
5886     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5887     if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5888         AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5889     fi
5890     MOZ_DISABLE_PARENTAL_CONTROLS=1
5891 else
5892 case "$target" in
5893 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5894     if test "$ac_cv_header_wpcapi_h" = "no"; then
5895         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.])
5896     fi
5897     ;;
5898 esac
5900 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5901 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5903 dnl ========================================================
5904 dnl =
5905 dnl = Module specific options
5906 dnl =
5907 dnl ========================================================
5908 MOZ_ARG_HEADER(Individual module options)
5910 dnl ========================================================
5911 dnl = Enable Lea malloc in xpcom. OFF by default.
5912 dnl ========================================================
5913 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
5914 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
5915     XPCOM_USE_LEA=1,
5916     XPCOM_USE_LEA= )
5917 if test -n "$XPCOM_USE_LEA"; then
5918     AC_DEFINE(XPCOM_USE_LEA)
5921 dnl ========================================================
5922 dnl = Enable places (new history/bookmarks)
5923 dnl ========================================================
5924 MOZ_ARG_ENABLE_BOOL(places,
5925 [  --enable-places        Enable 'places' bookmark/history implementation],
5926     MOZ_PLACES=1,
5927     MOZ_PLACES= )
5928 if test -n "$MOZ_PLACES"; then
5929     AC_DEFINE(MOZ_PLACES)
5930     if test -z "$MOZ_MAIL_NEWS"; then
5931       MOZ_MORK=
5932     fi
5933     MOZ_MORKREADER=1
5934 else
5935   if test "$MOZ_BUILD_APP" = "browser"; then
5936     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5937   fi
5940 dnl ========================================================
5941 dnl = Disable feed handling components
5942 dnl ========================================================
5943 MOZ_ARG_DISABLE_BOOL(feeds,
5944 [  --disable-feeds        Disable feed handling and processing components],
5945     MOZ_FEEDS=,
5946     MOZ_FEEDS=1 )
5947 if test -n "$MOZ_FEEDS"; then
5948     AC_DEFINE(MOZ_FEEDS)
5949 else
5950     if test "$MOZ_BUILD_APP" = "browser"; then
5951         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
5952     fi
5955 dnl ========================================================
5956 dnl = Enable mozStorage
5957 dnl ========================================================
5958 dnl Implicitly enabled by default if building calendar or places
5959 MOZ_ARG_ENABLE_BOOL(storage,
5960 [  --enable-storage        Enable mozStorage module and related components],
5961     MOZ_STORAGE=1,
5962     MOZ_STORAGE= )
5963 if test -n "$MOZ_STORAGE"; then
5964     AC_DEFINE(MOZ_STORAGE)
5967 dnl ========================================================
5968 dnl Check for sqlite
5969 dnl ========================================================
5971 MOZ_NATIVE_SQLITE=
5972 MOZ_ARG_ENABLE_BOOL(system-sqlite,
5973 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
5974 MOZ_NATIVE_SQLITE=1,
5975 MOZ_NATIVE_SQLITE= )
5977 if test -z "$MOZ_NATIVE_SQLITE"
5978 then
5979     SQLITE_CFLAGS=
5980     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
5981 else
5982     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
5985 AC_SUBST(MOZ_NATIVE_SQLITE)
5987 dnl = Enable help viewer (off by default)
5988 dnl ========================================================
5989 MOZ_ARG_ENABLE_BOOL(help-viewer,
5990 [  --enable-help-viewer        Enable help viewer],
5991     MOZ_HELP_VIEWER=1,
5992     MOZ_HELP_VIEWER= )
5993 if test -n "$MOZ_HELP_VIEWER"; then
5994      AC_DEFINE(MOZ_HELP_VIEWER)
5996 AC_SUBST(MOZ_HELP_VIEWER)
5998 dnl ========================================================
5999 dnl = Enable safe browsing (anti-phishing)
6000 dnl ========================================================
6001 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6002 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6003     MOZ_SAFE_BROWSING=1,
6004     MOZ_SAFE_BROWSING= )
6005 if test -n "$MOZ_SAFE_BROWSING"; then
6006     AC_DEFINE(MOZ_SAFE_BROWSING)
6008 AC_SUBST(MOZ_SAFE_BROWSING)
6010 dnl ========================================================
6011 dnl = Enable url-classifier
6012 dnl ========================================================
6013 dnl Implicitly enabled by default if building with safe-browsing
6014 if test -n "$MOZ_SAFE_BROWSING"; then
6015     MOZ_URL_CLASSIFIER=1
6017 MOZ_ARG_ENABLE_BOOL(url-classifier,
6018 [  --enable-url-classifier        Enable url classifier module],
6019     MOZ_URL_CLASSIFIER=1,
6020     MOZ_URL_CLASSIFIER= )
6021 if test -n "$MOZ_URL_CLASSIFIER"; then
6022     AC_DEFINE(MOZ_URL_CLASSIFIER)
6024 AC_SUBST(MOZ_URL_CLASSIFIER)
6026 dnl ========================================================
6027 dnl = Disable zipwriter
6028 dnl ========================================================
6029 MOZ_ARG_DISABLE_BOOL(zipwriter,
6030 [  --disable-zipwriter             Disable zipwriter component],
6031     MOZ_ZIPWRITER=,
6032     MOZ_ZIPWRITER=1 )
6033 AC_SUBST(MOZ_ZIPWRITER)
6035 dnl ========================================================
6036 dnl = Enable Ultrasparc specific optimizations for JS
6037 dnl ========================================================
6038 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6039 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6040     JS_ULTRASPARC_OPTS=1,
6041     JS_ULTRASPARC_OPTS= )
6043 dnl only enable option for ultrasparcs
6044 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6045     "$OS_TEST" != "sun4u"; then
6046     JS_ULTRASPARC_OPTS=
6048 AC_SUBST(JS_ULTRASPARC_OPTS)
6050 dnl ========================================================
6051 dnl =
6052 dnl = Feature options that require extra sources to be pulled
6053 dnl =
6054 dnl ========================================================
6055 dnl MOZ_ARG_HEADER(Features that require extra sources)
6057 dnl ========================================================
6058 dnl =
6059 dnl = Debugging Options
6060 dnl = 
6061 dnl ========================================================
6062 MOZ_ARG_HEADER(Debugging and Optimizations)
6064 dnl ========================================================
6065 dnl = Disable building with debug info.
6066 dnl = Debugging is OFF by default
6067 dnl ========================================================
6068 if test -z "$MOZ_DEBUG_FLAGS"
6069 then
6070     case "$target" in
6071     *-irix*)
6072         if test "$GNU_CC"; then
6073             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6074             case "$GCC_VERSION" in
6075             2.95.*)
6076                 MOZ_DEBUG_FLAGS=""
6077                 ;;
6078             *)
6079                 MOZ_DEBUG_FLAGS="-g"
6080                 ;;
6081             esac
6082         else
6083             MOZ_DEBUG_FLAGS="-g"
6084         fi
6085         ;;
6086     *)
6087         MOZ_DEBUG_FLAGS="-g"
6088         ;;
6089     esac
6092 MOZ_ARG_ENABLE_STRING(debug,
6093 [  --enable-debug[=DBG]    Enable building with developer debug info
6094                           (Using compiler flags DBG)],
6095 [ if test "$enableval" != "no"; then
6096     MOZ_DEBUG=1
6097     if test -n "$enableval" && test "$enableval" != "yes"; then
6098         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6099     fi
6100   else
6101     MOZ_DEBUG=
6102   fi ],
6103   MOZ_DEBUG=)
6105 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6106  case "${target_os}" in
6107     beos*)
6108         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6109         ;;
6110     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6111         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6112         ;;
6113     *) 
6114         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6115         ;;
6116   esac
6117 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6119 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6121 if test -n "$MOZ_DEBUG"; then
6122     AC_MSG_CHECKING([for valid debug flags])
6123     _SAVE_CFLAGS=$CFLAGS
6124     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6125     AC_TRY_COMPILE([#include <stdio.h>], 
6126         [printf("Hello World\n");],
6127         _results=yes,
6128         _results=no)
6129     AC_MSG_RESULT([$_results])
6130     if test "$_results" = "no"; then
6131         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6132     fi
6133     CFLAGS=$_SAVE_CFLAGS
6136 dnl ========================================================
6137 dnl = Enable code optimization. ON by default.
6138 dnl ========================================================
6139 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6140         MOZ_OPTIMIZE_FLAGS="-O"
6143 MOZ_ARG_ENABLE_STRING(optimize,
6144 [  --disable-optimize      Disable compiler optimization
6145   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6146 [ if test "$enableval" != "no"; then
6147     MOZ_OPTIMIZE=1
6148     if test -n "$enableval" && test "$enableval" != "yes"; then
6149         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6150         MOZ_OPTIMIZE=2
6151     fi
6152 else
6153     MOZ_OPTIMIZE=
6154 fi ], MOZ_OPTIMIZE=1)
6156 if test "$COMPILE_ENVIRONMENT"; then
6157 if test -n "$MOZ_OPTIMIZE"; then
6158     AC_MSG_CHECKING([for valid optimization flags])
6159     _SAVE_CFLAGS=$CFLAGS
6160     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6161     AC_TRY_COMPILE([#include <stdio.h>], 
6162         [printf("Hello World\n");],
6163         _results=yes,
6164         _results=no)
6165     AC_MSG_RESULT([$_results])
6166     if test "$_results" = "no"; then
6167         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6168     fi
6169     CFLAGS=$_SAVE_CFLAGS
6171 fi # COMPILE_ENVIRONMENT
6173 AC_SUBST(MOZ_OPTIMIZE)
6174 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6175 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6176 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6178 dnl ========================================================
6179 dnl = Enable/disable debug for specific modules only
6180 dnl =   module names beginning with ^ will be disabled 
6181 dnl ========================================================
6182 MOZ_ARG_ENABLE_STRING(debug-modules,
6183 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6184 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6186 dnl ========================================================
6187 dnl = Enable/disable generation of debugger info for specific modules only
6188 dnl =    the special module name ALL_MODULES can be used to denote all modules
6189 dnl =    module names beginning with ^ will be disabled
6190 dnl ========================================================
6191 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6192 [  --enable-debugger-info-modules
6193                           Enable/disable debugger info for specific modules],
6194 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6195       dnl note that the list of module names is reversed as it is copied
6196       dnl this is important, as it will allow config.mk to interpret stuff like
6197       dnl "^ALL_MODULES xpcom" properly
6198       if test "$i" = "no"; then
6199         i="^ALL_MODULES"
6200       fi
6201       if test "$i" = "yes"; then
6202         i="ALL_MODULES"
6203       fi
6204       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6205     done ])
6207 dnl ========================================================
6208 dnl Enable garbage collector
6209 dnl ========================================================
6210 MOZ_ARG_ENABLE_BOOL(boehm,
6211 [  --enable-boehm          Enable the Boehm Garbage Collector],
6212     GC_LEAK_DETECTOR=1,
6213     GC_LEAK_DETECTOR= )
6214 if test -n "$GC_LEAK_DETECTOR"; then
6215     AC_DEFINE(GC_LEAK_DETECTOR)
6218 dnl ========================================================
6219 dnl Disable runtime logging checks
6220 dnl ========================================================
6221 MOZ_ARG_DISABLE_BOOL(logging,
6222 [  --disable-logging       Disable logging facilities],
6223     NS_DISABLE_LOGGING=1,
6224     NS_DISABLE_LOGGING= )
6225 if test "$NS_DISABLE_LOGGING"; then
6226     AC_DEFINE(NS_DISABLE_LOGGING)
6227 else
6228     AC_DEFINE(MOZ_LOGGING)
6231 dnl ========================================================
6232 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6233 dnl ========================================================
6234 _ENABLE_LOGREFCNT=42
6235 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6236 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6237     _ENABLE_LOGREFCNT=1,
6238     _ENABLE_LOGREFCNT= )
6239 if test "$_ENABLE_LOGREFCNT" = "1"; then
6240     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6241 elif test -z "$_ENABLE_LOGREFCNT"; then
6242     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6245 dnl ========================================================
6246 dnl = Enable trace malloc
6247 dnl ========================================================
6248 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6249 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6250 [  --enable-trace-malloc   Enable malloc tracing],
6251     NS_TRACE_MALLOC=1,
6252     NS_TRACE_MALLOC= )
6253 if test "$NS_TRACE_MALLOC"; then
6254   # Please, Mr. Linker Man, don't take away our symbol names
6255   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6256   USE_ELF_DYNSTR_GC=
6257   AC_DEFINE(NS_TRACE_MALLOC)
6259 AC_SUBST(NS_TRACE_MALLOC)
6261 dnl ========================================================
6262 dnl = Enable jemalloc
6263 dnl ========================================================
6264 MOZ_ARG_ENABLE_BOOL(jemalloc,
6265 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6266     MOZ_MEMORY=1,
6267     MOZ_MEMORY=)
6269 if test "$NS_TRACE_MALLOC"; then
6270     MOZ_MEMORY=
6273 if test "$MOZ_MEMORY"; then
6275   dnl Don't try to run compiler tests on Windows  
6276   if test "$OS_ARCH" = "WINNT"; then
6277     if test -z "$HAVE_64BIT_OS"; then
6278       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6279     else
6280       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6281     fi
6282   else
6283     AC_CHECK_SIZEOF([int *], [4])
6284     case "${ac_cv_sizeof_int_p}" in
6285     4)
6286       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6287       ;;
6288     8)
6289       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6290       ;;
6291     *)
6292       AC_MSG_ERROR([Unexpected pointer size])
6293       ;;
6294     esac
6295   fi
6297   AC_DEFINE(MOZ_MEMORY)
6298   if test "x$MOZ_DEBUG" = "x1"; then
6299     AC_DEFINE(MOZ_MEMORY_DEBUG)
6300   fi
6301   dnl The generic feature tests that determine how to compute ncpus are long and
6302   dnl complicated.  Therefore, simply define special cpp variables for the
6303   dnl platforms we have special knowledge of.
6304   case "${target_os}" in
6305   darwin*)
6306     AC_DEFINE(MOZ_MEMORY_DARWIN)
6307     ;;
6308   *-freebsd*)
6309     AC_DEFINE(MOZ_MEMORY_BSD)
6310     ;;
6311   *linux*)
6312     AC_DEFINE(MOZ_MEMORY_LINUX)
6313     ;;
6314   netbsd*)
6315     AC_DEFINE(MOZ_MEMORY_BSD)
6316     ;;
6317   solaris*)
6318     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6319     ;;
6320   msvc*|mks*|cygwin*|mingw*)
6321     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6322     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6323     dnl will fail miserably
6324     if test "$_CC_SUITE" -lt "8"; then
6325         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6326     fi
6327     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6328       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6329         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.])
6330       else
6331         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6332       fi
6333     fi
6334     if test -z "$WIN32_CRT_SRC_DIR"; then
6335       # pre-built dll
6336       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6337       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6338     else
6339       # CRT source directory
6340       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6341       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6342       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6343     fi
6344     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6345     dnl are to avoid m4
6346     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6347     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6348     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6349     dnl This needs to be unix style.
6350     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6351     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6352     AC_DEFINE(_STATIC_CPPLIB)
6353     dnl Don't generate a manifest, since we're linking to a custom CRT.
6354     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6355     dnl Also pass this to NSPR/NSS
6356     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6357     export DLLFLAGS
6358     ;;
6359   *)
6360     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6361     ;;
6362   esac
6364   AC_ARG_WITH([valgrind],
6365     [  --with-valgrind         Enable valgrind integration hooks],
6366     [enable_valgrind="yes"], [enable_valgrind="no"])
6367   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6368   if test "x$enable_valgrind" = "xyes" ; then
6369     AC_DEFINE(MOZ_VALGRIND)
6370   fi
6372 AC_SUBST(MOZ_MEMORY)
6373 AC_SUBST(WIN32_CRT_SRC_DIR)
6374 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6375 AC_SUBST(MOZ_LIB)
6376 AC_SUBST(MOZ_PATH)
6377 dnl Need to set this for make because NSS doesn't have configure
6378 AC_SUBST(DLLFLAGS)
6380 dnl ========================================================
6381 dnl = Use malloc wrapper lib
6382 dnl ========================================================
6383 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6384 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6385     _WRAP_MALLOC=1,
6386     _WRAP_MALLOC= )
6388 if test -n "$_WRAP_MALLOC"; then
6389     if test "$GNU_CC"; then
6390     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"
6391     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6392     fi
6395 dnl ========================================================
6396 dnl = Location of malloc wrapper lib
6397 dnl ========================================================
6398 MOZ_ARG_WITH_STRING(wrap-malloc,
6399 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6400     WRAP_MALLOC_LIB=$withval)
6402 dnl ========================================================
6403 dnl = Use Electric Fence
6404 dnl ========================================================
6405 MOZ_ARG_ENABLE_BOOL(efence,
6406 [  --enable-efence         Link with Electric Fence],
6407     _ENABLE_EFENCE=1,
6408     _ENABLE_EFENCE= )
6409 if test -n "$_ENABLE_EFENCE"; then
6410     AC_CHECK_LIB(efence,malloc)
6413 dnl ========================================================
6414 dnl jprof
6415 dnl ========================================================
6416 MOZ_ARG_ENABLE_BOOL(jprof,
6417 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6418     MOZ_JPROF=1,
6419     MOZ_JPROF= )
6420 if test -n "$MOZ_JPROF"; then
6421     AC_DEFINE(MOZ_JPROF)
6424 dnl ========================================================
6425 dnl shark
6426 dnl ========================================================
6427 MOZ_ARG_ENABLE_BOOL(shark,
6428 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6429     MOZ_SHARK=1,
6430     MOZ_SHARK= )
6431 if test -n "$MOZ_SHARK"; then
6432     AC_DEFINE(MOZ_SHARK)
6435 dnl ========================================================
6436 dnl = Enable static checking using gcc-dehydra
6437 dnl ========================================================
6439 MOZ_ARG_WITH_STRING(static-checking,
6440 [  --with-static-checking=path/to/gcc_dehydra.so
6441                             Enable static checking of code using GCC-dehydra],
6442     DEHYDRA_PATH=$withval,
6443     DEHYDRA_PATH= )
6445 if test -n "$DEHYDRA_PATH"; then
6446     if ! test -f "$DEHYDRA_PATH"; then
6447         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6448     fi
6449     AC_DEFINE(NS_STATIC_CHECKING)
6451 AC_SUBST(DEHYDRA_PATH)
6453 dnl ========================================================
6454 dnl = Enable stripping of libs & executables
6455 dnl ========================================================
6456 MOZ_ARG_ENABLE_BOOL(strip,
6457 [  --enable-strip          Enable stripping of libs & executables ],
6458     ENABLE_STRIP=1,
6459     ENABLE_STRIP= )
6461 dnl ========================================================
6462 dnl = Enable stripping of libs & executables when packaging
6463 dnl ========================================================
6464 MOZ_ARG_ENABLE_BOOL(install-strip,
6465 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6466     PKG_SKIP_STRIP= ,
6467     PKG_SKIP_STRIP=1)
6469 dnl ========================================================
6470 dnl = --enable-elf-dynstr-gc
6471 dnl ========================================================
6472 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6473 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6474     USE_ELF_DYNSTR_GC=1,
6475     USE_ELF_DYNSTR_GC= )
6477 dnl ========================================================
6478 dnl = --enable-old-abi-compat-wrappers
6479 dnl ========================================================
6480 dnl on x86 linux, the current builds of some popular plugins (notably
6481 dnl flashplayer and real) expect a few builtin symbols from libgcc
6482 dnl which were available in some older versions of gcc.  However,
6483 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6484 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6485 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6486 dnl to true on x86 linux, and false everywhere else.
6489 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6490 [  --enable-old-abi-compat-wrappers
6491                           Support old GCC ABI symbols to ease the pain 
6492                           of the linux compiler change],
6493     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6494     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6495 if test "$COMPILE_ENVIRONMENT"; then
6496 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6497     AC_LANG_SAVE
6498     AC_LANG_CPLUSPLUS
6499     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6500     AC_LANG_RESTORE
6501     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6503 fi # COMPILE_ENVIRONMENT
6505 dnl ========================================================
6506 dnl = --enable-prebinding
6507 dnl ========================================================
6508 MOZ_ARG_ENABLE_BOOL(prebinding,
6509 [  --enable-prebinding     Enable prebinding (Mac OS X only)],
6510     USE_PREBINDING=1,
6511     USE_PREBINDING= )
6513 dnl ========================================================
6514 dnl = 
6515 dnl = Profiling and Instrumenting
6516 dnl = 
6517 dnl ========================================================
6518 MOZ_ARG_HEADER(Profiling and Instrumenting)
6520 dnl ========================================================
6521 dnl = Enable timeline service, which provides lightweight
6522 dnl = instrumentation of mozilla for performance measurement.
6523 dnl = Timeline is off by default.
6524 dnl ========================================================
6525 MOZ_ARG_ENABLE_BOOL(timeline,
6526 [  --enable-timeline       Enable timeline services ],
6527     MOZ_TIMELINE=1,
6528     MOZ_TIMELINE= )
6529 if test -n "$MOZ_TIMELINE"; then
6530     AC_DEFINE(MOZ_TIMELINE)
6533 dnl ========================================================
6534 dnl Turn on reflow counting
6535 dnl ========================================================
6536 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6537 [  --enable-reflow-perf    Enable reflow performance tracing],
6538     MOZ_REFLOW_PERF=1,
6539     MOZ_REFLOW_PERF= )
6540 if test -n "$MOZ_REFLOW_PREF"; then
6541     AC_DEFINE(MOZ_REFLOW_PREF)
6543 AC_SUBST(MOZ_REFLOW_PERF)
6545 dnl ========================================================
6546 dnl Enable performance metrics.
6547 dnl ========================================================
6548 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6549 [  --enable-perf-metrics   Enable performance metrics],
6550     MOZ_PERF_METRICS=1,
6551     MOZ_PERF_METRICS= )
6552 if test -n "$MOZ_PERF_METRICS"; then
6553     AC_DEFINE(MOZ_PERF_METRICS)
6556 dnl ========================================================
6557 dnl Enable code size metrics.
6558 dnl ========================================================
6559 MOZ_ARG_ENABLE_BOOL(codesighs,
6560 [  --enable-codesighs      Enable code size analysis tools],
6561     _ENABLE_CODESIGHS=1,
6562     _ENABLE_CODESIGHS= )
6563 if test -n "$_ENABLE_CODESIGHS"; then
6564     if test -d $srcdir/tools/codesighs; then 
6565         MOZ_MAPINFO=1
6566     else
6567         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6568     fi
6571 dnl ========================================================
6572 dnl = Add support for Eazel profiler
6573 dnl ========================================================
6574 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6575 [  --enable-eazel-profiler-support
6576                           Enable Corel/Eazel profiler support],
6577     ENABLE_EAZEL_PROFILER=1,
6578     ENABLE_EAZEL_PROFILER= )
6579 if test -n "$ENABLE_EAZEL_PROFILER"; then
6580     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6581     USE_ELF_DYNSTR_GC=
6582     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6583     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6584     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6587 MOZ_ARG_ENABLE_STRING(profile-modules,
6588 [  --enable-profile-modules
6589                           Enable/disable profiling for specific modules],
6590 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6592 MOZ_ARG_ENABLE_BOOL(insure,
6593 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6594     _ENABLE_INSURE=1,
6595     _ENABLE_INSURE= )
6596 if test -n "$_ENABLE_INSURE"; then
6597     MOZ_INSURE="insure"
6598     MOZ_INSURIFYING=1
6599     MOZ_INSURE_DIRS="."
6600     MOZ_INSURE_EXCLUDE_DIRS="config"
6603 MOZ_ARG_WITH_STRING(insure-dirs,
6604 [  --with-insure-dirs=DIRS
6605                           Dirs to instrument with insure ],
6606     MOZ_INSURE_DIRS=$withval )
6608 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6609 [  --with-insure-exclude-dirs=DIRS
6610                           Dirs to not instrument with insure ],
6611     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6613 dnl ========================================================
6614 dnl = Support for Quantify (Windows)
6615 dnl ========================================================
6616 MOZ_ARG_ENABLE_BOOL(quantify,
6617 [  --enable-quantify      Enable Quantify support (Windows only) ],
6618     MOZ_QUANTIFY=1,
6619     MOZ_QUANTIFY= )
6621 dnl ========================================================
6622 dnl = Support for demangling undefined symbols
6623 dnl ========================================================
6624 if test -z "$SKIP_LIBRARY_CHECKS"; then
6625     AC_LANG_SAVE
6626     AC_LANG_CPLUSPLUS
6627     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6628     AC_LANG_RESTORE
6631 # Demangle only for debug or trace-malloc builds
6632 MOZ_DEMANGLE_SYMBOLS=
6633 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6634     MOZ_DEMANGLE_SYMBOLS=1
6635     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6637 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6639 dnl ========================================================
6640 dnl = Support for gcc stack unwinding (from gcc 3.3)
6641 dnl ========================================================
6642 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6643     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6646 dnl ========================================================
6647 dnl =
6648 dnl = Misc. Options
6649 dnl = 
6650 dnl ========================================================
6651 MOZ_ARG_HEADER(Misc. Options)
6653 dnl ========================================================
6654 dnl update xterm title
6655 dnl ========================================================
6656 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6657 [  --enable-xterm-updates  Update XTERM titles with current command.],
6658     MOZ_UPDATE_XTERM=1,
6659     MOZ_UPDATE_XTERM= )
6661 dnl =========================================================
6662 dnl = Chrome format
6663 dnl =========================================================
6664 MOZ_ARG_ENABLE_STRING([chrome-format],
6665 [  --enable-chrome-format=jar|flat|both|symlink
6666                           Select FORMAT of chrome files (default=jar)],
6667     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6669 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6670     MOZ_CHROME_FILE_FORMAT=jar
6673 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6674     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6675     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6676     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6677     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6680 dnl ========================================================
6681 dnl = Define default location for MOZILLA_FIVE_HOME
6682 dnl ========================================================
6683 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6684 [  --with-default-mozilla-five-home
6685                           Set the default value for MOZILLA_FIVE_HOME],
6686 [ val=`echo $withval`
6687   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6689 dnl ========================================================
6690 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6691 dnl ========================================================
6692 MOZ_ARG_WITH_STRING(user-appdir,
6693 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6694 [ val=`echo $withval`
6695 if echo "$val" | grep "\/" >/dev/null; then
6696     AC_MSG_ERROR("Homedir must be single relative path.")
6697 else 
6698     MOZ_USER_DIR="$val"
6699 fi])
6701 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6703 dnl ========================================================
6704 dnl = Doxygen configuration
6705 dnl ========================================================
6706 dnl Use commas to specify multiple dirs to this arg
6707 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6708 MOZ_ARG_WITH_STRING(doc-input-dirs,
6709 [  --with-doc-input-dirs=DIRS
6710                           Header/idl dirs to create docs from],
6711 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6712 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6714 dnl Use commas to specify multiple dirs to this arg
6715 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6716 MOZ_ARG_WITH_STRING(doc-include-dirs,
6717 [  --with-doc-include-dirs=DIRS  
6718                           Include dirs to preprocess doc headers],
6719 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6720 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6722 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6723 MOZ_ARG_WITH_STRING(doc-output-dir,
6724 [  --with-doc-output-dir=DIR
6725                           Dir to generate docs into],
6726 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6727 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6729 if test -z "$SKIP_COMPILER_CHECKS"; then
6730 dnl ========================================================
6731 dnl =
6732 dnl = Compiler Options
6733 dnl = 
6734 dnl ========================================================
6735 MOZ_ARG_HEADER(Compiler Options)
6737 dnl ========================================================
6738 dnl Check for gcc -pipe support
6739 dnl ========================================================
6740 AC_MSG_CHECKING([for gcc -pipe support])
6741 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6742     echo '#include <stdio.h>' > dummy-hello.c
6743     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6744     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6745     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6746     if test $? = 0; then
6747         _res_as_stdin="yes"
6748     else
6749         _res_as_stdin="no"
6750     fi
6751     if test "$_res_as_stdin" = "yes"; then
6752         _SAVE_CFLAGS=$CFLAGS
6753         CFLAGS="$CFLAGS -pipe"
6754         AC_TRY_COMPILE( [ #include <stdio.h> ],
6755             [printf("Hello World\n");],
6756             [_res_gcc_pipe="yes"],
6757             [_res_gcc_pipe="no"] )
6758         CFLAGS=$_SAVE_CFLAGS
6759     fi
6760     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6761         _res="yes";
6762         CFLAGS="$CFLAGS -pipe"
6763         CXXFLAGS="$CXXFLAGS -pipe"
6764     else
6765         _res="no"
6766     fi
6767     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6768     AC_MSG_RESULT([$_res])
6769 else
6770     AC_MSG_RESULT([no])
6773 dnl pass -Wno-long-long to the compiler
6774 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6775 [  --enable-long-long-warning 
6776                           Warn about use of non-ANSI long long type],
6777     _IGNORE_LONG_LONG_WARNINGS=,
6778     _IGNORE_LONG_LONG_WARNINGS=1)
6780 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6781      _SAVE_CFLAGS="$CFLAGS"
6782      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6783      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6784      AC_TRY_COMPILE([], [return(0);], 
6785         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6786           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6787           result="yes" ], result="no")
6788      AC_MSG_RESULT([$result])
6789      CFLAGS="$_SAVE_CFLAGS"
6792 dnl ========================================================
6793 dnl Profile guided optimization
6794 dnl ========================================================
6795 dnl Test for profiling options
6796 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6797 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6799 dnl Provide a switch to disable PGO even when called via profiledbuild.
6800 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6801 [  --disable-profile-guided-optimization
6802                            Don't build with PGO even if called via make profiledbuild],
6803 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6804 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6806 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6808 _SAVE_CFLAGS="$CFLAGS"
6809 CFLAGS="$CFLAGS -fprofile-generate"
6811 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6812 AC_TRY_COMPILE([], [return 0;],
6813                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6814                  result="yes" ], result="no")
6815 AC_MSG_RESULT([$result])
6817 if test $result = "yes"; then
6818   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6819   PROFILE_USE_CFLAGS="-fprofile-use"
6820   PROFILE_USE_LDFLAGS="-fprofile-use"
6821 else
6822   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6823   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6824   AC_TRY_COMPILE([], [return 0;],
6825                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6826                    result="yes" ], result="no")
6827   AC_MSG_RESULT([$result])
6828   if test $result = "yes"; then
6829     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6830   fi
6831   # don't really care, this is an old GCC
6832   PROFILE_GEN_LDFLAGS=
6833   PROFILE_USE_LDFLAGS=
6836 CFLAGS="$_SAVE_CFLAGS"
6838 if test -n "$INTEL_CC"; then
6839   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6840   PROFILE_GEN_LDFLAGS=
6841   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6842   PROFILE_USE_LDFLAGS=
6845 dnl Sun Studio on Solaris
6846 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6847   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6848   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6849   if test "$CPU_ARCH" != "sparc"; then
6850     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6851     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6852   else
6853     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6854     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6855   fi
6858 AC_SUBST(PROFILE_GEN_CFLAGS)
6859 AC_SUBST(PROFILE_GEN_LDFLAGS)
6860 AC_SUBST(PROFILE_USE_CFLAGS)
6861 AC_SUBST(PROFILE_USE_LDFLAGS)
6863 AC_LANG_CPLUSPLUS
6865 dnl ========================================================
6866 dnl Test for -pedantic bustage
6867 dnl ========================================================
6868 MOZ_ARG_DISABLE_BOOL(pedantic,
6869 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6870 _PEDANTIC= )
6871 if test "$_PEDANTIC"; then
6872     _SAVE_CXXFLAGS=$CXXFLAGS
6873     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6874     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6875     AC_TRY_COMPILE([$configure_static_assert_macros],
6876                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6877                    result="no", result="yes" )
6878     AC_MSG_RESULT([$result])
6879     CXXFLAGS="$_SAVE_CXXFLAGS"
6881     case "$result" in
6882     no)
6883         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6884         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6885         ;;
6886     yes)
6887         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
6888         ;;
6889     esac
6892 dnl ========================================================
6893 dnl Test for correct temporary object destruction order
6894 dnl ========================================================
6895 dnl We want to make sure the compiler follows the C++ spec here as 
6896 dnl xpcom and the string classes depend on it (bug 235381).
6897 AC_MSG_CHECKING([for correct temporary object destruction order])
6898 AC_TRY_RUN([ class A {
6899              public:  A(int& x) : mValue(x) {}
6900                       ~A() { mValue--; }
6901                       operator char**() { return 0; }
6902              private:  int& mValue;
6903              };
6904              void func(char **arg) {}
6905              int m=2;
6906              void test() {
6907                   func(A(m));
6908                   if (m==1) m = 0;
6909              }
6910              int main() {
6911                  test();
6912                  return(m);
6913              }
6914              ],
6915      result="yes", result="no", result="maybe")
6916 AC_MSG_RESULT([$result])
6918 if test "$result" = "no"; then
6919     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
6922 dnl ========================================================
6923 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
6924 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
6925 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
6926 dnl ========================================================
6927 _SAVE_CXXFLAGS=$CXXFLAGS
6928 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
6929 AC_CACHE_CHECK(for correct overload resolution with const and templates,
6930     ac_nscap_nonconst_opeq_bug,
6931     [AC_TRY_COMPILE([
6932                       template <class T>
6933                       class Pointer
6934                         {
6935                         public:
6936                           T* myPtr;
6937                         };
6938                       
6939                       template <class T, class U>
6940                       int operator==(const Pointer<T>& rhs, U* lhs)
6941                         {
6942                           return rhs.myPtr == lhs;
6943                         }
6944                       
6945                       template <class T, class U>
6946                       int operator==(const Pointer<T>& rhs, const U* lhs)
6947                         {
6948                           return rhs.myPtr == lhs;
6949                         }
6950                     ],
6951                     [
6952                       Pointer<int> foo;
6953                       const int* bar;
6954                       return foo == bar;
6955                     ],
6956                     ac_nscap_nonconst_opeq_bug="no",
6957                     ac_nscap_nonconst_opeq_bug="yes")])
6958 CXXFLAGS="$_SAVE_CXXFLAGS"
6960 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
6961     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
6963 fi # SKIP_COMPILER_CHECKS
6965 dnl ========================================================
6966 dnl C++ rtti
6967 dnl Should be smarter and check that the compiler does indeed have rtti
6968 dnl ========================================================
6969 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
6970 [  --enable-cpp-rtti       Enable C++ RTTI ],
6971 [ _MOZ_USE_RTTI=1 ],
6972 [ _MOZ_USE_RTTI= ])
6974 if test "$_MOZ_USE_RTTI"; then
6975    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
6976 else
6977    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
6980 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
6982 dnl ========================================================
6983 dnl C++ exceptions (g++/egcs only - for now)
6984 dnl Should be smarter and check that the compiler does indeed have exceptions
6985 dnl ========================================================
6986 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
6987 [  --enable-cpp-exceptions Enable C++ exceptions ],
6988 [ _MOZ_CPP_EXCEPTIONS=1 ],
6989 [ _MOZ_CPP_EXCEPTIONS= ])
6991 if test "$_MOZ_CPP_EXCEPTIONS"; then
6992     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
6993 else
6994     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
6997 # Irix & OSF native compilers do not like exception declarations 
6998 # when exceptions are disabled
6999 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7000     AC_DEFINE(CPP_THROW_NEW, [])
7001 else
7002     AC_DEFINE(CPP_THROW_NEW, [throw()])
7004 AC_LANG_C
7006 dnl ========================================================
7007 dnl =
7008 dnl = Build depencency options
7009 dnl =
7010 dnl ========================================================
7011 MOZ_ARG_HEADER(Build dependencies)
7013 dnl ========================================================
7014 dnl = Do not auto generate dependency info
7015 dnl ========================================================
7016 MOZ_AUTO_DEPS=1
7017 MOZ_ARG_DISABLE_BOOL(auto-deps,
7018 [  --disable-auto-deps     Do not automatically generate dependency info],
7019     MOZ_AUTO_DEPS=,
7020     MOZ_AUTO_DEPS=1)
7022 if test -n "$MOZ_AUTO_DEPS"; then
7023 dnl ========================================================
7024 dnl = Use mkdepend instead of $CC -MD for dependency generation
7025 dnl ========================================================
7026 _cpp_md_flag=
7027 MOZ_ARG_DISABLE_BOOL(md,
7028 [  --disable-md            Do not use compiler-based dependencies ],
7029   [_cpp_md_flag=],
7030   [_cpp_md_flag=1],
7031   [dnl Default is to turn on -MD if using GNU-compatible compilers
7032    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7033      _cpp_md_flag=1
7034    fi
7035   dnl Default is to use -xM if using Sun Studio on Solaris
7036    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7037      _cpp_md_flag=1
7038    fi])
7039 if test "$_cpp_md_flag"; then
7040   COMPILER_DEPEND=1
7041   if test "$OS_ARCH" = "OpenVMS"; then
7042     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(*F).pp))'
7043   else
7044     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(*F).pp)'
7045   fi
7046   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7047   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7048     _DEPEND_CFLAGS=
7049   fi
7050 else
7051   COMPILER_DEPEND=
7052   _USE_CPP_INCLUDE_FLAG=
7053   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7054   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7056 fi # MOZ_AUTO_DEPS
7057 MDDEPDIR='.deps'
7058 AC_SUBST(MOZ_AUTO_DEPS)
7059 AC_SUBST(COMPILER_DEPEND)
7060 AC_SUBST(MDDEPDIR)
7063 dnl ========================================================
7064 dnl =
7065 dnl = Static Build Options
7066 dnl =
7067 dnl ========================================================
7068 MOZ_ARG_HEADER(Static build options)
7070 MOZ_ARG_ENABLE_BOOL(static,
7071 [  --enable-static         Enable building of internal static libs],
7072     BUILD_STATIC_LIBS=1,
7073     BUILD_STATIC_LIBS=)
7075 dnl Disable libxul in debug builds, but not for xulrunner.
7076 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7077    MOZ_ENABLE_LIBXUL=
7080 MOZ_ARG_ENABLE_BOOL(libxul,
7081 [  --enable-libxul         Enable building of libxul],
7082     MOZ_ENABLE_LIBXUL=1,
7083     MOZ_ENABLE_LIBXUL=)
7085 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7086         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7089 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
7090         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
7093 if test -n "$MOZ_ENABLE_LIBXUL"; then
7094     XPCOM_LIBS="$LIBXUL_LIBS"
7095     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7096 else
7097     if test -n "$BUILD_STATIC_LIBS"; then
7098         AC_DEFINE(MOZ_STATIC_BUILD)
7099     fi
7100     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7103 dnl ========================================================
7104 dnl = Force JS to be a static lib
7105 dnl ========================================================
7106 MOZ_ARG_ENABLE_BOOL(js-static-build,
7107 [  --enable-js-static-build  Force js to be a static lib],
7108     JS_STATIC_BUILD=1,
7109     JS_STATIC_BUILD= )
7111 AC_SUBST(JS_STATIC_BUILD)
7112         
7113 if test -n "$JS_STATIC_BUILD"; then
7114     AC_DEFINE(EXPORT_JS_API)
7116 if test -z "$BUILD_STATIC_LIBS"; then
7117     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
7122 dnl Disable static mail in debug builds, but not with libxul sdk.
7123 if test -n "$MOZ_DEBUG" -a -z "$LIBXUL_SDK"; then
7124    MOZ_STATIC_MAIL_BUILD=
7126 MOZ_ARG_ENABLE_BOOL(static-mail,
7127 [  --enable-static-mail Enable static mail build support],
7128     MOZ_STATIC_MAIL_BUILD=1,
7129     MOZ_STATIC_MAIL_BUILD= )
7131 if test "$MOZ_STATIC_MAIL_BUILD"; then
7132     AC_DEFINE(MOZ_STATIC_MAIL_BUILD)
7135 AC_SUBST(MOZ_STATIC_MAIL_BUILD)
7137 dnl ========================================================
7138 dnl =
7139 dnl = Standalone module options
7140 dnl = 
7141 dnl ========================================================
7142 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7144 dnl Check for GLib and libIDL.
7145 dnl ========================================================
7146 case "$target_os" in
7147 msvc*|mks*|cygwin*|mingw*|wince*)
7148     SKIP_IDL_CHECK="yes"
7149     ;;
7151     SKIP_IDL_CHECK="no"
7152     ;;
7153 esac
7155 if test -z "$COMPILE_ENVIRONMENT"; then
7156     SKIP_IDL_CHECK="yes"
7159 dnl = Allow users to disable libIDL checking for standalone modules
7160 MOZ_ARG_WITHOUT_BOOL(libIDL,
7161 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7162         SKIP_IDL_CHECK="yes")
7164 if test "$SKIP_IDL_CHECK" = "no"
7165 then
7166     _LIBIDL_FOUND=
7167     if test "$MACOS_SDK_DIR"; then 
7168       dnl xpidl, and therefore libIDL, is only needed on the build host.
7169       dnl Don't build it against the SDK, as that causes problems.
7170       _MACSAVE_CFLAGS="$CFLAGS"
7171       _MACSAVE_LIBS="$LIBS"
7172       _MACSAVE_LDFLAGS="$LDFLAGS"
7173       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7174       changequote(,)
7175       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"`
7176       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7177       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7178       changequote([,])
7179       unset NEXT_ROOT
7180     fi
7182     if test "$MOZ_ENABLE_GTK2"; then
7183         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7184     fi
7185     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7186     dnl to either libIDL1 or libIDL2.
7187     if test -z "$_LIBIDL_FOUND"; then
7188         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7189         if test -z "$_LIBIDL_FOUND"; then
7190             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7191         fi
7192     fi
7193     dnl
7194     dnl If we don't have a libIDL config program & not cross-compiling, 
7195     dnl     look for orbit-config instead.
7196     dnl
7197     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7198         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7199         if test -n "$ORBIT_CONFIG"; then
7200             AC_MSG_CHECKING([for ORBit libIDL usability])
7201                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7202             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7203             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7204             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7205             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7206             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7207             LIBIDL_CONFIG=
7208             _SAVE_CFLAGS="$CFLAGS"
7209             _SAVE_LIBS="$LIBS"
7210             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7211             LIBS="$LIBIDL_LIBS $LIBS"
7212             AC_TRY_RUN([
7213 #include <stdlib.h>
7214 #include <libIDL/IDL.h>
7215 int main() {
7216   char *s;
7217   s=strdup(IDL_get_libver_string());
7218   if(s==NULL) {
7219     exit(1);
7220   }
7221   exit(0);
7223             ], [_LIBIDL_FOUND=1
7224                 result="yes"],
7225                [LIBIDL_CFLAGS=
7226                 LIBIDL_LIBS=
7227                 result="no"],
7228                [_LIBIDL_FOUND=1
7229                 result="maybe"] )
7230             AC_MSG_RESULT($result)
7231             CFLAGS="$_SAVE_CFLAGS"
7232             LIBS="$_SAVE_LIBS"
7233         fi
7234     fi
7235     if test -z "$_LIBIDL_FOUND"; then
7236         AC_MSG_ERROR([libIDL not found.
7237         libIDL $LIBIDL_VERSION or higher is required.])
7238     fi
7239     if test "$MACOS_SDK_DIR"; then
7240       CFLAGS="$_MACSAVE_CFLAGS"
7241       LIBS="$_MACSAVE_LIBS"
7242       LDFLAGS="$_MACSAVE_LDFLAGS"
7243       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7244         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7245       fi
7246     fi
7249 if test -n "$CROSS_COMPILE"; then
7250      if test -z "$HOST_LIBIDL_CONFIG"; then
7251         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7252     fi
7253     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7254         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7255         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7256     else
7257         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7258         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7259     fi
7262 if test -z "$SKIP_PATH_CHECKS"; then
7263 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7264     PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7268 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7269     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7272 AC_SUBST(LIBIDL_CFLAGS)
7273 AC_SUBST(LIBIDL_LIBS)
7274 AC_SUBST(STATIC_LIBIDL)
7275 AC_SUBST(GLIB_CFLAGS)
7276 AC_SUBST(GLIB_LIBS)
7277 AC_SUBST(GLIB_GMODULE_LIBS)
7278 AC_SUBST(HOST_LIBIDL_CONFIG)
7279 AC_SUBST(HOST_LIBIDL_CFLAGS)
7280 AC_SUBST(HOST_LIBIDL_LIBS)
7282 dnl ========================================================
7283 dnl Check for libart
7284 dnl ========================================================
7285 if test "$MOZ_SVG_RENDERER_LIBART"; then
7286   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
7287     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
7288 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
7289   fi
7291   dnl libart's configure hasn't been run yet, but we know what the
7292   dnl answer should be anyway
7293   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
7294   case "$target_os" in
7295   msvc*|mks*|cygwin*|mingw*|wince*)
7296       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
7297       ;;
7298   os2*)
7299       MOZ_LIBART_LIBS='-lmoz_art -lm'
7300       ;;
7301   beos*)
7302       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
7303       ;;
7304   *)
7305       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
7306       ;;
7307   esac
7308   AC_FUNC_ALLOCA
7311 AC_SUBST(MOZ_LIBART_CFLAGS)
7312 AC_SUBST(MOZ_LIBART_LIBS)
7314 dnl ========================================================
7315 dnl Check for cairo
7316 dnl ========================================================
7317 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7319 MOZ_TREE_CAIRO=1
7320 MOZ_ARG_ENABLE_BOOL(system-cairo,
7321 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7322 MOZ_TREE_CAIRO=,
7323 MOZ_TREE_CAIRO=1 )
7325 # Check for headers defining standard int types.
7326 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7328 if test "$MOZ_TREE_CAIRO"; then
7329     AC_DEFINE(MOZ_TREE_CAIRO)
7331     # For now we assume that we will have a uint64_t available through
7332     # one of the above headers or mozstdint.h.
7333     AC_DEFINE(HAVE_UINT64_T)
7335     # Define macros for cairo-features.h
7336     if test "$MOZ_X11"; then
7337         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7338         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7339         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7340         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7341         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7342         MOZ_ENABLE_CAIRO_FT=1
7343         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7344     fi
7345     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7346         QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7347     fi
7348     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7349         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7350         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7351         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7352     fi
7353     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7354         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7355         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7356         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7357     fi
7358     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7359         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7360         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7361         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7362         MOZ_ENABLE_CAIRO_FT=1
7363         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7364         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7365     fi
7366     if test "$MOZ_ENABLE_GLITZ"; then
7367         GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
7368     fi
7369     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7370         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7371         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7372         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7373         MOZ_ENABLE_CAIRO_FT=1
7374     fi
7375     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7376     AC_SUBST(CAIRO_FT_CFLAGS)
7378     if test "$MOZ_DEBUG"; then
7379       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7380     else
7381       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7382     fi
7384     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7386     AC_SUBST(PS_SURFACE_FEATURE)
7387     AC_SUBST(PDF_SURFACE_FEATURE)
7388     AC_SUBST(SVG_SURFACE_FEATURE)
7389     AC_SUBST(XLIB_SURFACE_FEATURE)
7390     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7391     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7392     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7393     AC_SUBST(XCB_SURFACE_FEATURE)
7394     AC_SUBST(WIN32_SURFACE_FEATURE)
7395     AC_SUBST(OS2_SURFACE_FEATURE)
7396     AC_SUBST(BEOS_SURFACE_FEATURE)
7397     AC_SUBST(GLITZ_SURFACE_FEATURE)
7398     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7399     AC_SUBST(FT_FONT_FEATURE)
7400     AC_SUBST(WIN32_FONT_FEATURE)
7401     AC_SUBST(QUARTZ_FONT_FEATURE)
7402     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7403     AC_SUBST(QPAINTER_SURFACE_FEATURE)
7405     if test "$_WIN32_MSVC"; then
7406         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7407         if test "$MOZ_ENABLE_GLITZ"; then
7408             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
7409         fi
7410     else
7411         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"
7413         if test "$MOZ_X11"; then
7414             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7415         fi
7417         if test "$MOZ_ENABLE_GLITZ"; then
7418             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
7419             if test "$MOZ_X11"; then
7420                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
7421             fi
7422             if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7423                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
7424             fi
7425         fi
7426     fi
7427 else
7428    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7429    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7430    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7431    if test "$MOZ_X11"; then
7432         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7433         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7434         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7435    fi
7438 AC_SUBST(MOZ_TREE_CAIRO)
7439 AC_SUBST(MOZ_CAIRO_CFLAGS)
7440 AC_SUBST(MOZ_CAIRO_LIBS)
7442 dnl ========================================================
7443 dnl Check for lcms
7444 dnl ========================================================
7446 MOZ_NATIVE_LCMS=
7447 MOZ_ARG_ENABLE_BOOL(system-lcms,
7448 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7449 MOZ_NATIVE_LCMS=1,
7450 MOZ_NATIVE_LCMS= )
7452 if test -z "$MOZ_NATIVE_LCMS"
7453 then
7454     LCMS_CFLAGS=
7455     if test "$_WIN32_MSVC"; then
7456         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7457             LCMS_CFLAGS=-DLCMS_DLL
7458         fi
7459         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7460     else
7461         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7462     fi
7463 else
7464     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7467 AC_SUBST(MOZ_NATIVE_LCMS)
7468 AC_SUBST(LCMS_CFLAGS)
7469 AC_SUBST(LCMS_LIBS)
7471 dnl ========================================================
7472 dnl disable xul
7473 dnl ========================================================
7474 MOZ_ARG_DISABLE_BOOL(xul,
7475 [  --disable-xul           Disable XUL],
7476     MOZ_XUL= )
7477 if test "$MOZ_XUL"; then
7478   AC_DEFINE(MOZ_XUL)
7479 else
7480   dnl remove extensions that require XUL
7481   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7484 AC_SUBST(MOZ_XUL)
7486 dnl ========================================================
7487 dnl Two ways to enable Python support:
7488 dnl   --enable-extensions=python # select all available.
7489 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7490 dnl or:
7491 dnl   --enable-extensions=python/xpcom,... # select individual ones
7493 dnl If either is used, we locate the Python to use.
7494 dnl ========================================================
7496 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7497 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7498     dnl Allow PYTHON to point to the Python interpreter to use
7499     dnl (note that it must be the python executable - which we
7500     dnl run to locate the relevant paths etc)
7501     dnl If not set, we use whatever Python we can find.
7502     MOZ_PYTHON=$PYTHON
7503     dnl Ask Python what its version number is
7504     changequote(,)
7505     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7506     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7507     changequote([,])
7508     dnl Ask for the Python "prefix" (ie, home/source dir)
7509     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7510     dnl Setup the include and library directories.
7511     if test "$OS_ARCH" = "WINNT"; then
7512         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7513         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7514         dnl Binary trees have "include" for .h, and "libs" for .lib
7515         dnl We add 'em both - along with quotes, to handle spaces.
7516         MOZ_PYTHON_DLL_SUFFIX=.pyd
7517         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7518         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7519     else
7520         dnl Non-Windows include and libs
7521         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7522         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7523         dnl Check for dynamic Python lib
7524         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7525         dnl - core, xpcom loader, pydom etc) all need to share Python.
7526         dnl - Python 2.3's std --enable-shared configure option will
7527         dnl   create a libpython2.3.so.1.0. We should first try this
7528         dnl   dotted versioned .so file because this is the one that
7529         dnl   the PyXPCOM build mechanics tries to link to.
7530         dnl   XXX Should find a better way than hardcoding "1.0".
7531         dnl - Python developement tree dir layouts are NOT allowed here
7532         dnl   because the PyXPCOM build just dies on it later anyway.
7533         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7534         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7535             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7536         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7537             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7538         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7539             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7540         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7541             dnl Don't Python development tree directory layout.
7542             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7543             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.])
7544         elif test "$OS_ARCH" = "Darwin"; then
7545             dnl We do Darwin last, so if a custom non-framework build of
7546             dnl python is used on OSX, then it will be picked up first by
7547             dnl the logic above.
7548             MOZ_PYTHON_LIBS="-framework Python"
7549         else
7550             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7551         fi
7552         if test "$OS_ARCH" = "Linux"; then
7553             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7554         fi
7555     fi
7556     dnl Handle "_d" on Windows
7557     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7558         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7559     else
7560         MOZ_PYTHON_DEBUG_SUFFIX=
7561     fi
7562     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7565 dnl If the user asks for the 'python' extension, then we add
7566 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7567 dnl Note the careful regex - it must match 'python' followed by anything
7568 dnl other than a '/', including the end-of-string.
7569 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7570     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7571         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7572     done
7574 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7575 dnl command-line, but not yet
7576 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7577 AC_SUBST(MOZ_PYTHON)
7578 AC_SUBST(MOZ_PYTHON_PREFIX)
7579 AC_SUBST(MOZ_PYTHON_INCLUDES)
7580 AC_SUBST(MOZ_PYTHON_LIBS)
7581 AC_SUBST(MOZ_PYTHON_VER)
7582 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7583 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7584 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7586 dnl ========================================================
7587 dnl disable profile sharing
7588 dnl ========================================================
7589 MOZ_ARG_DISABLE_BOOL(profilesharing,
7590 [  --disable-profilesharing           Disable profile sharing],
7591     MOZ_PROFILESHARING=,
7592     MOZ_PROFILESHARING=1 )
7593 if test "$MOZ_PROFILESHARING"; then
7594   MOZ_IPCD=1
7595   AC_DEFINE(MOZ_PROFILESHARING)
7598 dnl ========================================================
7599 dnl enable ipc/ipcd
7600 dnl ========================================================
7601 MOZ_ARG_ENABLE_BOOL(ipcd,
7602 [  --enable-ipcd                      Enable IPC daemon],
7603     MOZ_IPCD=1,
7604     MOZ_IPCD= )
7606 dnl ========================================================
7607 dnl disable profile locking
7608 dnl   do no use this in applications that can have more than
7609 dnl   one process accessing the profile directory.
7610 dnl ========================================================
7611 MOZ_ARG_DISABLE_BOOL(profilelocking,
7612 [  --disable-profilelocking           Disable profile locking],
7613     MOZ_PROFILELOCKING=,
7614     MOZ_PROFILELOCKING=1 )
7615 if test "$MOZ_PROFILELOCKING"; then
7616   AC_DEFINE(MOZ_PROFILELOCKING)
7619 dnl ========================================================
7620 dnl disable rdf services
7621 dnl ========================================================
7622 MOZ_ARG_DISABLE_BOOL(rdf,
7623 [  --disable-rdf           Disable RDF],
7624     MOZ_RDF= )
7625 if test "$MOZ_RDF"; then
7626   AC_DEFINE(MOZ_RDF)
7629 AC_SUBST(MOZ_RDF)
7631 dnl ========================================================
7632 dnl necko configuration options
7633 dnl ========================================================
7636 dnl option to disable various necko protocols
7638 MOZ_ARG_ENABLE_STRING(necko-protocols,
7639 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7640                           Enable/disable specific protocol handlers],
7641 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7642     if test "$option" = "yes" || test "$option" = "all"; then
7643         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7644     elif test "$option" = "no" || test "$option" = "none"; then
7645         NECKO_PROTOCOLS=""
7646     elif test "$option" = "default"; then
7647         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7648     elif test `echo "$option" | grep -c \^-` != 0; then
7649         option=`echo $option | sed 's/^-//'`
7650         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7651     else
7652         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7653     fi
7654 done],
7655     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7656 dnl Remove dupes
7657 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7658 AC_SUBST(NECKO_PROTOCOLS)
7659 for p in $NECKO_PROTOCOLS; do
7660     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7661 done
7664 dnl option to disable necko's disk cache
7666 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7667 [  --disable-necko-disk-cache
7668                           Disable necko disk cache],
7669     NECKO_DISK_CACHE=,
7670     NECKO_DISK_CACHE=1)
7671 AC_SUBST(NECKO_DISK_CACHE)
7672 if test "$NECKO_DISK_CACHE"; then
7673     AC_DEFINE(NECKO_DISK_CACHE)
7677 dnl option to minimize size of necko's i/o buffers
7679 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7680 [  --enable-necko-small-buffers
7681                           Minimize size of necko's i/o buffers],
7682     NECKO_SMALL_BUFFERS=1,
7683     NECKO_SMALL_BUFFERS=)
7684 AC_SUBST(NECKO_SMALL_BUFFERS)
7685 if test "$NECKO_SMALL_BUFFERS"; then
7686     AC_DEFINE(NECKO_SMALL_BUFFERS)
7687 fi 
7690 dnl option to disable cookies
7692 MOZ_ARG_DISABLE_BOOL(cookies,
7693 [  --disable-cookies       Disable cookie support],
7694     NECKO_COOKIES=,
7695     NECKO_COOKIES=1)
7696 AC_SUBST(NECKO_COOKIES)
7697 if test "$NECKO_COOKIES"; then
7698     AC_DEFINE(NECKO_COOKIES)
7701 dnl NECKO_ configuration options are not global
7702 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7704 dnl ========================================================
7705 dnl string api compatibility
7706 dnl ========================================================
7707 MOZ_ARG_DISABLE_BOOL(v1-string-abi,
7708 [  --disable-v1-string-abi   Disable binary compatibility layer for strings],
7709     MOZ_V1_STRING_ABI=,
7710     MOZ_V1_STRING_ABI=1)
7711 AC_SUBST(MOZ_V1_STRING_ABI)
7712 if test "$MOZ_V1_STRING_ABI"; then
7713     AC_DEFINE(MOZ_V1_STRING_ABI)
7716 dnl Only build Mork if it's required
7717 AC_SUBST(MOZ_MORK)
7718 if test "$MOZ_MORK"; then
7719   AC_DEFINE(MOZ_MORK)
7722 dnl Build the lightweight Mork reader if required
7723 AC_SUBST(MOZ_MORKREADER)
7724 if test "$MOZ_MORKREADER"; then
7725   AC_DEFINE(MOZ_MORKREADER)
7728 dnl ========================================================
7729 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7730     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7733 if test "$MOZ_LDAP_XPCOM"; then
7734     LDAP_CFLAGS='-I${DIST}/public/ldap'
7735     if test "$OS_ARCH" = "WINNT"; then
7736         if test -n "$GNU_CC"; then
7737             LDAP_LIBS='-L$(DIST)/lib -lnsldap32v60 -lnsldappr32v60 -lnsldif32v60'
7738         else
7739             LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)nsldap32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldappr32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldif32v60.${IMPORT_LIB_SUFFIX}'
7740         fi
7741     elif test "$OS_ARCH" = "OS2"; then
7742             LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)ldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)prldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)ldif60.${IMPORT_LIB_SUFFIX}'
7743     else
7744         LDAP_LIBS='-L${DIST}/bin -L${DIST}/lib -lldap60 -lprldap60 -lldif60'
7745     fi
7748 if test "$COMPILE_ENVIRONMENT"; then
7749 if test "$SUNCTL"; then
7750     dnl older versions of glib do not seem to have gmodule which ctl needs
7751     _SAVE_CFLAGS=$CFLAGS
7752     CFLAGS="$CFLAGS $GLIB_CFLAGS"
7753     AC_LANG_SAVE
7754     AC_LANG_C
7755     AC_TRY_COMPILE([#include <gmodule.h>],
7756         [ int x = 1; x++; ],,
7757         [AC_MSG_ERROR([Cannot build ctl without gmodule support in glib.])])
7758     AC_LANG_RESTORE
7759     CFLAGS=$_SAVE_CFLAGS
7760     AC_DEFINE(SUNCTL)
7762 fi # COMPILE_ENVIRONMENT
7764 dnl ========================================================
7765 dnl =
7766 dnl = Maintainer debug option (no --enable equivalent)
7767 dnl =
7768 dnl ========================================================
7770 AC_SUBST(AR)
7771 AC_SUBST(AR_FLAGS)
7772 AC_SUBST(AR_LIST)
7773 AC_SUBST(AR_EXTRACT)
7774 AC_SUBST(AR_DELETE)
7775 AC_SUBST(AS)
7776 AC_SUBST(ASFLAGS)
7777 AC_SUBST(AS_DASH_C_FLAG)
7778 AC_SUBST(LD)
7779 AC_SUBST(RC)
7780 AC_SUBST(RCFLAGS)
7781 AC_SUBST(WINDRES)
7782 AC_SUBST(USE_SHORT_LIBNAME)
7783 AC_SUBST(IMPLIB)
7784 AC_SUBST(FILTER)
7785 AC_SUBST(BIN_FLAGS)
7786 AC_SUBST(NS_USE_NATIVE)
7787 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7788 AC_SUBST(MOZ_GFX_TOOLKIT)
7789 AC_SUBST(MOZ_UPDATE_XTERM)
7790 AC_SUBST(MINIMO)
7791 AC_SUBST(MOZ_AUTH_EXTENSION)
7792 AC_SUBST(MOZ_MATHML)
7793 AC_SUBST(MOZ_PERMISSIONS)
7794 AC_SUBST(MOZ_XTF)
7795 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7796 AC_SUBST(MOZ_PREF_EXTENSIONS)
7797 AC_SUBST(MOZ_SVG)
7798 AC_SUBST(MOZ_SVG_FOREIGNOBJECT)
7799 AC_SUBST(MOZ_XSLT_STANDALONE)
7800 AC_SUBST(MOZ_JS_LIBS)
7801 AC_SUBST(MOZ_PSM)
7802 AC_SUBST(MOZ_DEBUG)
7803 AC_SUBST(MOZ_DEBUG_MODULES)
7804 AC_SUBST(MOZ_PROFILE_MODULES)
7805 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7806 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7807 AC_SUBST(MOZ_DEBUG_FLAGS)
7808 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7809 AC_SUBST(WARNINGS_AS_ERRORS)
7810 AC_SUBST(MOZ_DBGRINFO_MODULES)
7811 AC_SUBST(MOZ_EXTENSIONS)
7812 AC_SUBST(MOZ_IMG_DECODERS)
7813 AC_SUBST(MOZ_IMG_ENCODERS)
7814 AC_SUBST(MOZ_JSDEBUGGER)
7815 AC_SUBST(MOZ_OJI)
7816 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7817 AC_SUBST(MOZ_PLUGINS)
7818 AC_SUBST(ENABLE_EAZEL_PROFILER)
7819 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7820 AC_SUBST(EAZEL_PROFILER_LIBS)
7821 AC_SUBST(MOZ_PERF_METRICS)
7822 AC_SUBST(GC_LEAK_DETECTOR)
7823 AC_SUBST(MOZ_LOG_REFCNT)
7824 AC_SUBST(MOZ_LEAKY)
7825 AC_SUBST(MOZ_JPROF)
7826 AC_SUBST(MOZ_SHARK)
7827 AC_SUBST(MOZ_XPCTOOLS)
7828 AC_SUBST(MOZ_JSLOADER)
7829 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7830 AC_SUBST(MOZ_INSURE)
7831 AC_SUBST(MOZ_INSURE_DIRS)
7832 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7833 AC_SUBST(MOZ_QUANTIFY)
7834 AC_SUBST(MOZ_INSURIFYING)
7835 AC_SUBST(MOZ_LDAP_XPCOM)
7836 AC_SUBST(MOZ_LDAP_XPCOM_EXPERIMENTAL)
7837 AC_SUBST(LDAP_CFLAGS)
7838 AC_SUBST(LDAP_LIBS)
7839 AC_SUBST(LIBICONV)
7840 AC_SUBST(MOZ_PLACES)
7841 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7842 AC_SUBST(MOZ_STORAGE)
7843 AC_SUBST(MOZ_FEEDS)
7844 AC_SUBST(NS_PRINTING)
7846 AC_SUBST(MOZ_JAVAXPCOM)
7847 AC_SUBST(JAVA_INCLUDE_PATH)
7848 AC_SUBST(JAVA)
7849 AC_SUBST(JAVAC)
7850 AC_SUBST(JAR)
7852 AC_SUBST(MOZ_PROFILESHARING)
7853 AC_SUBST(MOZ_PROFILELOCKING)
7855 AC_SUBST(MOZ_IPCD)
7857 AC_SUBST(HAVE_XIE)
7858 AC_SUBST(MOZ_XIE_LIBS)
7859 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7861 AC_SUBST(XPCOM_USE_LEA)
7862 AC_SUBST(BUILD_STATIC_LIBS)
7863 AC_SUBST(MOZ_ENABLE_LIBXUL)
7864 AC_SUBST(ENABLE_TESTS)
7865 AC_SUBST(IBMBIDI)
7866 AC_SUBST(SUNCTL)
7867 AC_SUBST(MOZ_UNIVERSALCHARDET)
7868 AC_SUBST(ACCESSIBILITY)
7869 AC_SUBST(MOZ_XPINSTALL)
7870 AC_SUBST(MOZ_VIEW_SOURCE)
7871 AC_SUBST(MOZ_SPELLCHECK)
7872 AC_SUBST(MOZ_XPFE_COMPONENTS)
7873 AC_SUBST(MOZ_USER_DIR)
7874 AC_SUBST(MOZ_CRASHREPORTER)
7875 AC_SUBST(MOZ_MOCHITEST)
7877 AC_SUBST(ENABLE_STRIP)
7878 AC_SUBST(PKG_SKIP_STRIP)
7879 AC_SUBST(USE_ELF_DYNSTR_GC)
7880 AC_SUBST(USE_PREBINDING)
7881 AC_SUBST(INCREMENTAL_LINKER)
7882 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7883 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7884 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7886 AC_SUBST(MOZ_FIX_LINK_PATHS)
7887 AC_SUBST(XPCOM_LIBS)
7888 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7889 AC_SUBST(XPCOM_GLUE_LDOPTS)
7890 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7892 AC_SUBST(USE_DEPENDENT_LIBS)
7894 AC_SUBST(MOZ_BUILD_ROOT)
7895 AC_SUBST(MOZ_OS2_TOOLS)
7896 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7898 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7899 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7900 AC_SUBST(MOZ_TIMELINE)
7901 AC_SUBST(WINCE)
7902 AC_SUBST(TARGET_DEVICE)
7904 AC_SUBST(MOZ_APP_NAME)
7905 AC_SUBST(MOZ_APP_DISPLAYNAME)
7906 AC_SUBST(MOZ_APP_VERSION)
7907 AC_SUBST(FIREFOX_VERSION)
7908 AC_SUBST(THUNDERBIRD_VERSION)
7909 AC_SUBST(SUNBIRD_VERSION)
7910 AC_SUBST(SEAMONKEY_VERSION)
7912 AC_SUBST(MOZ_PKG_SPECIAL)
7914 AC_SUBST(MOZILLA_OFFICIAL)
7915 AC_SUBST(BUILD_OFFICIAL)
7916 AC_SUBST(MOZ_MILESTONE_RELEASE)
7918 dnl win32 options
7919 AC_SUBST(MOZ_PROFILE)
7920 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7921 AC_SUBST(MOZ_MAPINFO)
7922 AC_SUBST(MOZ_BROWSE_INFO)
7923 AC_SUBST(MOZ_TOOLS_DIR)
7924 AC_SUBST(CYGWIN_WRAPPER)
7925 AC_SUBST(AS_PERL)
7926 AC_SUBST(WIN32_REDIST_DIR)
7927 AC_SUBST(PYTHON)
7929 dnl Echo the CFLAGS to remove extra whitespace.
7930 CFLAGS=`echo \
7931         $_WARNINGS_CFLAGS \
7932         $CFLAGS`
7934 CXXFLAGS=`echo \
7935         $_MOZ_RTTI_FLAGS \
7936         $_MOZ_EXCEPTIONS_FLAGS \
7937         $_WARNINGS_CXXFLAGS \
7938         $CXXFLAGS`
7940 COMPILE_CFLAGS=`echo \
7941     $_DEFINES_CFLAGS \
7942         $_DEPEND_CFLAGS \
7943     $COMPILE_CFLAGS`
7945 COMPILE_CXXFLAGS=`echo \
7946     $_DEFINES_CXXFLAGS \
7947         $_DEPEND_CFLAGS \
7948     $COMPILE_CXXFLAGS`
7950 AC_SUBST(SYSTEM_MAKEDEPEND)
7951 AC_SUBST(SYSTEM_JPEG)
7952 AC_SUBST(SYSTEM_PNG)
7953 AC_SUBST(SYSTEM_ZLIB)
7954 AC_SUBST(SYSTEM_BZ2)
7956 AC_SUBST(JPEG_CFLAGS)
7957 AC_SUBST(JPEG_LIBS)
7958 AC_SUBST(ZLIB_CFLAGS)
7959 AC_SUBST(ZLIB_LIBS)
7960 AC_SUBST(BZ2_CFLAGS)
7961 AC_SUBST(BZ2_LIBS)
7962 AC_SUBST(PNG_CFLAGS)
7963 AC_SUBST(PNG_LIBS)
7965 AC_SUBST(MOZ_JPEG_CFLAGS)
7966 AC_SUBST(MOZ_JPEG_LIBS)
7967 AC_SUBST(MOZ_ZLIB_CFLAGS)
7968 AC_SUBST(MOZ_ZLIB_LIBS)
7969 AC_SUBST(MOZ_BZ2_CFLAGS)
7970 AC_SUBST(MOZ_BZ2_LIBS)
7971 AC_SUBST(MOZ_PNG_CFLAGS)
7972 AC_SUBST(MOZ_PNG_LIBS)
7974 AC_SUBST(NSPR_CFLAGS)
7975 AC_SUBST(NSPR_LIBS)
7976 AC_SUBST(MOZ_NATIVE_NSPR)
7978 AC_SUBST(NSS_CFLAGS)
7979 AC_SUBST(NSS_LIBS)
7980 AC_SUBST(NSS_DEP_LIBS)
7981 AC_SUBST(MOZ_NATIVE_NSS)
7983 AC_SUBST(CFLAGS)
7984 AC_SUBST(CXXFLAGS)
7985 AC_SUBST(CPPFLAGS)
7986 AC_SUBST(COMPILE_CFLAGS)
7987 AC_SUBST(COMPILE_CXXFLAGS)
7988 AC_SUBST(LDFLAGS)
7989 AC_SUBST(LIBS)
7990 AC_SUBST(CROSS_COMPILE)
7992 AC_SUBST(HOST_CC)
7993 AC_SUBST(HOST_CXX)
7994 AC_SUBST(HOST_CFLAGS)
7995 AC_SUBST(HOST_CXXFLAGS)
7996 AC_SUBST(HOST_OPTIMIZE_FLAGS)
7997 AC_SUBST(HOST_AR)
7998 AC_SUBST(HOST_AR_FLAGS)
7999 AC_SUBST(HOST_LD)
8000 AC_SUBST(HOST_RANLIB)
8001 AC_SUBST(HOST_NSPR_MDCPUCFG)
8002 AC_SUBST(HOST_BIN_SUFFIX)
8003 AC_SUBST(HOST_OS_ARCH)
8005 AC_SUBST(TARGET_CPU)
8006 AC_SUBST(TARGET_VENDOR)
8007 AC_SUBST(TARGET_OS)
8008 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8009 AC_SUBST(TARGET_MD_ARCH)
8010 AC_SUBST(TARGET_XPCOM_ABI)
8011 AC_SUBST(OS_TARGET)
8012 AC_SUBST(OS_ARCH)
8013 AC_SUBST(OS_RELEASE)
8014 AC_SUBST(OS_TEST)
8016 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8017 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8019 AC_SUBST(WRAP_MALLOC_CFLAGS)
8020 AC_SUBST(WRAP_MALLOC_LIB)
8021 AC_SUBST(MKSHLIB)
8022 AC_SUBST(MKCSHLIB)
8023 AC_SUBST(MKSHLIB_FORCE_ALL)
8024 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8025 AC_SUBST(DSO_CFLAGS)
8026 AC_SUBST(DSO_PIC_CFLAGS)
8027 AC_SUBST(DSO_LDOPTS)
8028 AC_SUBST(LIB_PREFIX)
8029 AC_SUBST(DLL_PREFIX)
8030 AC_SUBST(DLL_SUFFIX)
8031 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8032 AC_SUBST(LIB_SUFFIX)
8033 AC_SUBST(OBJ_SUFFIX)
8034 AC_SUBST(BIN_SUFFIX)
8035 AC_SUBST(ASM_SUFFIX)
8036 AC_SUBST(IMPORT_LIB_SUFFIX)
8037 AC_SUBST(USE_N32)
8038 AC_SUBST(CC_VERSION)
8039 AC_SUBST(CXX_VERSION)
8040 AC_SUBST(MSMANIFEST_TOOL)
8042 if test "$USING_HCC"; then
8043    CC='${topsrcdir}/build/hcc'
8044    CC="$CC '$_OLDCC'"
8045    CXX='${topsrcdir}/build/hcpp'
8046    CXX="$CXX '$_OLDCXX'"
8047    AC_SUBST(CC)
8048    AC_SUBST(CXX)
8051 dnl Check for missing components
8052 if test "$COMPILE_ENVIRONMENT"; then
8053 if test "$MOZ_X11"; then
8054     dnl ====================================================
8055     dnl = Check if X headers exist
8056     dnl ====================================================
8057     _SAVE_CFLAGS=$CFLAGS
8058     CFLAGS="$CFLAGS $XCFLAGS"
8059     AC_TRY_COMPILE([
8060         #include <stdio.h>
8061         #include <stdlib.h>
8062         #include <X11/Xlib.h>
8063         #include <X11/Intrinsic.h>
8064     ],
8065     [
8066         Display *dpy = 0;
8067         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8068             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8069             exit(1);
8070         }
8071     ], [], 
8072     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8073     CFLAGS="$_SAVE_CFLAGS"
8075     if test ! -z "$MISSING_X"; then
8076         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8077     fi
8079 fi # MOZ_X11
8080 fi # COMPILE_ENVIRONMENT
8082 dnl Set various defines and substitutions
8083 dnl ========================================================
8085 if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
8086       LIBS='so32dll.lib tcp32dll.lib'
8087 elif test "$OS_ARCH" = "BeOS"; then
8088   AC_DEFINE(XP_BEOS)
8089   MOZ_MOVEMAIL=1
8090 elif test "$OS_ARCH" = "Darwin"; then
8091   AC_DEFINE(XP_UNIX)
8092   AC_DEFINE(UNIX_ASYNC_DNS)
8093   MOZ_MOVEMAIL=1
8094 elif test "$OS_ARCH" = "OpenVMS"; then
8095   AC_DEFINE(XP_UNIX)
8096 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8097   AC_DEFINE(XP_UNIX)
8098   AC_DEFINE(UNIX_ASYNC_DNS)
8099   MOZ_MOVEMAIL=1
8101 AC_SUBST(MOZ_MOVEMAIL)
8103 AC_DEFINE(JS_THREADSAFE)
8105 if test "$MOZ_DEBUG"; then
8106     AC_DEFINE(MOZ_REFLOW_PERF)
8107     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8110 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8111     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8112     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8113     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8114     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8115     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8116     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8117     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8118     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8121 # Used for LD_LIBRARY_PATH of run_viewer target
8122 LIBS_PATH=
8123 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8124   case $lib_arg in
8125     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8126       * ) ;;
8127   esac
8128 done
8129 AC_SUBST(LIBS_PATH)
8131 dnl ========================================================
8132 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8133 dnl ========================================================
8134 case "$host_os" in
8135 mingw*)
8136     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8137     ;;
8138 cygwin*|msvc*|mks*)
8139     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8140     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8141     CC="\$(CYGWIN_WRAPPER) $CC"
8142     CXX="\$(CYGWIN_WRAPPER) $CXX"
8143     CPP="\$(CYGWIN_WRAPPER) $CPP"
8144     LD="\$(CYGWIN_WRAPPER) $LD"
8145     AS="\$(CYGWIN_WRAPPER) $AS"
8146     RC="\$(CYGWIN_WRAPPER) $RC"
8147     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8148     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8149     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8150     ;;
8151 esac
8153 AC_SUBST(CYGDRIVE_MOUNT)
8154 AC_SUBST(WIN_TOP_SRC)
8156 AC_SUBST(MOZILLA_VERSION)
8158 . ${srcdir}/config/chrome-versions.sh
8159 AC_DEFINE_UNQUOTED(MOZILLA_LOCALE_VERSION,"$MOZILLA_LOCALE_VERSION")
8160 AC_DEFINE_UNQUOTED(MOZILLA_REGION_VERSION,"$MOZILLA_REGION_VERSION")
8161 AC_DEFINE_UNQUOTED(MOZILLA_SKIN_VERSION,"$MOZILLA_SKIN_VERSION")
8163 AC_SUBST(ac_configure_args)
8165 dnl Spit out some output
8166 dnl ========================================================
8168 dnl The following defines are used by xpcom
8169 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8170 CPP_THROW_NEW
8171 HAVE_CPP_2BYTE_WCHAR_T
8172 HAVE_CPP_ACCESS_CHANGING_USING
8173 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8174 HAVE_CPP_BOOL
8175 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8176 HAVE_CPP_EXPLICIT
8177 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8178 HAVE_CPP_NAMESPACE_STD
8179 HAVE_CPP_NEW_CASTS
8180 HAVE_CPP_PARTIAL_SPECIALIZATION
8181 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8182 HAVE_CPP_TYPENAME
8183 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8184 HAVE_STATVFS
8185 NEED_CPP_UNUSED_IMPLEMENTATIONS
8186 NEW_H
8187 HAVE_GETPAGESIZE
8188 HAVE_ICONV
8189 HAVE_ICONV_WITH_CONST_INPUT
8190 HAVE_MBRTOWC
8191 HAVE_SYS_MOUNT_H
8192 HAVE_SYS_VFS_H
8193 HAVE_WCRTOMB
8194 MOZ_V1_STRING_ABI
8197 AC_CONFIG_HEADER(
8198 netwerk/necko-config.h
8199 xpcom/xpcom-config.h
8200 xpcom/xpcom-private.h
8203 # Save the defines header file before autoconf removes it.
8204 # (Do not add AC_DEFINE calls after this line.)
8205   _CONFIG_TMP=confdefs-tmp.h
8206   _CONFIG_DEFS_H=mozilla-config.h
8208   cat > $_CONFIG_TMP <<\EOF
8209 /* List of defines generated by configure. Included with preprocessor flag,
8210  * -include, to avoid long list of -D defines on the compile command-line.
8211  * Do not edit.
8212  */
8214 #ifndef _MOZILLA_CONFIG_H_
8215 #define _MOZILLA_CONFIG_H_
8218 _EGREP_PATTERN='^#define ('
8219 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8220     for f in $_NON_GLOBAL_ACDEFINES; do
8221         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8222     done
8224 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8226   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8228   cat >> $_CONFIG_TMP <<\EOF
8230 #endif /* _MOZILLA_CONFIG_H_ */
8234   # Only write mozilla-config.h when something changes (or it doesn't exist)
8235   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8236     rm $_CONFIG_TMP
8237   else
8238     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8239     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8241     echo ==== $_CONFIG_DEFS_H =================================
8242     cat $_CONFIG_DEFS_H
8243   fi
8245 dnl Probably shouldn't call this manually but we always want the output of DEFS
8246 rm -f confdefs.h.save
8247 mv confdefs.h confdefs.h.save
8248 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8249 AC_OUTPUT_MAKE_DEFS()
8250 MOZ_DEFINES=$DEFS
8251 AC_SUBST(MOZ_DEFINES)
8252 rm -f confdefs.h
8253 mv confdefs.h.save confdefs.h
8255 dnl Load the list of Makefiles to generate.
8256 dnl   To add new Makefiles, edit allmakefiles.sh.
8257 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8258 . ${srcdir}/allmakefiles.sh
8259 dnl 
8260 dnl Run a perl script to quickly create the makefiles.
8261 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8262 dnl   for the files it cannot handle correctly. This way, config.status
8263 dnl   will handle these files.
8264 dnl If it fails, nothing is set and config.status will run as usual.
8266 dnl This does not change the $MAKEFILES variable.
8268 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8270 if test -z "${AS_PERL}"; then
8271 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8272 else
8273 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8275 . ./conftest.sh
8276 rm conftest.sh
8278 echo $MAKEFILES > unallmakefiles
8280 AC_OUTPUT($MAKEFILES)
8282 dnl ========================================================
8283 dnl = Setup a nice relatively clean build environment for
8284 dnl = sub-configures.
8285 dnl ========================================================
8286 CC="$_SUBDIR_CC" 
8287 CXX="$_SUBDIR_CXX" 
8288 CFLAGS="$_SUBDIR_CFLAGS" 
8289 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8290 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8291 LDFLAGS="$_SUBDIR_LDFLAGS"
8292 HOST_CC="$_SUBDIR_HOST_CC" 
8293 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8294 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8297 unset MAKEFILES
8298 unset CONFIG_FILES
8300 if test "$COMPILE_ENVIRONMENT"; then
8301 if test -z "$MOZ_NATIVE_NSPR" || test "$MOZ_LDAP_XPCOM"; then
8302     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8303     if test -z "$MOZ_DEBUG"; then
8304         ac_configure_args="$ac_configure_args --disable-debug"
8305     fi
8306     if test "$MOZ_OPTIMIZE" = "1"; then
8307         ac_configure_args="$ac_configure_args --enable-optimize"
8308     fi
8309     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8310        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8311     fi
8312     if test -n "$HAVE_64BIT_OS"; then
8313         ac_configure_args="$ac_configure_args --enable-64bit"
8314     fi
8315     AC_OUTPUT_SUBDIRS(nsprpub)
8316     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8319 if test -z "$MOZ_NATIVE_NSPR"; then
8320     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8321     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8322     if test ! "$VACPP" && test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8323        _libs=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --libdir=$\(LIBXUL_DIST\)/lib --libs`
8324        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $_libs'" config/autoconf.mk
8325     fi
8326     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE" ; then
8327        _cflags=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --includedir=$\(LIBXUL_DIST\)/include/nspr --cflags`
8328        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $_cflags'" config/autoconf.mk
8329     fi
8330     rm -f config/autoconf.mk.bak
8333 # if we're building the LDAP XPCOM component, we need to build 
8334 # the c-sdk first.  
8336 if test "$MOZ_LDAP_XPCOM"; then
8338     # these subdirs may not yet have been created in the build tree.
8339     # don't use the "-p" switch to mkdir, since not all platforms have it
8340     #
8341     if test ! -d "directory"; then
8342         mkdir "directory"
8343     fi
8344     if test ! -d "directory/c-sdk"; then
8345         mkdir "directory/c-sdk"    
8346     fi
8347     if test ! -d "directory/c-sdk/ldap"; then
8348         mkdir "directory/c-sdk/ldap"    
8349     fi
8351     ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/dist --with-dist-prefix=$MOZ_BUILD_ROOT/dist --without-nss --with-mozilla"
8352     if test -z "$MOZ_DEBUG"; then
8353         ac_configure_args="$ac_configure_args --disable-debug"
8354     fi
8355     if test "$MOZ_OPTIMIZE" = "1"; then
8356         ac_configure_args="$ac_configure_args --enable-optimize"
8357     fi
8358     if test -n "$HAVE_64BIT_OS"; then
8359         ac_configure_args="$ac_configure_args --enable-64bit"
8360     fi
8361     AC_OUTPUT_SUBDIRS(directory/c-sdk)
8362     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8364 fi # COMPILE_ENVIRONMENT